# Question
Title: How do I add a Grid row using a Channel Form?
I've been experimenting with ExpressionEngine 2.7.0, attempting to replace my use of Matrix with Grid and updating my Safecracker forms with Channel Forms.

Currently, I have a template where users are able to create a channel entry in a SafeCracker form, which includes populating the first row in a Matrix field within that entry.

I'd like to replace that with a template where users are able to create an entry using a Channel Form and populate a row in a Grid field. I've successfully changed it to a Channel Form, but can't for the life of me figure out how to populate a Grid field. I'll share the code I was previously using:

```
        {exp:safecracker channel="routine" return="" json="yes" rules:field_id_3[row_new_0][col_id_1]="valid_ee_date"}
            <input name="RET" type="hidden" value="/" />
            <input name="title" type="hidden" value="New Routine" />
            <input name="routine_catalyst" type="text" />
            <input name="routine_reaction" type="text" />

            <input type="hidden" name="field_id_3[row_order][]" value="row_new_0" />
            <input type="hidden" name="field_id_3[row_new_0][col_id_1]" value="{entry_date}" />
            <select style="display: none" name="field_id_3[row_new_0][col_id_2]">
                <option value="n" selected="">NO</option>
                <option value="y">YES</option>
            </select>

        <select name="category[]" id="routine_category" size="4" multiple="multiple" style="display: none;">

            {categories}
           <option value="{category_id}"{selected}>{category_name}</option>
        {/categories}

        </select>

        {/exp:safecracker}

```

and what I currently have below

```
    {exp:channel:form
        channel="routine"
        return=""
        json="yes"
    }

        <input name="RET" type="hidden" value="/" />
        <input name="title" type="hidden" value="New Routine" />
        <input name="routine_catalyst" type="text" />
        <input name="routine_reaction" type="text" />

        <input type="text" name="routine_occurence[row_order][]" value="row_new_0" />

        <input type="" name="routine_occurence:date" value="{entry_date}" />
        <select style="" name="routine_occurence:complete">
            <option value="false" selected="">false</option>
            <option value="true">true</option>
        </select>

        <select name="category[]" id="routine_category" size="4" multiple="multiple">

        {categories}
            <option value="{category_id}"{selected}>{category_name}</option>
        {/categories}

        </select>

        <input type="submit" value="submit" />

    {/exp:channel:form}

```

I know it's still new, but I was wondering whether anyone had had any success with this? The docs are pretty lacking in the area at the moment.

EDIT: I should add that when I use the above code, I receive PHP errors with the message:

Severity: Notice

Message: Undefined offset: 0

Filename: libraries/Grid\_lib.php

Line Number: 238

And the entry is created, without the Grid row being entered

EDIT2: Solution below

# Answer
So, I've found a way to achieve this, which seems to work in the reduced test case that I created (Grid fieldtype with one column of text type and only one entry being entered in at a time). In the future, I'll create test that's a bit more complex and see if it becomes more involved. The code for this is:

```
        <input type="hidden" name="field_id_9[rows][new_row_0][]" value="new_row_0" />
        <input type="text" name="field_id_9[rows][new_row_0][col_id_5]" value="{entry_date}" />

```

The magic numbers you see floating in there (9 & 5) correspond to the custom field ID for the Grid field and the column ID for the data respectively.

Strangely, the Column ID does not necessarily begin at 0. That is, I had three Grid fields in that Channel Field Group, the former two having two columns in them. This third Grid field had one column and was created last, making it column 5, despite the Grid fields not actually being one field.

So, this can be extended to add more than one row by creating further instances (new\_row\_1, new\_row\_2) etc, or extended to use more than one column by creating more inputs (col\_id\_6, col\_id\_6).

Hope this helps others and cheers for anyone who scratched their head for it.
> 3 votes

# Answer
I've not tried this yet, but certainly `[row_order]` is not going to work because that's Matrix lingo. Any luck with using `[row_id]` instead?
> 0 votes

---
Tags: channel-entries, matrix, safecracker, forms, grid
---


# Question
Title: Pass custom/dynamic product information during add to cart process
I need to pass a custom, and dynamic field through from the page that has the Add to Cart button on it, all the way through checkout. How would I go about doing this?

Basically, I have some Add to Cart buttons that add a specific "product" from the Store Products channel and the Product they add, depends on the entry from a secondary channel so I need to pass the entry\_id from that secondary channel all the way through.

Hopefully this makes sense and hopefully it's a quick answer. :-)

# Answer
> 3 votes
You want to take a look at custom product modifiers:

https://exp-resso.com/docs/store/product\_tag.html#inputcustom\_modifier\_name

This will let you pass any text along with the product through to the checkout.

---
Tags: expresso-store
---


# Question
Title: Change admin password programmatically using PHP or MySQL
As part of a build/deployment script I will need to programmatically set the site admin password.

I have read this question but the output from the accepted answer does not work. I see extra columnd `salt` and `crypt_key`. I'm guessing these are use in when generating the password.

Does anybody know the function used to generate password?

Thanks in advance

# Answer
> 2 votes
Try this code by putting withing a EE template and run:

```
ee()->load->library('auth');
ee()->auth->update_password([MEMBER ID], '[NEW PASSWORD]');

```

For EE2.4:

```
$EE =& get_instance();
$EE->load->library('auth');
$EE->auth->update_password([MEMBER ID], '[NEW PASSWORD]');

```

I hope, it would work for you.

# Answer
> 1 votes
If you find that you need to get at this at a lower level, you might take a look at the source code in AJW Member Import. (I was just using this as a reference for a similar need...)

In the do\_import() function in ajw\_import\_members\_model.php (line 186), you'll see this simple conversion of a plain text password to the proper hash used by EE:

```
$data["password"] = do_hash( $data["password"] );

```

The do\_hash() function is just one of the CodeIgniter Security Helper functions.

It looks like this is just a standard SHA1 hash--if so, you should be able to hash the password in any language script (e.g., if your build / deploy script is Javascript/Node or Ruby, etc.)

---
Tags: admin, password, automation
---


# Question
Title: Changing languages in sessions_start hook
I am trying to implement a multilanguage site.

I have a hook handler for the hook `sessions_start` that is supposed to set the language for a page. Here are the lines of code from the hook to change the language that I have tried.

```
$this->EE->config->_global_vars['language'] = 'xxxxx';

$this->EE->config->_global_vars['default_language'] = 'xxxxx';

$this->user_lang = "xxxxx";

```

But none of them worked.

Any idea how to change the language in a hook?

P.S. Tried this

```
public function do_sessions_start($session_object)
{
 ....
 $session_object->userdata['language'] = "xxxxx";
}

```

But it seems it only works if the user is logged out. If logged in, the preference in the localization settings seems to overwrite.

We want to overwrite that.

# Answer
> 1 votes
The way I read the documentation on session hooks, what you set in sessions\_start gets overridden by the logged in users settings.

Here is what the documentation says exactly: "Reset Session class variables, modify default/guest settings, take over whole session check, etc."

From what you're saying, I think you need your code on the sessions\_end hook. Doc: "Modify the user’s session/member data, also allows for additional session or login methods (ex: log in to other system)."

Putting it on sessions\_end, you will be able to overwrite the language variable, whether it's set from the logged in session or its the default value.

Link to documentation: http://ellislab.com/expressionengine/user-guide/development/extension\_hooks/global/session/index.html

---
Tags: multi-language, hook, language
---


title: Pagination error suddenly appearing

text:
# Question
Title: Pagination error suddenly appearing
Overnight the following php error is being reported on our EE (2.6) site for pages requiring pagination:

```
A PHP Error was encountered

Severity: Notice

Message: Undefined property: Pagination_object::$pager_sql

Filename: ab_pagination/ext.ab_pagination.php

Line Number: 159

```

e.g. here:

http://www.tutor2u.net/blog/index.php/business-studies/

Any thoughts on why + how to fix?

Jim

# Answer
It looks as though the error is coming from the AB Pagination add-on. Have you updated it recently?

As to why it's suddenly appearing, it's possible that the error may have always been there and it just wasn't shown. Maybe the server it's hosted on has had it's PHP `error_reporting` settings changed in it's INI file to allow PHP Notices to be visible?

This blog post tells you how you can turn errors and notices on/off in code. So you would put the code it suggests in the `ab_pagination/ext.ab_pagination.php` file.

**However**, I'd suggest getting to the root of why the error is being caused in the first place, rather than putting a sticking plaster over it. I notice you've asked the question over at Addon Bakery, so hopefully the developer will give you a satisfactory answer.
> 1 votes

---
Tags: pagination, ab-pagination
---


# Question
Title: Inside exp:channel:entries PHP Variable not working
From so long facing this issue, don't getting the result if I pass the php variable inside exp:channel's as paramater, I have mentioned the code below.

```
$entryId = "1";
$entryId = "1|2|3";

{exp:channel:entries entry_id='<?=$entryId?>'}
    <h2>{title}</h2>
    {paginate}
        <p>Page {current_page} of {total_pages} pages {pagination_links}</p>
    {/paginate}
{/exp:channel:entries}

```

I would love to allow both of them, One of these atleast. But as of now in my case none of these is working. it didnt accept PHP variable, and returns null or blank. If I write directly like this
`entry_id="1" OR entry_id="1|2|3"`,
that will work perfect. and returns the entries and I've print the title of entry, So got the results.
And Yes I have allow `PHP` in my template from preference.
Can anybody find what I am making mistake in this..??

Please to help me, its such a irritating issue for me now.. I am open make any kind of changes.
All of suggestions will be allowed..
Thanks in Advance

Update :

Sir, Here I am not passing the segment, its a php form submit. So, I got the data in php $\_POST Variable, I have used that in sql query\[i.e. simple basic code like mysql\_query and mysql\_fetch\_array\]. I used this code, becuase of the same problem, I am not getting PHP variable inside exp:channel. Otherwise I like to use that {exp:query sql="..."}. Now what should I do.?? In actual its a result of search criteria. In form I have lots of fields with check box, whatever checkbox are checked that will be pass in from post, N here I got the result in $\_POST variable\[those are channel's fields\], and need to pass that $\_POST data and then what result i got on the base of channel's fields that is entries that will be display.

# Answer
> 0 votes
If you want to make your PHP variables available to the EECMS template language, make sure you set the PHP stage parsing to `input`, so the PHP will be parsed before all the template stuff.

# Answer
> 0 votes
Try a different approach using segment variables.

Or, if you want a list of entry ids, wrap the channel entries tag in the query module

```
{exp:query sql="SELECT GROUP_CONCAT(entry_id) AS entry_ids FROM exp_channel_titles WHERE ...put your conditions here..."}
{exp:channel:entries channel="news" entry_id="{entry_ids}" limit="10"}
    <h2>{title}</h2>
{/exp:channel:entries}
{/exp:query}

```

Php in templates is not recommended.

Update: ok, so you have a search form and want to display entries, try dynamo or stash bundle. Youll need to do some reading.

FYI. I originaly used dynamo. Then wanted it to do more, so altered the source code. Then switched to stash bundles.

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


# Question
Title: exp:resso store paypal 'ReturnURL is invalid'
I'm getting invalid `ReturnURL` error when trying to use PayPal Express. And I'm not seeing any options for setting the return url in the Store settings page.

I've tried setting the `return` parameter in the checkout-tag, but it doesn't seem to help

```
{exp:store:checkout return="https://www.example.no"}
{exp:store:checkout return="store/order/ORDER_HASH"}

```

None of the above works (the second one is the same as in the example template)

Any suggestions?

**Edit:** I think I found the problem. We use config-bootstrap in our EE, and there I've set up the site\_url as

```
define('NSM_SERVER_NAME', $_SERVER['SERVER_NAME']);
define('NSM_SITE_URL', '//' . NSM_SERVER_NAME);

```

This is to make plugins like minimee work when we're on https and http. So the site url wil be spit out like //www.example.com, and this is the reason PayPal is getting angry at me.

I found a way around it, though, but I'm not happy about it. In merchant\_paypal\_express.php in the `system/ee/third_party/`-folder, I changed the `_build_authorize_or_purchase()` method a bit:

```
$request['RETURNURL'] = 'https:' . $this->param('return_url');
$request['CANCELURL'] = 'https:' . $this->param('cancel_url');

```

As you see, I added `https` hardcoded to the url. But now it works.

# Answer
Give your .htaccess file a check to see if there is anything in there which could interfere with the return path. If you're unsure then copy and paste it in to your question so we can give it a quick check.

Failing that try including a hidden field in between your checkout tags:

```
<input type="hidden" name="return_url" value="http://domain.com/store/order/ORDER_HASH" />

```

Make sure the above is the correct return URL in full. Give that a try and see if it yields any different results so we have something to go on from there. Let me know how it goes.
> 1 votes

---
Tags: expresso-store, paypal
---


# Question
Title: Client reports errors and/or log-out when uploading a file
My client is reporting a problem that I am unable to reproduce, either locally or on the live, production server. The issue they are reporting comes when they try to change a file. The site contains a 'Latest events' link, which simply links to a PDF or JPG. There is a channel set up specifically for this link, containing nothing but a single 'file' field type. It is also set up to use the Single Entry add-on, so that the existing entry will always be edited rather than new entries added.

The client reports that when they go to edit this channel, they frequently find that clicking the 'Add File' link sends them to the CP log-in screen – presumably logging them out, although looking at the CP log shows no formal log-out taking place. On occasions when they have *not* been kicked out of the CP in this way they have had mixed success with actually uploading a file; some attempts work, whilst others result in the error message "The file could not be written to disk". (They have reported that they have had more success in uploading jpegs than with PDFs).

The perplexing bit is that when I log into the site from my own computer, even if I use the client's own login details, I see none of these problems -- files and images upload without a hitch, both in Safari (Mac) and IE9 (which is the browser that the client uses, AFAIK).

Has anybody here come across anything like this? Without being able to reproduce the problem from my end it's pretty hard to diagnose; I'm thinking that it's maybe something to do with the client's own browser set-up, but that's a pure guess and I haven't a clue regarding where to look for the specific cause. Um... help?

# Answer
Are they using some sort of proxy to connect to the site? Are they using some sort of remote session (e.g. Citrix) to connect to the site? Are you uploading the same PDF they're uploading? Some PDFs trigger the XSS filter and prevent the file from uploading, maybe try turning that off in your system settings.
> 1 votes

# Answer
Before doing anything, make sure you are running the most recent version of EE. It's possible they have updated EE code in a newer version to deal with changes in how PDFs are created.

---

The issue sounds specific to the PDF so you'll have to have it in hand for testing. When you get it, disable XSS Filtering as a test.

> Admin \> Security and Privacy \> Security and Session Preferences
>
> Set Apply XSS Filtering to uploaded files? to No and save

If your upload works with this disabled, reenable it and then add this to your code to exempt specific member groups from the filtering:

```
$config['xss_clean_member_group_exception'] = "1|6";

```

---

This could also be related to the size of the actual PDF and the amount of PHP resources the upload needs to complete. Try increasing the amount of memory allotted to PHP if the above doesn't solve the problem.
> 1 votes

---
Tags: file-uploads, browser, logout
---


title: Radio Button across Grid Rows

text:
# Question
Title: Radio Button across Grid Rows
I want to have a radio button field where it acts as “is default” field for all my rows.

That is, across all the rows, only one radio button should be checked.

Is this type of radio button supported in Grid?

I am at 2.5.5 and I am using Matrix/Playa. I am contemplating on upgrading to 2.7.0. If this type of field is supported, then I I think I will upgrade.

# Answer
It sounds like MX Lone Star is what you are looking for.

> MX Lone Star is small fieldtype which you can use to replace standard checkbox. But the real power of this fieldtypes is opened in Matrix-like fields - you can limited choosing in this fieldtype per row or/and per column.

It works with Matrix ~~, and according to this blog post it's also Grid compatible.~~

Also see this similar question, "Matrix & Radio Buttons - how to make radio button part of the same group?"
> 4 votes

---
Tags: grid, 2.7.0
---


title: Matrix rows: how to target every 3 rows

text:
# Question
Title: Matrix rows: how to target every 3 rows
I would like to wrap every 3 rows that the matrix fields output with some required html like this:

```
{exp:channel:entries channel="pages" disable="categories|member_data|pagination"}
 {my_matrix_field}
 {if rows are: FIRST FOURTH SEVENTH etc}
  <div class="row">
 {/if}
 <div class="span4">
 <p>{text} <a href="{link}" class="more">Read more</a></p>
 </div>
 {if rows are THIRD SIXTH NINTH etc}
  </div><!-- / row -->
 {/if}
 {/my_matrix_field}
{/exp:channel:entries}

```

# Answer
> 8 votes
Ah, you want groups of three wrapped and not every third one, wrapped, right? @mediagirl almost has it, but if your returned entries is not evenly divisible by three, you'll have a problem - the final switch will not take effect. You therefore have to close the wrapper conditionally, like this:

```
{exp:channel:entries channel="pages" disable="categories|member_data|pagination"}
  {my_matrix_field}

      {switch="<div class='row'>||"}

      Your per matrix row data here

      {if row_count != total_rows}{switch="||</div>"}{/if}{!-- closes row at switch interval IF last row IS NOT the current row --}
      {if row_count == total_rows}</div>{/if}{!-- closes row IF last row IS current row --}

  {/my_matrix_field}
{/exp:channel:entries}

```

I've done this many times, and it's a great, if not often thought of uses for the switch variable.

# Answer
> 3 votes
Unfortunately, I don't think this is supported natively (thought I would love to be shown otherwise!). The way I achieved this was to use the MX Calculator extension to calculate whether a row's count is divisible by 3 or not:

```
    {matrix_test}

        <span style="display: none;">
          {exp:mx_calc expression="mod({row_count}, 3)"}
        </span>

            {if '{calc_result}' == '0'}
                divisible by 3: {number} <br />
            {if:else}
                not divisible by 3: {number} <br />
            {/if}
        {/exp:mx_calc}
    {/matrix_test}

```

This works and you can then customise every third row's outcome, but has a small inconvenience. When you use the exp:mx\_calc opening tag to set the {calc\_result} variable, it prints out the result of the expression. This prints out:

1 not divisible by 3: 1
not divisible by 3: 2
divisible by 3: 3
not divisible by 3: 4
not divisible by 3: 5
divisible by 3: 6

Unfortunately, I can't use the mx\_calc tag right in the conditional, due to parse order issues. The work around is to just wrap the mx\_calc tag in a span and give it display: none;

However, I unfortunately skim read your question (which I know I shouldn't do) and I thought you were talking about Grid. In Grid, you can just have mx\_calc right in the conditional, because it's not a third party add-on. Thus:

```
    {test}
        {if '{exp:mx_calc expression="mod({test:count}, 3)"}' == '0'}
            divisible by 3: {test:number} <br />
        {if:else}
            not divisible by 3: {test:number} <br />
        {/if}
    {/test}

```

# Answer
> 2 votes
Using the `switch=""` parameter may do what you need. This is untested but I don't see why it wouldn't work.

```
{switch="||<div class='row'>"}
{switch="||</div>"}

```

---

**EDIT**
I adjusted the quotes in my code example based on Jean's comment below...

---
Tags: matrix, fieldtype
---


# Question
Title: {if} conditional prevent running module function
I created a module for GitHub's API and am having trouble preventing the module's function `{exp:cl_github:repo_contents_archive}` from running given a conditional. The reason this is imperative is that the function actually sends a file to the browser (sets headers, echos, and dies).

```
{if logged_out}{redirect="member/login"}{/if}

{exp:channel:entries require_entry="yes" parse="inward"}
    {addon_github}
        {exp:cl_github:repo_contents_archive
            owner="{owner}"
            repo="{repo}"
            ref="{ref}"}
    {/addon_github}
{/exp:channel:entries}

```

I've tried a few things like putting `{if logged_out}limit="0"{/if}` in the `{exp:channel:entries}` tag.

Another solution I thought of was to pass into my `{exp:cl_github:repo_contents_archive}` a parameter like `is_authenticated="{logged_in}"` but for some reason that wouldn't parse the value of {logged\_in}.

I don't really want to hardcode checking for logged\_in in the module itself. Can you guys/gals think of any other workaround or something I am missing?

# Answer
If you look at the Template Parsing Order, you'll see that the redirect, stage 20, is parsed after the modules, stage 15. So, let's try to prevent the parsing of `exp:channel:entries`.

I thought you could try this:

```
{if logged_out}{redirect="member/login"}{/if}

{if logged_in}
{exp:channel:entries require_entry="yes" parse="inward"}
    {addon_github}
        {exp:cl_github:repo_contents_archive
            owner="{owner}"
            repo="{repo}"
            ref="{ref}"}
    {/addon_github}
{/exp:channel:entries}
{/if}

```

But, your tests proved that `{if logged_in}` and `{if logged_out}` are advanced conditionals. I didn't realize this until to read your comment. This makes a lot sense, since their parsing need to be done after the page caching, to avoid `logged_out` users to see a `logged_in` cached page.

There's a way to use global variables, that make all conditionals to be advanced, on early parsing stages: using switchee!

Please, try this:

```
{exp:switchee variable = "global:logged_in_member_id" parse="inward"}
    {case value="0"}
        {redirect="member/login"}
    {/case}
    {case default="yes"}
        {exp:channel:entries require_entry="yes" parse="inward"}
            {addon_github}
                {exp:cl_github:repo_contents_archive
                owner="{owner}"
                repo="{repo}"
                ref="{ref}"}
            {/addon_github}
        {/exp:channel:entries}
    {/case}
{/exp:switchee}

```

The prefix `global:` allow us to access the global variables that, otherwise, aren't available until the later stages of parsing.
> 2 votes

# Answer
Something like this works with the mo\_variables extension which early parses for use in simple conditionals (I should extend mo\_variables to support a `{logged_in/out}` var as well):

```
{if "{logged_in_member_id}" == FALSE}{redirect="member/login"}{/if}

{exp:channel:entries require_entry="yes"}
    {addon_github}
        {exp:cl_github:repo_contents_archive
        owner="{owner}"
        repo="{repo}"
        ref="{ref}"
        }
    {/addon_github}
{/exp:channel:entries}

```
> 1 votes

---
Tags: add-on-development, conditionals, module
---


# Question
Title: Can I cache a exp:cartthrob:add_to_cart_form?
I'm working on a wholesale site that means I have at least 15 unique add\_to\_cart forms on a product listing page. This slows the page down considerably as each form is dynamically generated. I've been experimenting with ce\_cache and if I cache the whole listing the site is so much faster - the only thing I'm concerned about is what I'm sacrificing in terms of dynamic information, and any risks I might incur by caching these listings.

The speed improvement is so significant that it would be great to be able to do this.

Also, the actual site is pretty straightforward - there are no inventory counts to look up, so it won't make any difference there. It seems to work for me, but I don't want to push it to production if I run the risk of anything happening to customer orders as a result of the caching.

If anyone has any experience of this, or knows more about what impact this may or may not have I'd love to hear about it!

# Answer
You should never cache things that are this dynamic. CodeIgniter adds an XID to forms which can cause validation errors if they're reused. What you could consider is dynamically loading them, sort of like this:

```
var items = $('.products .product');

$.each(items, function(){

    var url = $(this).attr('data-form-url');

    $(this).find('form-wrapper').load(url);

})

```
> 2 votes

---
Tags: cartthrob, ce-cache
---


# Question
Title: What hook for immediately after user is logged in?
I'm trying to find what hook there is for immediately after the user logged in?

I've been looking at sessions\_start and sessions\_end but I'm not sure how exactly they work and nothing seems to be working the way I want it to, the docs arent the clearest.

Thanks.

# Answer
member\_member\_login\_start is what you're looking for
> 1 votes

# Answer
What is it you are trying to do?

This may help. Download plugin ress and look at source code.

Edit: no, my mistake session\_start is wrong hook. Sorry

Another suggestion, point return params of all login pages to an empty template where you run a plugin to test for T&C = done. If so, redirect here. If not, redirect there.

You can also use group\_ids to redirect.

```
{exp:member:login_form return="template_group/my_login_redirect_template"}

```

For example

```
{if logged_in}
    {exp:my_login_plugin}
            {redirect='pages/terms_conditions'}
    {/exp:my_login_plugin}
{/if}

```

OR

```
{exp:switchee variable = "{group_id}" parse="inward"}

{case value="9"}
    {redirect='pages/terms_conditions'}
{/case}

{case value="6"}
    {redirect='template_name/member'}
{/case}

{case default="Yes"}
    {redirect='template_name/welcome'}
{/case}

{/exp:switchee}

```
> 0 votes

---
Tags: hook, sessions
---


title: Pagination showing blank content area

text:
# Question
Title: Pagination showing blank content area
ExpressionEngine greenhorn here...

I'm trying to output some pagination and run into blank pages when I click any of the links (page 1, 2, 3, Next/Last etc...). The numbered list of pages also jumps up by multiples 6... which sets of alarm bells because my channel below has a limit of 6.

```
{exp:channel:entries channel="news" limit="6" dynamic="off" orderby="date" sort="desc" paginate="bottom"}
                 {paginate}

                       <p id="pagination">Page {current_page} of {total_pages} pages {pagination_links}</p>
                    {/paginate}
<!-- SOME ENTRIES -->
{/exp:channel:entries}

```

Any help would be much appreciated! Thanks!

# Answer
> 2 votes
Try following instructions on Blank Pages in EE docs and see if you get any errors reported.

# Answer
> 1 votes
The sample code you have provided looks right and is an exact copy of what is provided in the user guide under pagination. I also tested it in my site and it works correctly.

The issue then must be caused by other code inside the channel entries tag.

Comment out chunks of the code and test it yourself until it works/doesnt work.

Maybe youve used a plugin tag that is causing the conflict.

Edit: After checking your code in your earlier question spotted a tag for slideshow and suggest if you remove that code things will work.

And a search for slideshow leads me to suggest its custom code thats been written and is causing the conflict.

If you place this inside the slideshow tag, (i think) youll get a result that is causing the conflict with pagination

```
{total_pages}

```

Am i correct?

---
Tags: pagination
---


# Question
Title: Complex Category Setup // Looking for Best Practices
Okay so I have looked at How to create a complex stockist list using Structure and/or categories and have studied all of the comments carefully but I don't think any of those setups are going to work for me. Although I'm open to any ideas on how to implement those into what I'm doing.

Okay here's my scenario and setup:

* Businesses Channel
* State and City Channels as sub-pages with Structure

I have a matrix field setup for each individual business with Playa fields pulling in the State and City.

I have a small set of Categories associated with each individual Business.

What I would like to do is to have a list of States on a Business page (I currently have this setup which pulls a list of each State in the "State" channel". that clicks through to the list of City's under each State.

I figured I would need a relationship (Playa) for each City, so EE knows which State each belongs too. I have this portion setup too.

**WHERE MY PROBLEM LIES**

I'm not sure how I am going to pull in (for example) *Bob's Towing company in Boulder, CO* on the business page.

I think using Playa is the way to go, but I'm currently lost at the moment on how to bring it all together. I want to avoid having to setup more Structure pages under each and every City as this will quickly become quite the mess.

I am open to virtually anything.

**WHAT I'M GOING FOR**

1. Business Page
2. Listings of States on Business Page
3. Listings of Cities from the States page, making it easy for people to find what they are looking for
4. Have a list of Categories clicked from the States page with individual businesses organized accordingly.

I am certain there's a better way of doing this and am looking to the EE gods for help on this. I am open to setting up a Channel for each State if need be, but again I'm looking for some better suggestions.

Thanks again for reading this and offering any advice on how I can bring all of this together!

Cheers

# Answer
> 1 votes
Why not just simply put your State/City structure in as categories/subcategories? You can use any number of add-ons to pull out just children and Low's Seg2Cat to get rid of the /category/ keyword etc, but seems like a case for categories to me.

---
Tags: matrix, playa, categories, structure
---


# Question
Title: Freeform default_value not working with global email variable
So I am building this "booking form" (really it just emails somebody) and I want the form to be pre-populated with the user's details if they are logged in. I have this mostly working, but the email address will not populate from the global `{email}` variable.

Because of the parse order I have the form in an include and am embedding it in my template, passing the variables to it.

Here is the embed code:

```
{embed="/includes/.booking-form"
        first-name="default_value='{exp:member:custom_profile_data}{first-name}{/exp:member:custom_profile_data}'"
        last-name="default_value='{exp:member:custom_profile_data}{last-name}{/exp:member:custom_profile_data}'"
        email="default_value='{email}'"
        school="default_value='{exp:member:custom_profile_data}{school}{/exp:member:custom_profile_data}'"
    }

```

And here is the form code:

```
{exp:freeform:form form_id="1" required="first_name|last_name|email|school" return="{page_url}" inline_errors="yes" form:class="booking-form"}
{if freeform:general_errors}
    <h2>There were some error(s) with your submission:</h2>
    <ul>
        {freeform:general_errors}
        <li>{freeform:error_message}</li>
        {/freeform:general_errors}
    </ul>
{/if}
<p>
    <label><span>*</span> First name:</label>
    {freeform:field:first_name {embed:first-name}}
    {if freeform:error:first_name}
        <span class="error">
            {freeform:error:first_name}
        </span>
    {/if}
</p>
<p>
    <label><span>*</span> Last name:</label>
    {freeform:field:last_name {embed:last-name}}
    {if freeform:error:last_name}
        <span class="error">
            {freeform:error:last_name}
        </span>
    {/if}
</p>
<p>
    <label><span>*</span> Email:</label>
    {freeform:field:email {embed:email}}
    {if freeform:error:email}
        <span class="error">
            {freeform:error:email}
        </span>
    {/if}
</p>
<p>
    <label><span>*</span> Your school:</label>
    {freeform:field:school {embed:school}}
    {if freeform:error:school}
        <span class="error">
            {freeform:error:school}
        </span>
    {/if}
</p>
<p>
    <label>Comments:</label>
    {freeform:field:comments}<br />
    {if freeform:error:comments}
        <span class="error">
            {freeform:error:comments}
        </span>
    {/if}
</p>
<p class="submit">{freeform:submit}</p>
{/exp:freeform:form}

```

As I said, the first name, last name and school are pre-populating perfectly, it is only the email that is not working. I have done a bit of debugging, if I put the `{embed:email}` tag in elsewhere in the code it outputs correctly `default_value='email@email.net'`, and if I manually type in the email into the embed code like so: `email="default_value='email@email.net'"` it pre-populates.

Anyone have any idea what's going on? Thanks in advance!

# Answer
According to the ExpressionEngine Parse Order documentation, {email} is parsed later than embeds, as a *standard global variable*. This is a common issue with other variables such as {member\_id} and {group\_id}. One way around this is to use PHP and EE's session class to get the email. This will parse **before** the embeds, which should send a parsed email variable.

In other words, turn on PHP and try this in your `{embed="/includes/.booking-form" ...}` tag:

```
email="default_value='<?php echo ee()->session->userdata["email"]; ?>'"

```

Since you're using `default=""` in all `{freeform:field:my_field}` fields, you could also try sending only the email address and put `default=""` in `{freeform:field:my_field}`, i.e. use this in your embed instead:

```
email="<?php echo ee()->session->userdata['email']; ?>"

```

(Note that I'm being careful with the types of quotes used to avoid escaping issues). Then, in your form, use:

```
{freeform:field:email default_value="{embed:email}"}

```
> 0 votes

# Answer
If you run just your embed template stand alone, does it return the results you are expecting. You may have to remove the "." in front of it. Try renaming your variable to user\_email so there is no potential conflict.
> 0 votes

---
Tags: email, solspace-freeform, solspace, global-variables
---


# Question
Title: How should I migrate an ExpressionEngine 1 site with Photo Gallery Module?
I have an existing site that I'm upgrading from ExpressionEngine 1.6.7 to ExpressionEngine 2.7.0 but the problem that I'm running into is that the Photo Gallery Module is installed. Of course there is no upgrade available for ExpressionEngine 2. Can someone suggest the best upgrade path for this situation?

Thanks

# Answer
Solspace has the Solspace Importer Module with Solspace Gallery Importer designed to do just this.
> 3 votes

---
Tags: ee1, upgrade, ee2-upgrades
---


# Question
Title: Fatal Error in EE Control Panel after updating Expresso Store PayPal Express code
I am having some issues trying to pass checkout cart line items to PayPal Express as part of the checkout process. I tried editing the merchant\_paypal\_base.php file as instructed in the post Expresso Store: List items on PayPal but couldn't get it to work so reverted back to the original php file.

Now, when I enter the Control Panel as administrator and navigate to **Store \> Settings \> Payment Methods** the screen refuses to load and instead offers this error message (URL redacted).

"Fatal error: Cannot redeclare class Merchant\_paypal\_base in /xxxx/system/expressionengine/third\_party/store/ci-merchant/libraries/merchant/merchant\_paypal\_base.php on line 34"

I have tried logging out/in and clearing all caches but to no avail. I was kind of expecting the passing of PayPal item details to be included with Store, so am a little disappointed that it requires some hacking around to pass this information across and it's a little beyond me. Any help much appreciated to either fix the error or get the item information to pass across to PayPal successfully.

Thanks in advance.

# Answer
It is going to be hard to diagnosis the issue since you have modified the files. The easiest thing to do would be to replace your store files with a fresh download to make sure that you have properly reverted your files.
> 2 votes

---
Tags: expresso-store, ee2, paypal-express-checkout
---


title: Solspace's Calendar and Relationships

text:
# Question
Title: Solspace's Calendar and Relationships
Here is the situation. I have two channels; one is "calendar\_events" and the other one is "projects" and there is a relationship field, "event\_related\_project" to relate that particular event to a specific project.

```
<h2>{title}</h2>
<h4 class="project_tagline">{project_tagline}</h4>
        {project_description}
            <section class="related-activities">
            <h3 class="related-title">Related Events</h3>
            <ul>
            {parents field="event_related_project" orderby="date" }
                {if parents:no_results}
                <p class="note-message">No related events are found.</p>
                {/if}
                <li><a href="{path='event/view'}/{parents:entry_id}/">{parents:title}</a> / {event_start_date format="%F %d, %Y"}</li>
            {/parents}
            </ul>

            <h3 class="related-title-news">Related News</h3>
            <ul>
            {parents field="news_related_project" orderby="date" limit="3"}
            {if parents:no_results}
            <p class="note-message">No related news are found.</p>
            {/if}
            <li><a href="{title_permalink='news/view'}">{parents:title} / {parents:entry_date format="%F %d, %Y"}</a></li>
            {/parents}
            </ul>
        </section>

```

It can display all the related events under a specific project but I cannot display the "event\_start\_date". I also tried to make the list wrapped by the {exp:calendar:events} pair tag but the result does not show correctly. May someone help? Thanks, Chris

# Answer
> 2 votes
Try passing the event\_id to an embedded template to a calendar:events tag. Which you would use to display the date.

something like:

```
{embed="my_date_template" event_id="{parents:entry_id}"}

```

then, your embedded template:

```
{exp:calendar:events event_id="{embed:event_id}"}
{event_start_date format="%F %d, %Y"}
{/exp:calendar:events}

```

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


title: Change sort order of files in Assets 2

text:
# Question
Title: Change sort order of files in Assets 2
In Assets 2, is it possible to change the sort order of files so that it automatically shows the most recently uploaded files first? I was hoping there would be a setting or config override for this, but I can't seem to find one.

I've got lots of images in the Assets folders, and it'd be much more convenient to me (and save a lot of infinite scrolling - btw, pagination FTW!) if the most recently uploaded files appeared first. Thanks.

# Answer
> 1 votes
There’s the Date column in Table view – you can click on that to get files to sort by date (which defaults to the date uploaded).

---
Tags: pixelandtonic, control-panel, assets
---


# Question
Title: Getting "ReferenceError: Matrix is not defined" error on channels that don't have Matrix fieldtypes
I recently updated a site to EE v2.7 and also updated all of my third-party add-ons to the most recent versions. The site in question has several channels, and everything seems to be working fine until I try and publish/edit something in a channel that doesn't have a "Matrix" fieldtype associated with it.

Little to none of the JS seems to be working on the publish/edit form (e.g., the "Entry Date" calendar widget), and even odder, the contents of EE's file upload modal appear at the bottom of the screen -- even though the channel in question doesn't have a "File" fieldtype.

I've tried reinstalling Matrix files, clearing caches -- the usual thing. Any ideas?

# Answer
I did some more digging, and it looks like this might not be a Matrix issue at all, but rather, an issue with the VZ URL fieldtype. On a whim, I went to one of the channels that was rendering fine, and added a URL field. Suddenly, I got the issue. I removed the URL field, and everything went back to normal.
> 1 votes

---
Tags: ee2, matrix
---


# Question
Title: Set item pricing based on incoming (referer) URL
I am working on a site that sells books. There is one book that should be discounted for students of an affiliated college program. However only active students in the class can have access to the pricing. The desired scenario is:

* website someclass.edu has a page someclass.edu/getbookcheap
* this page is limited to current students only (behind a log in)
* that page has a URL to a landing page examplebookstore.com/getbookcheap
* that page will show the reduced price for the book
* users who try to access example bookstore.com/getbookcheap from anywhere but someclass.edu/getbookcheap will get redirected to the page for the book where it is listed at full price

my questions:

* what is the best way to implement this using CartTHrob (shopping cart used)? I could use a coupon code, but those are global and not item/page specific. We could list the book twice, the second being only listed on this special landing page.
* are there any EECMS methods of limiting traffic based on referer? Would we have to use htaccess?

It must work if the buyer is not logged in or logged in. Limiting access based on member group is not an option at this point.

# Answer
What you are after are conditional statements based on IF someone is entitled to discounts or not.

Would the discount remain the same overall or vary? eg. 50% off for all. Or 10%, 20% and 30% off in variations.

You'd use one page per book title and load the page using EE's conditional statements for displaying information based on user group. You can read more about conditional statements in the Docs here:

http://ellislab.com/expressionengine/user-guide/templates/globals/conditionals.html

In a book title's template page, you would declare conditions that if the logged in user group is "Student" then display this pricing only. If else, then display full retail price. This way a visitor who is not registered or logged in is still able to access the page and view pricing.

As an example, if you had two types of students (fulltime and casual) and their user group id's were 1 and 2 then you would use this code within the template:

```
{if in_group('1|2')}
 Discount student price
 {if:else}
 Retail Price
{/if}

```

If the student is logged out they will see the full retail pricing as anyone else will. The price listed using this will be passed in through the form to Cart Throb based on what is displayed with this method. This same conditional if:else statement can also allow you to display information on any page if the user is logged in. If they are logged in and on the front page you could use the statement to advise of a discount promotion or any information specific to that user group.

You can discount the price on the page using PHP which will then be passed through the form in to the cart. This method allows you to control the pricing on a page rather than on the final order confirmation page.

Consider that if you look at most book stores, they apply discount on order confirmation pages. This allows coupon codes to be added to the sale. This could allow a student to obtain a further discount on a book. Secondary discounts are an option to boost sales during festive times.

If discount prices vary then you would still display the correct pricing using the above conditional statements but would need to declare in a custom field in the channel entry of each book using either -

* the exact discount eg. custom field - {stdiscount\_off} allowing control over book discount per channel entry and display using the if:else or
* create tier levels of applied discounts custom field - {stdiscount\_off\_1}, {stdiscount\_off\_2}, {stdiscount\_off\_3} and display based on user group identification in the conditional.

If you wanted to have a page that is solely for students (for eg. './studentbooks') then you could use a conditional at the top of your page template to redirect them to another page that is for full retail pricing ('./books') like this:

```
{if logged_out}
 {redirect='books/'}
{/if}

```

But this increases the number of pages you are handling by having separate pages for users. Not the best practice approach to use.

I guess you first have to let the client decide for their business website if they wish to "force" and "apply" a discount for a user too.
> 1 votes

---
Tags: cartthrob, htaccess, security
---


# Question
Title: Control panel submenus not expanding and 503 service unavailable error
Sometimes the top submenus are not showing . Same time when we check the browser console we can see '503 Service unavailable' .

```
<script type="text/javascript" charset="utf-8" src="secure_access.php?S=0c587174500c93563f4efd82b4275a3984fb1c87&D=cp&C=javascript&M=combo_load&ui=core,widget,mouse,position,sortable,dialog&plugin=ee_focus,ee_interact.event,ee_notice,ee_txtarea,tablesorter,ee_toggle_all,ee_navigation&file=cp/global_start&effect=core&v=1359470773"></script><script type="text/javascript" charset="utf-8" src="secure_access.php?S=0c587174500c93563f4efd82b4275a3984fb1c87&D=cp&C=javascript&M=combo_load&file=cp/global_end&v=1359470108"></script><script type="text/javascript" charset="utf-8">

GET secure_access.php?S=0c587174500c93563f4efd82b4275a398…,ee_toggle_all,ee_navigation&file=cp/global_start&effect=core&v=1359470773 503 (Service Unavailable)

```

This submenu issue is not happening always. At the same time, one admin user sees the issue, but another admin user don't have this issue.

Can anyone advise whats the issue and how to be sorted. I'm using ExpressionEngine 2.6.1.

# Answer
The basic issue was that the javascript files that makes the menu working didn't get downloaded from server. This happened because there was an issue on server and hence we were shown the '503 service unavailable' error.

The '503 service unavailable' was due to varnish and apache disagreeing with the size of gzipped content. When this issue got fixed on server the javascript resource downloaded properly and the submenu started working.
> 1 votes

---
Tags: control-panel, javascript, jquery, ajax
---


# Question
Title: Exp:resso Store: Show customers email in template
My client has requested that a customers email address be placed in an email template. This can obviously be retrieved using the member details if the customer has chosen to be a member, but how do I get the email address if the customer hasn't opted to register as a member please?

Cheers

Tom

# Answer
> 2 votes
Found the solution. The tag `{order_email}` works in the email templates.

---
Tags: expresso-store, email, tags
---


# Question
Title: Remove Cookies Allowed Default EE Message when using Cookie Consent Module
I have recently installed the Cookie Consent Module on a recent EE site build, and have added an allow cookies link (ie. {cookies\_allowed\_link} ) to a policy banner at the top of the site.

My question is:

Is there anyway to remove the default EE ' Cookies Allowed ' grey message box from showing? ie. I just want the user to able to click allow cookies and the site just carries on as normal with out going to a message screen.

Many thanks in advance on this :-)

Regards

Karl

# Answer
> 2 votes
you could:

1. style the systems message template
2. use an addon called custom system messages
3. or look for an AJAX way to do it. the last one is the most elegant, i however, with my limited javascript skills have not yet been able to do it

# Answer
> 0 votes
I haven't used this module but if there is a CSS class for the grey message box, you can hide it with CSS using `.classname { display:none }`.

# Answer
> 0 votes
I seem to have got round it by using Jquery to load the page into a new iFrame. I haven't tested it fully though.

I added a click handler to the link with this code:

```
$('a.close-cookie-policy').click(function(){
  var thisLink = $(this).attr('href');

  $('<iframe>', {
    src: thisLink,
    id:  'cookie-frame',
    frameborder: 0,
    width: 0,
    height: 0,
    scrolling: 'no'
  }).appendTo('body');

  $('.cookie-policy').fadeOut('slow');

  return false;
});

```

---
Tags: module, cookies
---


# Question
Title: Via a module, how do I get a specific function to fire when I submit a form?
Below are the four required files to install a module that I created. They are all located within the '/third\_party/database\_add/' folder. **My issue and my question is located after these files**, which I am including to show what I've done so far.

File: database\_add\_lang.php

Location: /third\_party/database\_add/language/english/

```
$lang = array(
'my_module_module_name'     => 'Database_add',
'my_module_module_description'  => 'Contains functionality to add a user to the user table',
''=>''
);

```

File: mcp.database\_add.php

Location: /third\_party/database\_add/

```
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    class Module_name_mcp {
    }
/* End of file mcp.module_name.php */
/* Location: ./system/expressionengine/third_party/database_add/mcp.database_add.php */

```

File: mod.database\_add.php

Location: /third\_party/database\_add/

```
class Database_add{
    var $return_data = '';

    function register(){
        $username = "john"
        $passhash = "smith"
        $data = array(
            'User_Name'     =>$username,
            'User_Passhash' =>$passhash
        );
        $query = ee()->db->insert('exp_user', $data);
    }

    function form(){
      $return_data = ee()->functions->form_declaration(array(
        'hidden_fields' => array(
          'ACT' => ee()->functions->fetch_action_id('Database_add', 'register'),
        ),
      ));

      $return_data .= ee()->TMPL->tagdata;
      $return_data .= '</form>';
      return $return_data;
    }
}

```

File: upd.database\_add.php

Location: /third\_party/database\_add/

```
class Database_add_upd{
    var $version = '1.0';

    function install(){
        $data = array(
            'module_name'       => 'Database_add',
            'module_version'    => $this->version,
            'has_cp_backend'    => 'n',
            'has_publish_fields'=> 'n'
        );
        ee()->db->insert('modules', $data);

        $data = array(
            'class'     => 'Database_add',
            'method'    => 'add_user'
        );
        ee()->db->insert('actions', $data);
    }

    function uninstall(){
        ee()->load->dbforge();

        ee()->db->select('module_id');
        $query = ee()->db->get_where('modules', array('module_name' => 'Database_add'));

        ee()->db->where('module_id', $query->row('module_id'));
        ee()->db->delete('module_member_groups');

        ee()->db->where('module_name', 'Database_add');
        ee()->db->delete('modules');

        ee()->db->where('class', 'Database_add');
        ee()->db->delete('actions');

        return TRUE;
    }

    function update($current = ''){
        return FALSE;
    }
}

```

That is my file structure. I followed this EllisLab tutorial to get this far. My front-end form code looks like this:

```
{exp:database_add:form}
    <input class="text_box" type="text" name="username" id="username" />
    <input class="text_box" type="password" name="password" id="password" />
    <input type="submit" name="submit_button" value="Register" />
{/exp:database_add:form}

```

The above form is simplified of course. The form successfully renders as this:

Now take a look at my register() function. No matter what I enter into the above form, I expect register() to fire, and the username "john" with the passhash "smith" to be entered into the "exp\_user" table. That doesn't happen. The table remains empty. All that happens is my blank 'index.php' page loads.

**My question is: How do I get the register() function to fire when I press the Submit button on the form?**

# Answer
> 2 votes
The issue was with my a specific line of code in my upd.database\_add.php file. The original line was

```
'ACT' => ee()->functions->fetch_action_id('Module_name', 'register'),

```

It should be (and currently is corrected to)

```
'ACT' => ee()->functions->fetch_action_id('Database_add', 'register'),

```

I forgot to put the name of my module as an argument in the fetch\_action\_id() function. It was searching for the action ID of a function called 'register', but it was trying to look in the wrong module 'Module\_name', which doesn't even exist. No error message or anything.

# Answer
> 0 votes
It looks like you'll need to also add the XID Hash into your form hidden input with the name "XID" as well for it to fire.

I would suspect that's the issue, but can we see what the rendered form in the front end looks like?

Carl

# Answer
> 0 votes
I don't have any docs, but you could look at my Authenticate add-on for a real world example. This form building process has always been a pain for me, so I built Base Form to make life easier. Your forms will inherits loads of default functionality without you having to code it. This library is due for a 2.0 rewrite at some point, and not perfect, but even still I use it all the time with almost all of my add-ons.

https://github.com/objectivehtml/Base-Form

---
Tags: module, forms
---


title: PHP Errors - possible firewall block?

text:
# Question
Title: PHP Errors - possible firewall block?
On the site, the errors shown below are appearing on the bottom of the home page, and also appear when I try and complete a SagePay test payment.

Doing a bit of digging, it appears it may be something to do with a firewall blocking permission, but not sure. Can anyone confirm this, and also, does Expression Engine need to connect to a port?

---

A PHP Error was encountered

Severity: Warning

Message: Unknown: open(/var/lib/php/session/sess\_4l2sqvju8b8ji8usse9vq4ekk7, O\_RDWR) failed: Permission denied (13)

Filename: Unknown

Line Number: 0

---

A PHP Error was encountered

Severity: Warning

Message: Unknown: Failed to write session data (files). Please verify that the current setting of session.save\_path is correct (/var/lib/php/session)

Filename: Unknown

Line Number: 0

---

# Answer
It seems it can't write to the folder because of incorrect permissions on the folder.

Possibly change the location of where the sessions files are saved (e.g. in a tmp\_sessions folder) and change the location in Plesk.
> 1 votes

# Answer
given you're using CartThrob and SagePay - we had a similar problem back in December. Have a look at extload.php inside themes/third\_party/cartthrob/lib and update as required.

That certainly fixed our issue.
> 0 votes

---
Tags: ee2, php, error
---


title: Solspace Friends & Favorites together

text:
# Question
Title: Solspace Friends & Favorites together
I'd like to output a list of *ONLY* the friends of the current logged in member who have favorited the entry being viewed (single entry page).

I'm sure this can be done by passing embeds of one module results down to another, but if anyone has accomplished this more easily before I'd love to hear suggestions.

thanks!

# Answer
> 1 votes
I happen to have the Friends mod file open in my editor. It appears that the friend\_id parameter of the Mine tag can accept a pipe separated list. Looking at the documentation, this would be an undocumented feature. There may be something I'm missing and this actually won't work, but you can try it.

```
{embed="foo/bar" members="{exp:favorites:members}{member_id}|{/exp:favorites:members}"}

```

Then in the embed template...

```
{exp:friends:mine friend_id="{embed:members}"} content {/exp:friends:mine}

```

Of course, make sure you add the other parameters you need, but that should give you the basic gist.

Edit: I ran a quick test on the components I wasn't sure about (parse order, multiple ID's separated by pipes and having a trailing pipe in the list) and each seemed to work fine. I couldn't do a full test because I don't have the Reviews module. But I'm confident this will work.

# Answer
> 0 votes
The quick-and-dirty way is to run {exp:favorites:members} to get members who favorited an entry first, then feed those {member\_id}s in {exp:friends:mine} to check if that member is a friend:

```
{exp:favorites:members entry_id="{segment_3}"}
    {exp:friends:mine friend_id="{member_id}"}
        {if friends_no_results}{/if}
        [{member_id}] {screen_name}<br />
    {/exp:friends:mine}
{/exp:favorites:members}

```

**However, the above won't work** because the `[{member_id}]` would parse when {exp:favorites:members} it encountered, not when {exp:friends:mine} is encountered. In that case, embedding the {exp:friends:mine} part could work, but can potentially create a lot of embeds at each looping of {exp:favorites:members}, which would degrade performance.

Although this might be possible with plugins such as Stash, you could use PHP to create a string of member\_ids that favorited the entry, pass this **single string of data** into a **single** embed, and use PHP in the embed to break up the string into individual member\_ids again.

For example, in your template, you would set PHP to **Output** and build the member\_id string like this:

```
<?php $member_ids = '';?>

{exp:favorites:members}
   <?php $member_ids .= '{member_id}|'; ?>
{/exp:favorites:members}

{!-- This removes the pending pipe character --}
<?php $member_ids = rtrim($member_ids, '|'); ?>

{embed="friends/list" member_ids="<?php echo $member_ids; ?>"}

```

Then, in your embed (`friends/list` here), break up the pipe-delimited string of member\_ids and cycle through them in {exp:friends:mine}. PHP on **Output** would probably do here:

```
<h1>Friends who favorited the entry:</h1>

<?php $member_ids = explode('|', '{embed:member_ids}'); ?>

{exp:friends:mine member_id="CURRENT_USER"}
  <?php foreach($member_ids as $member_id) :?>
    <?php if( $member_id == '{member_id}' ) :?>

       [{member_id}] {screen_name}<br />

    <?php endif ?>
  <?php endforeach ?>
{/exp:friends:mine}

```

You could do the foreach() loop outside of the {exp:friends:mine} tag pair and feed member\_ids individually, but this would call the {exp:friends:mine} tag multiple times. The above approach would call {exp:friends:mine} once.

---
Tags: ee2, solspace
---


title: calendar and date formatting error

text:
# Question
Title: calendar and date formatting error
No matter how I format my entry\_date, it throws an error:

```
{exp:channel:calendar switch="calendarToday|calendarCell" channel="workshop_events" show_future_entries="yes" show_expired="yes"}
{calendar_rows}
{if entries}
    {entries}
        {title}<br />
        {entry_date format="%g:%i%a"}
    {/entries}
{/if}
{/calendar_rows}
{/exp:channel:calendar}

```

PHP error on the entry\_date is as follows:

> Undefined index: entry\_date format="%g:%i%a"
>
> Filename: channel/mod.channel\_calendar.php
>
> Line Number: 472

thanks for any advice.

# Answer
why not use :

```
{exp:channel:calendar switch="calendarToday|calendarCell" channel="workshop_events" show_future_entries="yes" show_expired="yes"}
{calendar_rows}
{if entries}
    {entries}
        {title}<br />
        {date format="%g:%i%a"}
    {/entries}
{/if}
{/calendar_rows}
{/exp:channel:calendar}

```
> 1 votes

# Answer
Looks like a bug in EE 2.7.0 (thanks @solspace for pointing that out \[offline\]). meanwhile, I used PHP to solve this issue:

```
<?php echo date("g:i:a",{entry_date}); ?>

```

I also had to use date\_default\_timezone\_set() because my server's settings were different than EE's general settings but it's working beautifully.
> 1 votes

---
Tags: ee2, calendar, date-format
---


title: RSS feed template and 404 Not Found

text:
# Question
Title: RSS feed template and 404 Not Found
I have created RSS feed template (named as 'feed') to pull data from the blog channel and it looks like

```
{preload_replace:master_channel_name="blog"}
{exp:rss:feed channel="{master_channel_name}"}

<?xml version="1.0" encoding="{encoding}"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
    xmlns:admin="http://webns.net/mvcb/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:content="http://purl.org/rss/1.0/modules/content/">

    <channel>

    <title><![CDATA[{channel_name}]]></title>
    <link>{channel_url}</link>
    <description>{channel_description}</description>
    <dc:language>{channel_language}</dc:language>
    <dc:creator>{email}</dc:creator>
    <dc:rights>Copyright {gmt_date format="%Y"}</dc:rights>
    <dc:date>{gmt_date format="%Y-%m-%dT%H:%i:%s%Q"}</dc:date>
    <admin:generatorAgent rdf:resource="http://expressionengine.com/" />

{exp:channel:entries channel="{master_channel_name}" limit="10" dynamic_start="on" disable="member_data|pagination"}
    <item>
      <title><![CDATA[{title}]]></title>
      <link>{title_permalink='site/index'}</link>
      <guid>{title_permalink='site/index'}#When:{gmt_entry_date format="%H:%i:%sZ"}</guid>
      <description><![CDATA[{summary}{body}]]></description>
      <dc:subject><![CDATA[{categories backspace="1"}{category_name}, {/categories}]]></dc:subject>
      <dc:date>{gmt_entry_date format="%Y-%m-%dT%H:%i:%s%Q"}</dc:date>
    </item>
{/exp:channel:entries}

    </channel>
</rss>

{/exp:rss:feed}

```

but when I will refer browser to feed url like http://www.mydomain.com/feed I'm getting 404 Not Found.

Any clue what can be missing?

Thanks

# Answer
I'm guessing it's just the way your templates are set up. Is your template group called `feed.group`? And the template itself called `feed.xml`?

If that's the case it will need to be accessed at `http://example.com/feed/feed`. Or you can change your RSS template to be `feed.group/index.xml` so you can access it at `http://example.com/feed` as desired.

If this misses the boat, please update your question with a little more information on your template setup and I can try to be more helpful.

UPDATE based on your comments:

Since you have strict URLs enabled you will not be able to access the default template group's templates without also including the default template group's name in the path. See this EllisLab blog post as well as this answer on Stack Exchange for more info.

So in your case, since the feed is in your default template group, `site.group`, the URL you need to use when Strict URLs is enabled is `http://example.com/site/feed`.
> 5 votes

---
Tags: templates
---


# Question
Title: Passing preload_replace variables into a plugin
I've been working on my first EE plugin today, and I need to make it dynamic by passing either a PHP variable, or I would have thought I can use a preload\_replace variable, from the template that calls the plugin, into the plugin.

The plugin runs a custom query on the database to return a set of entry IDs into the channel entries tag. But I need to set a category ID in the the template that would be dynamic depending on the template been viewed. This needs to be passed into the plugin for the query to run.

How can I pass this in?

I've tried numerous ways with the template class, and using PHP by setting a variable in the template, but no success. I just keep getting an undefined variable error.

Can anyone offer any pointers, please?

# Answer
I've found a way to do this; not sure its the 'right' way, but it works and seems logical :-)

```
{exp:plugin_name parse="inward" variable_to_pass="{some_id}"}

```

Then in the plugin:

```
$my_var = $this->EE->TMPL->fetch_param('some_id');

```
> 2 votes

---
Tags: add-on-development, php, plugin, variable, preload-replace
---


# Question
Title: “The uploaded file exceeds the maximum allowed size…” error
I am trying to upload a 30MB PDF file. I keep getting the "“The uploaded file exceeds the maximum allowed size…” error. I have turned off XSS filtering and here is my PHP info:

memory\_limit 100M post\_max\_size 12M upload\_max\_filesize 80M max\_execution\_time 300

I am a Super Admin. Any ideas on what might be going wrong?

# Answer
Your post\_max\_size needs to be at least 30MB to handle that file. It's set to 12M currently, which is not nearly enough. I generally set my post\_max\_size to be the same as upload\_max\_filesize just to keep things simple.
> 3 votes

---
Tags: file-uploads, size
---


# Question
Title: RSS Feed template and links to posts - not working URLs
I have created RSS Feed template based on EE documentation and one online tutorial. Code for it looks like

```
{preload_replace:master_channel_name="blog"}
{exp:rss:feed channel="{master_channel_name}"}

<?xml version="1.0" encoding="{encoding}"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
    xmlns:admin="http://webns.net/mvcb/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:content="http://purl.org/rss/1.0/modules/content/">

    <channel>

    <title><![CDATA[{channel_name}]]></title>
    <link>{channel_url}</link>
    <description>{channel_description}</description>
    <dc:language>{channel_language}</dc:language>
    <dc:creator>{email}</dc:creator>
    <dc:rights>Copyright {gmt_date format="%Y"}</dc:rights>
    <dc:date>{gmt_date format="%Y-%m-%dT%H:%i:%s%Q"}</dc:date>
    <admin:generatorAgent rdf:resource="http://expressionengine.com/" />

{exp:channel:entries channel="{master_channel_name}" limit="10" dynamic_start="on" disable="member_data|pagination"}
    <item>
      <title><![CDATA[{title}]]></title>
      <link>{title_permalink='site/index'}</link>
      <guid>{title_permalink='site/index'}#When:{gmt_entry_date format="%H:%i:%sZ"}</guid>
      <description><![CDATA[{summary}{body}]]></description>
      <dc:subject><![CDATA[{categories backspace="1"}{category_name}, {/categories}]]></dc:subject>
      <dc:date>{gmt_entry_date format="%Y-%m-%dT%H:%i:%s%Q"}</dc:date>
    </item>
{/exp:channel:entries}

    </channel>
</rss>

{/exp:rss:feed}

```

Everything works fine except links to posts.

Based on above I can tell that URL generated based on the 'URL title' is not working, but when used 'Pages URI' page loads fine.

Link to the RSS feed: http://www.childrensmedgroup.com/index.php/site/feed

Is there any way to replace title\_permalink with page\_uri in the RSS feed template?

Thanks

# Answer
> 0 votes
Well, I have answered myslef:

```
  <link>{page_url}</link>
  <guid>{page_url}#When:{gmt_entry_date format="%H:%i:%sZ"}</guid>

```

---
Tags: templates
---


# Question
Title: Playa fields: can I pair one channel entry to another and populate similar channel fields in template?
I'm an EE novice working on a big site. I have a configuration concept in my head and I want to know if it's doable. Please bear with my limited knowledge of EE lingo. I'm still learning.

So I have a channel **Speaker** whose channel fields include Name, Topic, Bio, etc. I have another channel **Multimedia** which includes many of the same kinds of channel fields: Title, Subtitle, Description, etc.

We have speakers come in regularly and give a presentation. We create their Speaker entry long before their event. After the event we produce a video and create the Multimedia entry for that event. We do multimedia for other types of events which is why we don't just have a multimedia channel field in the Speaker channel.

Is there a way for me to add a Playa channel field to Multimedia, connecting a Multimedia entry to a Speaker entry, and then populate the template with Speaker info?

Something like this (this is again, theoretical, but if you feel the need to correct my syntax, go right ahead):

```
{exp:channel:entries channel="Multimedia"}
  {if playa_field}
    {playa_field}
      <h1>{speaker_name}</h1>
      <h2>{speaker_topic}</h2>
      <p>{speaker_bio}</p>
    {/playa_field}
  {if:else}
    <h1>{media_title}</h1>
    <h2>{media_subtitle}</h2>
    <p>{media_desc}</p>
  {/if}
  <video src="{media_url}">Your browser doesn't support HTML5 video.</video>
{/exp:channel:entries}

```

(edit: removed a redundant `{/if}` thanks to syntax correction in comments)

# Answer
You have it exactly right, save one syntax error - after `{/playa_field}`, you should go right to `{if:else}`, skipping the `{/if}`.
> 1 votes

---
Tags: playa, ifelse
---


# Question
Title: Paragraphs in Matrix field not showing on the frontend
I have a Matrix field with a Rich Text Cell Type. When I output it on the frontend there are no paragraph tags. How do I add them? Other tags (e.g. `<strong>` display fine).

```
{exp:channel:entries channel="channel_faq"}
{matrix_faqs}
    <dt>{question}</dt>
        <dd>{answer}</dd>
{/matrix_faqs}
{/exp:channel:entries}

```

EE 2.6.1

Matrix 2.5.6

# Answer
> 2 votes
Go into Admin \> Channel Administration \> Channels \> Edit Preferences (beside the appropriate channel). Under “Channel Posting Preferences”, make sure that the “Default HTML formatting in channel entries” setting is set to “Allow ALL HTML”.

# Answer
> 1 votes
To help you, try this.

Go to the following db table and check that your paragraph tags are being saved: exp\_matrix\_data

If they dont exist then the issue is with matrix cell.

If the do exist, then check the source code of the rendered html page.

---
Tags: matrix
---


# Question
Title: Changed Domain, but Old Domain Still Referenced... Somewhere!
I have a site which was on a different domain. We changed it ages ago.

I am now adding a Safecracker form, and when I click submit, it goes to the OLD domain, and ignores the return parameter I add.

I have searched all files in the website for the old domain, and searched the database, there is no reference to this old domain. I have cleared my browser cache, and EE cache. Still the same.

Somewhere, this old domain is referenced and Safecracker is using it. Does anyone have any idea?

Thanks

# Answer
> 1 votes
I solved it!

So our site has Membrr installed, a member subscription system. This has the facility to protect channel entries, so only members subscribed to certain subscription plans can edit channel entries. If they don't then it redirects them to a specified URL.

I discovered we had channel protection on from when we developed the site with a development URL. Even though the Safecracker form template has no Membrr tags on there, so I did not think Membrr had anything to do with it, its registered a hook for when channel entries are updated.

So I was saving this form using a new member plan I created in Membrr, that did not have permissions to add entries into this Channel (using Membrr protection), and the redirect was to an old, old dev URL, which redirected to the old URL I was searching for, which redirected to the home page. So no wonder I could not find the domain in the database or files, its an even older domain again!

So disabling channel protection in Membrr, or just allowing the subscriber to edit the channel and entering the correct domain, fixed the issue.

# Answer
> 0 votes
Is there any redirection going on in .htaccess?

I always use the excellent Deeploy Helper whenever I move a site, may be worth an install as it shows you anything that should have been moved: http://www.hopstudios.com/software/deeploy\_helper

---
Tags: safecracker
---


# Question
Title: Channel Fields Error After Updating to 2.7
I just updated to 2.7 and I was in the backend.. When I clicked on the name on one of the channel fields I got:

> Fatal error: Declaration of Safecracker\_file\_ft::display\_field() must becompatible with that of EE\_Fieldtype::display\_field() in /home/site/public\_html/dev/system/expressionengine/third\_party/safecracker\_file/ft.safecracker\_file.php on line 5

This happens when I click any of the channel fields.. whats happening here?

# Answer
Remove `safecracker_file` from your `third_party` directory. It has been deprecated (now rolled into the standard File fieldtype).
> 6 votes

---
Tags: channel-entries, safecracker, channel
---


title: Upgrading from 2.5.5 to 2.7 - Database

text:
# Question
Title: Upgrading from 2.5.5 to 2.7 - Database
I followed the documentation to upgrade here from 2.5.5 to 2.7

However, doing the steps, I saw nothing that would help me update the database. No wizard, no tutorial or documentation.

What is the proper way to update the database?

**UPDATE**: Here is the image after upgrading

# Answer
> 2 votes
Step 5: Run the Update Wizard. That will update the database.

---
Tags: ee2-upgrades, v2.5.5, 2.7.0
---


# Question
Title: Notifications on Page beside E-Mail-Notifications
Is there a way to get the User-Notifications that normaly get sent via E-Mail (new Comment, new Entries etc.) somehow ON PAGE beside via eMail?

My Goal is to provide the member with notifications similiar to the notifications on Facebook oder Google+ etc. where you get all the notifications on page instead only per E-Mail. The larger scope would be to use this in a «Notification-Center/-Flyout», with the Web-Push-Notifications API and other APIs.

Has anyone already developed such a System or how could it be possible? I am quite sure I am not the only one with this goal.

**Update** To prevent missunderstanding: I need a solution to get the notifications out of the email-only-format to the frontend.

# Answer
> 2 votes
You can achieve it with the Pusher API. For any event, store within the database and publish it. If that notification has been read update the status for the same. I think, you can get more detail by seeing the Pusher API doc. I hope, it would help you.

---
Tags: notification
---


# Question
Title: Exporting/importing Structure entries within the same site
I've got a channel that will need to be copied, and it's part of the Structure add-on/hierarchy.

Is it possible to copy/migrate the Structure data along with other custom field data to a new channel using DataGrab or Solspace Importer?

P.S. Here's a possible solution: migrating content from EE1 to EE2 with Structure and Datagrab

# Answer
> 1 votes
I have not seen an add-on that will do this, since the URLs would be different anyway.

---
Tags: structure, solspace, import, export, solspace-importer
---


# Question
Title: In content Name/ TItle Linking to entries?
Is it possible that in a text field to create a link to an entry ? ex :

The movie ,, X MAN ,, is about to reach its top...

Is it possible to have an easy way of adding the link to XMAN text ( a link to an entry from the same website ) ?

I mean, not to manually search and paste the link ...

# Answer
Since content in EE can be displayed anywhere you want, using any URL (template group/template), this is very difficult to do in an automated way. Only Pages module or Structure module entries can be predictably linked to in this manner - and if you use a fieldtype like Wygwam you can do this via its Link pop-up.

But perhaps you want to look at Low Link? This works well if you want to link the exact titles of entries, and they all are in the same channel.
> 1 votes

# Answer
I don't know about text fields, dynamically anyway. You could add a playa field for the entries and then toss that variable in a predict text block inside the template.

Is it something you want to be on the fly and have free changing text/copy or is it standard? I think that would determine if it was feasible to use playa or not.

If it's text that needs to be free flowing, then maybe using Allow EE Code.

Per the description:

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

This would allow you to use the natural EE linking to entries.
> 0 votes

# Answer
I have an idea that might work - using either native relationships or Playa, along with Low Replace. No idea if the parse order will allow you to do this (you may need to use stash to cheat parse order to make the mechanics of this idea actually work). It's an untested idea - so here goes:

1) Establish a "related movies" relationship field. Your entry would then be related to the movies mentioned in the article body.

2) in the body of the text, be sure to use the title of the move as it appears in your movies channel - basically what we're looking to do is a bit of find and replace magic next, but it would need to match for the find and replace to be successful.

3) use low replace tag to search the body for the exact title and replace it with the linked title, following your URL pattern. The challenge is that you have to set the low replace parameters of "find" and "replace" dynamically based on the relationship field. This is the main point of concern - and stash may be the way to get the parse order to work in your favor. I don't know if you can get the parse order to flow properly natively, since you would need the relationship field to parse, then the body, then the low replace.

Anyway, that's the framework that I believe COULD work. A bit complicated though, and I'm sure from a performance perspective, it's far from ideal. But in terms of being able to automatically seek out the titles and link to entries, it may be a way to make it work.
> 0 votes

---
Tags: matrix, playa, extension, entrylinks
---


title: strange parse order issue

text:
# Question
Title: strange parse order issue
I'm working on an old EE1 site at the moment.

It's multi-lingual using this approach from Carl http://cwcrawley.co.uk/2010/01/multi-lingual-websites-in-expressionengine/ with English, Chinese, Japanese & Korean versions.

I have a conditional in a template that looks like

```
{if description_{user_language} != ""}{description_{user_language}}{if:else}{description_en}{/if}

```

where {description\_en} etc is an LG TinyMCE field. It works fine.

However, the client wants a better WYSIWYG and so, naturally, we'd like to use WYGWAM. So after installing WYGWAM and configuring the custom fields, our conditional renders the page blank. As soon as we remove the conditional it's fine (missing the content of course but has pinpointed the cause).

I can't think of a way around this or why it's happening.

Any suggestions?

# Answer
I know this seems completely elementary, but I have dealt with a lot of EE1 sites that give fits and find that sometimes, it's as simple as adding quote around the value you are comparing in your logic. So something like this might work in your case:

```
{if "{description_{user_language}}" != ""}
    {description_{user_language}}
{if:else}
    {description_en}
{/if}

```
> 1 votes

---
Tags: wygwam, conditionals, ee1, parse-order, wysiwyg
---


# Question
Title: Parsing matrix field inside a playa loop
I have a setup where I have to parse information from a matrix field that is nested within a playa loop.

The template code would look like this:

```
{exp:channel:entries}

    {matrix_tag_pair}

            {playa}

                {matrix_field}

            {/playa}

    {/matrix_tag_pair}

{/exp:channel:entries}

```

Unfortunately the {matrix\_field} would not parse. Any idea how to make the matrix field parse other than to place it outside the {playa} loop?

Cheers

Edit:

here is the longer version:

I would like to add a couple af products at the same time in a ct cart.

The products I add recide in a matrix that contains a playa field. The matrix is a recipe and the ingredients are the playa field that come from a product/ingredients channel. The quantity is defined with the matrix field {quantity}.

a basic example is this:

```
{exp:cartthrob:multi_add_to_cart_form return="/store/cart"}
{exp:channel:entries
    channel="recipes"
    disable="categories|category_fields|member_data|pagination|trackbacks"
}
        <ul>
            <li>{title}
                <ul>You will need:
                    {matrix_recipes}
                        <li>
                            {products}{!-- playa field --}
                                {title}
                                <input type="hidden" name="entry_id[{entry_id}]" value="{entry_id}" />
                                <input type="input" name="quantity[{entry_id}]" value="{quantity}" />
                                (price:{product_price} each)
                            {/products}

                        </li>
                    {/matrix_recipes}
                </ul>
            </li>
        </ul>

<input type="submit" value="add to cart"/>

{/exp:channel:entries}

    {/exp:cartthrob:multi_add_to_cart_form}

```

The problem with the above setup is that the quantity is not rendering. I found a couple of ways to make this work but they were all looking clumsy. One was to wrap playa fields in the playa tag pairs leaving the quantity field outside the playa loop. That left me with a far to verbose template code.

# Answer
> 1 votes
Have you tried using Stash for this?

Maybe something like this would work:

```
{exp:channel:entries}
    {matrix_tag_pair}
        {exp:stash:set name="whatever_matrix_fields"}{matrix_field}{/exp:stash:set}
        {playa}
            {exp:stash:get name="whatever_matrix_fields"}
        {/playa}
    {/matrix_tag_pair}
{/exp:channel:entries}

```

---
Tags: matrix, playa
---


# Question
Title: How to retrieve/pass current entry id within another channel entries tag pair?
I am currently trying to loop through channel "promos", where each entry has a Playa field designating which entries that particular promo should display on:

```
{exp:channel:entries channel="promos" orderby="promos_order"}
    {exp:playa:children field="promos_show_on_page" child_id="{current_entry_id}" var_prefix="playa"}
        <a href='{promos_link}'><img src="{promos_image}" /></a>
    {/exp:playa:children}
{/exp:channel:entries}

```

My issue is that I don't know how to pass in the `current_entry_id` to the `child_id` parameter.

Is this possible with or without any particular plugins or extensions, or am I going about this in the completely wrong way?

# Answer
> 2 votes
You want to use `playa:parents`, not `channel:entries`. Playa will infer the `entry_id` so long as you place this tag loop within the `channel:entries` tag of the entry you're viewing. (You can pass it via the `entry_id` parameter if you like.)

```
{exp:playa:parents channel="promos" field="promos_show_on_page" orderby="promos_order"}
    <a href='{promos_link}'><img src="{promos_image}" /></a>
{/exp:playa:parents}

```

# Answer
> 0 votes
It doesn't seem to me like you would need the child\_id param if you're looking for the playa loop to display the children of each entry in your promos entries loop of the "promos" channel. It would do that automatically, with each loop being within each returned entry of the entries loop. Without that parameter, the children loop would assume the parent to be the current entry.

# Answer
> 0 votes
I may be missing something here, but you should just be able to use the {entry\_id} tag as mentioned in the playa docs here.

**entry\_id**

The parent entry’s ID(s). If your tag is within an {exp:channel:entries} tag pair, this will default to the current entry’s ID.

So you would have something like this:

```
{exp:channel:entries channel="promos" orderby="promos_order"}
    {exp:playa:children field="promos_show_on_page" child_id="{entry_id}" var_prefix="playa"}
        <a href='{promos_link}'><img src="{promos_image}" /></a>
    {/exp:playa:children}
{/exp:channel:entries}

```

***UPDATE*** Using the example I described below, you would use embed variables. Once you pass the variable and value to the embed template, you can use it instead like this:

```
{exp:channel:entries channel="promos" orderby="promos_order"}
    {exp:playa:children field="promos_show_on_page" child_id="{embed:main_entry_id}" var_prefix="playa"}
        <a href='{promos_link}'><img src="{promos_image}" /></a>
    {/exp:playa:children}
{/exp:channel:entries}

```

---
Tags: playa, entryid
---


# Question
Title: Filter Geofinder results if a Matrix field has data
I've got a simple Geofinder form that's working great but we now want to have the results only show specific entries. The entries we want showing are just the ones that have data in a Matrix field.

Is this possible or is there some sort of workaround? I'm stumped on this one. :/

**Edit:** I should note that it's possible to use a conditional within the Geofinder results tag (`{exp:geofinder:location_results}`) to simply not display the entries with an empty Matrix field. Like so:

```
{exp:geofinder:location_results}
  {if my_field}
    {my_field}{data}{/my_field}
  {/if}
{/exp:geofinder:location_results}

```

What I've found is that this breaks pagination altogether because the count gets all screwed up. We need pagination to work here.

# Answer
From memory Geofinder extends the channel:entries tag, so you should be able to use the search parameter to only find those which have a value for 'my\_field' - instead of using the conditional inside.

```
{exp:geofinder:location_results search:my_field="not IS_EMPTY"}
...

```

That should give you the correct counts etc. hopefully :)
> 1 votes

---
Tags: matrix, geofinder
---


# Question
Title: Can I display select array data in a Freeform notification template?
I have a form that contains an array field, e.g. `name="product_list[]"`. Is there anyway to access specific values within this array in the notification template? All I'm currently doing is adding `{product_list}` which barfs them all out in a line. Is there a way to print only value 1, only value 2, etc?

# Answer
What kind of field are you storing these in?

If you are using Freeform Pro and a Multi-select field, it supports a tag pair for the selected data:

http://www.solspace.com/docs/freeform/default\_fieldtypes/#multi-select\_attr\_name

If its a standard textarea field and you are just using the array input, its going to store it as regular text with no way by default to split it on output. It's going to come out as if it was all written at once in the textarea.

However, Notifications are ran as full templates as of Freeform 4 and you could use something along the lines of the PHPStringFun addon to explode the string output: http://devot-ee.com/add-ons/phpstringfun
> 1 votes

---
Tags: solspace-freeform
---


# Question
Title: Perpetual loading bar in modifier options on CP
I'm having an issue with Store when adding a modifier to any item. I've used Store successfully until now but since adding new channels to the site there's a glitch that I just can't get around. When I add a new product modifier and enter a name, the 'stock' area below shows a loading bar but doesn't do anything.

I'm able to click on submit but the product details aren't saved. This is now the same across the whole site and I have no idea why.

Any help would be greatly appreciated!

I've tried with a blank .htaccess file and using store version 1.6.4. It works fine on a different host but the client is with 1&1 and it just doesn't seem to work.

**Edit**

After looking at the firebug console when this issue arises I see "Post my/url/path?ACT=26 200 OK" When I look at this post, I can see the 'response header' says "no-cache, must revalidate".

Still really stuck on this.

**Edit 2**

Right, I think I just solved the problem. It turns out it was some kind of problem with the way 1&1 handled requests without the 'www' portion of a url. I added the following lines to my .htaccess file and all now seems to be working

```
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

```

Thank god.

# Answer
Right, I think I just solved the problem. It turns out it was some kind of problem with the way 1&1 handled requests without the 'www' portion of a url. I added the following lines to my .htaccess file and all now seems to be working

```
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

```

Thank god.
> 2 votes

---
Tags: expresso-store
---


# Question
Title: P&T Assets Error Creating Subfolders : Invalid Assets Source Path
I'm pretty sure I'm missing something obvious here. But for some reason, when I try and create a new subfolder, I get the following: "Invalid Assets source path". I checked and the parent folder has CHMOD of 777. I'm running Assets 2.0.4 and EE 2.6.1.

Any ideas?

# Answer
> 1 votes
Sounds like the actual Server Path setting is incorrect; not just a permissions issue. Ensure that it’s correct and then try updating Assets’ indexes for that directory.

---
Tags: assets, pixelandtonic, path
---


# Question
Title: Why is my custom fieldtype in a matrix cell not receiving data?
I've created a custom fieldtype for "links" which have three input fields (URL, label and target). It works very well and I've now added the only required method to the class in Matrix which is display\_cell() (according to the documentation).

*My field displays fine, but when I save the entry and edit it again, no data is present in my field.*

If I add **save\_cell()** to my class and return some debug data, it is saved to the entry and displayed, but if I just return the data that it is supposed to receive in the method params, I get nothing.

I can, however, force the data to save by fetching it from the post array, as shown here:

```
function save_cell($data)
{
    return json_encode(ee()->input->post($this->settings['field_name']));
}

```

Obviously, I don't want to do this but `$data` is always empty! Any ideas why?

Thanks, Mat

**UPDATE**: I've answered this below

# Answer
Resolved! I wasn't using **$this-\>cell\_name** when displaying my field in **display\_cell()** so EE wasn't able to get the data from the form because it had the wrong name. The method shown in my question will try to get the data from the matrix *field*, not the *row* within the matrix field. The actual name of a cell within a matrix ROW looks something like this:

```
field_id_35[row_id_85][col_id_14][url]

```

\[url\] is an array element I added to split the field into three parts (url,label,target).

Now my save function just returns $this-\>save($data) because I don't need to do anything different to the save() method (which simply json\_encodes the three parts).
> 1 votes

---
Tags: matrix, fieldtype
---


title: Filtering MSM articles by site

text:
# Question
Title: Filtering MSM articles by site
I've setup a page that shows news from four different sites that are all within the same MSM (Multi site manager) build, the page is working great but I want to be able to filter by site. I basically want the following:

News listing (domain.com/all-news) \- news from all sites

News listing filtered (domain.com/all-news/site1) \- news from one site

Or alternatively it would be great to have the filters working with ajax

Any ideas?

Cheers!

# Answer
> 2 votes
Seems like you could use a combination of conditionals, the site= parameter, and a segment variable.

---
Tags: multi-site-manager
---


# Question
Title: Matrix outputting cell names not content and only one row
Matrix 2.5.6 EE 2.6.1

I've got a matrix field that is behaving strangely. It only outputs one row despite having multiple rows added and then only outputs the cell names.

I've copied and pasted the field name and cell names to the template so that there is no chance of typos, but still it doesn't work as expected. I've also created a duplicate matrix field and inserted content into an entry and it behaves the same. There is however another matrix in the same entry with different content that works as expected.

My template code is below

```
          <ul>
          {near_hotels}
            <li><a href="{link}">{hotel}</a></li>
          {near_hotels}
          </ul>

```

I've attached a screenshot of the cell settings

# Answer
You’re missing the “/” in “{/near\_hotels}”.
> 2 votes

---
Tags: matrix, template-scripting
---