title: Setting and Getting Cookies

text:
# Question
Title: Setting and Getting Cookies
Are there any preferred ways of setting and getting cookies in EE? Whether through an add-on or a PHP snippet?

Need to set a location cookie based on user input and get the cookie within my templates.

# Answer
> 1 votes
There's an add-on called Cookie Plus which makes setting and getting cookies via template tags very simple.

---
Tags: cookies
---


# Question
Title: Search relationship or relationship conditional
I have this in my template:

```
{exp:channel:entries
    channel="profiles"
    disable="categories|category_fields|member_data|pagination"
    {if segment_2}entry_id="not {segment_2}"{/if}
    dynamic="no"
}
    {if {profession}{profession:title}{/profession} == "foo"}
        <!-- display something -->
    {/if}
{/exp:channel:entries}

```

This returns the error:

> 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: Invalid Condition: Not enough operands for operator ” == “.

What is wrong with my template? Is the test in my if-statement somehow causing this problem? Is there a way I can add this filter as a search in the channel entry tag?

# Answer
First thing to try is to remove the second conditionl to be sure it's that one which causes the problem.

Try using quotes in your second conditional so it looks like;

```
{if "{profession}{profession:title}{/profession}" == "foo"}
    <!-- display something -->
{/if}

```

Though it would be better to reformat it slightly to:

```
{profession}
    {if profession:title == "foo"}
        <!-- display something -->
    {/if}
{/profession}

```
> 2 votes

---
Tags: channel-entries, templates
---


# Question
Title: Stash is rewriting my variables when outputting multiple entries - how to make them distinct?
I'm using Stash for image replacement in my main column. {images} is a Matrix field.

In my body field, {image-1}, {image-2}, etc. are the image placeholders. My code looks like this ({images} is a Matrix field).

```
{images}
    {exp:stash:set name="image-{row_count}" type="snippet"}
        {exp:ce_img:single src="{image:url}"
     alt="{image:title}"}
    {/exp:stash:set}
{/images}
{exp:stash:set name="content"}{body}{/exp:stash:set}
{exp:stash:get name="content" parse_vars="yes"}

```

This works fine, but then I need to run it again for the side column. I also run in to problems with my RSS feed - multiple entries on the page cause Stash to run over and over, but I'm not getting fresh results for each entry.

How do I make Stash run freshly each time?

# Answer
Try this:

```
{exp:stash:content}
  {images}
    {exp:stash:set name="image-{row_count}" type="snippet"}
        {exp:ce_img:single src="{image:url}"
     alt="{image:title}"}
    {/exp:stash:set}
  {/images}
  {exp:stash:parse}{body}{/exp:stash:parse}
{/exp:stash:content}

{exp:stash:get name="content"}

```
> 1 votes

# Answer
With what you already have set up: When you have multiple entries the stash 'image-{row\_count}' variable can be overwritten each entry loop. Try adding in a reference to the entry id to distinguish the variables, like:

```
{images}
    {exp:stash:set name="image-{entry_id}-{row_count}" type="snippet"}
...

```
> 0 votes

---
Tags: stash, responsive-images
---


# Question
Title: Adding the total number from a specific custom field of all channel entries
I am wondering if the following is possible to do within ExpressionEngine:

On the front end of the site, I would like ExpressionEngine to search a particular custom field within a particular channel, and add all of those numbers together to come up with a sum total. So for example...I have a channel named "Invoices" and within that channel, I have a custom field named "Monthly Total" which only has numbers and a decimal (ie. 15.25). On the front end of the website, I would like to display the sum total of custom field named "Monthly Total" for every single entry in that channel. So essentially, this front end section would automatically update when a new channel entry is created or deleted.

I hope that made sense, can this be done? Thanks!

# Answer
I used the "Tally" addon found here https://devot-ee.com/add-ons/tally. It works like a charm.
> 1 votes

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


# Question
Title: Freeform: Display freeform entries from logged in user
I want to create a page where a user can view and edit his own submitted freeform entries.

The user has to log in before submitting the form.

I have tried this:

```
{exp:freeform:entries
orderby="entry_date"
sort="desc"
limit="2"
form_id="21"
author_id="{member_id}"
}

```

And it does not display any entries. But when I hard code the author\_id author\_id="1" it works.

So, how do I display form entries submitted by the logged in user only?

# Answer
Why do use {member\_id}? From where this coming from?

Try to use CURRENT\_USER if u want show list of entries for current user

```
{exp:freeform:entries
orderby="entry_date"
sort="desc"
limit="2"
form_id="21"
author_id="CURRENT_USER"
}

```
> 1 votes

# Answer
Try editing the Member group to disallow the viewing of post made by others. A long time ago I created a support site which bothered me for a while and I found the above solution would only display entries by the logged in user.
> 0 votes

---
Tags: solspace-freeform
---


# Question
Title: Expresso Store display custom field on checkout page
I'm trying to display a custom field (a product picture) in the checkout page but it's getting buggy. I'd like to display a picture of each product next to it's info. When the page is processed, it displays the first picture correctly, but loops the same image for the rest of the products. I can't figure out why (I'm new to EE). Please help. My code is as follows:

```
    {items}
    {exp:channel:entries channel="products"}
    <a class="quick-cart-item" href="{path='store_example/checkout'}"><!-- item  -->
    <img class="pull-left" src="{main_pic}" width="40" alt="quick cart">
    <div class="inline-block">
        <span class="title block">{title}</span>
        <span class="price block">{item_qty} × {item_subtotal}</span>
    </div>
    </a><!-- /item -->
    {/exp:channel:entries}
    {/items}

```

# Answer
You need to pass the entry\_id (which is stored per item) to the embedded channel entries tag so it knows which entries to pull since EE can not figure it out dynamically.

```
{items}
    {exp:channel:entries entry_id="{entry_id}"}
    <a class="quick-cart-item" href="{path='store_example/checkout'}"><!-- item  -->
    <img class="pull-left" src="{main_pic}" width="40" alt="quick cart">
    <div class="inline-block">
        <span class="title block">{title}</span>
        <span class="price block">{item_qty} × {item_subtotal}</span>
    </div>
    </a><!-- /item -->
    {/exp:channel:entries}
   {/items}

```
> 0 votes

---
Tags: expresso-store, custom-fields, expresso
---


# Question
Title: MoreEvents Not Saving Events, Dev Log Error
I have been using MoreEvents for event registrations and now it will no longer save event information (specifically, the Registration cut-off date and ability to open Global Memberships to registration). Because of this, registration functionality no longer works. I noticed in developer log that it was throwing an error:

> Deprecated function set\_variable() called in system/expressionengine/third\_party/moreevents/mcp.moreevents.php on line 114. Deprecated since 2.6. Use view-\> = ; instead.

Since the add-on is no longer supported, I wanted to find out if this is something that could be fixed? Or, if anyone else has found a fix?

There is a thread over at devot-ee (http://devot-ee.com/add-ons/support/moreevents/viewthread/10239) that references this but the solution that is provided didn't work for me.

Any help or direction would be appreciated.

# Answer
Certainly found a fix for this, following advise here - https://ellislab.com/expressionengine/user-guide/development/usage/cp.html#set-variables

For instance at **mcp.moreevents.php:17**

```
$this->EE->cp->set_variable('cp_page_title', $this->EE->lang->line('moreevents_config_heading'));

```

replace with

```
$this->EE->view->cp_page_title = $this->EE->lang->line('moreevents_config_heading');

```

A simple find/replace of all instances of set\_variable() will fix this.

Still yet to find the issue as to why event data is not being saved...

**Edit - saving fixes below**

The following lines need to altered to ensure saving works - seems to be an issue around strtotime (the two values using this are already in a time format, so this is largely unnecessary. Maybe I'm missing something?.

**models/more\_event\_data.php:165**

```
    $data = array(
        "status"                        => $this->_yep_nope($params['mod_data']['status']),
        "registration_expiry"           => $params['mod_data']['registration_expiry'],
        "notify_on_registration"        => $this->_yep_nope($params['mod_data']['notify_on_registration']),
        "notify_email"                  => $params['mod_data']['notify_email'],
        "member_prices"                 => serialize($params['mod_data']['member_price'][0]),
        "member_permissions"            => serialize($params['mod_data']['member_price'][1]),
        "member_earlybird_prices"       => serialize($params['mod_data']['member_price'][2]),
        "custom_fields"                 => serialize($params['mod_data']['custom_fields']),
        "tickets_available"             => $params['mod_data']['tickets_available'],
        "earlybird_expiry"              => $params['mod_data']['earlybird_expiry']
    );

```

**ext.moreevents.php:103**

When changing the 'Notify on Registration' dropdown, this was the only field that didn't trigger the `save()` function to actually save its value to the DB. Adding the below line at line 103 (after very similar looking lines for other fields) seemed to do the trick. However, once removing this line afterwards, it all seems to work normally. To be safe, its best to add this line anyway.

```
$query_result[$key]['event:notify_on_registration'] = $is_event ? $event['notify_on_registration'] : NULL;

```

**mod.moreevents.php:54, 57, 79, 108, 111, 228, 415, 525**

Replace

```
$this->EE->functions->redirect($this->EE->functions->create_url($this->EE->functions->remove_double_slashes($next_page ."/".$event_tx_id)));

```

with

```
if (version_compare(APP_VER, '2.6', '>=')) {
    $this->EE->load->helper('string');
    $sFixedslashes = reduce_double_slashes($next_page ."/".$event_tx_id);
} else {
    $sFixedslashes = $this->EE->functions->remove_double_slashes($next_page ."/".$event_tx_id);
}

$this->EE->functions->redirect($this->EE->functions->create_url($sFixedslashes));

```

or for only \>= 2.6 support:

```
$this->EE->load->helper('string');
$this->EE->functions->redirect($this->EE->functions->create_url(reduce_double_slashes($next_page ."/".$event_tx_id)));

```

**FINAL EDIT**

I've created a Gist of all the fixes and files so you can simply copy/paste to have them fully working. Any new issues I find will be updated in the Gist.
> 0 votes

---
Tags: error
---


title: Rotate entry every hour

text:
# Question
Title: Rotate entry every hour
I would like to rotate between two entries each hour depending on the time of the day.

Any ideas on how to do this?

# Answer
You could use the expressionengine current time variable in a conditional

```
{if {current_time format="%G"} < 12}
   {exp:channel:entries url_title="morning"}
      ...
   {/exp:channel:entries}
{if:else}
   {exp:channel:entries url_title="evening"}
      ...
   {/exp:channel:entries}
{/if}

```
> 1 votes

---
Tags: channel-entries, php
---


title: DevDemon Credits decode_date deprecated

text:
# Question
Title: DevDemon Credits decode_date deprecated
DevDemon Credits v2.5.3a includes a deprecated method decode\_date which was removed in #eecms v1.9.2.

# Answer
> 1 votes
In ajax.credits.php line 193:

```
$this->EE->localize->decode_date('%d-%M-%Y %g:%i %A', $row->date))

```

should be replaced with:

```
$this->EE->localize->format_date('%d-%M-%Y %g:%i %A', $row->date))

```

# Answer
> 0 votes
Credits 2.5.4 fixes this issue.

---
Tags: devdemon
---


# Question
Title: Freeform Pro fields and MSM, fields not consistent across multi sites
FreeForm 4.2 EE 2.8.1 MSM

Today I needed to create the first form for one of the sites on our EE with Multi-site. So I began by creating fields. I went to create a *First Name* field, but FreeForm told me the **field name** already existed and I needed to select another name. Which was a surprise to me since this was the first field and form I was creating for this site. I checked the fields list and it clearly wasn't showing. So I checked the other site and confirmed the **field name** was being already used. So I had to switch my field naming conventions to help differentiate. And I created all the fields needed for the form. But I didn't use a different convention for the **field label**.

Then I began to create the form, setting the *Form Type* to *Composer*. In the list of fields, I now have two *First Name* fields. The list uses the **field label**, so now I can't tell them apart. I have to edit one to check the **field name** so I select the field for this site and not the other site.

I suggest that you either let FreeForm share the fields across the multiple sites or create a better separation between the sites. And I lean towards the latter. And by better separation I think I should be able to reuse the **field labels**, **field names**, **form names** and **form labels** etc without worrying about names on other sites.

# Answer
> 0 votes
Solspace replied with their support ticket. Here is what they wrote:

> Having all site's fields in Composer indeed complicates things if field labels are the same across multiple sites. This was mentioned by other users, and I added your voice to the bug report about this. Unfortunately we can't provide an ETA for bug fixes/feature additions.
>
> As for using the same field\_shortnames in different sites, I don't know if Freeform's current data architecture can handle that, but I filed a feature request for it in any case :)

# Answer
> 0 votes
Having your Freeform fields work across all MSM sites is doable. You just need to enable (check) the *"Show Data from All Sites"* setting in the Freeform **Preferences** tab in the EE CP. :)

All that said, there are a couple of bugs that are allowing you to experience the behaviour you're seeing. We have a new version of Freeform coming out in the next few days that will correct that (but the former part of this answer should still remain true and work for you now). :)

---
Tags: solspace-freeform
---


# Question
Title: Display relative date just for today, with "today" as prefix
I am trying to prefix today's (blog)posts with "Today". So that it would read:

> Today, January 12, 2015

From tomorrow on the prefix should not be displayed anymore. I want to achieve an eyecachting effect for the latests posts like that.

I have looked into EE's relative dates but nothing outputs exactly what I need and I don't know how to stop it after today either.

Has anybody achieved this in the past. Seems to be a pretty basic thing actually...

# Answer
> 2 votes
You could do this:

```
{if '{entry_date format="%Y%m%d"}' == '{current_time format="%Y%m%d"}'}Today, {/if}{entry_date format="%F %j, %Y"}

```

---
Tags: date
---


# Question
Title: PHP warning at the top of CP that I cannot fix
I'm having trouble on an install of EE 2.8.1. This is the first time I've seen this php error, and it bugs me. It doesn't seem to be causing any real problems, but it messes up the font sizes on the CP. Any ideas on what may be causing this?

---

A PHP Error was encountered

Severity: Warning

Message: file\_get\_contents(/chroot/home/---/---/system/expressionengine/cache/current\_version): failed to open stream: Permission denied

Filename: drivers/Cache\_file.php

Line Number: 74

# Answer
Check that your cache directory's permissions are set to 777 so that it's fully readable/writeable.
> 4 votes

---
Tags: php-errors
---


# Question
Title: blank page when saving extension settings
I am developing an EE extension and everything was working fine and I thought I was done. So I uninstalled the extension and re-installed it to testing everything. It uninstalled fine and re-installed fine but now when I submit the settings in the control panel I get a blank white page with no error of any kind.

I have looked at the apache error log and there is nothing is the error log. I have installed it on a clean install of EE and same thing. Anyone have any suggestions on how to track the problem down?

# Answer
> 1 votes
I finally tracked this down and posting my findings here so in case anyone else runs into this issue.

I have a custom settings for my extension and in the settings\_form.php file there is this line of code:

```
<input type="hidden" name="file" value="<?=$name?>" />

```

Apparently at some point I deleted a character out of the name field so it was fil instead of file like so

```
<input type="hidden" name="fil" value="<?=$name?>" />

```

And this caused the blank page when saving the extension settings. In the file system/expressionengine/controllers/cp/addons\_extensions.php in thew function save\_extension\_settings in fails this check

```
if ($this->input->get_post('file') === FALSE OR ! preg_match("/^[a-z0-9][\w.-]*$/i",$this->input->get_post('file')))

```

It returns false and you get the blank white page. Shouldn't this show some kind of error message instead? Seems like a bug in EE to me.

---
Tags: control-panel, error, extension, settings
---


title: Expresso Store - Custom Dimensions

text:
# Question
Title: Expresso Store - Custom Dimensions
I have a couple questions regarding Expresso Store:

* Is it possible to add custom dimensions to a product? Our client sells Sofas which have more than just Length/Width/Height (Overall Depth, Seat Width, Seat Height etc), so we need to be able to add new dimension fields.
* Is it possible to group variations? The customers need to be able to choose the materials and colours for the sofas, so we have multiple ranges of materials and colours available.

Thank you

# Answer
> 0 votes
Exp-resso Store only extends ExpressionEngine, so you can add all the fields you want. If those attributes effect price or need to be part of a custom order, you would add them as attributes.

Again this can be done through ExpressionEngine for just showing content. If you need this to pass through as Attributes you can do so as well. You can create as many variation groups with options as you wish.

---
Tags: expresso-store, product
---


# Question
Title: user_delete_account_end hook doesn't appear to be working
*Firstly apologies for my explanation and terminology, this is a relatively new area for me.*

I've built an extension which uses three hooks:

* user\_register\_end
* user\_edit\_end
* user\_delete\_account\_end

The first two are working correctly however the last one doesn't appear to be. The hook is referenced in Solspace User in file mod.user.php as is the `user_register_end` one.

Here are the two hook initiations:

```
//Register user hook (working)
if (ee()->extensions->active_hook('user_register_end') === TRUE)
{
    $edata = ee()->extensions->universal_call('user_register_end', $this, $member_id);
    if (ee()->extensions->end_script === TRUE) return;
}

//Delete user hook (not working)
if (ee()->extensions->active_hook('user_delete_account_end') === TRUE)
{
    $edata = ee()->extensions->universal_call('user_delete_account_end', $this);
    if (ee()->extensions->end_script === TRUE) return;
}

```

And here is my code for both hooks:

```
//Hook array used to populate the extensions table
$hooks = array(
    'user_register_end' => 'new_client_check',
    'user_edit_end' => 'upd_client_check',
    'user_delete_account_end' => 'del_client_check'
);

function upd_client_check($member_id, $user_object, $cfields) {
    //Function code
}

function del_client_check($member_data) {
    return('working');
    die;
}

```

During my tests I've been printing out comments or data and killing the function so it stops right away and this has been working fine so far. Now though when I delete a member I'm just shown the successful delete message so the hook isn't being noticed.

I can confirm that all the hooks and methods are in the database correctly.

Can anyone help at all? And if you need to me explain in more detail I'll try my best.

**Edit** I am using this extension with the Solspace User delete form.

Thank you.

# Answer
> 0 votes
You're using `return` before `die`, which means your PHP script will see `return` then stop, and never see the `die` command. Try `echo 'working'; die();` or even simply `die('working');`

# Answer
> 0 votes
Looking at the change log for when that hook was added, it states:

> Added a "user\_delete\_account\_end" hook to the end of the delete\_account function for the Delete\_form tag

So this tells me that this hook only fires when an account is deleted using User's own delete\_form tag.

To hook into member deletion via the control panel, you'll want to use EE's own cp\_members\_member\_delete\_end hook.

---
Tags: solspace-user, hook, users
---


# Question
Title: Can I remove XID param from super search 'get' url?
I am trying to get google analytics site search to pull results submitted through my site's super search. I saw a post in the forums that I am supposed to change my form action from "post" to "get". This appears to be working as it creates the "?" that GA seems to depend on, however the url is pretty nasty with the XID=1232321 included. Is this XID necessary, or is there a way to remove this? If so, how would I remove it?

**current url**

```
/search/results?XID=25454320fc0a3329123123f8d496b5591fb4add&keywords=test

```

**preferred url exmple**

```
/search/results?keywords=test

```

Thanks for any information you can provide.

**UPDATED**

```
<div id="search">
    <form method="get" action="{path=search/results}">
        <input type="text" name="keywords" id="keywords" placeholder="Search" class="typeahead">
        <input type="submit" class="hidden-submit" />
    </form>
</div>

```

# Answer
> 4 votes
The `XID` (`csrf_token` in EE 2.8+) is used in POST forms to secure form submissions. A quick test shows that the XID isn't required for GET form submissions, so you can remove this from your GET form without running into issues.

If you're using `{exp:super_search:search}` in your search form, the XID field is provided for you (it's a hidden field), and the only way to get rid of it is to turn off secure forms in EE. **However, this is not recommended to disable secure forms in EE as this disables secure forms for all forms on your site (from 3rd-parties or native EE)**.

The other solution is to keep secure forms enabled in EE, and to **not** use `{exp:super_search:search}`: it's not required for the functioning of the search form. If your form was a POST form, you would need to add the following field in your form:

```
<input type="hidden" name="XID" value="{XID_HASH}" />

```

However, if your form is a GET form, you don't need to add this field, and search should run fine and without throwing any errors about a missing XID.

---
Tags: solspace, supersearch, google-analytics
---


title: Pagination while Get Variables in URL

text:
# Question
Title: Pagination while Get Variables in URL
I've built a plugin that runs on a page & pulls data from a get variable in the URL. Page URIs look like '/page&foo=bar'. That's working perfectly.

I've also built pagination into my plugin, since I have some large datasets outputting. That also works perfectly on it's own.

The problem is that when I have a Get variable in the URL my pagination links don't account for it. Is there a trick to getting an add-on to recognize Get variables in the URL? I can provide some example code if needed, but I suspect there's something obvious I'm missing here.

# Answer
There isn't "something obvious" you're missing, as far as I know. I try and maintain the query string in pagination for Low Search, which ended up doing an obtuse regular expression to find/replace URLs without query strings.

Simplest solution is to not automate it, but use something like `{pagination_url}?{current_query_string}` in your pagination links.
> 1 votes

---
Tags: add-on, module, pagination
---


# Question
Title: Expresso Store product form tag not wrapping form content
I've set up an accessory section on a product page. The accessories are being pulled in through a Playa relationship field and are displaying in a table. I discovered an issue when I went to add an accessory to my cart and it added the main product instead which is available on the page from a side column. On viewing the source I noticed the form tag didn't wrap the form elements including the ad to cart button, the store javascript was injected below it though. Here is my code.

```
{exp:playa:children channel="accessories" category="{category_id}" sort="asc" field="accs_inc"}

{exp:store:product entry_id="{entry_id}" return="{segment_1}/{segment_2}/{segment_3}"}
{accs_info}
<tr>
    <td width="60"><img src="{accs_thumb:url}"></td>
    <td>{title}<br><small>{sku}</small><br><span class="label label-success">Included as standard</span></td>
    <td width="70">{price}</td>
    <td width="80"><div class="controls"><input type="text" id="item_qty" name="item_qty" class="input-mini" value="{min_order_qty}" /></div></td>
    <td width="150"><div class="form-actions formbut"><input type="submit" alt="add to cart" name="submit" value="add to cart" class="btn btn-success pull-right"></div></td>
</tr>
{/accs_info}
{/exp:store:product}

{/exp:playa:children}

```

And this is what is served

```
<tbody>
    <form method="post" class="store_product_form"></form>

            <tr>
                <td width="60"><img src="/images/uploads/accessories/thumbnail/PP359.png"></td>
                <td>Accessory kit <br><small>PP359</small><br><span class="label label-info">Reccomended</span></td>
                <td width="70">5</td>
                <td width="80"><div class="controls"><input type="text" id="item_qty" name="item_qty" class="input-mini" value="1"></div></td>
                <td width="150"><div class="form-actions formbut"><input type="submit" alt="add to cart" name="submit" value="add to cart" class="btn btn-success pull-right"></div></td>
            </tr>

            <script type="text/javascript">
            window.ExpressoStore = window.ExpressoStore || {};
            ExpressoStore.products = ExpressoStore.products || {};
            ExpressoStore.products[8971] = {"entry_id":"8971","price":"5.0000","weight":null,"length":null,"width":null,"height":null,"handling":null,"free_shipping":"0","tax_exempt":"0","modifiers":[],"stock":[{"id":"661","entry_id":"8971","sku":"PP359","stock_level":null,"min_order_qty":null,"track_stock":"0","opt_values":[]}],"regular_price":"5.0000","sale_price":"5.0000"};

        (function() {
            ExpressoStore.config = {"store_currency_symbol":"","store_currency_decimals":"0","store_currency_thousands_sep":",","store_currency_dec_point":".","store_currency_suffix":""};
            if (!ExpressoStore.scriptElement) {
                var script = ExpressoStore.scriptElement = document.createElement("script");
                script.type = "text/javascript"; script.defer = true;
                script.src = "/themes/third_party/store/store.js?v=2.4.1";
                document.getElementsByTagName("body")[0].appendChild(script);
            }
        })();
            </script>
        </tbody>

```

Can anybody help?

# Answer
I've fixed the issue by using the product\_form tag

```
{exp:store:product_form return="{segment_1}/{segment_2}/{segment_3}"}
<tr>
{exp:playa:children channel="accessories" category="{category_id}" sort="asc" field="accs_rec"}
{exp:store:product entry_id="{entry_id}" disable_form="yes"}
{accs_info}
    <td width="60"><img src="{accs_thumb:url}"></td>
    <td>{title}<br><small>{sku}</small><br><span class="label label-info">Reccomended</span></td>
    <td width="70">{price}</td>
    <td width="80"><div class="controls"><input type="hidden" name="items[{count}][entry_id]" value="{entry_id}" /><input type="text" id="item_qty" name="items[{count}][item_qty]" class="input-mini" value="{min_order_qty}" /></div></td>

{/accs_info}
{/exp:store:product}
{/exp:playa:children}

    <td width="150"><div class="form-actions formbut"><input type="submit" alt="add to cart" name="submit" value="add to cart" class="btn btn-success pull-right"></div></td>
</tr>
{/exp:store:product_form}

```
> 0 votes

---
Tags: expresso-store, playa, expresso, product
---


# Question
Title: {sale_end_date} not working (tag not recognised?)
I can't get sale\_start\_date or sale\_end\_date to work in expresso store.

The following code (inside {exp:store\_product})

```
{if on_sale}
<strong>På salg: <strike>{regular_price}</strike> {price}</strong><br>
<em>Du sparer {you_save}</em><br>
<em>Salget varer til {sale_end_date format="%m-%d-%Y"}</em>
{if:else}
<strong>Pris: {price}</strong>
{/if}

```

simply outputs {sale\_end\_date format="%m-%d-%Y"} as plain text exactly as is. It doesn't seem to be a recognized tag. All other tags seem to work.

What am I doing wrong? I can't see anything else in the docs.

# Answer
> 0 votes
It appears this variable never made it into Store 2 even though it is in the docs. Email support and we will take a look and getting this fixed.

\** Edit v2.3 doesn't have this variable for a reason. With Store 2 you can have multiple sales per product, so there is no single variable that would work. We will need to add a new feature in an upcoming version to make it work.

# Answer
> 0 votes
This is probably not the best solution, because it will just use the last sale's start and end date if there's multiple sales and discounts, but it is better than nothing and most sites will only run one sale at a time.

In store/src/Store/Service/ProductsService.php just below the line (+- line 248)

```
$product->on_sale = true;
```

Add:

```
// HACK: added sale start and end date
$product->sale_start_date = isset($sale['start_date']) ? $sale['start_date'] : NULL;
$product->sale_end_date = isset($sale['end_date']) ? $sale['end_date'] : NULL;

```

---
Tags: expresso-store
---


# Question
Title: if:elseif statement not working correctly with PHP
I have a news section on our website and I want to only show the current years articles unless it is January, February or March. Since those months are at the beginning of the year, I don't want the page to not have any content.

I have been able to figure out the PHP to get the current date and subtract 2 years (so I can show last year's posts).

```
<?$date = strtotime('{current_time format="%Y"} -2 year');?>

```

I also figured out how to do the {if/if:elseif} statements to check which month we are currently in and if it is January do this. February do this. March do this. All the other months do that.

```
{if {current_time format="%m"} == "01"}
<p>This is January</p>
{if:elseif {current_time format="%m"} == "02"}
<p>This is February</p>
{if:elseif {current_time format="%m"} == "03"}
<p>This is March</p>
{if:else}
<p>This is all the other months</p>
{/if}

```

Both of the codes above work well independently of each other, but when I put them together the {if:elseif} quits working and it defaults to the last {if:else} content.

Anyone know why? Here is the final code I tried:

```
{if {current_time format="%m"} == "01"}
<?$date = strtotime('{current_time format="%Y"} -2 year');?>
{if:elseif {current_time format="%m"} == "02"}
<?$date = strtotime('{current_time format="%Y"} -2 year');?>
{if:elseif {current_time format="%m"} == "03"}
<?$date = strtotime('{current_time format="%Y"} -2 year');?>
{if:else}
<?$date = strtotime('{current_time format="%Y"} -1 year');?>
{/if}

```

# Answer
Would this work:

Configure the template to execute PHP *before* EE code.

Handle your conditionals in PHP rather than EE.

Something like:

```
<?

$todays_month = date('n');

if ($todays_month == "1") {

echo "your EE code for January goes here";

} elseif ($todays_month == "2") {

echo "your EE code for February goes here";

} else {

echo "your EE code for March and after goes here";

}

?>

```
> 1 votes

# Answer
After doing some extensive research on this, I found the problem.

Advanced conditionals in the ‘global’ template scope (not within a tag) are generally parsed by the EE template parser near the end of the process. This unfortunately means that any tags within non-matching conditions are parsed first, before being removed. This can have a significant performance impact if the nested tags are doing a lot of processing, such as is the case with the {exp:channel} tag.

I did however find a plugin by Mark Croxton called "ifelse" that forces the advanced conditional to be processed first, but it is not working with my version of EE (2.4.0) even though it states that it can so it might be conflicting with one of my other plugins.

Anyone else come across a solution to force advance conditionals to be processed sooner for ExpressionEngine?
> 0 votes

# Answer
Why not just the mighty Low's Yearly Archive?

http://gotolow.com/addons/low-yearly-archives

From the looks of what you're trying to do it could work without using php in your templates. You'll then want to write conditionals using his tag pairs to check which month you're in. Should be pretty straightforward.
> 0 votes

# Answer
Do not ever mix EE code with PHP code. This not only slows down things significally, but you may easily run into unpredictable issues that will be hard to debug (like this one).

If you're really not sure you can't achieve what you want with EE add-ons, turn your code into pure PHP.

Something like this:

```
<?php
if (ee()->localize->format_date('%m')=="01")
{
    $date = strtotime(ee()->localize->format_date('%m').' -2 year');
{
    else
{
    //some more code
}
?>

```
> 0 votes

---
Tags: php
---


title: Pagination Not Showing

text:
# Question
Title: Pagination Not Showing
I am showing past events for visitors to reference old performances by using 'show\_expired="yes"' however the page got very big so I used pagination to break it up. I also use {if expiration\_date \< current\_date} content {/if}, so only past show are shown.

When I employ pagination, I get large blank spaces on the first page where the current content wants to show, but I don’t want it too show. How do I disable the pagination from wanting to try and show blank spaces where the current shows are trying to show.

```
{exp:channel:entries channel="now_playing"  show_expired="yes"  limit="3" paginate="bottom"}

{if expiration_date < current_time}
 content of paage includes description and photo of past shows
 {/if}

{paginate}
 <p>Page {current_page} of {total_pages} pages {pagination_links}</p>
{/paginate}

```

# Answer
Instead of using conditional check inside your channel entries loop, consider providing **stop\_before** parameter to limit your entries to those created before certain date. Be aware though the parameter works with entry\_date, not expiration\_date.

https://ellislab.com/expressionengine/user-guide/add-ons/channel/channel\_entries.html#stop-before
> 2 votes

---
Tags: pagination
---


# Question
Title: member_delete hook isn't deleting member after my code
I've got an extension that is using the member\_delete hook which checks a specific entry field for the deleted member's ID and removes it if found.

This is working fine (field cleared of member ID) and I am shown the EE message saying that the member has been deleted however when I view the member list the member still remains.

I read question Cancelling member deletion in member\_delete hook handler and it says that you need to return an array of member\_ids for it to continue. I've done just that but it doesn't appear to be doing anything.

Here is my code:

```
function del_client_check($member_ids) {
    $cleared_entries = array();

    $member_id = $member_ids[0];

    $field['m_client'] = $this->settings['client_field'];
    $field['e_client'] = $this->settings['e_client_field'];
    $m_field = $this->settings['member_field'];

    $this->EE->db->select('entry_id, ' . $m_field . '');
    $entries = $this->EE->db->get('channel_data')->result_array();

    foreach ($entries as $entry) {
        if ($entry[$m_field] != '') {
            $members = explode('|', $entry[$m_field]);

            if (($key = array_search($member_id, $members)) !== false) {
                unset($members[$key]);

                $entry[$m_field] = implode('|', $members);
                $cleared_entries[] = $entry;
            }
        }
    }

    if (!empty($cleared_entries)) {
        $this->entry_update_del($cleared_entries, $member_id);
    } else {
        return $member_ids;
    }
}

function entry_update_del($entries, $member_id) {
    $member_ids = array();
    $this->EE->db->update_batch('channel_data', $entries, 'entry_id');
    $member_ids[0] = $member_id;
    return $member_ids;
}

```

*Just a note, in the entry\_update\_del function I am setting `$member_ids[0]` to `$member_id`. There is always only going to be 1 member deleted at a time.*

If anyone could help that would be great.

# Answer
> 2 votes
Take *return* statement out of *} else {*.

You should always return member\_ids that should be deleted.

So, change

```
if (!empty($cleared_entries)) {
    $this->entry_update_del($cleared_entries, $member_id);
} else {
    return $member_ids;
}

```

to

```
if (!empty($cleared_entries)) {
    $this->entry_update_del($cleared_entries, $member_id);
}
return $member_ids;

```

---
Tags: members, hook
---


# Question
Title: How do I customize the tell-a-friend "thank you" template?
I'm using the standard tell-a-friend code from the EE Docs. Where do I find the "thank you" page template that comes up after emailing an entry using the tell-a-friend tag? I'd like to style it to look like the rest of my site.

# Answer
> 0 votes
You can use the **`return`** parameter on the `exp:email:tell_a_friend` tag to specify a template you want to use as the confirmation (thank you) page. It can be any template you want, customized as needed.

If you're talking about the "interstitial" page where a message is shown for a few seconds before redirecting, *that* is a system message and to customize it you'll need to go to *CP \> Design \> Message Pages \> User Messages* or use an add-on like Custom System Messages.

---
Tags: tell-a-friend
---


title: Stash Playa field from Matrix (context)

text:
# Question
Title: Stash Playa field from Matrix (context)
I'm trying to Stash and output an entry from a channel. Since I also need a dynamic=no menu on the left, I've been able to use a match of the {segment\_2} against the url-title to dinamically display the actual entry.

I would like to display, under the main content, its related entries, which are stored as matrix rows. Each related entry has a custom title, a custom bodycopy and a link to the actual entry. The link is stored in one of the Matrix fields as a Playa field. So far I've been able to achieve most of my requirements, but I can't seem to find a way to indicate the context in the get\_list for the Playa.

Each related entry, lists links from other rows too. So, if I get 4 related results, each result lists its link and the ones from it's siblings (3+1) too.

```
{exp:stash:set_list name="patologie_list" parse_tags="yes" parse_depth="2"}
{exp:channel:entries channel="elements_patologie" dynamic="no"}
    {stash:entry_id}{entry_id}{/stash:entry_id}
    {stash:title}{title}{/stash:title}
    {stash:testo_patologia}{testo_patologia}{/stash:testo_patologia}
    {stash:url_title}{url_title}{/stash:url_title}
        {exp:stash:set_list:matrix name="matrix_link_patologia" context="{entry_id}" parse_tags="yes"}
            {matrix_link_patologia}
                {stash:titolo_link_patologia}{titolo_link_patologia}{/stash:titolo_link_patologia}
                {stash:testo_link_patologia}{testo_link_patologia}{/stash:testo_link_patologia}
                {exp:stash:set_list:playa parse_tags="yes" name="resources"}
                        {exp:playa:children col="link_patologia"}
                            {stash:link_patologia}{url_title}{/stash:link_patologia}
                        {/exp:playa:children}
                {/exp:stash:set_list:playa}
            {/matrix_link_patologia}
        {/exp:stash:set_list:matrix}
{/exp:channel:entries}
{/exp:stash:set_list}

<div class="page" id="patologie">
<div class="container">
    <aside class="aside-navigation">
        <nav class="side-menu">
            <ul>
                {exp:stash:get_list name="patologie_list"}
                <li><a href="{url_title}" class="active">{title}</a></li>
                {/exp:stash:get_list}
            </ul>
        </nav>
    </aside>

    <section class="main">
        <h1>Le patologie trattate</h1>
        {exp:stash:get_list name="patologie_list" match="#^{segment_2}$#" against="url_title"}
            <h2>{title}</h2>
            {testo_patologia}

        <div class="related_entries">
            <ul>
                {exp:stash:get_list:matrix name="matrix_link_patologia" context="{entry_id}" limit="4"}
                <li>
                    <h3>{titolo_link_patologia}</h3>
                    <p>{testo_link_patologia}
                        {exp:stash:get_list:playa name="resources"}
                        <a href="{link_patologia}">Continua</a></p>
                        {/exp:stash:get_list:playa}
                </li>
                {/exp:stash:get_list:matrix}
            </ul>
        </div>
        {/exp:stash:get_list}
    </section>
</div>

```

# Answer
> 1 votes
Try using row\_id and entry\_id for the context. You might also need to increase the `parse_depth` on the outermost stash tag to `4`.

```
{exp:stash:set_list name="patologie_list" parse_tags="yes" parse_depth="4"}
{exp:channel:entries channel="elements_patologie" dynamic="no"}
    {stash:entry_id}{entry_id}{/stash:entry_id}
    {stash:title}{title}{/stash:title}
    {stash:testo_patologia}{testo_patologia}{/stash:testo_patologia}
    {stash:url_title}{url_title}{/stash:url_title}
        {exp:stash:set_list:matrix name="matrix_link_patologia" context="{entry_id}" parse_tags="yes"}
            {matrix_link_patologia}
                {stash:row_id}{row_id}{/stash:row_id}
                {stash:titolo_link_patologia}{titolo_link_patologia}{/stash:titolo_link_patologia}
                {stash:testo_link_patologia}{testo_link_patologia}{/stash:testo_link_patologia}
                {exp:stash:set_list:playa parse_tags="yes" name="resources" context="{row_id}-{entry_id}"}
                        {exp:playa:children col="link_patologia"}
                            {stash:link_patologia}{url_title}{/stash:link_patologia}
                        {/exp:playa:children}
                {/exp:stash:set_list:playa}
            {/matrix_link_patologia}
        {/exp:stash:set_list:matrix}
{/exp:channel:entries}
{/exp:stash:set_list}

<div class="page" id="patologie">
<div class="container">
    <aside class="aside-navigation">
        <nav class="side-menu">
            <ul>
                {exp:stash:get_list name="patologie_list"}
                <li><a href="{url_title}" class="active">{title}</a></li>
                {/exp:stash:get_list}
            </ul>
        </nav>
    </aside>

    <section class="main">
        <h1>Le patologie trattate</h1>
        {exp:stash:get_list name="patologie_list" match="#^{segment_2}$#" against="url_title"}
            <h2>{title}</h2>
            {testo_patologia}

        <div class="related_entries">
            <ul>
                {exp:stash:get_list:matrix name="matrix_link_patologia" context="{entry_id}" limit="4"}
                <li>
                    <h3>{titolo_link_patologia}</h3>
                    <p>{testo_link_patologia}
                        {exp:stash:get_list:playa name="resources" context="{row_id}-{entry_id}"}
                        <a href="{link_patologia}">Continua</a></p>
                        {/exp:stash:get_list:playa}
                </li>
                {/exp:stash:get_list:matrix}
            </ul>
        </div>
        {/exp:stash:get_list}
    </section>
</div>

```

EDIT to add

If each row will only ever return a single related entry then there's no need to use set\_list and get\_list, and you can also do away with the Playa module tag and use the simpler field tag instead. Something like this:

```
{exp:stash:set_list name="patologie_list" parse_tags="yes" parse_depth="4"}
    {exp:channel:entries channel="elements_patologie" dynamic="no"}
        {stash:entry_id}{entry_id}{/stash:entry_id}
        {stash:title}{title}{/stash:title}
        {stash:testo_patologia}{testo_patologia}{/stash:testo_patologia}
        {stash:url_title}{url_title}{/stash:url_title}
            {exp:stash:set_list:matrix name="matrix_link_patologia" context="{entry_id}" parse_tags="yes"}
                {matrix_link_patologia}
                    {stash:row_id}{row_id}{/stash:row_id}
                    {stash:titolo_link_patologia}{titolo_link_patologia}{/stash:titolo_link_patologia}
                    {stash:testo_link_patologia}{testo_link_patologia}{/stash:testo_link_patologia}
                    {stash:link_patologia}
                        {link_patologia var_prefix="playa"} {!-- playa field inside matrix --}
                           {playa:url_title}
                        {/link_patologia}
                    {/stash:link_patologia}
                {/matrix_link_patologia}
            {/exp:stash:set_list:matrix}
    {/exp:channel:entries}
{/exp:stash:set_list}

<div class="page" id="patologie">
<div class="container">
    <aside class="aside-navigation">
        <nav class="side-menu">
            <ul>
                {exp:stash:get_list name="patologie_list"}
                <li><a href="{url_title}" class="active">{title}</a></li>
                {/exp:stash:get_list}
            </ul>
        </nav>
    </aside>

    <section class="main">
        <h1>Le patologie trattate</h1>
        {exp:stash:get_list name="patologie_list" match="#^{segment_2}$#" against="url_title"}
            <h2>{title}</h2>
            {testo_patologia}

            <div class="related_entries">
                <ul>
                    {exp:stash:get_list:matrix name="matrix_link_patologia" context="{entry_id}" limit="4"}
                    <li>
                        <h3>{titolo_link_patologia}</h3>
                        <p>{testo_link_patologia}
                            <a href="{link_patologia}">Continua</a></p>
                    </li>
                    {/exp:stash:get_list:matrix}
                </ul>
            </div>
        {/exp:stash:get_list}
    </section>
</div>

```

---
Tags: matrix, playa, stash
---


title: Playa field with the same data

text:
# Question
Title: Playa field with the same data
I have a playa field into an entrie for a channel written by teachers. I'd like to prevent when a teacher uploads the same 'link' multiple time in different lessons that the 'link' is NOT shown multiple times but only once in a summery for the student

I was thinking for a conditional like {if link == link} {/if} or would a conditional with count be in order for this.

Hope someone can help?

{exp:playa:parents channel="teacher" status="not closed"} {link} {/exp:playa:parents}

Thanks in advance

Dave

# Answer
> 1 votes
Are you using Stash already? If so, you can use its `unique` parameter to exclude duplicates. Something like this:

```
{!-- ====================================
SET
========================================= --}

{exp:stash:set_list name="links" trim="yes" parse="yes"}
  {exp:playa:parents channel="teacher" status="not closed"}
    {stash:the-link}{link}{/stash:the-link}
  {/exp:playa:parents}
{/exp:stash:set_list}

{!-- ====================================
GET
========================================= --}

<ul>
{exp:stash:get_list name="links" unique="yes"}
  <li><a href="{the-link}">{the-link}</a></li>
{/exp:stash:get_list}
</ul>

```

---
Tags: playa, conditionals
---


title: Separate template path for a subdomain

text:
# Question
Title: Separate template path for a subdomain
I want to set the template path specifically for a subdomain - outside of the default\_site templates, while still using the same site/entries/data. MSM isn't what I need here and related posts I can find just uses a template group inside of the current set of templates.

So far I have the subdomain loading the site and hitting my conditional in index.php:

```
if($_SERVER['HTTP_HOST'] == 'sub.domain.com')
{

    $assign_to_config['site_url'] = 'http://sub.domain.com/';
    $assign_to_config['site_name']  = 'admin';
    $assign_to_config['template_group'] = 'home';

    $assign_to_config['global_vars'] = array(
    'subsite_id' => 'admin_site',
    'domain' => 'http://sub.domain.com/',
    'site_name' => 'Admin Portal',
    );
}

```

My main default\_site template path resolves as `/home/site/public_html/templates/default_site` I want the subdomain path to use `/home/site/public_html/templates/admin_site`

Is there a param I can add to set the template path when coming in on the subdomain? Are any edits needed to .htaccess as well?

Thanks!

# Answer
Yes, you're looking for tmpl\_file\_basepath

```
$config['tmpl_file_basepath'] = '/home/site/public_html/templates/admin_site';

```

You could also consider using FocusLab Master Config, which makes a multi-environment approach much cleaner.
> 0 votes

---
Tags: templates, subdomain, routing
---


# Question
Title: Conditional based on content of a nested Playa field works in 2.8.1 but breaks in 2.9.2
I have a conditional statement that checks if anything is selected in a nested Playa field. It worked in EE 2.8.1 but upon upgrading to EE 2.9.2 a parse error occurs:

> 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 “site/.wrapper\_page” on line 2; expected ENDIF tag for opening on line 1.

The offending conditional statement is as follows:

```
{if '{exp:playa:children channel="sidebar_portlets" var_prefix="sidebar"}{sidebar:sidebar-text}{/exp:playa:children}' }
   Do Stuff
{if:else}
   Do other stuff
{/if}

```

I have tried alternating the use of single and double quotes, as well as escaping the interior quotes with a "\\" as suggested in the EE docs, but to no avail.

I would appreciate any suggestions people may have.

For what it's worth, this conditional starts on line 122 of the template, not line 1 as reported in the parse error above. Not sure if that matters.

Thanks in advance.

# Answer
> 0 votes
It turns out this issue had nothing to do with the syntax above, which is correct. The issue is with my placement of channel:entries tags.

As I understand it (please correct if I'm wrong) in EE 2.9+ conditionals are evaluated as soon as the requisite variables are known and only the “true” condition is parsed (the rest are discarded). Prior to the update, all the possible scenarios were parsed first and then one was chosen to render based on the outcome of the conditional test.

In my case, this change in sequence results in the “true” condition being parsed outside of the channel:entries tag pair and failing.

If you're looking at my original post and scratching your head, it's because I left out some key things. A more complete representation of the code is as follows:

```
{!-- This is a wrapper template --}

{exp:channel:entries}
    {if '{exp:playa:children channel="sidebar_portlets" var_prefix="sidebar"}{sidebar:sidebar-text}{/exp:playa:children}' }
{/exp:channel:entries}
       {layout:contents} {!-- Stuff from another template --}
    {if:else}
       Do other stuff
    {/if}

```

Doing this fixed it:

```
{!-- This is a wrapper template --}

{exp:channel:entries}
    {if '{exp:playa:children channel="sidebar_portlets" var_prefix="sidebar"}{sidebar:sidebar-text}{/exp:playa:children}' }
       {layout:contents} {!-- Stuff from another template --}
    {if:else}
       Do other stuff
    {/if}
{/exp:channel:entries}

```

---
Tags: ee2, playa
---


title: New server, EE migration, PHP 5.4 issue

text:
# Question
Title: New server, EE migration, PHP 5.4 issue
We've just set up a new server with the identical set up of a previous server, with one small difference: php 5.4 instead of php 5.3.

This is an EE install, version 2.6.1.

When I go to the site I get the white screen of death, and `debug = 1` doesn't give me anything of use.

I tried digging through the execution path, adding an `echo('test')` and a `die()` after every line and the first thing that causes an issue is in `system/codeigniter/system/CodeIgniter.php` on line 88:

`get_config(array('subclass_prefix' => $assign_to_config['subclass_prefix']));`

If I comment this out, the next hiccup is at line 106:

`$BM =& load_class('Benchmark', 'core');`

From my research, it appears that even 2.6.1 should be fine on php 5.4, so does anyone have any ideas on a) how to fix it without downgrading to 5.3 and b) how to debug it properly to find out what might be causing the issue?

Thanks!

# Answer
The white screen of death is often caused by this:

Sometimes EE is set to output content as Gzip data. When a PHP error occurs, the PHP error spits out first, and but the browser is expecting content that it can un-zip. So you get a white screen of death.

Disable the Gzip preference, and the content will be served with a different mime-type, and then you'll get the error message displaying properly above a page of regular HTML, because the browser interprets the data correctly.
> 1 votes

---
Tags: php, white-screen-of-death
---


# Question
Title: How would I charge to create an entry (e.g. in Solspace Calendar)
I want to build a site that allows subscribe, then book time slots in a calendar. Booking a slot will cost an amount based on criteria the member selects in a form. I'm thinking the subscription part of the site will be built with Membrr, and the calendar will be Solspace Calendar.

The part I'm not sure about is how to charge users to book a slot (effectively charging to create an entry?).

Has anyone done something similar, or have ideas regarding how I might implement this?

Thanks in advance.

# Answer
Not sure if you got this figured out yet on your own but here's what I would do: Membrr is not actively maintained (last I checked), but I know DevDemon has a new addon called Subscriptions that looks killer. I haven't used it yet but it seems like it would do everything and then some that you are asking.

But if you don't need actual subscriptions, but just one-off allowing of creating entries I would use Charge. I have used this in the past and what I did was created a AJAX request to a hidden template URL on the "receipt" page. What this did was created a new entry with that user as the author, then in the list of pages they were allowed to edit, I limited these to the ones by CURRENT\_USER.

I hope this helps. You can hit me up if you want me to send you some code snippets.
> 0 votes

---
Tags: members, solspace-calendar, subscriptions, membrr
---


title: Cartthrob Subscriptions and PayPal Pro

text:
# Question
Title: Cartthrob Subscriptions and PayPal Pro
Looking at various add ons for Expressionengine I found Cartthrobs Subscription module which looks almost perfect for my requirement. When I say almost, the issue is that my customer is using PayPal pro but in the documentation for Subscriptions it says it only supports:

* Authorize.net (CIM)
* eWay (Token Payments)
* Payleap (SCM)
* Sage (Token)
* Stripe

Surely there will be a way to set up using PayPal pro for the gateway but I dont know if this will be possible? Is there an alternative if not?

I'm struggling to find out for definite if I can make it work with PayPal Pro.

Thanks Guy

# Answer
> -1 votes
I would recommend that you checkout Subscriptions from DevDemon instead. They have great support and their new module is really robust. I know it doesn't support PayPal Pro at the moment but maybe you can look into extending it through their plugin architecture or possibly paying them to add it.

http://www.devdemon.com/expressionengine-addons/subscriptions

---
Tags: expresso-store, cartthrob, paypal, brilliantretail
---


title: CartThrob - Quote instead of payment

text:
# Question
Title: CartThrob - Quote instead of payment
A client of mine is wanting to enable Ecommerce at some point but in the interim for at least the next 12 months they would like a request a quote feature. I was thinking that it would make the most sense to use something like CartThrob, Brilliant Retail or Espresso in which customers can add products to their basket (probably will rename it to get a quote) for which they can then submit to our client's sales team.

However instead of going through a typical payment gateway process we just send the sales team an email.

Does anyone know if this is possible?

Appreciate you looking at this, Adeeb

# Answer
> 0 votes
You can do that with CartThrob. It has a single-page check out feature that gives you the flexibility to completely abandon the 'Cart' metaphor... Then you could combine that with Off-line payment to skip the need for a payment processor.

# Answer
> 0 votes
You can certainly do this with Cartthrob but just to add another option you could also do it with something like RememberMe to build an "enquiry list" and then feed the list into a form field and send an email (perhaps using Freeform).

# Answer
> 0 votes
You can definitely do this with BrilliantRetail as well. You could simply remove the product pricing tags from the page templates and email templates and display only the product titles, options, etc.

---
Tags: expresso-store, cartthrob, ecommerce, brilliantretail
---


# Question
Title: Trouble with occurrences loop when client edits a specific occurrence for a recurring event
I have a site running Solspace Calendar and am having trouble displaying certain occurrences that have been edited by my client.

My 'event2' template displays properly for one-off events as well as recurring events where an occurrence has not been altered. But when my client edits a specific occurrence of a recurring event (like a promotional image or adding a different price, for example), the {exp:calendar:occurrences} tag does not return ANY information.

• Example of one-off event displaying correctly: http://clubomgsf.com/calendar/event2/cake/2015/01/16/

• Example of recurring event whose occurrence has not been edited after creating the recurring event: http://clubomgsf.com/calendar/event2/nsa1/2015/01/13/

• Example of a recurring event whose occurrence has been edited and thusly **does not return any data**: http://clubomgsf.com/calendar/event2/nsa5/2015/01/06

Is there a reason why creating an occurrence is breaking this loop? If so, what is the proper or alternate way to display each of these types of occurrences? I appreciate any insight that you guys can provide!

Excerpt from 'event2' template:

```
{exp:calendar:occurrences
            event_name="{segment_3}"
            date_range_start="{segment_4}-{segment_5}-{segment_6}"
            date_range_end="{segment_4}-{segment_5}-{segment_6}"
            show_days="1"
            }

            <div id="event-header" style="background-image:url('{event_image}')"></div>
                <img id="event-poster" src="{event_image}" />
            <div id="event-infobox">

                <!-- FACEBOOK SHARE DIALOGUE -->
                <a href="javascript:fbShare('{current_url}', '{title}', '', '{event_image}', 520, 350)">
                    <img class="f-icon" src="{site_url}website-images/static-information/facebook.png" />

                </a>

                <!-- TWITTER SHARE DIALOGUE -->
                <a href="javascript:twitterShare('https://twitter.com/share?', 520, 350)">
                    <img class="f-icon" src="{site_url}website-images/static-information/twitter.png" />
                </a>
                <br /><br />

                {if subheader}<div id="event-subheader">{subheader}</div>{/if}
                <span id="event-name">{title}</span>
                <br /><div style="margin-top:-6px"><small><br /></small></div>
                <span id="event-date">{exp:stash:get name="month" random} {segment_6}, {segment_4}</span>

                    <div id="event-price">
                        <span class="event-dolla">
                            {if price}${price}</span>
                        {if:else}Free{/if}
                        <span class="event-priceinfo">{price_info}</span><br />

                        {if ticket_options}
                        {ticket_options search:buy_status="=not inactive"}
                            <a href="{ticket_options:buy_link}"><button class="owhole" style="margin-top: 6px;">{ticket_options:buy_text}</button></a><br />
                        {/ticket_options}
                        {/if}

                        <div id="event-summary">{event_summary}</div>
                    </div>

            </div>
        {/exp:calendar:occurrences}

```

# Answer
By default, occurrences do not have their own ID, but share the ID of the main event entry. When an occurrence is edited, they get their own ID. If you usually pass an event\_id in your tag, this ID will be different for the edited occurrence. This is why the `{event_parent_id}` variable is available to pass the original event entry ID when necessary: http://www.solspace.com/docs/calendar/events/#event\_parent\_id

**The better answer is to use `{exp:calendar:cal}` instead of `{exp:calendar:occurrences}`**. This is particularly true since you're trying to display occurrences within a set timeframe (assumed from the date\_range\_start="" and date\_range\_end="" parameters in your code). `{exp:calendar:cal}` is the only tag that will calculate event occurrences within a set chronological timeframe. Details about how each tag works is explained in more detail here: http://www.solspace.com/docs/calendar/getting\_started/ (**Recommended read**)

With `{exp:calendar:cal}`, your edited occurrence should also be included in your occurrence list.
> 1 votes

---
Tags: solspace, solspace-calendar
---


# Question
Title: Solspace Calendar One-way Sync with Outlook?
I know that I can import data from a .ics file when creating a new calendar, but is it possible to do some sort of synchronization with Outlook on certain intervals?

I have been tasked with building a Intranet and I'm trying to decide if I can save costs by building in EE rather than doing custom development.

With synchronization, I need to have it run at an interval (cron job to hit a URL?) and be able to add/update/remove events.

I appreciate any feedback, thanks!

# Answer
Using `{exp:calendar:icalendar}` (http://www.solspace.com/docs/calendar/icalendar/), you can output an .ics file containing event entries from a calendar. This .ics file will be presented to your browser as a downloadable file (i.e. it's not outputted to the screen. You're prompted to download the file).

If Outlook can read this .ics file (really depends on the calendaring app whether it accepts a downloadable file when hitting a URL), then you could indeed import this information into Outlook (although I have never tried). It's not really synchronization but more exporting Calendar data, which can be used for import in other apps/software (eg. iCal).
> 0 votes

---
Tags: solspace, solspace-calendar
---


# Question
Title: Changing or adding existing members to another member group
Is there a way to move an existing member from one member group to another? If so, how can this be done?

Also, is it possible to have one member belong to multiple groups?

Thanks!

# Answer
> 1 votes
You should be able to change the member group from Member Administration --\> Member Preferences pane in the user profile page.

If you want a user to be part of multiple member groups, you can use any Module that threats members as entries, such as Solspace User or Zoovisitor

---
Tags: members, solspace-user, member-management
---


# Question
Title: How can I include a link instead of attachment in Freeform Pro email?
I'm using the File Upload field type in one of my web forms. The email notifications include the uploaded file as an attachment. Is there any way to change this to a download link? My reason is that most of the file uploads are too large for email.

# Answer
> 3 votes
This should work:

Add the Freeform field tag: `{freeform:field:file}` to your form and choose the directory you wish the files to be uploaded to.

Go to your notification settings in Freeform and add the {file} tag inside (swap file for your file field name).

Make sure the **Include Attachments** checkbox is unticked and hit save.

Now when you get notifications they should just contain the file name.

To make it the full URL you can use the following:

`{site_url}[path-to-upload-directory]/{[field_name]}`

example:

`{site_url}uploads/documents/{file}`

This should then link directly to your newly uploaded file. If you tick **Enable HTML** too you could wrap them in an anchor and provide a link title

`<a href="{site_url}uploads/documents/{file}">Download File</a>`

---
Tags: solspace-freeform, solspace
---


title: Replace a file / image in File Manager?

text:
# Question
Title: Replace a file / image in File Manager?
I think the answer to this is "no", but is there any way in File Manager to replace an uploaded image?

So if an image is used somewhere on the site, and we want to just replace it with a new one, we can just upload the new version, without needing to know what stylesheet or template file makes reference to it? Seems like a basic request. I guess the only other option is to delete the file and upload one with the same exact filename.

-jim

# Answer
If you have FTP access, you should just be able to overwrite the file on the server. Anywhere it's referenced on the site then, should pick up the file.
> 1 votes

---
Tags: file-manager
---


# Question
Title: Get a range of entries based on a custom date field
I have a custom calendar I am building for a client. I wanted to filter the fields before I started displaying so I could avoid conditional statements.

Here is an example channel tag

```
{exp:channel:entries channel="calendar_events_and_entries" search:start_date=">1422748800" search:start_date="<1425081600" orderby="start_date" sort="asc" dynamic="no"}

```

I need to know if the search:start\_date is over ridden by the second one.

Thank you for any help you can provide.

# Answer
> 0 votes
The way you are currently doing it, yes it would. But you can specify or values https://ellislab.com/expressionengine/user-guide/add-ons/channel/channel\_entries.html#exact-matching

```
{exp:channel:entries channel="calendar_events_and_entries" search:start_date=">1422748800|<1425081600" orderby="start_date" sort="asc" dynamic="no"}

```

---
Tags: channel-entries, search, date
---


# Question
Title: Mx Cloner with Zenbu - only SuperAdmins can clone
I've had the mx cloner and zenbu add on working for a while now. However, I set up some additional content groups, for others to make edits.

When I try "Cloning" an entry from another group, it looks like it's going to clone, but when you save it, it's actually just replacing the entry you had there.

I tried all the permissions I could find, but can't get this to work for any group but "Super Admins"

Any ideas?

-Jim

# Answer
Most probably that MX Cloner Accessory is activated for SuperAdmins only. It is why your entry is not cloned. Check if its assigned to another member groups.
> 2 votes

---
Tags: zenbu, mx-cloner
---


# Question
Title: Output the value of field1 * field2 within an entries loop
I have a template that outputs a csv, php is set to run on input to allow headers to be set.

For each row I need to calculate the result of 2 fields multiplied and output this as a field to the csv.

Are the field values available in PHP?

Or is there another way to mulitply 2 fields in an entries loop?

```
<?php
$csv_ids = $this->EE->input->post('csv_id');

header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=stock_".date("d_m_Y_H_i").".csv");
header("Pragma: no-cache");
header("Expires: 0");
?>
CODE,field1, field2
{exp:channel:entries channel="stock" limit="10000" entry_id="<?=$csv_ids?>"}
{code},{field1},{field2},{field5}
{/exp:channel:entries}

```

I need 'field5' to be the result of multiplying 'field3' by 'field4'.

# Answer
> 3 votes
You can use MX Calculator for any calculation.

But possible you can use query module instead of channel:entries (if you have some simple fieldtype which keep they data regular way). In this case you can do calculation in query:

```
{exp:query sql="SELECT field_id_15 AS code, field_id_2 AS field2, field_id_1 AS field1, (field_id_3 * field_id_4) AS field5 FROM exp_channel_data WHERE channel_id = 1 AND entry_id IN (<?=$csv_ids?>) LIMIT 10000"}
    {code},{field1},{field2},{field5}
{/exp:query}

```

---
Tags: channel-entries
---


# Question
Title: Expresso Store: set price based on rules
I'm going to be importing thousands of products into my products channel. The imported data will have "cost" information.

By default, I want to "selling price" to be based on whatever category the product is assigned to (the category will have a "markup field" that'll either be in dollar value or percentage). I do want the store operator to be able set the markup at the product level (so the channel will also have something like a "markup field").

How can I do this in Store? Is Carthrob able to do this?

# Answer
There is nothing built into Store (or CartThrob) that would allow you to do this out of the box. Without writing a custom add-on to handle the logic the best place to start would be looking at the

> Added the ability to enable "custom prices" on a per-channel basis. This allows you to use a user-submitted price in the add to cart form (for example with donations).

Which was added in Store v2. From there you would need to calculate the base price by the category modifier and then populate a hidden field with the price. Depending on how you are doing the calculations you will probably need to use an embedded template to get around parse order issues.

This approach doesn't prevent a determined user from modifying the hidden field however to adjust the price so you will probably need some other logic to make sure that the item total is correct.
> 1 votes

---
Tags: expresso-store, cartthrob, ecommerce
---


# Question
Title: Prevent a category being displayed when using category="{segment_3_category_id}"
Because of the URL schema on a site I'm working on I'm using {segment\_x\_category\_id} (via Low Seg2Cat - http://gotolow.com/addons/low-seg2cat) to grab the category ID and pass it to a channel entries loop.

The problem I have is that there are a couple of specific categories which I never want to be navigable using this method. Usually I would exclude them specifically using category="not 1|2|3" but when I also need to pass in the category I want to display that's not going to work... any ideas?

# Answer
@derek's answer is good, except that it will match other categories containing the numbers, like `18`.

So, let's improve it using the contains and the concatenation operators, instead of a regex.:

```
{if '/32/15/8/' *= '/'.segment_x_category_id.'/'}
    {redirect="404"}
{/if}

```

I'm using `/` as delimiter, but it could be some different character.
> 1 votes

# Answer
If you're running 2.9, you could use a regular expression conditional to send the visitor to a 404 when trying to browse those categories:

```
{if segment_x_category_id ~ "/32|15|8/"}
    {redirect="404"}
{/if}

```
> 2 votes

# Answer
Nathan, you can also check GWcode Categories which gives you more flexibility dealing with categories.

Example:

{exp:gwcode\_categories channel="abcd" cat\_id="{segment\_3\_category\_id}" depth="1|2" style="linear" excl\_cat\_id="1|3" limit="9" parse="inward"} {/exp:gwcode\_categories}
> 0 votes

---
Tags: categories, low-seg2cat
---


# Question
Title: Deep content structure. Entries at each level (Categories, Relationships or Playa?)
If you had this structure

* Main - Channel + Entry + Related/categories Entries
* + Main Sub - Entry + Related/categories Entries
* + - Sub - Entry + Related/categories Entries
* + - * Article Entry

Where each category from depth 1-3 contained entry data and lists of entries how would you approach it?

My first thought was to create a channel for each depth (fixed) , and associate entries at the article level with them (or associate articles with the parent)... but I wonder if native categories might be better, using segments to trigger channel information?

Thoughts?

# Answer
> 0 votes
Honestly once you get past 3 levels deep I start looking at alternate ways of building navigation. I prefer the Taxonomy add-on, but have heard good things about Nav-ee as well.

---
Tags: playa, categories, relationships
---


# Question
Title: Quick and simple way to determine which templates are used on an EE site and where
I have inherited a large EE site (upgraded to 2.9.2) that is, frankly, a mess on the backend (EE CP). There are many template groups and templates that appear to have been left behind from multiple site redesign iterations over the past 6 years and I am not sure **if** they are used any more, and even if they are, **where** they are used. Additionally they are not saved to disk - they are just stored in the db - and I want to version control all the templates, but **only what is current, not the legacy junk**, so I need to turn back on template writing to disk, at the very least to initially dump out the used templates so I can get them into Git.

I want to clean it up for both my and my content creators sanity. Is there a simple way (I don't care whether it is via the EE CP, PHP, or MySQL CLI - I am fluent in all) that I can easily determine if a template is used on any Pages in the site? If I used the MySQL CLI which EE table(s) should I be searching for? Are templates stored in the db by name, or as key-value pairs (PK integer and name), and are the templates names/PK integer used as foreign keys in other tables? I need to know how to isolate everything unused.

Thanks in advance.

# Answer
There's a similar post here

But you could just look in the template debugging info.

Another option would be to add something to each template that shows its name (either output to screen or as an HTML comment).

Of course, you would then need to traverse the whole site and note which templates were used, and which ones weren't. Which would possibly be extremely time consuming.
> 3 votes

# Answer
AFIAK there is no quick/easy/simple way. You're on the hook for trying to generate every page within the site and reverse-engineering it to see what templates were involved. With Templates Routes now possible this chore will get even harder.

I have lobbied in the past for an addon that would not only do this, but find *all* the cruft in a legacy install - fields/channels/categories etc. I think it's worthy of a commercial add-on offering.
> 2 votes

---
Tags: templates, control-panel, mysql, template-manager
---


# Question
Title: CE String outputting global variable tag minus "{ }"
I've got a page behind a login that I have various member groups set up for.

Depending on the member group, I want the link in the Downloads section to go to a different page: e.g. Contractors member group will go to /downloads/contractors, Students member group will go to /downloads/students etc.

When I use my global variable for {group\_title} in my page, it outputs "Contractors". Ideally it should output "contractors" in my link because if a member group has more than one word my URL isn't valid.

I tried wrapping {group\_title} in CE String but it just outputs "group\_title" into my HTML without the braces.

Here's my code:

{exp:ce\_str:ing url\_title}{group\_title}{/exp:ce\_str:ing}

# Answer
> 0 votes
This is because user-defined global variabes are parsed *after* plugin and module tags. (See parse order.) So you're literally passing `{group_title}` to CE String.

Try setting `{group_title}` via a preload\_replace variable instead, as those are processed just before plugin tags.

---
Tags: parse-order, ce-image, global-variables
---


# Question
Title: Create a list of entries where parents status is open
I have 2 channels, artists and artwork.

I want to display the artwork entries where their parent entry, in the artists channel, has the status set to 'open'.

I would like to show all the fields from the artwork entry.

As I can't search against the parent field status using the channel entries tag i presume I will have to use the query module, which I am happy to do.

What query would I use to show the entries?

Thanks

# Answer
If I understand you needs correctly, and you need art list w/o grouping by artists (for list for last artworks as example) :

```
{exp:query sql='SELECT GROUP_CONCAT(child_id SEPARATOR ',') as art_ids FROM exp_relationships LEFT JOIN exp_channel_titles ON exp_relationships.parent_id=exp_channel_titles.entry_id  WHERE exp_channel_titles.status = "open" AND exp_relationships.field_id = 29 LIMIT 100' parse="inward"}
    {exp:channel:entries channel="artists" entry_id = "{art_ids}" }
        {artwork}
           {artwork:title}
           {artwork:other-custom-fields]
        {/artwork}
    {/exp:channel:entries}
{/exp:query}

```

in example I select rel based on field\_id.
> 2 votes

# Answer
Unless I'm missing something this is really straightforward. The channel:entries tag assumes the open status so you don't even need to specify it.

Assuming you have a relationship field in the Artists channel where you specify which pieces from the Artwork channel belong to that artist the cod is roughly:

```
 {exp:channel:entries channel="artists"}
    {artwork}
       {artwork:title}
       {artwork:other-custom-fields]
    {/artwork}
 {/exp:channel:entries}

```
> 1 votes

---
Tags: relationships, query, parent, query-module, children
---


# Question
Title: Channel Form: Why is Wygwam/CKFinder disabling the file browser for security reasons?
EE 2.9.2 - WYGWAM 3.3.3

In a Channel Form, I am getting the error...

> "The file browser is disabled for security reasons. Please contact your system administrator and check the CKFinder configuration file."

...when trying to link to or upload a file.

In the Control Panel, Wygwam is working fine and the above scenario plays out as expected (works)

Yes, the Wygwam configuration setting is pointing to a proper directory. Yes, we've added an XID hash to the form.

What else should I be looking for?

# Answer
> 1 votes
This just in from Brad at P&T:

> From what I can tell, if Admin-\>Security & Privacy-\>Security & Settings's "Website Session Type" is set to anything with session in it (session only, cookies and session), then EE just won't log you in from the front-end of the site at all. No idea why.
>
> It will only work with "cookies only" selected. If EE were to log you in on the front-end with sessions, then it would automatically start the PHP $\_SESSION global. Where Wygwam runs into trouble is that it sees that $\_SESSION hasn't been started so it calls session\_start(), but for some reason, EE sets that to a path restriction of {segment\_2} causing Wygwam not to able to read/write to it.
>
> However, if you go to Admin-\>Security & Privacy-\>Cookie Settings and explicitly set the "Cookie Path" to "/", then it will save the cookie with no path restriction and all of the sudden, CKFinder works like it should on the front-end.

I don't know if this fits the definition of an Expression Engine bug, but it sure is hinkey.

---
Tags: safecracker, pixelandtonic, wygwam, security
---


# Question
Title: How many articles are present in my site?
I'm using EE 1.7.3, and I'd like to know how many articles are present in my site (there are thousands, want an exact number). Where can I find this?

# Answer
> 4 votes
In the control panel go to *Admin › Utilities › SQL Manager › Database Query Form*

In the query form put

```
SELECT COUNT(*) FROM exp_weblog_titles;

```

This will give you the total number of entries on your site.

If you would like to know the number of entries in a specific *Weblog* you can do

```
SELECT COUNT(*) FROM exp_weblog_titles
WHERE weblog_id = X;

```

Just replace "X" with the weblog\_id of the Weblog you are interested in.

An alternative to running MySQL queries in the control panel is to use an application like Sequel Pro or Navicat to browse your database and/or run these queries.

---

NOTE for EE v2.x users: alter the SQL by replacing "weblog" with "channel."

---
Tags: ee1, count
---


# Question
Title: access Freeform mp_data of upload field with multiple files
as far as said situation is concerned, i only get one string of all the file names joined. Is it possible to loop through them or even get the files full paths?

```
{freeform:mp_data:my_multiple_upload_field}

```

I want to use this for a summary of all submitted content and the end of the form.

# Answer
> 1 votes
I haven't tested this, but I would guess that the File Upload field tag pair can be used the same way within a multi-page form as it can be used within a Freeform Entries loop.

```
{freeform:mp_data:my_multiple_upload_field}
    {freeform:fileurl}
    {freeform:server_path}
    {freeform:filename}
    {freeform:extension}
    {freeform:filesize}
{/freeform:mp_data:my_multiple_upload_field}}

```

(Docs.)

---
Tags: solspace-freeform, solspace, file-uploads
---


# Question
Title: Date input field formatting problem in channel form
**\# Goal**

Display multiple entries using `{exp:channel:entries}` and within each entry use a `{exp:channel:form}` to allow editing the entry’s content.

**\# Problem**

Using this method, I’m able to display and edit entry select fields and checkboxes but a custom field using the native date type does not work.

For example, if an entry’s custom date field contains the value 2013-11-29 12:00 AM, the corresponding date input field in my channel form has the value: ‘1385704800’

Additionally, clicking the date input field does not display the date picker.

This problem only arises when a channel form is wrapped in a channel entries tag. Creating a new entry with the channel form by itself works fine.

I’m running 2.7.2.

**Edit:** Here's the simplified template code:

```
{exp:channel:entries channel="projects" disable="pagination|categories|member_data" status="Open"}
    {exp:channel:form channel="projects" return="graphics/manager" entry_id="{entry_id}" json="yes" id="publishForm{entry_id}" include_jquery="no" preserve_checkboxes="yes" disable="categories|member_data"}
        {cf-form-proj-due format='%M. %d'} <!-- This works -->
        <input type="text" name="cf-form-proj-due" id="cf-form-proj-due" value="{cf-form-proj-due}"> <!-- This does not work -->
    {/exp:channel:form}
{/exp:channel:entries}

```

# Answer
I believe what might be happening is that the JavaScript for the datepicker is being added to the page multiple times, by each loop through the channel entries tag.

There is a parameter for the channel form tag `include_assets="no"` which will prevent it from adding the Javascript, so perhaps you could use that with a conditional to only output the assets on the first entry. Adjust your code like this:

```
{exp:channel:entries channel="projects" disable="pagination|categories|member_data" status="Open"}
    {exp:channel:form channel="projects" return="graphics/manager" entry_id="{entry_id}" json="yes" id="publishForm{entry_id}" include_jquery="no" preserve_checkboxes="yes" disable="categories|member_data" {if count > 1}include_assets="no"{/if} }
        {cf-form-proj-due format='%M. %d'} <!-- This works -->
        <input type="text" name="cf-form-proj-due" id="cf-form-proj-due" value="{cf-form-proj-due}"> <!-- This does not work -->
    {/exp:channel:form}
{/exp:channel:entries}

```
> 1 votes

# Answer
You can use datepicker = "no" in your exp:channel:form tag and add a jquery:

```
$('#start_date').datepicker({changeYear: true, changeMonth: true, yearRange:'today.getFullYear():2020',dateFormat:'dd-mm-yy'});

```
> 0 votes

---
Tags: channel-entries, channel-form, date
---


# Question
Title: Is it possible to add a data attribute to a DevDemon Forms form tag?
I discovered that you can use attr:id and attr:class in a DevDemon Forms tag using parameters such as `attr:class="form-class"`. I didn't see this listed in the docs anywhere and now I'm wondering if it's possible to add a data attribute to the form tag as well?

Does anyone know if this is possible? I'd like to use some form validation that requires a data attribute on form tag.

# Answer
Currently we can not do this in forms. You could do it with Javascript though, since you have the ID. Just call some javascript afterwards and add the data attributes. I know it is a pain, but it would work for now.
> 1 votes

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


# Question
Title: Parameter error_page doesn't work at all
I have a simple form calling it with `{exp:freeform:form}` composer tags. Inside of it I put the `error_page` parameter but it still renders the default error page. I am really stuck in this situation and I can't get over it.

Here's part of my code :

```
{exp:freeform:form
    form_id="2"
    required="full_name|email|phone_number|comment"
    return="/thank-you/"
    error_page="/en/error/"
}

...

{/exp:freeform:form}

```

I am using Freeform Pro 4.1.1

# Answer
> 0 votes
Make sure that your error page is an actual template. Also I believe you have to have freeform pro to use this feature ( http://www.solspace.com/docs/freeform/error\_page/ )

---
Tags: solspace-freeform, error
---


# Question
Title: Solspace user registration isn't setting group id correctly
I have a registration form which allows admins of my site to register new members. The form itself is functioning fine however the member group is always defaulting to Pending (ID:4).

Here's the form:

```
{exp:user:register admin_register="yes" allowed_groups="5|6|7|8|9" return="members"}
    <div class="row profile">
        <div class="col-sm-6">
            <label for="username">Username</label>
            <input type="text" name="username" id="username">

            <label for="email">Email</label>
            <input type="email" name="email" id="email" >

            <label for="password">Password</label>
            <input type="password" name="password" />

            <label for="password-confirm">Confirm Password</label>
            <input type="password" name="password_confirm" id="password-confirm">

            <label for="member-group">Member Group</label>
            <select name="group_id" id="member-group" class="styled-select">
                {select_member_groups}
                    <option value="{group_id}">{group_title}</option>
                {/select_member_groups}
            </select>

            <label for="client">Associated Client</label>
            <select name="client" id="client" class="styled-select">
                {embed="clients/_associated" client="{client}"}
            </select>

            <label for="sceen-name">Screen Name <small>This will be displayed on the site</small></label>
            <input type="text" name="screen_name" id="screen-name" >

            <label for="occupation">Occupation</label>
            <input type="text" name="occupation" id="occupation" >

            <label for="bio">Bio</label>
            <textarea id="bio" name="bio"></textarea>

            <label for="location">Location</label>
            <input type="text" name="location" id="location" >

            <input type="submit" id="save" value="Save">
        </div>
        <div class="col-sm-6">
            <label for="file">Add Profile Pic</label>
            <input type="file" id="file" name="avatar_filename">

            <ul class="edit">
                <li>
                    <label for="facebook">Facebook</label>
                    <input type="text" name="facebook" id="facebook" >
                </li>
                <li>
                    <label for="twitter">Twitter</label>
                    <input type="text" name="twitter" id="twitter" >
                </li>
                <li>
                    <label for="linkedin">LinkedIn</label>
                    <input type="text" name="linkedin" id="linkedin">
                </li>
                <li>
                    <label for="website">Website</label>
                    <input type="text" name="url" id="website"></li>
            </ul>
            <input type="hidden" name="notifications" value="Opt in" />
            <input type="hidden" name="accept_terms" value="y" />
        </div>
    </div>
{/exp:user:register}

```

As I say, everything else in the form fills out correctly, it is only the group\_id that keeps defaulting to 4. The strange thing is I have an edit form too, which is more or less identical (see below), and upon submitting that the group\_id will update correctly.

Here are the differences with the edit form:

*Opening tag*

`{exp:user:edit allowed_groups="5|6|7|8|9" return="profile/{segment_3}"}`

*Member Group Select*

```
<label for="member-group">Member Group</label>
<select name="group_id" id="member-group" class="styled-select">
    {select_member_groups}
        <option value="{group_id}" {selected}>{group_title}</option>
    {/select_member_groups}
</select>

```

I have tried the following:

* Added member groups manually (not using the select\_member\_groups tag).
* Removing the styled-select class which returns the select back to its default styling.
* Disabled any custom extensions that hook into the registration process.
* Added a text field with the id as value.
* I've also tried changing allowed\_groups to `group_id=""`

All of the above still result in the member group remaining as Pending (ID:4)

Has anyone got any ideas?

# Answer
> 2 votes
In the Members \> Preferences \> Require Member Account Activation? field it sounds like you have selected Self-activation via email which will set all new members to Pending until they have activated their account.

This prevents fake email addresses from being able to access member specific areas before the activation.

You can either set the field to No activation required which will put people in the proper group or need to send out the activation email.

---
Tags: members, solspace-user
---


# Question
Title: What file contains my template definition?
I've just inherited a site that uses ExpressionEngine and CodeIgniter. I'm very excited about it, but I've immediately found myself at a standstill.

I want to place a tracking script in the footer. In the index file(and on all other pages), a call is made at the end to `{footer}` .

I don't have access to the CMS side of EE, so I'm just deep inside the cPanel looking through the template PHP files. Where do I find the declaration?

# Answer
If I understand you correctly, it is very possible that `{footer}` is global variable or snippet which is not saved into files by default EE methods. So very possible you can find it in DB only (tables \_snippets & \_global\_variables).
> 1 votes

---
Tags: templates
---


# Question
Title: Is it possible to use $lang variable in fatal_error output on front end?
In my custom module I want to display a series of error messages for X, Y & Z. I have a single tag in the mod.\[module\_name\].php file and I want to throw out an error if no id has been provided.

```
if ( !ee()->TMPL->fetch_param('contact_id') ) {
    ee()->output->fatal_error(lang('missing_contact_id'));
}

```

Now when I add the tag without the id the message appears but with the text 'missing\_contact\_id' rather than what is defined in my $lang language file.

Is there a way to output this on the front end?

It's worth noting that all my language strings are displaying correctly from the various functions in the mcp.\[module\_name\].php file and the views that I have set up.

Thank you.

# Answer
Just found an answer over at ExpressionEngine link

In case the link dies here is what is posted:

> "If you want to display language messages in from end templates (for instance, in error messages) you must explicitly load the language file. Without loading it, the CP will render the language items just fine, but the front-end will not. So, in the hook function or constructor, load your language file like so:"

```
// if your lang file is named example_lang.php
public function __construct($settings = '') {
    $this->EE =& get_instance();
    $this->settings = $settings;
    $this->EE->lang->loadfile('example');
}

```

> or if you have a function for instance:

```
function cartthrob_pre_process() {
    $this->EE->lang->loadfile('example');
    $this->EE->output->show_user_error('general', lang('minimum_not_met') );
}

```

Just a quick note, mine was called lang.module\_name.php so I just used

`ee()->lang->loadfile('module_name')`
> 0 votes

---
Tags: add-on-development, module, language, custom-system-messages
---


title: Selective parsing of matrix rows

text:
# Question
Title: Selective parsing of matrix rows
I am using matrix to pull instagram photos using the pic puller plugin. Sometimes, the picture is not available. I am able to skip these by using an if conditional in the pic puller loop. however an empty matrix row is still parsed and shown on the final template. I am not sure how to just show the rows with instagram content.

```
{exp:channel:entries channel="mychannel" status="open" }
    {matrix_field}

        {exp:ig_picpuller:media user_id="1" media_id="{media_id}" use_stale_cache="yes"}
        {if ig_status == "true"}
            {ig_standard_resolution}
        {/if}
        {/exp:ig_picpuller:media}

    {/matrix_field}
{/exp:channel:entries}

```

I considered using the ig\_status tag as a search parameter in matrix, but didn't work.

```
{exp:channel:entries channel="mychannel" status="open" }
    {exp:ig_picpuller:media user_id="1" media_id="{media_id}" use_stale_cache="yes"}

        {matrix_field search:{ig_status}="true"}
                {ig_standard_resolution}
        {/matrix_field}

    {/exp:ig_picpuller:media}

{/exp:channel:entries}

```

Any ideas how i can skip the rows without any pictures from being parsed?

# Answer
> 0 votes
Assuming ig\_status is a column in the Matrix field, you don't want the curlies in the search:col\_name="" parameter:

```
{exp:channel:entries channel="mychannel" status="open" }
{exp:ig_picpuller:media user_id="1" media_id="{media_id}" use_stale_cache="yes"}

    {matrix_field search:ig_status="true"}
            {ig_standard_resolution}
    {/matrix_field}

{/exp:ig_picpuller:media}

```

{/exp:channel:entries}

---
Tags: matrix, pixelandtonic
---


title: Get IDs of deleted entries

text:
# Question
Title: Get IDs of deleted entries
I’m creating an ExpressionEngine extension. I want to get the IDs of any records that are deleted. I’m aware of the `delete_entries_end()` and `delete_entries_loop()` hooks, but they both return `void` which isn’t much use.

Is this possible out of the box with ExpressionEngine? I wanted to steer away from editing core files to make any future core upgrades seamless.

# Answer
delete\_entries\_loop passes two arguments: `$val` (which is the `entry_id` of the entry which has just been deleted) and `$channel_id`. So, your `entry_id` is there for the taking.

But if you want to get this data *before* each entry is deleted, then you are out of luck, as the hook is triggered right *after* each entry is deleted.
> 0 votes

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


title: MoreEvents Module - Templates

text:
# Question
Title: MoreEvents Module - Templates
it's good to see the answers from Brad on issues with MoreEvents. I have been trying to work with the module but wondered if my installation was ok or not.

Can anyone tell me if the module was supposed to install some templates only I cannot find any within the control panel?

Regards

Richard

# Answer
> 0 votes
Just by the way, I'm the one who supplied the fixes.

No templates are installed, but if you following the documentation (http://moresoda.co.uk/docs/moreevents/sections/templates/) its a pretty straightforward process.

What specifically are you having issues with?

---
Tags: module
---


# Question
Title: no_parents/no_results Using playa entry results based on a url segment, want to display no results
I have a list that builds based on the URL segment. Sometimes there no entries for the segment and need to display "no results". I have tried several varations on this and nothing seems to work.

Any suggestions are greatly appriciated, thanks for looking.

I have tried to take this another direction and am tying to use {if no\_parents} … {/if} variable.

However written like this it only shows up when there are results not when there is no results. Here is what my code looks like now

```
{exp:channel:entries
   channel="my_child_channel"
   orderby="data_contact_last_name"
   sort="asc"
   limit="3"
   }

     {exp:playa:parents
     channel="mychannel"
     field="my_field"
     var_prefix="my_var"
     }

        {if no_parents} no parent content {/if}

        <!-- label -->
        {if count == '1'}
         <h4 class="f400m"><strong>{child:title}</strong></h4>  <!-- The title-->
        {/if}

            <h4><a href="{my_var:url_title}">{my_var:title}</a></h4>

   {/exp:playa:parents}

```

Earlier I tried this and what Jason suggested i also could not get to work.

```
{exp:channel:entries
   channel="my_channel"
   limit="3"
   }

   {exp:playa:parents
      channel="my_parent_channel"
      field="field_choice"
      require_entry="yes"}

{if no_results}  <p>There are no entries available.</p>  {/if}

     {if count == '1'}
         <h4>{child:title}</h4>
      {/if}

       <h4><a href="{url_title}">{title}</a></h4>

 {/exp:playa:parents}
{/exp:channel:entries}

```

# Answer
The `if no_results` is actually referencing the outer `exp:channel:entries` tag - basically an EE parse order issue.

To test inside playa, you need to use the `var_prefix` parameter... as in:

```
{exp:playa:parents var_prefix="my_var"}
{if my_var:no_results}
    //no results behaviour here
{/if}
{if my_var:count == '1'}
     <h4 class="f400m"><strong>{child:title}</strong></h4>  <!-- The Str Discipline title-->
{/if}
{/exp:playa:parents}

```

The docs: https://docs.pixelandtonic.com/playa/templating/module/parents.html
> 1 votes

---
Tags: templates, playa, conditionals, no-results
---