# Question
Title: Possible to use Stash variable as entries parameter?
*I found similar questions, but the “answers” were alternatives that won’t work here. If I missed an answer, please let me know! Thanks!*

I have been having trouble wrapping my head around how parse order might be interacting with the tags here. Hopefully someone can help. The template is actually much more complicated and uses many more custom fields, but this is a basic example I still cannot get to work properly without resorting to a bunch of embeds duplicating code. I want to keep these bits contained in one template if at all possible. Note I am using Dynamo, but also tried with regular `exp:channel:entries` tags to rule out Dynamo as the problem.

The expectation is all entries in the channel are returned for managers, and other users only see a subset depending on a custom field specifying member groups to allow access to.

For users from managers user groups included in `{manager_groups}`, this yields “No results ()”, and for other users, this yields something like “No results (IS\_EMPTY|24)”.

```
{exp:switchee variable="{logged_in_group_id}" parse="inward"}
  {case value="{lv_manager_groups}" trim="1"}
    {!-- don’t add any permission filtering for managers --}
    {exp:stash:groups}{/exp:stash:groups}
  {/case}
  {case default="Yes"}
    {exp:stash:groups}IS_EMPTY|{logged_in_group_id}{/exp:stash:groups}
  {/case}
{/exp:switchee}

{exp:dynamo:entries
  channel="resources"
  show_pages="no"
  dynamic_parameters="search:allowed_groups"
  paginate="custom"
  limit="5"
  search_id="{segment_4}"
  search:allowed_groups="{exp:stash:get name='groups'}"
  parse="inward"
}
  {if no_results}
    <p>No results ({exp:stash:get name='groups'})</p>
  {/if}
  {exp:stash:set name="no_pagination_html" trim="yes"}
    {if absolute_results <= 5}
      <p><strong>({exp:stash:get name='groups'}) Viewing:</strong> {exp:stash:filter_name} (1-{total_results})</p>
    {/if}
  {/exp:stash:set}
  {paginate}
    <p><strong>Viewing:</strong> {exp:stash:filter_name} ({abp_entry_from}-{abp_entry_to} of {abp_total_entries})</p>
    <p>
      {if abp_has_previous}<a href="{abp_previous_link}">{/if}« Prev{if abp_has_previous}</a>{/if}
      {abp_pages}{if abp_is_current}{abp_num}{if:else}<a href="{abp_link}">{abp_num}</a>{/if} {/abp_pages}
        {if abp_has_next}<a href="{abp_next_link}">{/if}Next »{if abp_has_next}</a>{/if}
    </p>
  {/paginate}
  {if count == "1"}
    {abp_pagination_html}
    {exp:stash:no_pagination_html}
  {/if}
  <p>{title}</p>
  {if count == total_results}
    {abp_pagination_html}
    {exp:stash:no_pagination_html}
  {/if}
{/exp:dynamo:entries}

```

I tried wrapping the entire `dynamo:entries` tag pair in

```
{exp:stash:parse process="end" parse_depth="20"}
  {exp:dynamo:entries …}…{/exp:dynamo:entries}
{/exp:stash:parse}

```

but this results in nothing being output at all. Also tried removing or changing value of `parse_depth` parameter, but same result.

I also tried a slightly different structure, which is the way I would do it ideally, since I will have more parameters than just group ID. This method yields all results regardless of user type.

```
{exp:stash:perms}
  {exp:switchee variable="{logged_in_group_id}" parse="inward"}
    {case value="{lv_manager_groups}" trim="1"}
      {!-- don’t add any permission filtering for managers --}
    {/case}
    {case default="Yes"}
      search:allowed_groups="IS_EMPTY|{logged_in_group_id}"
    {/case}
  {/exp:switchee}
{/exp:stash:perms}

{exp:dynamo:entries
  channel="resources"
  show_pages="no"
  dynamic_parameters="search:allowed_groups"
  paginate="custom"
  limit="5"
  search_id="{segment_4}"
  {exp:stash:get name='perms'}
  parse="inward"
}

```

What seems to be going on here is in both cases the Stash variable is not being parsed before the entries are pulled. In the first case, the filter is trying to matching something that doesn’t exist, resulting in no entries. And in the second case, the entire filter name is in a variable that doesn’t get parsed, so the entries are pulled with the filter entirely ignored, resulting in all entries.

Is there any way I can use a Stash variable as a parameter for an entries loop?

# Answer
I haven't tested this (it's a bit tricky to setup!) but try promoting your Stash tags to the top level of the nesting hierarchy like this... Also with `exp:stash:parse` you should omit the `exp` part when you get variables (I think you can get away without parse="inward" with this method too).

```
{exp:stash:set name="groups" trim="yes" parse_tags="yes"}
    {exp:switchee variable="{logged_in_group_id}" parse="inward"}
      {case value="{lv_manager_groups}" trim="1"}
        {!-- don’t add any permission filtering for managers --}
      {/case}
      {case default="Yes"}
        IS_EMPTY|{logged_in_group_id}
      {/case}
    {/exp:switchee}
{/exp:stash:set}

{exp:stash:parse process="end"}
  {exp:dynamo:entries
    channel="resources"
    show_pages="no"
    dynamic_parameters="search:allowed_groups"
    paginate="custom"
    limit="5"
    search_id="{segment_4}"
    search:allowed_groups="{stash:groups}"
  }
    ...
  {/exp:dynamo:entries}
{/exp:stash:parse}

```

An alternative would be to move the setting block into a Stash embed with `process="start"` to make absolutely sure it gets parsed before you call it.
> 2 votes

---
Tags: stash, parse-order, entries
---


title: Matrix-like survey for client

text:
# Question
Title: Matrix-like survey for client
I have a membership site where, besides their location and other contact information, part of the member profile will include a summary of their areas of practice. This summary will be a list of what areas their practice covers (I’ll call them service 1, service 2, service 3, etc.) and what their expertise level is - considerate, moderate, limited or none (meaning they don’t specialize in that area). This list of services is currently at about 40 items, and the client needs to be able to add/remove services from the list at will. In addition, the member will need to update their own areas of practice through a front-end SAEF. Below is an example of what the might look like.

In addition, someone from the public could use this information to search for a member who does "considerate work in service 1".

Originally I thought a Matrix field would be perfect due to its flexibility. However, when setting it up, I don’t think it will work as I thought. So now I’m back to the drawing board on how to set this up.

Thanks in advance for any suggestions?

Todd

# Answer
One option would be to use Zoo Visitor to be able to work with the members as channel entries.

Then you could add the list of services to the zoo visitor channel as individual select fields. So for example you would have a zoo visitor channel that contains all the members as entries, and on each entry you would have the contact info as well as the individual fields that make up your list of services. Going this route should also make editing through the front end channel:form easy.

I think you could also go a similar route just using custom member fields, but in your case you might really appreciate the flexibility with having the members in channel entries.
> 2 votes

---
Tags: matrix
---


# Question
Title: User Module: Custom member profile fields don't get updated when posting a form
Maybe this is a "duh" moment for me and I'm missing the obvious but I have an exp:user:edit form setup where none of the checkbox fields get updated when posting the form. Here is an example line of code...

```
<input type="checkbox" name="notify_how_email" class="no_float" value="n" {if notify_how_email == 'y'}checked="checked"{/if} /> <label for="notify_how_email">Notify via Email</label>

```

I've also added the following on the recommendation from another solution but fields are still not updated...

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

```

We are using Exp Eng 2.7.2 and User module 3.4.4 and Friends 1.6.2

Is there any special coding I need to do to set the custom fields to 'y' or 'n'? This is also happening with radio fields.

When I use the control panel to edit the profile the field content shows up on the form but with a checkbox I can't change it from checked to unchecked.

Thanks, Bob

# Answer
This has been a common gripe with ExpressionEngine for years.

Here's a hack that I find works:

```
<input type="hidden" name="custom_fieldname" value="n" />
<input type="checkbox" name="custom_fieldname" value="y" {if custom_fieldname == "y"}checked="checked"{/if}>Bla bla</input>

```

The first value sets the field to "n". If the user checks the box, then the value will be overwritten with "y".

This hack is also referenced at the end of this post from the ExpEng forums from way back in 2007. If you're brave, the post documents how to hack the Member Template to allow checkboxes. Personally, event though it's a bit verbose, I'd prefer simply adding the extra hidden field.
> 4 votes

# Answer
The User:Edit tag only allows updating of the fields mentioned in the documentation: http://www.solspace.com/docs/user/edit/#form\_fields

**notify\_how\_email** is not a valid option. Are you sure this is even a valid EE option (natively)? If so, what is it supposed to do?
> 3 votes

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


# Question
Title: How to improve performance of CI_Encrypt->encode?
I've been having some significant server-side performance issues with an ExpressionEngine / CartThrob site (pages taking 5 seconds or more to generate under no load). Today I installed XDebug and WebGrind to take a look at what was causing the performance hit.

To my surprise, the biggest offender by far (taking over 3 seconds to run only 40 times), was the function CI\_Encrypt-\>encode, and specifically CI\_Encrypt-\>\_xor\_encode (taking about 97% of that time).

Nothing else in the profiler even comes close to taking this much time, so it looks like this function is basically the sole cause of my woes. Is there any way to speed it up?

# Answer
From looking at the CI\_Encrypt source code, I noticed that \_xor\_encrypt is only used when the PHP mcrypt module is not installed. I installed the PHP mcrypt module and added it to php.ini, which seems to have substantially reduced the time required to run this function.

Note: I'm still having some slowness due to this module (much less than before), particularly with CI\_Encrypt-\>\_add\_cipher\_noise, which I have posted about as a separate question here: How to improve performance of CI\_Encrypt-\>\_add\_cipher\_noise?
> 3 votes

---
Tags: cartthrob, performance, codeigniter, encryption
---


# Question
Title: Expresso Store: Can't add/edit product details - Fatal PHP error
I have v1.6.4 of Expresso Store running on a site with EE v2.6.1

When trying to edit the channel with the product details I get the following PHP error:

Fatal error: Cannot redeclare class Store\_config in /SERVERPATH/system/expressionengine/third\_party/store/libraries/store\_config.php on line 12

I also get the same error when trying to publish a channel entry. Any ideas on how to fix this?

# Answer
> 1 votes
Is there a chance you have a different/old copy of Store sitting in a different folder under third\_party/? It looks like for some reason EE is trying to load Store twice, which is triggering that error. Normally EE keeps track of which libraries have already been loaded so they don't get loaded twice.

---
Tags: expresso-store, expresso, php-errors
---


title: Category and URL problem

text:
# Question
Title: Category and URL problem
In my url the entry have a category and a sub-category.

1. Category = meat
2. sub category = beef

> href="{url}/{channel\_short\_name}/{categories}{category\_url\_title}{/categories}/{url\_title}"

I'm using {category\_url\_title}, but the result URL is:

```
mysite/recipes/meatbeef/hamburger

```

The category and the sub category are together: **meatbeef** with no /. It should be **meat/beef**.

How to have a category and subcategories working fine, like : cat/subcat/subsubcat..?? It give me headaches :)

Happy XMas Stéphane

# Answer
Use the backspace parameter:

```
href="{url}/{channel_short_name}/{categories backspace='1'}{category_url_title}/{/categories}/{url_title}"

```

Backspace removes x characters from the final output.

Watch out if your entry belongs to 1 or more sub categories as your category URLs will grow uncontrollably.
> 3 votes

---
Tags: url, categories
---


title: Low Variable / Matrix Blank Screen

text:
# Question
Title: Low Variable / Matrix Blank Screen
We have a Low Variable using Matrix with 3 columns.

Two columns are raw text and one is a playa list of channel entries.

All has been working fine, there were about 60 rows so far - all of a sudden when we go to manage the low variable to add more content we see a blank screen (attached)

The data that has been input is still there (can see it on the front end)

Not sure how to fix or trouble shoot this.

ee2.6.1 / lv 2.3.5 / Matrix 2.5.5

# Answer
I'd guess you are hitting a JS error which will be logged in the console or a PHP memory issue which should show in the PHP error logs. If you aren't seeing anything in the PHP error logs, set $debug = 1 in the /system/index.php file and reload the problem page.
> 1 votes

---
Tags: matrix, playa, low-variables, low
---


# Question
Title: I cannot render {cp_session_id} in edit this like
I am trying to make edit entry link using this idea in user guide bellow

http://ellislab.com/expressionengine/user-guide/templates/globals/single\_variables.html#cp-session-id

but {cp\_session\_id} variable is not rendering in the page, any ideas ?

{if logged\_in\_group\_id == "1" OR logged\_in\_group\_id == "2" }• Edit This{/if}

# Answer
The problem might be the S=0 part. That does only work if you have control panel security set to cookie only. By default the CP is set to Session\_id too. For session\_id to work with "edit" links from the front-end, you currently need to get the fingerprint / session\_id with a little add-on (or with PHP, which i'm not a fan of in templates).

Here is a small plugin i created and use for this
https://gist.github.com/GDmac/8095086

(edit: issue is accepted, but is not in current EE.
https://support.ellislab.com/bugs/detail/19501
with php in template work-around)
> 1 votes

# Answer
It's possible you are logged into the control panel at www.domain.com/system/ and looking at the front-end of the site using domain.com (without www). If this is the case, EE doesn't consider you "logged in". You can change this in two ways...

---

Force either www.domain.com or domain.com in the htaccess file

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

```

Then log into the control panel again if needed.

---

Set the **cookie domain** in the EE CP to `.domain.com`... (change domain.com to your domain)
> 1 votes

---
Tags: ee2, control-panel
---


# Question
Title: How to improve performance of CI_Encrypt->_add_cipher_noise?
I've been trying to track down some performance issues with an ExpressionEngine site, specifically around pages using CartThrob. I've been using XDebug and Webgrind, and noticed that CI\_Encrypt-\>encode was causing the bulk of my performance issues.

Much of the problem was resolved by enabling the PHP mcrypt module, although CI\_Encrypt still seems to be the major bottleneck in my application.

Now, the problem seems to be with CI\_Encrypt-\>\_add\_cypher\_noise, which is taking almost 1.5 seconds to run just 40 times, accounting for over half of my page load time.

Is there any way to improve the performance of this function?

# Answer
> 1 votes
The following article suggests that the Codeigniter add\_cipher\_noise method might fall in the category "don’t come up with your own way to solve a (possible) vulnerability". I doubt this will be fixed.

The article suggests using hmac over the IV. I don't know if you could shoehorn in using the PHP internal hash\_hmac() function instead of the custom add\_cipher\_noise, and/or if that would/could speed up things.

http://www.cryptofails.com/post/70059597528/codeigniter-encryption-is-not-authentication (juli 2013)

**EDIT** : CodeIgniter 3.dev has a new library that adds standard authenticated encryption. (old: Encrypt.php new/extra Encryption.php). https://github.com/EllisLab/CodeIgniter/blob/develop/system/libraries/Encryption.php
and here is the raw manual
https://github.com/EllisLab/CodeIgniter/blob/develop/user\_guide\_src/source/libraries/encryption.rst

---
Tags: cartthrob, performance, codeigniter, encryption
---


# Question
Title: Bulk delete of images & folders in P&T Assets
I want to clear out all of the files and folders in Assets. We have been testing and am now ready to start using in anger. Is there a way to do this without deleting directly in the DB?

Many thanks

Pete

# Answer
Yes - you can multi-select files in the Assets module control panel, then right-click and choose "Delete" from the custom contextual menu.
> 1 votes

---
Tags: assets, pixelandtonic, delete
---


title: Wygwam if conditional

text:
# Question
Title: Wygwam if conditional
Basically i want to know if its possible for expression engines if tag to check if a wygwam field contains images.

I know its possible to pull through just images like so:

```
    {my_wygwam_field images_only="yes"}
      (code for images)
    {/wygwam_field}

```

but what if i want to check whether that tag returns any results. I tried

```
{if my_wygwam_field images_only="yes"}
    {my_wygwam_field images_only="yes"}
       (image code)
    {/wygwam_field}
{/if}

```

but it didn't seem to work. Any suggestions

# Answer
> 2 votes
You just need to vary your syntax slightly:

```
{if '{my_wygwam_field images_only="yes"}'}
    {my_wygwam_field images_only="yes"}
       (image code)
    {/wygwam_field}
{/if}

```

This way you're actually telling EE to parse that first tag (inside the conditional statement) - you need to do it this way because it's a tag pair requiring a parameter,so simple conditional checking won't work.

---
Tags: wygwam, ifelse
---


# Question
Title: How can I install a custom payment gateway in Expresso Store 2.1
I have (had) a custom payment gateway running in Expresso Store 2.0.6. Since i updated to 2.1 the gateway is not working anymore. I am aware of the new folder structure inside the vendor/omnipay folder and tried to adapt my own gateway folder without success. The gateway is not listed in stores payment gateway settings. I also changed the store\_unofficial\_payment\_gateways value in the db from 0 to 1.

So,

* Are there some special installation instructions for custom payment gateways in EE Store 2.1? Or is it like in previous versions that i only have to move my custom gateway folder into the vendor folder and if everything is fine in my folder the gateway shows up?
* Are there other files i have to adapt outside my custom gateway folder?
* What's about that new composer.json file? I'm not sure how that should look like …

Also worth to note: The button "Add Payment Method" in the upper right corner doesn't exists in my installation as seen in the store docs: https://exp-resso.com/docs/settings\_payment\_methods.html

I am running the latest versions from both EE and Expresso Store.

Thanks in advance

# Answer
As of Store 2.1 gateways are now added as separate extensions outside of the actual Store folders. This makes it easier in the future to upgrade Store because you don't have to worry about overwriting your custom gateway. (Last item under Developer). You can see an example of the folder structure in the example gateway Store Check.
> 2 votes

# Answer
Just to expand on Justin's answer a little, payment gateways in Store 2.1 can now be registered as separate extensions. This means you don't need to copy anything into the `third_party/store` folder or worry about re-copying files when you upgrade.

The extension hook you need to use is called `store_payment_gateways`. If you are unfamiliar with ExpressionEngine extension development, it's probably worth reviewing the extension development guide first.

Inside the extension hook, you need to first add your gateway name to Store's list of gateways, then tell Store where to find your gateway files (so they can be autoloaded when needed). Here is a complete example:

```
/**
 * This hook is called when Store is searching for available payment gateways
 * We will use it to tell Store about our custom gateway
 */
public function store_payment_gateways($gateways)
{
    // tell Store about our new payment gateway
    // (this must match the name of your gateway in the Omnipay directory)
    $gateways[] = 'Check';

    // tell PHP where to find the gateway classes
    // Store will automatically include your files when they are needed
    $composer = require(PATH_THIRD.'store/autoload.php');
    $composer->add('Omnipay', __DIR__);

    return $gateways;
}

```

For a complete example, check out these existing third-party gateways:

* Check \- our example custom gateway which simply creates an additional "Manual" payment gateway
* Beanstream by Derek Hogue
> 2 votes

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


title: Website very slow

text:
# Question
Title: Website very slow
I think I have a design issue which makes my site very slow! Probably I used the EE templating in the wrong way, however I can't find a better way, hopefully until now!

From php I'm used to include files in a `if else` structure so I will include the correct file if specific conditions are met. For the templates I do the same, but loading time's are up to 5 seconds for just loading a couple of channel entries (6). That can't be right!

So at the moment I have the following which is very slow:

Template group called "site". This index.html file is the index file of the page. All other template are loaded inside this template.

```
{embed="include/head"}
  <body>
    {embed="include/header"}
    // some HTML

    {if segment_1 == ''}
      {embed="include/home"}
    {if:elseif segment_1 == 'smartphone' OR segment_1 == 'tablet'}
       {embed="include/merk"}
    {if:else}
      {embed="include/404"}
    {/if}

    {embed="include/foot"}
  </body>
</html>

```

For the home page, where include/home is included, it loads just normal, within 1 second.

But when URL `segment_1` is for example 'smartphone', it gets very slow. So below the template `include/merk`

```
<section class="row" id="content">
  <div class="col-xs-11 midden">
  {if segment_2 == ""}
    {!-- De smartphone of tablet pagina met merken overzicht. --}
    <ul>
      {exp:channel:entries channel="merken" orderby="title" sort="asc" category="{segment_1_category_id}" dynamic="no" disable="member_data|pagination"}
      <li><a href="{segment_1}/{exp:stringy:lowercase}{title}{/exp:stringy:lowercase}"><img src="{merk_afbeelding}" width="180" height="133"></a></li>
      {/exp:channel:entries}
    </ul>
  {if:elseif segment_2 != "" AND segment_3 == ""}
      <ul class="dropdown-menu drop-model">
        {exp:channel:entries channel="modellen" orderby="volgorde" sort="asc" category="{segment_1_category_id}" limit="999" dynamic="no" disable="member_data|pagination"}
          {if "{segment_2}" ==  "{exp:stringy:lowercase}{merken:title}{/exp:stringy:lowercase}"}
          <li><a href="{exp:stringy:lowercase}/{segment_1}/{segment_2}/{url_title}{/exp:stringy:lowercase}">{title}</a></li>
          {/if}
        {/exp:channel:entries}
      </ul>
    <ul class="list-unstyled grid-type modellen">
      {exp:channel:entries channel="modellen" orderby="volgorde" sort="asc" category="{segment_1_category_id}" limit="999" dynamic="no" disable="member_data|pagination"}
        {if "{exp:stringy:lowercase}{segment_2}{/exp:stringy:lowercase}" ==  "{exp:stringy:lowercase}{merken:title}{/exp:stringy:lowercase}"}
        <li><h2>{title}</h2><a href="{exp:stringy:lowercase}/{segment_1}/{segment_2}/{url_title}{/exp:stringy:lowercase}" title="{title}"><img src="{model_afbeelding}" alt="{title}" width="100" height="130"></a></li>
        {/if}
      {/exp:channel:entries}
    </ul>

  {if:elseif segment_3 != "" AND segment_4 == ""}
    {exp:channel:entries channel="modellen" url_title="{segment_3}" dynamic="no" disable="member_data|pagination"}
    {reparaties}
    <ul class="list-unstyled grid-reparatie">
       {items}
       <li class="list-reparatie">
        <article>
          <h2 class="reparatie">{title}</h2>
        </article>
      </li>
      {/items}
    </ul>
    {/reparaties}
    {/exp:channel:entries}
  {/if}
  </div>
</section>

```

There's an if else structure that determines what to show. The first if, `segment_2 == ""` will load some channel entries. There are about 6 entries that will match. However loading time takes up to 5 seconds!

Now I created a group called `smartphone` and put a part of the first if condition in the index.html file (only the 6 channel entries loaded). Now the page loads in less than 1 second. The URL would be http://www.mywebsite.nl/smartphone

After smartphone, there will be a brand, for example apple and the URL would be http://www.mywebsite.nl/smartphone/apple.

The brand however is loaded from a channel entries with a url-title 'apple'. So if I now use the mentioned URL, it will load the index.html file in the template group 'smartphone' because the template apple.html doesn't exist. But this index file does not load the models of apple, but is loads the brands... So I would need to use a if else structure again what makes it really slow...

It looks like it is loading everything in the other if else conditions to, which makes it so slow. But I suppose that if EE conditions in a if statement doesn't match, it will not do anything with that code!

So.. what am I doing wrong...

# Answer
When you use if else statements EE executes all the code in every statement before deciding what to output. This makes it very slow indeed. What you need is devot-ee.com/add-ons/switchee

Now gimme some credits ;-)
> 4 votes

# Answer
As has been mentioned in a comment, EE will process each embed within the if:else structure before deciding what to do so it will slow your site down considerably.

But, looking at what you're doing, why not use EE's template/entry url structure to achieve what you're doing?

Create a template group for Smartphone. Then create your index template within that group, loading the embed you need (or use the code directly on the templates if possible).

You may then be able to use EE's native url parsing to do the rest of the work being done by "merk". But even if not then I think you could possibly rationalise the content of that template (especially the conditional logic) down to make it a bit quicker.
> 2 votes

---
Tags: templates
---


# Question
Title: Having embeded include use channel fields
I am using BrilliantRetail and on my product page, I have tabs with different information about the products. The code for the tabs is pretty long so I would like to make it an include and then embed it within my loop. However, when I do this, the channel fields aren't recognized, is there any way to accomplish this without putting the loop inside the include? Also, please let me know if there is a better way to accomplish my IF statement for the store IDs. Thanks in advance!

```
{exp:brilliant_retail:product}

        <div class="inner_container">
            <div class="product_detail">
                {if "{store_id}" == "2641" OR "{store_id}" == "2635" OR "{store_id}" == "2572" OR "{store_id}" == "2619" OR "{store_id}" == "2576"}
                    {embed="_includes/tabs"}
                {if:else}
                    {detail}
                {/if}
            </div>
        </div>

{/exp:brilliant_retail:product}

```

# Answer
Why not to put the code of `{embed="_includes/tabs"}` into a snippet? In my sample code, I'm calling it `snip_tabs`.

```
{exp:brilliant_retail:product}

        <div class="inner_container">
            <div class="product_detail">
                {if "{store_id}" == "2641" OR "{store_id}" == "2635" OR "{store_id}" == "2572" OR "{store_id}" == "2619" OR "{store_id}" == "2576"}
                    {snip_tabs}
                {if:else}
                    {detail}
                {/if}
            </div>
        </div>

{/exp:brilliant_retail:product}

```

Embeds are completely new templates that are parsed and then inserted into the parent template. You need to insert the code before the parsing. So, snippets are an excellent solution.

To make the edition of snippets easier, you can use the SnippetsSync add on. Just remember to disable the automatic update on your production environment, because this function can make you website really slow. You can do this by setting `$config['snippetssync_production_mode_override'] = TRUE;` for this environment.
> 1 votes

# Answer
I'm not 100% sure if this what you trying to accomplish but you can pass parameters through as part of the embed tag. For example:

```
{embed="site/header" entry_id="2145"}

```

and then in the template your embedding use the variable like so.

```
{exp:channel:entries channel="default_site" limit="1" entry_id="{embed:entry_id}"}
    ...
{/exp:channel:entries}

```

There's more information in ee's docs

http://ellislab.com/expressionengine/user-guide/templates/embedding.html
> 0 votes

---
Tags: channel, embeds, ifelse
---


title: How to use stash:parse and no_results

text:
# Question
Title: How to use stash:parse and no_results
It seems many users have issues with Stash and `no_results`, but as far as I can tell, nobody is trying to do this scenario. Please forgive me if I missed something.

I would like to redirect users to a page if they stumble on the URL for a specific entry for which they do not have permissions, determined by some custom fields specified in `{lv_permissions}`. To make permissions work, I needed to wrap the entries block in `exp:stash:parse process="end"`, but that seems to have killed my `{if no_results}{redirect="site/1"}{/if}` line. No redirect occurs, though the content also does not show up, which is good.

Does anyone have an explanation for this behavior and some proper syntax?

```
{lv_permissions}
{exp:stash:parse process="end"}
  {exp:channel:entries
    channel="my_channel"
    require_entry="yes"
    limit="1"
    {stash:permissions}
  }
    {if no_results}{redirect="site/1"}{/if}
  {/exp:channel:entries}
{/exp:stash:parse}

```

I tried the `no_results_prefix` concept, but that doesn’t seem to work for `exp:stash:parse`.

# Answer
> 2 votes
I found if I repeat the `no_results` line, the redirect works. If I just write it once, no redirect occurs, though the content also does not show up, which is good.

Does anyone have an explanation for this behavior?

Navigating to a URL I should not have access to as a logged in user redirects me to /site/1 using this:

```
{lv_permissions}
{exp:stash:parse process="end"}
  {exp:channel:entries
    channel="my_channel"
    require_entry="yes"
    limit="1"
    {stash:permissions}
  }
    {if no_results}{/if}
    {if no_results}{redirect="site/1"}{/if}
  {/exp:channel:entries}
{/exp:stash:parse}

```

This works, but clearly it’s wonky.

# Answer
> 0 votes
In my opinion you should rethink your approach a bit here. Whilst it's probably possible to cobble together some esoteric convoluted template code to deal with permissions, it would be much safer and more maintainable if you built a custom add-on to handle your exact needs.

Specifically, you could build an extension based on the channel\_entries\_tagdata\_end hook that makes the necessary checks and redirects accordingly.

---
Tags: stash, no-results
---


# Question
Title: Channel Entries - Possible to combine specifying specific ids and excluding other ids?
Is it possible to do something like the condition below in channel entries?

`Get all ids that are 88,99 and 100 but not 200,300 or 400`

The examples in the documentation, only shows to get certain ids

```
entry_id="13|42|147"

```

or exclude certain ids

```
entry_id="not 45|534|807"

```

I want to combine getting certain ids and excluding certain ids.

Is this possible?

# Answer
As stuart says passing all the id's you would like to include should automatically exclude all those not passed in the entry\_id parameter.
> 2 votes

# Answer
Based on your comment, there is no native way to include and exclude in one channel tag.

Whilst I don't appreciate your requirements, I'd look at Stash by Croxton. It will allow you to capture multiple entries from multiple channesl using whatever logic you require.
> 2 votes

---
Tags: channel-entries
---


# Question
Title: Adding low variables entries to search results
How can I search Low Variables content using the Search tag, is it possible?

# Answer
You can't. Global variables (which LV are, essentially) aren't searchable by the native Search module, nor by any 3rd party search add-on that I know of.
> 2 votes

---
Tags: search, low-variables
---


# Question
Title: although logged in, no access to off line site, EE thinks I am not logged in
Although I am logged in a s superadmin, I do not get access to a site that is offline. Klicking on the site name link, I get

```
To proceed to the URL you have requested, click the link below:

http://www.mysite.com/index.php

```

proceeding makes that I reach the offline status, as if I am not logged in. But I am!

When tampering with the url, I get acces, also a new window in same browsersession. This is of course not a desirable situation.

I studied all the posts I could find here about being kicked out of the site and or CP.

In the CP: My cookie settings: all empty. Securety settings: standard: (cookies and session for CP, cookies only for site.)

Help is much appreciated, I must solve this problem tomorrow.

# Answer
> 0 votes
make sure the URL you logged in at and the URL you are trying to access the site is the same. like www or no www, etc.

---
Tags: control-panel, cookies
---


# Question
Title: jQuery AJAX POST data can't be accessed via PHP
The following allways evaluates `if (isset($_POST["sort"]))` as false:

// Base template

```
// Fired on click event (no JS console errors)
$.post( "/path/to/ajax/target/", {sort: day} );

```

// AJAX target template (PHP enabled)

```
<?php
     if (isset($_POST["sort"]))
     {
       $sort = $_POST["sort"];
       echo $sort;
     }
     else
     {
       $sort = null;
       echo "no sort data";
     }
?>

```

I've even tried using POSTMAN to test the AJAX template with post data and it still returns false. I know the ajax works because `$.get("/path/to/ajax/target/");` properly returns whatever html i put in it

Any ideas?

# Answer
> 0 votes
Ok so I was being a complete dummy about this. In the end I didn't need to POST any data using the AJAX `data:` property. All I needed to do was edit what URL I passed :P

HTML and AJAX call on the **base template**:

```
<div id="calendar_sort">
  <div>
    {!-- A default view value before any date-range AJAX filters are triggered --}
  </div>
</div>

....

<a href="example.com/calendar/ajax/day"  class="trigger" data-orderby="day">Day</a>
<a href="example.com/calendar/ajax/week"  class="trigger" data-orderby="week">Week</a>
<a href="example.com/calendar/ajax/month"  class="trigger" data-orderby="month">Month</a>

....

<script type="text/javascript">
  $(document).ready(function(){

    var ajaxTarget;

    var trigger = $(".trigger"),
        sort    = $("#calendar_sort > div");

    trigger.click(function(event) {

      event.preventDefault();

      var selectedRange = $(this).attr("data-orderby");

      // This replaces the POST data { sort: day } from the question above.
      ajaxTarget = "/calendar/ajax/" + selectedRange + "/";

      $.ajax({
          type: "GET",
          url: ajaxTarget,
          dataType: "html"
      })
      .done(function(e) {
         $( "#calendar_sort" ).html(e);
      })
      .fail(function(e) {
         console.log("ajax error:" + e);
      });
      return false;
    });

  });
</script>

```

And the `/calendar/ajax/<range>` template that's being called (defined in my `calendar` template group simply as `ajax` as any trailing url data will simply redirect to the `ajax` template):

```
<div id="calendar_sort">
  <div>
    {if segment_3 == "day"}
        {!-- Populate 'day' data before the template is returned --}
    {if:elseif segment_3 == "week"}
        {!-- Populate 'week' data before template is returned --}
    {if:else}
        {!-- Then it must be 'month' so do populate month data here --}
    {/if}
  </div>
</div>

```

We're using Solspace Calendar so generating stuff via AJAX this way is actually pretty nifty and easy once you get the right approach.

Thanks again to @AlexKendrick for your input on this.

# Answer
> 2 votes
Do you have *Process form data in Secure Mode?* set to "Yes" in your Security and Session Preferences? That could be your issue.

If you do, then EE will give a "The action you have requested is invalid." error message instead of using your template, and you'll never be able to get your POST data.

I tried your code and it works as long as *Process form data in Secure Mode?* set to "No".

If you'd like to keep *Process form data in Secure Mode?* set to "Yes" you can do that, you just need to submit a valid XID along with your other parameters.

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

```

See CSRF Tokens in Templates

---
Tags: php, jquery, ajax
---


# Question
Title: How to prevent EE and CartThrob setting cookies for anonymous users?
I'm trying to set up Varnish to cache certain static pages on my site for users who have not logged in or added anything to their cart.

Basically, Varnish will check whether the user has any cookies set on the site. If not, it will serve a cached version of the page. This can help dramatically when the page is under heavy load (like during a press push), where the majority of visitors won't have logged in or added anything to the cart.

The problem is, ExpressionEngine and CartThrob both set a bunch of cookies when the user first arrives, before there's any need for session data to be stored. As such, pages are (rightly) never cached by Varnish. I'm seeing these cookies set immediately on the first request:

exp\_cartthrob\_session\_id exp\_last\_activity exp\_last\_visit exp\_tracker

Ideally, neither EE or CartThrob should set a cookie until either the user logs in or adds something to their cart. Is there any way to prevent all of these cookies from being set on first visit?

# Answer
> 3 votes
The answer to this lay in the Varnish configuration. Basically, in the vcl\_recv function, I created my logic for whether to "lookup" (check the cache, fetch from the backend if the cache is empty), or "pass" (always serve from the backend).

Then in vcl\_pass, I added an HTTP header to the request indicating "this request was passed and should never be cached".

```
sub vcl_pass {
  set req.http.X-Varnish-Passed = "PASS";
  return (pass);
}

```

Finally in vcl\_fetch, I checked the HTTP header added to the request. If the header is missing, this request is safe to strip cookies and cache (based on my logic in vcl\_recv). If the header is present, we should just serve it from the back end as-is.

```
sub vcl_fetch {
  if (req.http.X-Varnish-Passed != "PASS") {
    set beresp.ttl = 300s;
    remove beresp.http.set-cookie;
    remove beresp.http.cookie;
  }
}

```

This may cause some problems with ExpressionEngine, since it is stripping out cookies on all of my static pages, but the cookies are still set correctly on all uncached pages (product pages, shopping cart, login pages, etc).

---
Tags: cartthrob, sessions, cookies, caching
---


# Question
Title: Plugin using tag pairs as "parameters". Possible?
Is it possible to use tag pairs as parameters?

Take the code below

```
{exp:utilities:foo}
    {qux}abcdef{/qux}
    {lux}12345789{/lux}
{/exp:utilities:foo}

```

Normally, using `parameters`, you are going to do this

```
$qux    = ee()->TMPL->fetch_param('qux');

```

Inside the plugin, is there something I can call to get the values between the tag pairs just like the code above?

My motivation for doing this is because using "parameters" for plugins usually result in a parse order issue for me.Some people seem to have the same problem too.

**NOTE:**

I aiming to use the parameters to do some processing and return a single string for the plugin.

# Answer
> 1 votes
you'll have to fetch / process them from tagdata yourself.
$this-\>EE-\>TMPL-\>var\_pair will have an array of var-pairs you can walk.
Then compare / preg\_match() them on the keys/tags you're looking for.

You can see by looking at an example in a small calendar class i made:
Calender\_entries (github, highlighted)

---
Tags: plugin
---


# Question
Title: Automatically assign parent category to sub-category entries?
I have a parent category called, 'Reviews', which has sub-categories, 'Albums', 'Tracks' and 'Gigs'.

The entries in the sub-categories had already been assigned those sub-categories before the parent category was created.

Is there any way I can automatically add the 'Reviews' (parent) category to all of its sub-category entries?

# Answer
> 3 votes
A couple of things. First, going forward, make sure that the **Auto-Assign Category Parents** option (under **Admin → Channel Administration → Global Preferences**) is set to **yes**.

Second, to fix all of the pre-existing entries, backup your database, create a new template, enable PHP on it, put this in it, then load the template in your browser. (You'll need to find the Category ID of each of the relevant categories and replace them below.)

```
<?php

$this->EE =& get_instance();

$child_categories = "1,2,3";
$parent_category = "4";

$entries = $this->EE->db->query("SELECT DISTINCT entry_id FROM exp_category_posts WHERE cat_id IN($child_categories)");
if($entries->num_rows() > 0)
{
    foreach($entries->result_array() as $entry)
    {
        $this->EE->db->query(
            $this>EE->db->insert_string(
                'exp_category_posts',
                array('cat_id' => $parent_category, 'entry_id' => $entry['entry_id'])
            )
        );
    }
}

?>

```

# Answer
> 1 votes
Fix for 2.6.1

```
<?php
$child_categories = "1,2,3";
$parent_category = "4";
$entries = ee()->db->query("SELECT DISTINCT entry_id FROM exp_category_posts WHERE cat_id IN($child_categories)");

if($entries->num_rows() > 0)
{
    foreach($entries->result_array() as $entry)
    {
            ee()->db->query(
                    ee()->db->insert_string(
                         'exp_category_posts',
                    array('cat_id' => $parent_category, 'entry_id' => $entry['entry_id'])
                    )
                    );
     }
}

?>

```

# Answer
> 0 votes
You could do this with a custom extension although my advice would be to reconsider your data architecture.

Can you post some more information on why you want to do this including channel setup and custom fields?

# Answer
> 0 votes
To avoid having problems with duplicate MySQL Errors, add this after the parent categoty ID variable

$parent\_category = "21";

$delete = ee()-\>db-\>query("delete FROM exp\_category\_posts WHERE cat\_id IN($parent\_category)");

that will delete all the old relations to the parent category -\_^

---
Tags: categories
---


title: Order Playa children by total_parents?

text:
# Question
Title: Order Playa children by total_parents?
I'd like to show a listing of Playa child entries (child's title + a few custom fields), ordered by their total\_parents (total number of parent entries associated with the child entry). The child entry with the most parents would be at the top of the list; the child entry with the fewest parents would be at the bottom.

I've looked through the Playa docs, EE StackExchange, and old P&T support site at Get Satisfaction. But I've had no luck so far. I suspect I've overlooked something obvious, or am off track in thinking about the problem.

I would really appreciate suggestions on how you would approach this issue. Thanks!

# Answer
> 3 votes
After some quick testing I'm pretty certain you can use the playa tag "total parents" and pipe that in as an orderby parameter. The playa children tag, as stated in their documentation "{exp:playa:parents} supports almost all of {exp:channel:entries}’ tag parameters", so it accepts orderby and sort parameters. So, the following should accomplish what your looking for:

```
 {exp:playa:children
    channel="your_channel"
    entry_id="1"
    field="your_field"
    orderby="{exp:playa:total_parents}"
 }
      {exp:playa:total_parents} - {title}
{/exp:playa:children}

```

I tested this using EE 2.6.1 and Playa 4.4.5. I included the `{exp:playa:total_parents)` so that in testing you could see if it is actually sorting based on the number of total parents. Also, if you want to perhaps reverse the order you could add another parameter of `sort="asc"`

Hope this helps and let me know if you run into any issues.

---
Tags: playa
---


title: Attendance List

text:
# Question
Title: Attendance List
I need to create an attendance list. I will be adding a over a 100 members to my expression engine installation and I want to be able to track their attendance to my events. I as an admin want to be able to check off which members attend today (so and so event). How can I accomplish that?

I also want to be able to go back and look at a grid and see every member and what days they attended. Any ideas?

# Answer
> 1 votes
One practical way I can suggest is to use one of the add-ons that allows you to have members as entries (profile edit, safecracker registration, zoo visitor are the ones that come to mind). Then it would be fairly straight forward for you to, at the event level, use a relationship field to indicate who was in attendance. There's nothing that will display a grid showing the information the way you're seeking within the control panel out of the box, but creating a template that lists your events and within each event, uses the relationship field to display the attendees you recorded would be fairly straight forward. This of course assumes that you are entering your events as entries in EE as well.

---
Tags: members
---


title: Count number of words in article

text:
# Question
Title: Count number of words in article
*A similar question has been asked here which ended in the recommendation to create a custom plugin. That's not possible for me.*

I want to know how many words my entries actually have; in the frontend I want to add to the meta-data "this article has 132 words".

Is there a way to count the words and use this number?

Thanks in advance!

# Answer
Certainly on the front end, one of the options would be to simply use jquery to do that work for you. A quick search revealed one method that would likely do the trick - you would surround the article body requiring a word count with a class of "to\_count" and then use jquery with a bit of regex to detect and count the words within that class element. This assumes that you're OK loading jquery on the page in which you need the count.

Alternatively, you could instead use an EE add-on like MD Character Count to give you a word count within the control panel and then you could add a custom field in which to record that value (but this may incorrectly assume that the content requiring a total is contained within a single field).
> 1 votes

---
Tags: count
---


# Question
Title: cursor not at beginning of commentform field
Is this a feature or a bug? When I place my cursor somewhere in the new and empty commentform field, it does not appear at the beginning of that field, as expected, but at some lines under the top, and quite a few characters insert. It is possible to replace the cursor at the beginning, though.

But 'something' makes that the cursor does not start directly there.

Is there someone maybe that has a clue?

Many thanks....!

# Answer
is this in EE backend, or one of your templates? typically a comment field would be a text area tag - as such it has an opening and a closing tag. so in the html check to see if there is spaces, newlines, etc between the two and that is probably the culprit. if not - CSS padding maybe? but not if you have space characters in there...
> 0 votes

---
Tags: comment-form
---


title: Stash - conditional doesn't work

text:
# Question
Title: Stash - conditional doesn't work
Here is my code

```
{exp:stash:set_list name="xxxxx" parse_tags="yes"}
    {exp:channel:entries
        category="{embed:category_id}"
        channel="xxxxx"
        disable="categories|category_fields|custom_fields|member_data|pagination"
        dynamic="no"
    }
            {if '{exp:plugin:that_returns_some_boolean}' == 'true'}
                {stash:item}
                    {exp:plugin:that_returns_some_value}
                {/stash:item}
            {/if}
    {/exp:channel:entries}
{/exp:stash:set_list}

{exp:stash:get_list name="xxxxx"}
    {if count == 1}
        <li>
        {exp:plugin:that_returns_some_string}:
    {/if}

    {if item}
        {item}
        {if count != total_results}
            ,
        {/if}
    {/if}

    {if count == total_results}
        </li>
    {/if}
{/exp:stash:get_list}

```

The basic gist of this code block is to simply put some values in the Stash list based on some conditional.

My problem is that the conditional that wraps `{stash:item}` doesn't seem to be respected. `{stash:item}` is always appended to the list. Because of that, I see all the items outputted by `{exp:stash:get_list}` as if the conditional doesn't exist.

Am I doing something wrong?

# Answer
> 1 votes
You could try adding

```
 {exp:stash:set_list name="xxxxx" parse_conditionals = "yes" parse_tags="yes"}

```

To your initial set\_list tag. You may also be better off using switchee instead of if ... Try adding the above first.

IF switchee isnt working then maybe try ifelse (also by Croxton). The issue I believe is parse order and in particular the parsing of the plugin inside the if statement, hopefully ifelse will correct the parse order issue.

```
{exp:stash:set_list name="xxxxx" parse_conditionals="yes" parse_tags="yes"}
    {exp:channel:entries
        category="{embed:category_id}"
        channel="xxxxx"
        disable="categories|category_fields|custom_fields|member_data|pagination"
        dynamic="no"
    }
        {exp:ifelse parse="inward"} //ifelse module
            {if '{exp:plugin:that_returns_some_boolean}' == 'true'}
                {stash:item}
                    {exp:plugin:that_returns_some_value}
                {/stash:item}
            {/if}
         {/exp:ifelse}
    {/exp:channel:entries}
{/exp:stash:set_list}

```

# Answer
> 1 votes
Try putting the conditional on the inside of the `{stash:item}` pair. In addition, you may need to add `trim="yes"` to the `set_list` parameters to ensure that the variable is not set to some whitespace when the condition doesn't apply. You'll also need `parse_conditionals="yes"` as mentioned already.

If that doesn't help, double check exactly what your plugin is returning (is it the word 'true', or is it a boolean TRUE, or 1 or 0 or yes/no etc)

---
Tags: stash
---


# Question
Title: table is marked as crashed and should be repaired
All of a sudden I cannot log into my control panel. Does anyone have any advice as to where I could start to get this repaired?

```
A Database Error Occurred
Error Number: 145

Table './db-name/exp_cartthrob_cart' is marked as crashed and should be repaired

SELECT `cart` FROM (`exp_cartthrob_cart`) WHERE `id` = '3099' LIMIT 1

Filename: third_party/cartthrob/models/cart_model.php

Line Number: 28

```

# Answer
Your best bet would be to attempt to repair the table via a database management utility outside of the EE control panel. Does your web host offer anything like a PHPMyAdmin interface, or do you have any experience with standalone MySQL clients like Sequel Pro? Those utilities should expose table repair functionality. I'd start there first.

Before you proceed beyond this point, I probably cannot emphasize enough that you **back up your database**. If you don't know how to do this, ask. The following could potentially further complicate the issue, and it would be best if you had a semi-safe point to roll back to.

That said, you could modify the following script with your database credentials, upload it to your server, and execute it:

```
<?php

// Taking the information in brackets from your /system/expressionengine/config/database.php

$db_con = mysql_connect('[YOUR DB HOSTNAME]', '[YOUR DB USERNAME]', '[YOUR DB PASSWORD]');
mysql_select_db('[YOUR DATABASE NAME]',$db_con);

$q_result = mysql_query('REPAIR TABLE exp_cartthrob_cart');

if ( ! $q_result )
{
    die('Total failure. I recommend panic.');
} else {
    echo mysql_result($q_result,0) . ' has been repaired.';
}

```
> 3 votes

---
Tags: cartthrob, login, mysql
---


# Question
Title: Nested lists with Stash, Playa, and Channel Videos
I have a channel of Events, which has a videos field. Videos is a playa field which relates to a Videos channel. The Videos channel has a field which uses Channel Videos to display the video. I'm trying to use Stash to retrieve and display these videos from my Event using nested lists. However, I'm not quite sure of the syntax with more than one two dimensional lists. Here is the code I've used so far.

```
{!-- set the list --}
{exp:stash:set_list name="an_event" parse_depth="2" parse_tags="yes" scope="site"}
  {exp:channel:entries channel="events" disable="categories|category_fields|member_data|pagination|trackbacks" dynamic="no" entry_id="155"}
    {stash:title}{title}{/stash:title}
    {stash:entry_id}{entry_id}{/stash:entry_id}

    {exp:stash:set_list:nested name="event_video" context="{entry_id}" parse_tags="yes" scope="site"}
      {event_video}
        {exp:channel_videos:videos entry_id="{entry_id}"}
          {stash:video_id}{video:id}{/stash:video_id}
          {stash:video_title}{video:title}{/stash:video_title}
          {stash:video_thumb}{video:img_url}{/stash:video_thumb}
          {stash:video_embed}{video:embed_code}{/stash:video_embed}
        {/exp:channel_videos:videos}
      {/event_video}
    {/exp:stash:set_list:nested}

  {/exp:channel:entries}
{/exp:stash:set_list}

{!-- get the list --}
{exp:stash:get_list name="an_event" scope="site"}

  <h1>{title}</h1>
  {exp:stash:get_list:nested name="event_video" context="{entry_id}" scope="site"}
    <img src="{video_thumb}" />
  {/exp:stash:get_list:nested}

{/exp:stash:get_list}

```

As a simple test, I'm just trying to output the thumbnail for the video, but I'm not seeing anything. Any ideas on what I'm missing?

Thanks, Dan

# Answer
When you're setting the an\_event list you didn't set a stash variable called entry\_id, although you're trying to use that variable for the context parameter when you're outputting with get\_list.

So you might want to set the variable (using a slightly different name than the default ee variable):

```
...
{stash:title}{title}{/stash:title}
{stash:e_id}{entry_id}{/stash:e_id}
...

```

and when outputting the list:

```
... context="{e_id}" ...

```

There may be more issues, but try that.
> 1 votes

# Answer
First you will need to close the {event\_video} tag. (/) Why are you using Stash? (early parsing?)
> 0 votes

---
Tags: playa, stash, channel-videos
---


title: Channel Form return to new window

text:
# Question
Title: Channel Form return to new window
I would like a channel form return path to open in a new window upon submission. Is there any way to do this? Below is the template code I have:

```
{exp:channel:entries channel="projects" entry_id="{last_segment}" limit="1"}
                        <h2>{title}</h2>
                        <ul class="buttons">
                            {project_proof orderby="row_id" sort="desc" limit="1"}
                                <li>
                                    {exp:channel:form
                                        channel="projects"
                                        entry_id="{last_segment}"
                                        return="images/uploads/proofs/{proof_file:filename}.{proof_file:extension}"
                                        orderby="row_id"
                                        sort="desc"
                                        limit="1"
                                        target="_blank"
                                    }
                                    <input type="hidden" name="field_id_77[row_order][]" value="row_id_{row_id}" />
                                    <input type="hidden" name="field_id_77[row_id_{row_id}][col_id_19]" value="{current_time format='%F %d, %Y - %g:%i:%s'}" />
                                    <input type="hidden" name="field_id_77[row_id_{row_id}][col_id_15]" value="{proof_date}" />
                                    <input type="hidden" name="field_id_77[row_id_{row_id}][col_id_18]" value="{proof_notes}" />
                                    <button class="button" type="submit">View details</button>
                                    {/exp:channel:form}
                                </li>

                                <li><a class="button" id="submitChanges">Submit changes</button></a></li>
                            {/project_proof}
                        {/exp:channel:entries}

```

Basically it returns an image so I want to have that image either open in a new window or download. Thanks!

# Answer
This is a job for JavaScript. Here's a thread over at the main Stack Exchange questions forum which may be useful:- https://stackoverflow.com/questions/3825078/jquery-post-response-in-new-window
> 2 votes

---
Tags: channel-form
---


# Question
Title: Call for support for Feature request: Search Module parameter: future_entry_channels
I've got a reply from EllisLab on a feature request, they only want to implement the feature request, when enough of you request the feature, here it is:

**The search module is an all the way show\_future\_entries = yes or no. However, i have only one event channel for which i like to enable future\_entries, the following couple of lines enables a "future\_entry\_channels" parameter that enables to set channels that allow future entries, instead of a general show\_future\_entries=yes**

\*This would enable a future\_entry\_channels="7|3" parameter for channels that you want to allow search into future entries, please add a comment with +1.\*

```
// ~ line 336 add a parameter
'future_entry_channels' => $this->EE->TMPL->fetch_param('future_entry_channels',''),

// ~ line 664 replace/extend show_future_entries conditional
if ( ! isset($this->_meta['show_future_entries']) OR $this->_meta['show_future_entries'] != 'yes')
{
    // Future entries for some channels, like event-channels
    $future_entry_channels = $this->_meta['future_entry_channels'];

    if(empty($future_entry_channels))
    {
         // regular show_future_entries="no"
         $sql .= "\nAND exp_channel_titles.entry_date < ".ee()->localize->now." ";
    }
    else
    {
        // allow some channels to have future entries
        $future_entry_channels = explode('|', $future_entry_channels);

        $sql .= "\nAND (exp_channel_titles.entry_date < ".ee()->localize->now." OR exp_channel_titles.channel_id IN(".implode(',', $future_entry_channels).") ) ";
    }
}

```

# Answer
> 1 votes
It does make sense, but seems just a bit too niche to be in core for me. How about you take your code and make it a wrapper for the core search and distribute it on Devot-ee?

Adrian Macneil has shared some code of how he wrapped the Channel Entries module in his own plugin and would be a good starting point: https://expressionengine.stackexchange.com/a/5796/96

TLDR: Yes to the feature. No for it being in core.

---
Tags: feature-request
---


# Question
Title: Unable to load requested field type file: ft.relationship.php. after updating
I upgraded my Expression Engine installation to 2.7.3 (from 2.3.1). But after upgrading I get an error when trying to view the site.

```
Error

Unable to load requested field type file: ft.relationship.php.

Confirm the fieldtype file is located in the expressionengine/third_party/ directory

```

I can see that there is a expressionengine/fieldtypes/relationship/ft.relationship.php and if I go to the admin page I see a field type as being installed there (As “Relationships Version 1.0”).

Why is EE giving me an error at that point?

# Answer
Per the EE 2.7.3 docs found here:

> Changed in version 2.6: Relationships was completely rewritten for this version, adding the ability to create multiple relationships for each entry and introducing a friendly new tag syntax. The template tags described here are not compatible with previous versions.

The foundation of Relationships is very different in the new version, so I would guess that you need an update to which ever third party add-on you're using.
> 1 votes

---
Tags: ee2-upgrades
---


title: calendar, more efficient code

text:
# Question
Title: calendar, more efficient code
the goal:
-show the remainder of the current month's events always
-when end of month is near (after the 18th, for example), also show the upcoming month's events

this is what i have presently, which works:

```
{if {current_time format="%d"} > 18}
  {exp:calendar:cal calendar_id="5057" date_range_start="today" show_months="2" pad_short_weeks="n"}
{if:else}
  {exp:calendar:cal calendar_id="5057" date_range_start="today" show_months="1" pad_short_weeks="n"}
{/if}

```

however, it's not terribly efficient, when all i really want to do is toggle the show\_months="1" to "2" -- and the template doesn't like that i have two opened {exp} and only one closed {/exp}

thought i could get away with:

```
show_months="{if {current_time format="%d"} > 18}2{if:else}1{/if}"

```

but that just fails silently. any tips?

# Answer
This doesn't works because this conditional isn't a simple one, so the template parser tries to parse the `exp:calendar:cal` before the conditional.

Simple conditionals looks like this:

```
{if foo == "bar"}

```

They are parsed before at the stage 13 on Rendering stages.

Everything else are advanced conditionals, parsed at stage 18.

So, `{if {current_time format="%d"} > 18}[...]{if:else}[...]{/if}` and `{if {current_time format="%d"} > "18"}[...]{/if} {if {current_time format="%d"} < "19"}[...]{/if}` looks like the same, but, for the EECMS template engine, they aren't.

Please, try this:

```
{exp:calendar:cal calendar_id="5057"
    date_range_start="today"
    {if {current_time format="%d"} > "18"}
        show_months="2"
    {/if}
    {if {current_time format="%d"} < "19"}
        show_months="1"
    {/if}
    pad_short_weeks="n"
    parse="inward"
}
    [...]
{/exp:calendar:cal}

```

I never tried to use a `string` after a `>`, but I can't test now. Please, test.

Take a look at the EECMS parsing order to understand better what is happening.
> 1 votes

---
Tags: variable, calendar, themes
---


title: Relationships and Channel Videos

text:
# Question
Title: Relationships and Channel Videos
This is the first time that I'm using the new Realationships field and I can't seem to get it to work with Channel Videos.

I am trying to display all videos from my relationship field "{related\_entries}" from the channel "videos".

Here is my template code:

```
<div>
<ul>

{exp:channel:entries channel="video_courses" disable="categories|category-fields|member-data|pagination"}
{related_videos}
{exp:channel_videos:videos prefix="cv"}

<li><a href="{title_permalink='videos/view'}" class="image"><img src="{cv:img_url_hd}" alt="image01" /><h2><span>{title}</span></h2></a></li>

{/exp:channel_videos:videos}

{/related_videos}
{/exp:channel:entries}

  </ul>
</div>

```

However it is not outputting anything. Any thoughts appreciated...

# Answer
> 2 votes
The related\_videos tag pair will loop through any you have selected, and for each loop you need to tell channel\_videos which video you're looking for. So you could use the entry id parameter, something like:

```
{related_videos}
    {exp:channel_videos:videos prefix="cv" entry_id="{related_videos:entry_id}"}
        <li><a href="{title_permalink='videos/view'}" class="image"><img src="{cv:img_url_hd}" alt="image01" /><h2><span>{related_videos:title}</span></h2></a></li>
    {/exp:channel_videos:videos}
{/related_videos}

```

using the related\_videos for a prefix to point to children variables in your video channel. You also might have to change the formatting for the permalink.

---
Tags: relationships, channel-videos
---


# Question
Title: Simple Commerce tag in Standard Channel entries tag?
I am looking to use simple commerce price variable inside a standard channel entries tag. Using the following code, it is not parsing the {item\_regular\_price} and simply displaying the tag.

```
{exp:channel:entries channel="membership_packages" dynamic="no"}
  <li><a href="{page_url}">{title} - {item_regular_price}</a></li>
{/exp:channel:entries}

```

Any ideas on how I can get the information from the simple commerce item to display in channel entries?

# Answer
Figured this out, you need to wrap the simple commerce tags with in the simple commerce purchase tags like so...

```
{exp:channel:entries channel="membership_packages" dynamic="no"}
     <li><a href="{page_url}">{title} - {exp:simple_commerce:purchase entry_id="{entry_id}" success="site/success" cancel="site/index"} {item_regular_price}{/exp:simple_commerce:purchase}</a></li>
{/exp:channel:entries}

```

It's important to note that the "success" and "cancel" parameters are required and it will not work without them.
> 2 votes

---
Tags: simple-commerce
---


title: Forcing SSL on /admin.php only

text:
# Question
Title: Forcing SSL on /admin.php only
Trying to force SSL on the admin area only (/admin.php) but running into some issues. I've installed the http support add-on (http://devot-ee.com/add-ons/https-support) and the SSL certificate is up and running with this the admin area all works fine.

However when logged in if you visit the main site it also tries to force to SSL, but for some reason pages 404 unless they have /index.php/ in the URL, making me assume this is a .htaccess issue. I'd rather not have the main site on SSL when logged in, but if this isn't possible with the https support add on then I'd be happy to just get the https site working without /index.php/

Our current .htaccess looks like this:

```
<IfModule mod_rewrite.c>
        RewriteEngine On

        # Redirect index.php Requests
        # ------------------------------
        RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
        RewriteCond %{THE_REQUEST} !/system/.*
        RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,L]

        # Standard ExpressionEngine Rewrite
        # ------------------------------
        RewriteCond $1 !\.(css|js|gif|jpe?g|png) [NC]
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

```

Not being an expert I can't see why the removal of /index.php isn't working for https? Any ideas?

# Answer
> 2 votes
Firstly I think you should rename `admin.php` to something else, in line with the Post-Installation Best Practices which can be read at http://ellislab.com/expressionengine/user-guide/installation/best\_practices.html

I would go for a sub-folder, and rename it something obscure like `/badgers/index.php`

In turn, this would make your htaccess file easier because you can now have different rules for that sub-folder.

I would also uninstall the *HTTPS Support* module, it makes the entire site encrypted and not just admin and so it's not quite right for you.

I am unable to test this because I'm on a silly Chromebook right now, but this may work.

```
    <IfModule mod_rewrite.c>
            RewriteEngine On
            RewriteBase /

            # Make visits to /badger/ HTTPS
            RewriteCond %{HTTPS} !=on
            RewriteCond %{THE_REQUEST} ^[A-Z]+\s/badger [NC]
            RewriteRule ^(badger) https://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L]

            # Make standard visits HTTP
            RewriteCond %{HTTPS} =on
            RewriteCond %{THE_REQUEST} !^[A-Z]+\s/badger [NC]
            RewriteRule !^badger http://%{HTTP_HOST}%{REQUEST_URI} [NC,R=301,L]

            # Removes index.php from ExpressionEngine URLs
            RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
            RewriteCond %{REQUEST_URI} !/system/.* [NC]
            RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]

            # Directs all EE web requests through the site index file
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule ^(.*)$ /index.php/$1 [L]
    </IfModule>

```

HTACCESS adapted from EllisLab's (http://ellislab.com/expressionengine/user-guide/urls/remove\_index.php.html) and this Stack Exchange (https://stackoverflow.com/questions/3307025/force-https-on-certain-urls-and-force-http-for-all-others)

# Answer
> 0 votes
The systems folks I've talked to usually advise enabling HTTPS/SSL across the entire site, not just the control panel; I'd suggest going that route, unless the client/manager is steadfast against it.

---
Tags: htaccess, ssl
---


title: Google Maps for EE, map syles and JSON

text:
# Question
Title: Google Maps for EE, map syles and JSON
I used the google map styling wizard to generate this JSON frag.

`[ { "featureType": "road.highway", "stylers": [ { "visibility": "on" } ] },{ "featureType": "road.local", "stylers": [ { "visibility": "on" } ] },{ "featureType": "road.arterial", "stylers": [ { "visibility": "on" } ] } ]`

But I have no idea what to do with it. Where do I put this?

Thanks!

Greg

# Answer
> 1 votes
I just implemented this on a project yesterday, and agree that the official docs/example is a bit skimpy on details. In any event...

Create a file that includes your JSON object, prefixed with `var stylez =`, save it as "gmap-styles.js" in a place where your browser can see it.

**gmap-styles.js**

```
var stylez = [ { "featureType": "road.highway", "stylers": [ { "visibility": "on" } ] },{ "featureType": "road.local", "stylers": [ { "visibility": "on" } ] },{ "featureType": "road.arterial", "stylers": [ { "visibility": "on" } ] } ]

```

Then, use use the `styles` and `style_var` parameters in `{exp:gmap:init}` in your template to specify the path to the JS file, as well as the name of the JSON var you saved in it.

**some.group/some\_template.html**

```
{exp:gmap:init
    ... a bunch of other params ...
    styles="url/path/to/gmap-styles.js"
    style_var="stylez"
}

```

---
Tags: google-maps, json
---


# Question
Title: How do you remove template group from URL?
I've scouring through StackExchange looking for an answer for the last few days with no luck.

These are the suggestions that I've seen without any real detail or resources: 1.) Somehow use the index page of a template group to handle this. Once again, no direction given on how one would do this.

2.) Use Template Router plugin on Devot:ee - Looks like it's primarily for blog functionality. I don't see any real clear documentation on how this plugin works.

3.) Use Pages module - doesn't work. I've gone through all of the documentation. Can't get it to work, plus I am not fond of the idea of manually changing links. Would love to have template groups removed automatically without requiring my client to take extra steps to remove this URL segment.

4.) Use Freeway extension - tried installing... doesn't appear in extension section once it's uploaded plus it has a bunch of tickets open for breaking other modules, etc.

5.) .htaccess - haven't found anything that works except to remove the index.php file - plus my understanding is that .htaccess isn't necessarily the most reliable way of approaching this sort of issue?

In short, how in the world do you remove the template group from the URL structure... I've heard the arguments that it somehow makes for a better user experience to include this, but for me, it's not the case. I use very generic names for my template groups; e.g., content\_page, general\_page, etc.

Someone, please tell me there's an easy way to work around this?

# Answer
If you wanted to use Template Routes, here's how you'd do it:

```
$config['template_routes'] = array(
  'about-us' => 'template_group/about-us',
  'faq' => 'template_group/faq',
);

```

This will make it so if you visit the `http://yoursite.com/about-us` url, you'll get the `template_group/about-us` template.
> 2 votes

# Answer
This is one of those questions where there is no 'silver bullet' approach. The most flexible method is using the partials or DRY approach but this is fairly in depth and prone to overuse or misuse.

Another approach would be to create a series of globals or snippets to markup the pages without the need for calling on structural templates, it requires re-creating the base template for every page but it's not that difficult. I;d use one of the modules that allows snippets to be edited as text files and in this example I'm referring to snippet sync.

SNIPPET based template:

```
<html>
{snip:css}
<body>
{snip:navigation}
  //Content lives in here
{snip:footer}
{snip:js}
</body>
<html>

```

Then using the following template structure, you'd simply copy/paste that above into each template.

```
  - about.group
      index.html
  - news.group
      index.html
      detail.html

```

About + News would render as mysite.com/about + mysite.com/news and mysite.com/news/detail/url\_title\_lives\_here. YOu can use the default index.html file to do advanced URL testing and present different data dependant on but thats more advanced again.

It's a broad question but this is the simple approach, it can quickly get complicated dependant on your data but this should start you on a path :)
> 0 votes

# Answer
Take a look at Structure; I use it on almost every EE project I build, much better than the Pages module, and, it has a great UX/UI for managing content, and it's pretty flexible (works with standard template groups when you need to, otherwise takes care of them). Also does some neat things like build navigation trees, etc.
> 0 votes

---
Tags: ee2, templates, module, url, htaccess
---


# Question
Title: Search Entries for Keyword in Control Panel not working
Using version 2.7.3, when I try to use the Keywords field in the Edit/Search Entries box, I just get a spinning activity indicator, but never any search results.

I am able to use the drop down filters, such as Channel, Category, and Status.

# Answer
This is a bug in EE 2.7.3 when Secure Forms is disabled. It is currently marked as "fixed in upcoming release". (Bug tracker link.)
> 5 votes

---
Tags: control-panel, search
---


# Question
Title: Remove "default site" from MSM installation?
Is it possible to remove the "default site" from a MSM installation and then remove the MSM plugin, thereby creating a stand alone from the second site?

I'm running EE 2.7.2 with Multiple Site Manager

# Answer
> 5 votes
Another option is to duplicate the entire MSM installation, set site #2 as the default, then delete Site #1.

I wrote an article about this process while doing it in EE1, so while some of the specifics will be different the overall process would be the same for EE2:

http://www.train-ee.com/courseware/free-tutorials/comments/splitting-a-site-out-of-an-ee-msm-installation

# Answer
> 1 votes
Nope, you're going to run into a bunch of problems.

I'd set up two separate installs and migrate the data using DataGrab.

Good luck!

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


# Question
Title: Blog permalink redirects to homepage channel?
I've been following Andy Johnson's (Shapingthepage.com) tutorial on building a blog using EE and have been running into an incredibly frustrating issue where the permalink redirects to the homepage. Only thing I can see in the template debugging is this and can't really make sense of it:

```
(0.010170 / 7.26MB) Snippets (Values): FALSE|1|Bio Mechaniks|default_site|blog-test-entry-photo

```

The blog entry page I'm working with is here: http://biomechaniks.com/blog\_entry/ When you click permalink for the non-video entry, you'll see it just sends you back to the home page. Per Andy Johnson's tutorial, I placed the following the index page for the template group:

```
{if segment_2 == ""}
{embed="blog_entry/.blog.main"}
{if:else}
{embed="blog_entry/.blog.article"}
{/if}

```

Thoughts?

# Answer
> 1 votes
Channel relationship issue. Problem solved.

---
Tags: ee2, channel-entries, links
---


# Question
Title: Blank page of death with pagination and blog article link
Getting the blank page of death with pagination links and full article links.

Here's the page I'm working on:

Here's the code I'm using:

```
{embed="inc/.header.doc-open"}
{embed="inc/.header.nav-blog"}
<div class="blog-section clearfix general tan-bg">

    <div class="clearfix">

{exp:channel:entries channel="blog_entry|blog_link|blog_photo|blog_quote|blog_video" limit="2" paginate="bottom" orderby="date"}
    {paginate}
        <p>Page {current_page} of {total_pages} pages {pagination_links}</p>
    {/paginate}
  {if channel_short_name == 'blog_link'}
</div><!-- end .wrapper -->

  <div class="link blog-entry">

      <h2><a href="{blog_link_url}">{title}</a></h2>

      <p>{blog_link_description}</p>

      <span class="date">Posted on <strong>{entry_date format="%F %j, %Y"}</strong>  |  <a href="{title_permalink="blog"}">Permalink</a></span>

  </div><!-- end .link -->

  {if:elseif channel_short_name == 'blog_quote'}
  <div class="quote blog-entry">

      <h2><a href="{blog_quote_url}">{title}</a></h2>

      <blockquote>{blog_quote}</blockquote>

      <span class="source"><a href="{blog_quote_url}">{blog_quote_source}</a></span>
      <p>{blog_quote_description}</p>
      <span class="date">Posted on <strong>{entry_date format="%F %j, %Y"}</strong>  |  <a href="{title_permalink="blog"}">Permalink</a></span>

  </div><!-- end .quote -->
  {if:elseif channel_short_name == 'blog_entry'}
  <div class="entry blog-entry">

      <h2><a href="{title_permalink="blog"}">{title}</a></h2>

      <span class="author">Written by <strong>{author}</strong></span>

      <p>{blog_entry_summary} <span><a href="{title_permalink="blog"}">Read More…</a></span></p>

      <span class="date">Posted on <strong>{entry_date format="%F %j, %Y"}</strong>  |  <a href="{title_permalink="blog"}">Permalink</a></span>

  </div><!-- end .entry -->
  {if:elseif channel_short_name == 'blog_photo'}
  <div class="photo blog-entry">

      <h2><a href="{title_permalink="blog"}">{title}</a></h2>

      <img src="{blog_photo_upload}" alt="" />
      <p>{blog_photo_description}</p>
      <span class="date">Posted on <strong>{entry_date format="%F %j, %Y"}</strong>  |  <a href="{title_permalink="blog"}">Permalink</a></span>

  </div><!-- end .photo -->
  {if:elseif channel_short_name == 'blog_video'}
  <div class="video blog-entry">

      <h2><a href="{blog_video_url}">{title}</a></h2>

      <div class="video-container blog-entry">
          <!-- start of embed code -->
          {blog_video_embed}
          <!-- end of embed code -->
      </div>
      <p>{blog_video_description}</p>
      <span class="date">Posted on <strong>{entry_date format="%F %j, %Y"}</strong>  |  <a href="{title_permalink="blog"}">Permalink</a></span>

  </div><!-- end .video -->
  {/if}
{/exp:channel:entries}
</div>

</div><!-- end .content-section -->

{embed="inc/.footer.doc-close"}

```

Any thoughts? I'm sure I'm making a very basic mistake... I've never attacked this type of functionality with an EECMS site.

# Answer
> 1 votes
Thanks for the advice. It didn't make any difference placing the pagination at the bottom. I think the parameter that places it at the bottom seems pretty solid.

**Problem solved:** I contacted Andy Johnson (shapingthepage.com) because I was following his tutorial. He suggested I use hard coded segment logic in the main index template, which I did and it worked. Not very elegant, but everything I do in EE seems to be a hack of some sort...

Thanks guys!

---
Tags: ee2
---


# Question
Title: Can't log in to Admin CP after updating from 2.6.1 to 2.7.3
I've just finished updating my EE installation from 2.6.1 to 2.7.3 but now that the update is complete I cannot log in. I can access the login page but when I enter my credentials it tries to load http://mysite.com/admin.php?S=0&D=cp&C=login&M=authenticate but it just hangs there forever.

Some things I have tried based on similar issues I found on the EE forum:

* Tried using a different browser
* Tried clearing browser cache and deleting EE cache folder
* Tried adding `$config[‘admin_session_type’] = “c”` to config.php
* Tried adding `$assign_to_config[‘cookie_prefix’] = “site_name”` to index.php and admin.php
* Tried enabling debug mode in index.php and admin.php(did not get any errors when trying to load the Admin CP but when I try to load the homepage I am getting the following error:

```
Fatal error: Class PT_Fieldtype contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (EE_Fieldtype::display_field) in \system_EE\expressionengine\third_party\pt_field_pack\pt_fieldtype.php on line 148

```

Any ideas? Thanks in advance!

# Answer
The error message is pointing to an issue with Pixel and Tonic's Field Pack; you should attempt to upgrade it.

These "white screens of death" errors with the control panel after updating are frequently caused by an issue with an add-on; you temporarily disable them by adding `$config['allow_extensions'] = "n";` to your config.php.
> 3 votes

# Answer
Another potential fix is to add the following config overrides:

```
$config['require_ip_for_login']     = 'n';
$config['require_ip_for_posting']   = 'n';

```

My team has had luck with that when dealing with add-ons that offer the option to redirect on login (Structure and Republic Analytics in our experience).
> 2 votes

---
Tags: debugging, updating
---


# Question
Title: Moving Hosts: Freeform 2.6.6 not sending email
I'm moving one of my sites to a new host. I'm still using EE 1.6.9 and using it with Freeform 2.6.6. I know, I know... I'm way out of date. But, things have worked and I've never seen a need up upgrade my software and pay for latest and greatest.

So... I'm hoping someone can give me some things to try because I'm all out of ideas.

I'm operating the site under a test URL for the time being just to ensure everything works. I've changed all paths (that I know of), changed config.php file, updated permissions on the necessary files/folders on the server, etc. The ONLY thing I can't seem to get working is getting Freeform to send email. On my current live host, I've used this version of EE and Freeform together for probably four years with zero issues sending mail.

On my new host, the only difference that I can tell is that I'm now using PHP 5.2, where on my old (current) host they're still using PHP 5.1.6. I don't think this would make a huge difference, but maybe? I'm not sure I can downgrade to 5.1.6, so if that is in fact an issue, is there an updated Freeform that I could install that will still work with my version of EE and PHP 5.2?

Any ideas would be greatly appreciated.

Thanks all

EDIT:

I wanted to add that on my old (current) host, email configuration was setup to use phpmail. On the new host, they use sendmail for email. So, I have went in and changed the email configuration in Admin to "sendmail."

I'm also able to email myself via the "communicate" tab in the control panel, so I know email is working.

# Answer
Just a follow up in case anyone else is having this problem. It ended up being my new host. I was with EngineHosting and was able to use a variable like `{email}` in the FreeForm template for the "From Email." This would allow the email to appear to have been sent from the person contacting me. Turns out, my new host does not allow that. So, I had to add a couple more tags to my FreeForm form for reply-to headers. To do that, you need three more tags:

* `reply_to`
* `reply_to_email_field`
* `reply_to_name_field`

`reply_to` would be set to `yes` and then you can set `reply_to_email_field` to `{email}` (or whatever the input name is in your form) and `reply_to_name_field` to something like `{name}` or whatever your name field is called in your form.

Hope that helps.
> 2 votes

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


# Question
Title: "Editors" member group is set to allow them to edit other member's entries, but it's not working
Can view channel entries authored by others Yes
Can delete their own channel entries Yes
Can edit entries authored by others Yes
Can delete channel entries authored by others Yes

All of these are set to Yes, but when I log in as an Editor and update an entry and click Submit, it gives me a "You are not authorized to perform this action" error in the control panel in the Options tab under Author. I do have the author selector hidden using publish layouts. Any ideas?

EE 2.6.1

# Answer
Turns out this was a bug in the EE version I was using. The patch worked... https://support.ellislab.com/bugs/detail/19382

Thanks for looking into this for me Derek!
> 1 votes

# Answer
My best guess is that **Can change the author name when posting channel entries** is set to **No**, and the author of the entry you're editing (or their member group - there are settings for both levels of granularity) is not set to **Include Members in PUBLISH page multi-author list**.

So when you got to save the entry, the **Author** menu defaults to another member (since the original author is not present in the menu), and you get the error because you're not allowed to change the author.
> 0 votes

---
Tags: members, publish-layout, groups
---


title: Remember me functionality

text:
# Question
Title: Remember me functionality
I have been trying to make "Remember Me" work for the frontend user using

```
<input type="hidden" name="auto_login" value="0">
<input class="checkbox" type="checkbox" name="auto_login" value="1"/>

```

Based on the documentation, it seems to me that "Remember Me" is only mentioned in the "Control Panel Session Type, Cookies Only" option.

Does this mean that "Remember Me" does not work for User Session?

EDIT:

Looking at *Admin -\> Security and Privacy -\> Cookie Settings*, all the fields are blank. Does this cause a problem?

# Answer
> 1 votes
"Remember Me" works with the Control Panel Session type set to Cookies Only: http://ellislab.com/expressionengine/user-guide/cp/admin/security\_settings.html

---
Tags: remember-me
---


# Question
Title: Solspace Calendar embed range not registering
For some reason we're getting a null set of data when the `{if segment_3 == "week"}` evaluates to true and its code is run:

// Base template

```
{if segment_3 == "day"} {!-- This works. --}
    {embed="calendar/event_landing" range_start="{segment_4}/{segment_5}/{segment_6}" range_end="{segment_4}/{segment_5}/{segment_6}"}
{/if}

{if segment_3 == "week"} {!-- This DOES NOT work. --}
    {embed="calendar/event_landing" range_start="{segment_4}/{segment_5}/{segment_6}" range_end="+1 week"}
{/if}

{if segment_3 == "month"} {!-- This works. --}
    {embed="calendar/event_landing" range_start="{segment_4}/{segment_5}/{segment_6}" range_end="+1 month"}
{/if}

```

// event\_landing template

```
{exp:calendar:cal date_range_start="{embed:range_start}" date_range_end="{embed:range_end}" pad_short_weeks="n"}
    ...show events...
{/exp:calendar:cal}

```

In our ajax call, we're changing the segments before we send them so all single digits receive preceeding 0s.

// JS

```
var s_2 = {segment_2} + "", // M
    s_3 = {segment_3} + "", // D
    s_4 = {segment_4} + ""; // Y

if (s_2.length == 1) { s_2 = "0" + s_2; }
if (s_3.length == 1) { s_3 = "0" + s_3; }

// Render the AJAX url before calling it
ajaxTarget = "/calendar/ajax/" + selectedRange + "/" + s_2 + "/" + s_3 + "/" + s_4 + "/";

```

For an example, when the value of our `ajaxTarget` var is

`/calendar/ajax/week/01/02/2014/`

the event data for the next 7 days is returned just fine, but if we change the value of `02` to `27`, resulting in

`/calendar/ajax/week/01/27/2014/`

no data is returned!

**Please note** that we've also tried using `+7 days` with the same results.

Any help on this would be appreciated~

---

EDIT 1:

I think I figured out the reason, but I don't know how to fix it:

I added this little bit of debug to the `event_landing` page:

```
<script type="text/javascript">
    var s4 = {segment_4} + "",
        s5 = {segment_5} + "",
        s6 = {segment_6} + "";

    console.log("/" + s4 + "/" + s5 + "/" + s6);
</script>

```

It's showing that the data is `/1/20/2014`, but this shouldn't be happening because we're adding (and checking) preceeding zeros before this is reached; they're just not showing up. Right before the `$.ajax(...)` call, the the log shows the `ajaxTarget` as `/calendar/ajax/week/01/20/2014/`, so it's being changed during the request somehow :(

# Answer
> 1 votes
If this is your URL:

```
/calendar/ajax/week/01/02/2014/

```

Then this part of your code is incorrect because it's calling the wrong segments:

```
var s_2 = {segment_2} + "", // M
    s_3 = {segment_3} + "", // D
    s_4 = {segment_4} + ""; // Y

```

Should be:

```
var s_2 = {segment_4} + "", // M
    s_3 = {segment_5} + "", // D
    s_4 = {segment_6} + ""; // Y

```

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


title: Channel Entries & Relationships

text:
# Question
Title: Channel Entries & Relationships
I am trying to display a video and beneath it a series of related videos.

All video are currently separate entries in the video channel.

In another channel, "video\_courses" I am using a relationship field to collate all video that belong to that course.

At present I can get the video to display and a list of related videos but it shows all videos and is not restricted to just the related videos.

How can I get the list to honour the relationship.

Current code:

```
{exp:channel:entries channel="videos" limit="1"}

<h1>{title}</h1>
{exp:channel_videos:videos entry_id="{entry_id}" prefix="cv" limit="1"}

<section>
<div class="video-container">
{cv:embed_code}
</section>

{/exp:channel_videos:videos}
{/exp:channel:entries}

<ul id="carousel" class="elastislide-list">

{exp:channel:entries channel="video_courses" disable="categories|category-fields|member-data|pagination" dynamic="no"}
{related_videos}
{exp:channel_videos:videos prefix="cv" entry_id="{related_videos:entry_id}"}

<li><a href="{related_videos:title_permalink='videos/view'}" class="image"><img src="{cv:img_url_hd}{/exp:low_replace}" alt="image01" /><h2><span>{cv:title}</span></h2></a></li>

{/exp:channel_videos:videos}
{/related_videos}
{/exp:channel:entries}

  </ul>

```

Any help appreciated.

N

# Answer
> 2 votes
Try this:

```
{exp:channel:entries channel="videos" limit="1"}

    <h1>{title}</h1>

    {exp:channel_videos:videos entry_id="{entry_id}" prefix="cv" limit="1"}
    <section>
        <div class="video-container">
            {cv:embed_code}
        </div>
    </section>
    {/exp:channel_videos:videos}

    <ul id="carousel" class="elastislide-list">
    {parents channel="video_courses" field="related_videos"}
        {parents:related_videos entry_id="not {entry_id}"}
            {exp:channel_videos:videos prefix="cv" entry_id="{parents:related_videos:entry_id}"}
            <li>
            <a href="{cv:title_permalink='videos/view'}" class="image">
                <img src="{cv:img_url_hd}" alt="" />
                <h2><span>{cv:title}</span></h2>
            </a>
            </li>
            {/exp:channel_videos:videos}
        {/parents:related_videos}
    {/parents}
    </ul>

{/exp:channel:entries}

```

You may have to experiment with prefixes inside of the Channel Videos loop, not sure if you might need `parents:related_videos` prefixes inside of it - but this should get you most of the way.

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


# Question
Title: Logging in as another member? Skeleton key?
My members have a custom control panel that they log into. Is there a way I can possibly set some sort of skeleton key so I can log in as those members? In some cases, the admin needs to play the role of the members (for troubleshooting, etc.). Is this possible?

# Answer
I don't think there is currently an add-on that would allow "login as member" functionality from the front-end (e.g. any other place then the EE control panel)

However you could write (or commission to let write) a small plugin, based on the login\_as\_member() and do\_login\_as\_member() functions. As a starting point for development see this question about Enable “Login as Member” for Additional Member Groups
> 2 votes

---
Tags: members, member-details, member-management, authentication
---


# Question
Title: How best for user to upload, access and insert own images only in Channel Form?
I have a Channel Form for users to submit content. They need to be able to upload images, and then in a RTE editor (e.g. Description field) be able to click the Insert Image button but only see the images they have uploaded. They cant be able to see other peoples images of course.

Initially we tried Dev Demon's Channel Images. This would actually suit our needs, but it has unresolved rendering issues that means its not working right in Channel Form (have reported to the developer).

The RTE Image button I read does not work on the front end only in the CP for some reason, so thats not working.

I cant find any information on a Pixel & Tonic Assets button for the RTE, I dont think there is one.

So aside from the above, how would one offer members the ability to upload their own images to the site and insert them into a field in Channel Form, but only seeing their own images?

Thanks

# Answer
> 2 votes
I'm not aware of any solutions on how to limit to only show current users images, however with Assets, you can just use the file input field instead of the full Assets field:

```
<input type="file" name="assets_field_name">

```

If you want further control on where the file is uploaded, then just add a hidden field for the upload directory:

```
<input type="hidden" name="assets_field_name_filedir" value="1">

```

Make sure the `name=` of the hidden field is your Asset field name suffixed with `_filedir`

This would at least only allow uploads–the only downfall is users won't be able to browse images. Then within your template, you could use a find & replace technique like **this** for the users to input {image\_1} in the RTE field to position the image where they want. Depending on how much control you want them to have, you may need to add a couple other fields for position, size, etc.

*Note: This could also be done with the native file field.*

Or, even better, just upgrade the RTE field to a 3rd Party WYISWYG that allows file uploading.

Sorry for the run on answer

# Answer
> 1 votes
I have actually now fixed the DevDemon Channel Images issue, and so we are going to use that, we could not find an alternative way of doing this easily.

In fact, it was not an issue with Channel Images as I thought, but an issue with EE/RTE and JQuery...

We were using our own JQuery version, one of the latest ones. If I removed this, and EE inserted its own Jquery (which is version 1.7.2!), then Channel Images works.

It was not only Channel Images pop up that broke, but the RTE Insert Hyperlink pop up.

So it seems the RTE pop ups require Jquery version 1.7.2 and no later. I tried it with versions 1.8.x and above and they all broke the RTE pop ups.

So my answer is not specific to the question, but fixing this issue does mean that we can use Channel Images which does allow us to do what we want!

Shame we have to resort to JQuery 1.7.2, I am going to have to test all our other JQuery functions and plugins now.

---
Tags: image, channel-images, rte
---