# Question
Title: jQuery not working after update to 2.7.2 and several add ons
I have a front end member profile editor that uses Zoo Visitor, Channel Images, and Matrix. I have updated them all to the latest version and they work…sort of. The jQuery on those pages no longer works. jQuery for opening and closing some divs as well as the buttons for the add ons (add a new row, CI open the file viewer for files on the server, etc). I can upload a file using CI.

I've seen this before with multiple jQuery loads on the same page, but this time around I can't seem to find what changed. I tried to turn off jQuery in Channel:Form but that didn't work.

Updating the content does work, however you can't see images already uploaded via CI stored images feature.

Are there any changes to 2.7.2 and channel form that impact how to implement jQuery on the front end? Everything works from the CP.

Sample Code:

```
{if segment_3 == "edit-profile"}
    {exp:zoo_visitor:update_form return="{segment_1}/account/edit-profile"}
    <h3 class="arrow-right">About You - The Basics</h3>
    <div class="about-you">
        <fieldset>
            <div class="row">
                <div class="span3">
                    <label for="member_first-name">Your {label:member_first-name}</label>
                    <input type="text" name="member_first-name" id="member_first-name" value="{member_first-name}"/>
                    <label for="label:member_last-name">Your {label:member_last-name}</label>
                    <input type="text" name="member_last-name" id="member_last-name" value="{member_last-name}"/>
                </div>

                <div class="span2 offset1">
                    <label for="label:member_avatar">{label:member_avatar}</label>
                    <p>no larger than 200px by 200px and 50kb</p>
                    {field:member_avatar}
                </div>
                <div class="span5 offset1">
                    <label for="member_bio">Your {label:member_bio}</label>
                    <textarea class="span5" rows="8" name="member_bio" id="member_bio">{member_bio}</textarea>
                </div>
            </div>
        </fieldset>
    </div>
    {if {exp:stash:get name='primary'} == member_id}
    <h3 class="arrow-right">Main/Family Photo</h3>
    <div class="details">
        <fieldset>
            <div class="row">
                <div class="span12">
                    <label for="label:member-cf-family-photo">{label:member-cf-family-photo}</label>
                    <p>{instructions:member-cf-family-photo}</p>
                    {field:member-cf-family-photo}
                </div>
            </div>
        </fieldset>
    </div>
    <h3 class="arrow-right">Contact and Ministry Details</h3>
    <div class="details">
        <fieldset>
            <div class="row">
                <div class="span4">
                    <h5>Social Media</h5>
                    <label for="label:member-cf-facebook">{label:member-cf-facebook}</label>
                    <input class="span4" type="text" name="member-cf-facebook" id="member-cf-facebook" value="{member-cf-facebook}"/>
                    <label for="label:member-cf-twitter">{label:member-cf-twitter}</label>
                    <input class="span4" type="text" name="member-cf-twitter" id="member-cf-twitter" value="{member-cf-twitter}"/>
                    <label for="label:member-cf-email-form">{label:member-cf-email-form}</label>
                    <input class="span4" type="text" name="member-cf-email-form" id="member-cf-email-form" value="{member-cf-email-form}"/>

                    <label for="label:member-cf-vimeo">{label:member-cf-vimeo}</label>
                    <input class="span4" type="text" name="member-cf-vimeo" id="member-cf-vimeo" value="{member-cf-vimeo}"/>
                    <label for="label:member-cf-youtube">{label:member-cf-youtube}</label>
                    <input class="span4" type="text" name="member-cf-youtube" id="member-cf-youtube" value="{member-cf-youtube}"/>
                </div>
                <div class="span4">
                    <h5>Office/Contact Information</h5>
                    <label for="label:member-cf-phone-office">{label:member-cf-phone-office}</label>
                    <input class="span4" type="text" name="member-cf-phone-office" id="member-cf-phone-office" value="{member-cf-phone-office}"/>
                    <label for="label:member-cf-phone-mobile">{label:member-cf-phone-mobile}</label>
                    <input class="span4" type="text" name="member-cf-phone-mobile" id="member-cf-phone-mobile" value="{member-cf-phone-mobile}"/>
                    <label for="label:member-cf-phone-home">{label:member-cf-phone-home}</label>
                    <input class="span4" type="text" name="member-cf-phone-home" id="member-cf-phone-home" value="{member-cf-phone-home}"/>
                    {!--<label for="label:member_email">{label:member_email}</label>
                    <input class="span4" type="text" name="member_email" id="member_email" value="{email}"/>--}
                    <label for="label:member_location">{label:member_location}</label>
                    <input class="span4" type="text" name="member_location" id="member_location" value="{member_location}"/>
                </div>
                <div class="span4">
                    <h5>Account/Privacy Settings</h5>
                    {!--<p><label for="label:member-cf-security">{label:member-cf-security}</label>
                    {field:member-cf-security}</p>--}
                    <p><label for="label:member-cf-sharing">{label:member-cf-sharing}</label>
                    {instructions:member-cf-sharing}<br />
                    {field:member-cf-sharing}</p>
                    <label for="label:member-cf-percent">{label:member-cf-percent}</label>
                    {field:member-cf-percent}
                </div>
            </div>
        </fieldset>
    </div>
    {/if}
    <div>
        <input type="hidden" name="title" value="{username}">
        <input type="submit" value="Update" class="btn btn-primary"/>
    </div>
    {/exp:zoo_visitor:update_form}

    {/if}

```

# Answer
I paid the $50 to have EllisLabs support look into it. In 30 minutes I had the solution. Turns out when EE updated it missed adding a row to the Actions table in the DB. Channel:form was looking for this action, but didn't find it. Producing this:

```
<script type="text/javascript" charset="utf-8" src="http://dev.uscwm.org/?ACT={AID:Channel:combo_loader}&ui=core,widget,mouse,position,draggable,resizable,sortable,button,dialog,tabs,datepicker&plugin=markitup,toolbox.expose,overlay,tmpl&file=underscore&v=1383866052&include_jquery=y"></script>

```

Kevin at EL says,

> “{AID:Channel:combo\_loader}”? That should be replaced with an action ID, if it’s not, it means the action ID likely isn’t present in your actions table. So, I simply added a row to the actions table to Channel:combo\_loader and now it seems to be working.

I know I never would have figured this one out. Well worth it to get this taken care of so my weekend will be better without this hanging over my head!
> 2 votes

# Answer
In your source code it looks like you have a ie conditional endif that doesn't have an opening which may be causing some errors

```
                    <table>
            <tbody>
                <tr>
                    <td class="imagefilter">
                        <div class="filter">
                            <div class="left">
                                                                                <!--[if IE]>
                                <input rel="desc" type="text" value="Description" maxlength="256" onblur="if (value == '') {value='Description'}" onfocus="if (value == 'Description') {value =''}">
                                <![endif]-->
                                <!--[if !IE]> -->
                                <input rel="desc" type="text" value="" maxlength="256" placeholder="Description">
                                <![endif]-->
                                                                                <!--[if IE]>
                                <input rel="category" type="text" value="Category" maxlength="256" onblur="if (value == '') {value='Category'}" onfocus="if (value == 'Category') {value =''}">
                                <![endif]-->
                                <!--[if !IE]> -->
                                <input rel="category" type="text" value="" maxlength="256" placeholder="Category">
                                <![endif]-->
                                                                                </div>
                            <div class="right">
                                <label>Last</label>
                                <select rel="limit"><option>50</option><option>75</option><option>100</option><option>150</option><option>200</option><option>500</option><option>1000</option><option>2500</option></select>
                                <label>Images</label>
                            </div>
                            <br clear="all">
                        </div>
                        <div class="images">
                            <p class="Loading">Loading Images...</p>
                        </div>
                    </td>
                </tr>
            </tbody>
        </table>

```

See that first `<![endif]-->.` I doubt this is the cause of your problems but you never know how this messes up browsers. I think you also have an extra `</div>` in there towards the bottom.

```
<style type="text/css">.hasDatepicker{background:#fff url(https://dev.uscwm.org/themes/cp_themes/default/images/calendar_bg.gif) no-repeat 98% 2px;background-repeat:no-repeat;background-position:99%;}</style>
        </div>

    </div> <!-- /container -->

```

Console is showing a JS error TypeError: ChannelImages.CFields.find(...).sortable is not a function

.sortable is a jquery UI function. I can't see anywhere in your document where you are loading jquery ui. I assume in your channel:form call you have include\_jquery="no" as you are including your own version. I would consider changing that to ="yes" and taking a look at what it is putting out. Likely it is loading the jquery ui
> 2 votes

---
Tags: jquery, channel-images
---


# Question
Title: Displaying list of Calendar events from a Playa field
I am needing to display a list of Calendar events that are selected from a Playa field. Of course, I need it to not display events that has passed (by event date) and if the events in the Playa custom field are all passed a 'No Events' message is returned.

My setup is as follows: Channel A contains the Playa custom field that is pulling in all Event entries.

My code is below:

```

{exp:channel:entries channel="education" disable="categories|member_data|pagination"}
<ul>
  {exp:playa:children channel="calendar_events" limit="5"}
    {exp:calendar:events event_id="{entry_id}" date_range_start="today" date_range_end="3 months"}
      {if calendar_no_results}
      No Events
      {/if}
      <li>{title}</li>
    {/exp:calendar:events}
  {/exp:playa:children}
</ul>
{/exp:channel:entries}

```

Doing this sort of works as it will output 'No Events' but it will do it twice as there are two entries selected in the Playa field that have passed.

If a event that hasn't passed (schedule for next month) that list will display the future event along with the 2 'No Events' for the other 2 passed events.

I've messed with Stash as well trying the calendar:events tag for the append\_list and placing the get\_list within channel and playa tags; see below.

```

{exp:calendar:events event_id="{entry_id}" date_range_start="today" date_range_end="3 months"}
{exp:stash:append_list name="cal_events"}
  {stash:item_title}{title}{if calendar_no_results}No Events{/if}{/stash:item_title}
{/exp:stash:append_list}
{/exp:calendar:events}

{exp:channel:entries channel="education" disable="categories|member_data|pagination"}
<ul class="icons-ul">
{exp:playa:children channel="calendar_events"}
  {exp:stash:get_list name="cal_events" limit="5"}
  <li>{item_title}</li>
  {/exp:stash:get_list}
</ul>
{/exp:channel:entries}

```

what am i missing?

thanks in advance!

# Answer
I've done this before with NSM Transplant. But I've been slowly removing it in favor of Stash. This question inspired me to finish the process with this template, so thank you!

First off, I think there might be a workflow problem with your question. I'm not sure how often people will be updating events but from what it sounds like is that when someone wants to add a new event, after publishing it they have to go back and edit Channel A to associate that event with the channel. I've found that for adding new events it's better that the Playa field is in the event itself. That way, adding an event only requires publishing a new entry that way, rather than publishing a new entry and editing a previous one.

You very well might have reason you've set it up that way. So my answer assumes your current workflow is correct.

First off, we need to get the event ids from the playa field, as in Stephen's answer. Some differences: I use the playa:children\_ids tag here which is perfect for stuff like this.

Second, you can't put a limit on this tag, but you really wouldn't want to. What if the first five found by playa were all expired Calendar Entries? There could be 20 others that are not expired and wouldn't show up. Best to leave the limiting to the Calendar tag itself.

```
{exp:stash:set name="eventids" parse_tags="yes" parse_depth="2"}
    {exp:channel:entries channel="education" disable="categories|member_data|pagination"}
        {exp:playa:children_ids channel="calendar_events"}
    {/exp:channel:entries}
{/exp:stash:set}

```

Next, I used Switchee myself instead of two if statements Stephen used. It gives me the chance to verify the data I got from playa was accurate with a regex statement.

In the Calendar:Cal tag is where I limit my returned events, since now we have all the potential events and not just the first five that could be expired Calendar Events.

```
{exp:switchee variable="stash:eventids" parse="inward"}
    {case value="#([0-9]+\|?)+#"}
        {exp:stash:set name="actualdata" parse_tags="yes" parse_depth="4"}
            {exp:calendar:cal event_id="{stash:eventids}" sort="asc" date_range_start="today"  show_months="3" pad_short_weeks="n" event_limit="5"}
                {if event_count == 1}<ul>{/if}
                    <li>{title}</li>
                {if event_total == "{event_count}"}</ul>{/if}
                {if calendar_no_results}
                    No Events
                {/if}
            {/exp:calendar:cal}
        {/exp:stash:set}
    {/case}
    {case value=""}
        {exp:stash:set name="actualdata"}
            No Events
        {/exp:stash:set}
    {/case}
{/exp:switchee}

```

Then you just stash:get your actualdata for whereever you stash:set your main content for your wrapper template.

If what I described to you with the workflow being off makes sense, this all still works with one slight change. You just have to change the children\_ids to parent\_ids once you put the Playa tag in the Calendar Events channel.
> 2 votes

# Answer
Try capturing the entry\_ids to set a stash value then use that value to define the calendars tag.

Grab the entry\_ids for the events.

```
{exp:stash:set parse_tags="yes"}
  {exp:channel:entries channel="education" disable="categories|member_data|pagination"}
    {stash:event_ids}0{exp:playa:children channel="calendar_events" limit="5"}|{entry_id}{/exp:playa:children}{/stash:event_ids}
  {/exp:channel:entries}
{/exp:stash:set}

```

`{stash:event_ids}` should output something like `0|32|54|73` which you can now use in your calendar tag pair.

```
{if "{stash:event_ids}" == ""}No Events{/if} {-- you may be able to remove the quote and brackets from the stash:event_ids tag --}
{if "{stash:event_ids}" != ""}
  <ul>
    {exp:calendar:events event_id="{stash:event_ids}" date_range_start="today" date_range_end="3 months"}
      <li>{title}</li>
    {/exp:calendar:events}
  </ul>
{/if}

```

The only thing I don't remember is if the `date_range_` parameters will override the `event_id` parameter.

**UPDATE**

You said the above didn't offer a way to display "No Events" if there were expired events in the Playa list of entry\_ids. You should be able to apply `{if calendar_no_results}{/if}` using the `exp:calendar:cal` tag with date ranges. See below.

```
{if "{stash:event_ids}" == ""}No Events{/if} {-- you may be able to remove the quote and brackets from the stash:event_ids tag --}
{if "{stash:event_ids}" != ""}
  {exp:calendar:cal event_id="{stash:event_ids}" date_range_start="today" date_range_end="3 months"}
    {if calendar_no_results}No Events{/if}
    {if event_count == 1}<ul>{/if}
      <li>{title}</li>
    {if event_total == "{event_count}"}</ul>{/if}
  {/exp:calendar:cal}
{/if}

```
> 3 votes

# Answer
I can't locally test this, but I thought if you could use some time of looping/increment plugin you could potentially use a couple conditionals to test and increment within the `{calendar_no_results}` tag. I was thinking this could work with the **Loop Plus** add-on:

```
{exp:channel:entries channel="education" disable="categories|member_data|pagination"}
<ul>
  {exp:playa:children channel="calendar_events" limit="5"}
    {exp:calendar:events event_id="{entry_id}" date_range_start="today" date_range_end="3 months"}
      {exp:loop_plus start="1" increment="1"}
          {if calendar_no_results}

                {loop_area}
                    {loop_count}
                {/loop_area}

          {/if}

          <li>{title}</li>

          {if count == total_results AND loop_count > 1}
            No Events?
          {/if}

      {/exp:loop_plus}
    {/exp:calendar:events}
  {/exp:playa:children}
</ul>
{/exp:channel:entries}

```
> 1 votes

---
Tags: playa, stash, solspace, solspace-calendar
---


# Question
Title: Assign parent category to entries with child categories (EE1)
In our EE1 installation we have the preference "Auto-Assign Category Parents" set to "No".

Now I am faced with a situation where for once particular set of categories it would be very useful to have this as "Yes" but It still probably makes sense for it to be "No" system-wide tho so we are still leaving it off as I don't believe there's any way to have it work just for one set of categories.

My question is this... Is there any way to "automatically" apply the parent category to all the entries that already have this particular subset of categories that I am interested in?

I see an EE2 answer here...

Automatically assign parent category to sub-category entries?

But I am in EE1.

I started to look at this in MySQL...

This query gives me all the entries that I would like have the parent category:

```
select distinct
    (t.entry_id)
from
    exp_weblog_titles t
        left join
    exp_category_posts cp ON t.entry_id = cp.entry_id
        left join
    exp_categories c ON c.cat_id = cp.cat_id
where
    t.weblog_id = 5 and c.parent_id = 4810
order by entry_id
limit 100000

```

But what if some of them already the parent category assigned? I don't want to categorize them twice. I think I need to use something like:

```
INSERT INTO exp_category_posts ...
WHERE NOT EXISTS
    (SELECT *
    from exp_category_posts
    where cat_id =  4810 and entry_id = ?this_entry_id?)

```

but the syntax is a little beyond me.

Since I framed this as primarily a mySQL question I've cross-posted it to SO casting the question a little bit differently.

# Answer
Depending how many entries need updating you can always bulk assign a category to multiple entries from the main edit page.
> 2 votes

---
Tags: categories, ee1, mysql
---


# Question
Title: Messages sent via the communicate panel error and are undelivered if a cc or bcc is included
EE v2.5.2

Messages sent via the communicate panel work OK and messages are delivered successfully.

But if an address is entered in the cc or bcc field then we get PHP error messages and the mail isn't delivered.

"For security reasons, extra headers for the mail() functionhave been disabled, please contact support for more information. Filename: libraries/Email.php Line Number: 1537"

"Cannot modify header information - headers already sent by (output started at /path/etc/etc/system/codeigniter/system/core/Exceptions.php:170) Filename: core/Common.php Line Number: 412"

Anyone got any ideas what to try?

# Answer
> 2 votes
> "For security reasons, extra headers for the mail() function have been disabled, please contact support for more information"

It sounds like your web host has disabled parts of PHP's mail function. You could try using one of the other mail delivery options (e.g. SMTP), or otherwise I would get in touch with your web host and ask them what they recommend.

# Answer
> 0 votes
This sounds like a bug so the first thing to try is update your ExpressionEngine version to the most current version which is 2.7.2

---
Tags: email, messages
---


# Question
Title: Dates before 1900 (even 1800) in EE 2.6?
With the changes to the way dates are handled in EE 2.6, can dates be set prior to 1900 (or even 1800) using the Date form field?

# Answer
So here's what I've found out:

* EE uses an INT database field to store a UNIX timestamp
* Because of this, EE can display dates back to about 1901
* Switching the database field from INT to BIGINT fixes the problem, but can dramatically increase the size of that database table

I discovered the INT vs BIGINT fix through a web search and tested it with success. I submitted a bug report (login required) with EllisLab about it proposing the fix. I am appreciative that they researched it and came to the conclusion that the potential for a dramatically increased database table is not in the best interest of most of its users.

Their solution: create a custom field type using the code from their date field type and changing INT to BIGINT for the newly-created custom field type. That seems both easy enough and reasonable to me.
> 4 votes

# Answer
Yep they can. My emphasis:

> Dates and Times Are Easy in ExpressionEngine 2.6
>
> Dates will still be stored in the database as Unix timestamps for the time being while it offers the best performance advantages under MySQL, so no need to change your add-ons there. **But don’t let that stop you entering dates pre-January 1, 1970, ExpressionEngine will handle it just fine.**

Out of curiosity I just gave it a try and it looks as though EE will save any pre-1970 dates with a negative timestamp:
> 3 votes

---
Tags: php, date, date-format, datetime
---


# Question
Title: Looping through channel entries with categories
For a given channel, is it possible to loop through the categories associated with its entries in alphabetical order, then nested-loop through the entries under that category? I'm trying to build a tree-view like template.

# Answer
> 2 votes
You can use the `category_archive` tag for this unless I've misunderstood your question: http://ellislab.com/expressionengine/user-guide/modules/channel/category\_archive.html

# Answer
> 1 votes
Something like this with Stash should do the trick:

```
{exp:channel:entries channel="news"}
    {categories}
        {exp:stash:append_list name="item_{category_id}"}
            {stash:title}{title}{/stash:title}
        {/exp:stash:append_list}
    {/categories}
{/exp:channel:entries}

```

---

```
{exp:channel:categories channel="news" style="linear"}
    <h2>{category_name}</h2>
    <ul>
        {exp:stash:get_list name="item_{category_id}"}
            <li>{title}</li>
        {/exp:stash:get_list}
    </ul>
{/exp:channel:categories}

```

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


# Question
Title: Conditionals inside Channel Entries tag to determine whether a second tag is required
## Current Setup

* I have 5 entries in the "internal\_ads" channel that rotate on the homepage.
* I have set up a category of "urgent" that has 1 entry in it.
* I'm using stash to set a list of adverts, then running through the list in my template to get them to rotate.

## What I want to happen

When an entry is added to the `urgent` category, I want that entry to be the *only* ad to display.

## What I've tried

I currently have the following in my initial template that sets the stash list and works correctly for getting the 5 ads.

```
{stash:embed:layouts:homepage}

{!-- Set data for Internal Adverts --}
     {exp:stash:set_list name="internal_ads" parse_tags="yes" parse_depth="2"}
          {exp:channel:entries channel="internal_adverts" dynamic="no" orderby="random" limit="1"}
                    {stash:url_title}{url_title}{/stash:url_title}
                    {stash:advert_title}{title}{/stash:advert_title}
                    {stash:short_description}{short_description}{/stash:short_description}
                    {stash:homepage_image}{homepage_image}{/stash:homepage_image}
         {/exp:channel:entries}
     {/exp:stash:set_list}

```

I have tried the following using conditionals to try checking if there's an entry in the `urgent` category and if there *isn't* then set the list as before. If there is, then only use that entry. It doesn't want to work and I can't really see why.

```
{stash:embed:layouts:homepage}

{!-- Set data for Internal Adverts --}
    {exp:stash:set_list name="internal_ads" parse_tags="yes" parse_depth="2"}
        {exp:channel:entries channel="internal_adverts" dynamic="no" orderby="random" limit="1" category="36"}
            {if no_results}
                {/exp:channel:entries}
                {exp:channel:entries channel="internal_adverts" dynamic="no" orderby="random" limit="1"}
                    {stash:url_title}{url_title}{/stash:url_title}
                    {stash:advert_title}{title}{/stash:advert_title}
                    {stash:short_description}{short_description}{/stash:short_description}
                    {stash:homepage_image}{homepage_image}{/stash:homepage_image}
                {/exp:channel:entries}
            {if:else}
                {stash:url_title}{url_title}{/stash:url_title}
                {stash:advert_title}{title}{/stash:advert_title}
                {stash:short_description}{short_description}{/stash:short_description}
                {stash:homepage_image}{homepage_image}{/stash:homepage_image}
            {/if}
        {/exp:channel:entries}
    {/exp:stash:set_list}

```

Any help is greatly appreciated.

# Answer
> 1 votes
There are a few different approaches to this. In my opinion I don't think this is an appropriate use of categories: rather, I would use a custom PT checkbox-group field called 'options', or alternatively use the 'sticky' functionality. Here's how you could use a PT checkbox group:

```
{exp:stash:set_list
    name="data"
    parse_tags="yes"
    parse_conditionals="yes"
    parse_depth="2"
}
    {exp:channel:entries
         channel="internal_adverts"
         dynamic="no"
         orderby="random"
    }
        {if {options:selected option="urgent"}}
            {exp:stash:set_value name="urgent" value="true"}
        {/if}

        {stash:options}{options}{/stash:options}
        {stash:url_title}{url_title}{/stash:url_title}
        {stash:advert_title}{title}{/stash:advert_title}
        {stash:short_description}{short_description}{/stash:short_description}
        {stash:homepage_image}{homepage_image}{/stash:homepage_image}

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

{!-- ==============================
TEST OUTPUT
=================================== --}

{exp:stash:parse process="end"}

    {if "{exp:stash:urgent}"}
        {exp:stash:get_list name="data" match="#Urgent#" against="options" limit="1"}
            <h3>Skirmish mode! Just show {advert_title}</h3>
        {/exp:stash:get_list}
    {if:else}
        <h3>Regular mode, loop through all ads:</h3>
        <ul>
        {exp:stash:get_list name="data"}
            <li>{advert_title}</li>
        {/exp:stash:get_list}
        </ul>
    {/if}

{/exp:stash:parse}

```

There are a few further examples of using these kind of 'switches' in Stash in my level-1 tutorial here: http://www.jamessmith.co.uk/articles/expressionengine-stash-tutorial-level-1#switches

# Answer
> 0 votes
Not that this will fix your issue but you have an extraneous {/exp:channel:entries} tag here:

---
Tags: channel-entries, categories, stash, conditionals
---


# Question
Title: EE pagination how to set limit and total rows
How can I set total row count in pagination using `exp:channel`. Hope limit will limit the result per page.

How can we set the total row limit?

# Answer
To display the total rows across all the pages of your pagination, you use `{absolute_results}` which can be **found here in the EE Docs**.

> This variable will always display the absolute total number of results that are returned by the tag, regardless of pagination.

---

The `limit=""` parameter is used to show a set number of entries per pagination page. **Docs here**.

> This parameter limits the number of entries on any given page. The limit will default to 100 entries if a value is not specified. If you are using pagination then this will determine the number of entries shown per page.
> 3 votes

---
Tags: pagination
---


title: Wygwam 3 no longer show table borders

text:
# Question
Title: Wygwam 3 no longer show table borders
Since updating to Wygwam 3, when you add a table it no longer shows table cell guides. So all you see is nothing. No way to see which cell you are in or even if a table was inserted at all. I understand that you can attach a style sheet to the Wygwam field and style the table that way... but it seems like a major usability issue that by default now tables are basically invisible. Is there anyway to fix this and make guides show up by default?

# Answer
> 1 votes
Yes, this absolutely sucks.

There is a workaround, try the following:

1) In the CP under addons -\> modules -\> Wygwam -\> editor configuration (your actual configuration, click on the name) specify a file in the field "css file", if you not already did so. probably it makes sense to store it in a folder themes/third\_party/wygwamAssets (but this has no effect on functionality).

2) create this file and enter some code to make the table-border visible, e.g.

```
table, td, tbody, tr, td span { border : 1px solid black;}

```

maybe you have to clear your browsers cache to see the effect. for me this worked.

# Answer
> 0 votes
I'm using Wygwam 3.2.1 and EE 2.7.2. By default Wygwam shows cell borders. I'd suggest upgrading to the latest version of Wygwam and EE.

---
Tags: pixelandtonic, wygwam
---


title: Content Elements wygwam not displaying

text:
# Question
Title: Content Elements wygwam not displaying
Can anyone tell me what I'm doing wrong here? Nothing displays at all. content\_elements it the name of my content elements custom field

```
 {content_elements}

  {wygwam}
  {if "{element_name}" == "Content Left Side" OR "{element_name}" == "Content Right Side" }
      <div class="col-lg-6">
         {value}
      </div>
      {if:else}
        <div class="col-lg-12">
            {value}
        </div>
   {/if}
   {wygwam}

{/content_elements}

```

# Answer
> 1 votes
Your closing `wygwam` tag needs a forward slash `/`.

```
{content_elements}

  {wygwam}
  {if "{element_name}" == "Content Left Side" OR "{element_name}" == "Content Right Side" }
      <div class="col-lg-6">
         {value}
      </div>
      {if:else}
        <div class="col-lg-12">
            {value}
        </div>
   {/if}
   {/wygwam}

{/content_elements}

```

---
Tags: wygwam, content-elements
---


# Question
Title: Carttrhob update not working, version_compare incorrectly returns true for older version
Does anyone know how to update Cartthrob from version 2.3x to 2.4? It's not working for us. The system thinks our version is less than 2.02x.

Therefore older version database scripts seem to be run, removing necessary database columns such as member\_id in cartthrob\_sessions table and giving database errors. So this completely messed up our update on a live site, deleting required columns.

# Answer
I have now found the issue.

In the Cartthrob update this Expression Engine check returns true when comparing the update version to a much older 2.02xxx version:

```
version_compare($this->current, $version, '<');

```

So updating to 2.4 from 2.3 will execute updates associated with 2.02xxx.

It seems the EE version\_compare script does not work when you have more than 2 digits after the dot.

So 2.02 works, 2.027 does not (or maybe it was 3 digits I cant remember).

This maybe a EE 2.7 issue, or Carttrhob using bad version numbers! I dont know.

In order for us to update Cartthrob we first had to restore an older database due to all the failed updates changes, then had to change the update script to remove any updates with "bad" version numbers.

I hope this post helps others due to no Cartthrob forum existing anymore.
> 1 votes

---
Tags: cartthrob
---


# Question
Title: What's the fastest way to post code to a blog post?
I find myself spending a lot of time when I have to create blog posts with code examples in them. What's the fastest way to do this? Is there a plugin that does it easier and faster?

Example: http://julianomoreira.com/notebook/article/php-mail-and-mac-os-x-mountain-lion

It took me a while. Would you share your workflow?

# Answer
If you have Wygwam installed, I'd recommend taking a look at GWCode SyntaxHighlighter.

http://gwcode.com/add-ons/gwcode-syntaxhighlighter

It's served me well for years now, and since it's integrated as a Wygwam toolbar button, it allows you to mix prose and code all in one single field.

Cheers, John
> 3 votes

# Answer
Checkout the EE syntax plugin from Eric Lamb at Mithra62:

http://devot-ee.com/add-ons/ee-syntax

I think that will help you do what you are looking for. It formats code based on the geshi library and supports a number of different syntax highlighting formats.
> 2 votes

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


title: Multiple Relationship Fields sort

text:
# Question
Title: Multiple Relationship Fields sort
how to get the sort number in relationship tag? the sort number is store in "order" in exp\_relationships. I need it to sort my data. but have no idea how to retrieve it.

# Answer
As posted here -- http://www.blue-dreamer.co.uk/blog/entry/ee2.6-new-relationship-tags -- you can use these variations of `{count}`.

Related Entries

```
{custom_field}
{if custom_field:count == "1"}
<h2>Related</h3>
<ul>
{/if}
<li>{custom_field:title}</li>
{if custom_field:count == custom_field:total_results}
</ul>
{/if}
{if custom_field:no_results}No related entries{/if}
{/custom_field}

```

Parent Entries

```
{parents field="custom_field"}
{if parents:count == "1"}
<h3>Parents</h3>
<ul>
{/if}
<li>{parents:title}</li>
{if parents:count == parents:total_results}
</ul>
{/if}
{if parents:no_results}No parent entries{/if}
{/parents}

```

Sibling Entries

```
{siblings field="custom_field"}
{if siblings:count == "1"}
<h3>Siblings</h3>
<ul>
{/if}
<li>{siblings:title}</li>
{if siblings:count == siblings:total_results}
</ul>
{/if}
{if siblings:no_results}No results{/if}
{/siblings}

```
> 3 votes

---
Tags: relationships
---


title: Saving stashed lists - to what end?

text:
# Question
Title: Saving stashed lists - to what end?
I am new to Stash's saving/caching system and from what I've seen so far it looks really useful.

Here's my thinking: I have a special offers section on a site, in the immediate future it is likely to have hundreds of entries in it.

Would this be the correct course of action?

1. Set a stash list called "special-offers" and grab all of the data from a channel entry loop and save that with the scope of site
2. Put that into a snippet, {sn\_set\_special-offers} and call this whenever I need a special offer
3. Whenever I need to read from that list, for example an individual special offer page I would use `match="#{segment_2}#" against="url_title"}` to emultate `dynamic="yes"`

Is this the correct way of doing things? To grab all of the data from EE channels into a stash list, cache that away and then use get\_list whenever data is needed?

# Answer
I don't tend to use Stash to duplicate the data model. In this case you would be adding a close coupling between the generation of the list and the individual offer pages. That adds fragility. As far as possible you should separate the functionality and presentation of your site into components that are not dependent on one other. You can and should still make reusable snippets of code but they should be generic and modular.

In this instance I would capture the list and use it wherever a list of offers is needed. The individual offer pages I would cache independently with full page caching.
> 3 votes

---
Tags: stash
---


# Question
Title: invalid_filename error when syncing upload directory
When I tried to synchronize my upload directories I kept getting the "invalid\_filename" error for all the files. What is happening and how can I fix it?

# Answer
I am using Focus Lab's EE master config so I had to add a trailing slash on my directory paths in the config file.

This is what I had:

```
 1 => array(
      'name'        => 'Images',
      'server_path' => $base_path . '/uploads/images',
      'url'         => $base_url  . '/uploads/images/'
 )

```

This is what fixed it:

```
 1 => array(
      'name'        => 'Images',
      'server_path' => $base_path . '/uploads/images/',
      'url'         => $base_url  . '/uploads/images/'
  )

```
> 2 votes

---
Tags: file-uploads, sync
---


# Question
Title: Display the number of entries in a channel
I would like to display the total number of entries for a channel and nothing else is required to be displayed.

Is there a more efficient way to do this than the following?

```
{exp:channel:entries channel="products"}
  {if count == total_results}
    {count}
  {/if}
{/exp:channel:entries}

```

# Answer
> 9 votes
Use the built-in Stats module:

```
{exp:stats channel="products"}{total_entries}{/exp:stats}

```

Or the Query module:

```
{exp:query sql="SELECT total_entries FROM exp_channels WHERE channel_name = 'products'"}
{total_entries}
{/exp:query}

```

http://ellislab.com/expressionengine/user-guide/modules/statistics/index.html#total-entries

# Answer
> 7 votes
From performance view is better to use query for this:

```
{exp:query sql="SELECT count(*) as total_results FROM exmx_channel_titles WHERE channel_id = '2' "}
total results: {total_results}
{/exp:query}

```

---
Tags: entries, count
---


# Question
Title: Admin control panel access behind firewall
The company is extremely concerned with security. There is a lot of sensitive data on the servers and this is understandable. What I struggle with is getting many of the addons to operate properly, as well as some core functionality due to this setup. I have no control over the setup so I need to try and figure a way of configuring EE to comply.

**The setup is as follows:**

Admin is contained on a sub-domain of the primary site and sits behind a firewall. So an example would be something like CP Access and System files are at http://admin.eesite.com and the public site is at http://www.eesite.com

The public site is open to the world. The admin is behind a firewall in which you must be connected to the internal network before you have access.

Most things function as they should, but this has proven to be an extremely problematic setup for using add-ons, and tiresome for performing updates, etc. because it is an MSM install and each leg of the site has this same setting for each segment.

Most of the problem I run into are 403 or standard 500 errors. Everything is hosted on windows servers via IIS7.

I am running EE 2.7.2

# Answer
This became way too problematic and another solution was suggested to the server admins which they accepted. This solution allowed for the more typical ExpressionEngine setup and environment which removed all of these problematic issues.
> 1 votes

---
Tags: ee2, add-on, control-panel, iis, administration
---


# Question
Title: Control Panel with Masked CP CORS issues
* MSM Setup
* EE 2.7.2

---

The site I am working on has masked CP access sitting on a subdomain of the site. This is a MSM setup in which the MSM sites are subdomains of the primary site.

Something like:

1. site.com
2. sub1.site.com
3. sub2.site.com
4. etc...

The masked CP access is setup so that each 'site' has its own location for the contributing groups to access independently.

So again, something like:

1. admin.site.com
2. admin.sub1.site.com
3. admin.sub2.site.com
4. etc...

All of the core files are located in the primary site admin folder (admin.site.com).

The site index.php files are in their respective site folders (site.com, sub1.site.com, etc...)

The admin.php files for the various admin folders has been renamed to index.php so that the contributing users can navigate to a clean URL of http://admin.sub1.site.com to get to that site segment's CP.

I am running into a lot of issues with resources not having permissions, CORS, etc. especially when using fieldtypes like wygwam when their is a NSM LiveLook tab. The NSM LiveLook tab errors with cross domain issues since it uses iframes to preview with when someone tries to use the embed media tool on wygwam.

Has anyone else run into issues like this? Are there any known solutions?

# Answer
This issue was resolved along with other issues that were determined as coming from the same source. There is a post here which was related.
> 0 votes

---
Tags: ee2, wygwam, multi-site-manager, subdomain, livelook
---


# Question
Title: Getting image files for META tags if in entry
Basic blog setup using Wygwam for the primary field in the entry. Inside the file management, I have Image Manipulations set to manipulate any images uploaded and used formatted for social media. For instance, since the twitter images for twitter card data must be at least 280x150, I just create better optimized images for them and they are dumped in a sub-folder of images named "\_Twitter\_Card\_Image".

Is there any way to find if an entry has an image in the Wygwam field and add a META tag for each image used?

Something like:

```
{wygwam-field}
    <meta name="twitter:image:src" content="{twitter-image-location}">
{/wygwam-field}

```

I've never done this before. It may be something pretty simple that I'm over thinking.

*** EDIT ***

Sorry, I should have been more clear. (Trying to post and answer questions when people walk up.)

I know of the images only tag. I wasn't exactly clear about the needs. I need the alternate image source for the Image Manipulation option spoken of above.

```
{my_wygwam_field images_only="yes"}
    <meta name="twitter:image:src" content="{twitter-image-location}">
{/my_wygwam_field}

```

*** UPDATE ***

```
<!-- Twitter summary card with large image must be at least 280x150px -->
{app_primary_copy images_only="yes"}
    <meta name="twitter:image:src" content="{exp:low_replace find='/appraisers/' replace='/appraisers/_Twitter_Card_Image'}{src}{/exp:low_replace}">
{/app_primary_copy}

<!-- Open Graph data -->
<meta property="og:title" content="{title}" />
<meta property="og:type" content="article" />
<meta property="og:url" content="{current_url}" />
{app_primary_copy images_only="yes"}
    <meta property="og:image" content="{src}" />
{/app_primary_copy}
<meta property="og:description" content="{exp:eehive_hacksaw chars = '150' append = '...'}{app_primary_copy}{/exp:eehive_hacksaw}" />

```

So the hacksaw info comes in just fine, but the rest of the info that's wrapped in EE Tags is completely blank. Basically, the wygwam tags aren't producing any results. No HTML or anything. It's like there is nothing there at all.

# Answer
> 0 votes
Wygwam has an Images-only Mode you can use for this.

```
{your_wygwam_field images_only="yes"}
     <meta name="twitter:image:src" content="{src}">
{/your_wygwam_field}

```

http://docs.pixelandtonic.com/wygwam/templating/field.html#images-only-mode

UPDATE to address your image path question

Since EE is systematic about storing manipulated versions of an image in a subfolder named after the manipulation, and otherwise uses the same filename, you could just use Low Replace. The exact parameters you use will depend on your setup, but for the sake of example if your image upload directory is "assets/twitter" and your manipulation is called "card" you can use

```
{your_wygwam_field images_only="yes"}
     <meta name="twitter:image:src" content="{exp:low_replace find="/assets/twitter" replace="/assets/twitter/_card"}{src}{exp:low_replace}">
{/your_wygwam_field}

```

---
Tags: wygwam, image, file-manager
---


# Question
Title: Expresso Store - limit number of items in a cart
Is there any way to limit only one item in a cart overall?

I want to give the client the ability to add one thing and one thing only to the cart, effectively disabling anything else unless they remove the item they have in cart itself?

{exp:store:cart limit='1'} seems too easy...?

# Answer
You can do this by building a conditional using `{qty_in_cart}` to show the Add To Cart:

```
   {exp:store:product entry_id="{entry_id}"  return="/checkout"}
        {if qty_in_cart == "0"}
            <select id="item_qty" name="item_qty">
                <option value="1">1</option>
            </select>
            <input type="submit" name="submit" value="Add To Cart">
        {if:else}
            <p>Limit 1 per order</p>
        {/if}
    {/exp:store:product}

```

---

Also, remove the ability to change quantity on the My Cart page... The user should only be able to delete the product from the cart.
> 2 votes

# Answer
What Anna said, although note that the `{qty_in_cart}` variable only refers to the current product. If you want to prevent the custom from purchasing any other items, you could either wrap your whole product form in a conditional:

```
{exp:store:cart}
    {if no_items}
        // product form here
    {/if}
{/exp:store:cart}

```

Alternatively, you could just empty the cart every time a new product is added:

```
{exp:store:product entry_id="1" empty_cart="yes"}
    // add to cart button here
{/exp:store:product}

```
> 3 votes

---
Tags: expresso-store, shopping-cart
---


title: Embed, Stash Conditionals problem

text:
# Question
Title: Embed, Stash Conditionals problem
I have this code

```
{if {embed="common/.get-gender-url-title" chosen_gender_id="{exp:stash:get name='chosen_gender_id'}"} != 'male'}

```

I get this error

```
Parse error: syntax error, unexpected '{' in .../system/expressionengine/libraries/Functions.php(679) : eval()'d code on line 138

```

So I tried this

```
{if "{embed="common/.get-gender-url-title" chosen_gender_id="{exp:stash:get name='chosen_gender_id'}"}" != 'male'}

```

But I get this error

```
A PHP Error was encountered
Severity: User Warning
Message: Invalid EE Conditional Variable: {if "embed="common/.get-gender-url-title" chosen_gender_id="2"}
Filename: libraries/Functions.php
Line Number: 2761

```

What do I need to do to make these code block work?

**UPDATE**: This is the contents of the embed file

```
{exp:low_replace find="\r|\n|\t" replace="" regex="yes"}
    {exp:channel:entries
        channel="genders"
        disable="categories|category_fields|member_data|pagination"
        dynamic="no"
        orderby="entry_id"
        sort="asc"
    }
        {if '{embed:chosen_gender_id}' == entry_id}
            {url_title}
        {/if}
    {/exp:channel:entries}
{/exp:low_replace}

```

# Answer
Change your quotations:

`{if '{embed="common/.get-gender-url-title" chosen_gender_id="{exp:stash:get name='chosen_gender_id'}"}' != 'male'}`

**UPDATE**

Sorry for the crappy first answer. Your issue is, as always, a parse order issue.

Embeds are parsed *after* conditionals, so the conditional is reading the embed code directly (not parsed) as notacouch mentioned. Since you are using Stash, use it all the way.

Put your embed code into a Stash embed. Then call it in your template where you need to, but after your `{exp:stash:set name='chosen_gender_id'}...{/exp:stash:set}` tag.

```
{stash:embed:gender-url-title process="start" parse_stage="set"}

```

Does that do anything magical?
> 2 votes

# Answer
I would avoid using an embed in that case.

An embedded template is the second to last thing to be processed, see ExpressionEngine's Parse Order courtesy Lowe.

If you want to re-use that code you can use it in a snippet (and use an add-on like Brian Litzinger's Snippet Sync to manage snippets as files if that's what's been preventing you from using snippets).

so e.g. your `{snippet:getgenderurltitle}`'s contents could be like (replace embed with `{stash:get...}` ):

```
{exp:low_replace find="\r|\n|\t" replace="" regex="yes"}
    {exp:channel:entries
        channel="genders"
        disable="categories|category_fields|member_data|pagination"
        dynamic="no"
        orderby="entry_id"
        sort="asc"
    }
        {if '{exp:stash:get name="chosen_gender_id"}' == entry_id}
            {url_title}
        {/if}
    {/exp:channel:entries}
{/exp:low_replace}

```

and stash that, e.g.

```
{exp:stash:set name="get_gender_url_title" parse_tags="yes" trim="yes"}
  {snippet:getgenderurltitle}
{/exp:stash:set}

```

Then for your conditional you can use Switchee:

```
{exp:switchee parse="inward" variable="stash:get_gender_url_title"}
  {case value="male"}
    {!-- do nothing --}
  {/case}
  {case default="Yes"}
    {!-- do something --}
  {/case}
{/exp:switchee}

```

**channel:form comment EDIT**

I'm not really familiar with safecracker/channel:form. Can you not use the Query Module for that? E.g.

```
{exp:query sql="SELECT url_title AS gender_url_title FROM exp_channel_titles WHERE url_title != 'male' AND entry_id = '{exp:stash:chosen_gender_id}'"}
  {gender_url_title}
{/exp:query}

```

you may not be able to use the no results conditional, in that case stash the results/lack thereof (with parse tags & trim) and use `{exp:stash:not_empty ...}`

**No SQL comment EDIT**

You can just stick to embedded templates, then. Except instead of running your conditional in the same template, do it in another one saving any variables you need via stash so you can re-use them in the embedded template.

E.g. your initial embedded template (taking out low replace for stash with trim)

```
{exp:stash:set name="gender_url_title" parse_tags="yes" parse_conditionals="yes" trim="yes"}
    {exp:channel:entries
        channel="genders"
        entry_id="{embed:chosen_gender_id}"
        limit="1"
        disable="categories|category_fields|member_data|pagination"
        dynamic="no"
        orderby="entry_id"
        sort="asc"
    }
            {url_title}
    {/exp:channel:entries}
{/exp:stash:set}

```

Then you ought to be able to run your conditional in another embedded template right afterwards (this would be the contents of that embedded template) (untested but it ought to work):

```
{if {exp:stash:not_empty name='gender_url_title'}
  {if "{exp:stash:get name='gender_url_title'}" != "male"}
    {!-- run code here --}
    ...{exp:stash:get name="saved_channel_form_variable..."}...
  {/if}
{/if}

```
> 2 votes

---
Tags: stash, embeds
---


# Question
Title: Playa update fails for EE2.6 & Playa 4.4.5
I am running EE2.6.1 and want to upgrade my Playa addon from version 4.1.0.3 to 4.4.5.

I was running into the same errors as posted previously here, then reverted back to the previous Playa version and tried again.

This worked locally, but not on my production install.

I followed the upgrade instructions by replacing both folders and going through Add-Ons \> Fieldtypes \> Playa to run the upgrade script.

When I examined the database through phpMyAdmin, I could not find any column `parent_is_draft` in either database - local or production. However, the local EE install shows "4.4.5" in Add-Ons \> Fieldtypes \> Playa, while the production install shows the old version.

For the time being I've rolled back to the old version. What steps can I try next?

Thank you!

Edit: Just like reported here I see different versions: When going to Add-Ons \> Modules \> Playa, EE shows "4.4.5".

# Answer
> 2 votes
This finally worked for me:

* Tools \> Data \> SQL manager
* Database Query Form
* enter queries:

```
ALTER TABLE exp_playa_relationships ADD parent_var_id INT(6) UNSIGNED AFTER parent_row_id, ADD INDEX (parent_var_id)

ALTER TABLE exp_playa_relationships ADD parent_is_draft INT(1) UNSIGNED NOT NULL DEFAULT 0 AFTER parent_var_id
```
* Submit

# Answer
> 3 votes
After updating Playa and it failing to run it's DB schema, here's what you can try: Take a look at the columns in exp\_playa\_relationships table in the database.

* Does it have a field parent\_var\_id? If no, then the version you should set is 4.1.
* If yes, does it have a field parent\_is\_draft? If no, then the version you should set is 4.3
* If yes, then the version you should set is 4.4.5

Now, set the version number we determined in the previous three steps for the Playa field in the exp\_fieldtypes table and go visit the Add-ons -\> Fieldtypes -\> Playa page and hit submit.

Everything should be all working now.

---
Tags: playa
---


# Question
Title: Sandbox Recurring Payments with SCM are just regular payments?
So I'm trying to test recurring payments/subscriptions with EllisLab's Simple Commerce Module.

I've got sandbox buyer/merchant accounts setup. Former has generated verified bank, latter has enhanced recurring payments enabled, encrypted payments enabled, IPN enabled (I receive DEBUG emails and logged in member purchases appear).

Everything seems to be in order... but when I make a recurring payment via the `{subscribe_now_url}` link it only seems to be a regular payment.

These are individual test purchases from the buyer's account screen:

And here is a sample of daily recurring payments from another project that used the Express Checkout API (note the *"**Recurring** Payment To"* as opposed to *"Payment To"*):

In the Simple Commerce Module Edit Purchases tab it shows the purchases as "Recurring". However, there is no sign of it being a recurring payment anywhere else, neither on the sandbox Buyer's end, nor on the sandbox Merchant's end. Is it still somehow a recurring payment? Does it start recurring payments the next day (testing as daily subscription)? Am I missing something?

**EDIT**

Tested with encrypted payments turned off and it works. My head hurts.

# Answer
> 3 votes
Really simple bug in Simple Commerce Module.

Open up `mod.simple_commerce.php` and look for where it's supposed to encrypt the subscribe data, it's around line 200. If you look carefully you'll find it's encrypting data for a regular payment not the `$subscribe` variable immediately above. Yeah, just change it to use `$subscribe` for encryption.

Mission accomplished.

**edit:** looked for a bug report on this and couldn't find one, so filed one here (contains actual code): https://support.ellislab.com/bugs/detail/19896

---
Tags: paypal, subscriptions
---


# Question
Title: exp:channel:form date undefined with datepicker
I updated today one of our EE installation from 2.6.1 to 2.7.2 and one of the changes was going from safecracker to EE forms.

All working well except when I use date picker for entry date and closing date. Entry date, by default formatting looks ok, but as soon as I change the date it appear with undefined (example: **2013-11-12un12efine12**). Same happens to Expiry date as well.

I've added the css as required and it seems fine:

```
<link href="{path=css/_ee_channel_form_css}" type="text/css" rel="stylesheet" media="screen" />

```

and it starts with

```
{exp:channel:form channel="jobs" return="/jobs/booking/ENTRY_ID"  include_jquery="yes"}

```

And I believe this is correct as well.

This is the page http://www.youthworks.net/jobs/booking

If anyone have an idea where something is wrong, I would love to hear from you.

Cheers

# Answer
> 2 votes
It might be this bug: https://support.ellislab.com/bugs/detail/19782 which affected me, and the fix worked as well:

> Known Solution: -------------- Try editing system/expressionengine/modules/channel/libraries/Channel\_form/Channel\_form\_lib.php around line 966 so it looks like:
>
> ```
> if ($this->datepicker)
>   {
>    $js_defaults['ui'][] = 'datepicker';
>    $js_defaults['file'][] = 'cp/date';
>
>   }
>
> ```
>
> You’re just adding the $js\_defaults\[‘file’\]\[\] = ‘cp/date’;.

---
Tags: forms
---


# Question
Title: zoo visitor - display members based on category
I have a category select menu that will select a category from the zoo\_visitor channel. THis will then load a page with the selected category in segment\_3. Problem is the zoo\_visitor members are not responding dynamically based on the category selected in segmetn\_3

Here is the select menu:

```
<form name="catmenu" action="">
  <select name="selcat" onchange="location=document.catmenu.selcat.options[document.catmenu.selcat.selectedIndex].value;">
  <option value="">Filter by Riding</option>
    <optgroup label="group 39">
    {exp:channel:categories cache="yes" refresh="60" channel="zoo_visitor" disable="category_fields" style="linear" category_group="39" show_empty="no"}
        <option value="{path='Riding'}">{category_name} </option>
    {/exp:channel:categories}
    </optgroup>
    <optgroup label="group 41">
    {exp:channel:categories cache="yes" refresh="60" channel="zoo_visitor" disable="category_fields" style="linear" category_group="41" show_empty="no"}
        <option value="{path='Riding'}">{category_name} </option>
    {/exp:channel:categories}
    </optgroup>
 </select>
</form>

```

this displays a url like: http://domain.com/index.php/Riding/category/cat\_name

this template has the code:

```
 {exp:zoo_visitor:members limit="99" member_group="5" orderby="random" dynamic_parameters="orderby|limit|sort|category|member_lastname" status="Members-id5" }
 <h2>{visitor:member_firstname} {visitor:member_lastname}</h2>
      <p>{visitor:member_level_of_government}<br />
      Region: {categories show_group="42"}{category_name}{/categories} </p>
  {/exp:zoo_visitor:members}

```

Problem is ALL members from group\_5 are displayed and not ONLY those have the segment\_3 selected

# Answer
Just came across this post, for anyone else that may be looking for similar answers to this question. I've used this type of code on pages to display member details based on a number of variables with no problems to date. Here's my take:

```
{if segment_3 == ""}
 <p>no results</p>
{if:else}
{exp:zoo_visitor:details limit="99" url_title="{segment_3}" member_group="5" status="Members-id5}
  <h2>{visitor:member_firstname} {visitor:member_lastname}</h2>
  <p>{visitor:member_level_of_government}<br />
  Region: {categories show_group="42"}{category_name}{/categories} </p>
{/exp:zoo_visitor:details}
{/}if

```

The form submitted will provide a set of conditional rules that determine the information displayed on the result page. The result page needs to be setup to enable the conditions to be met or otherwise return an error response.

The first IF conditional should provide a response if the segment\_3 is empty (which can be a result of a search engine link) and advise the visitor accordingly.

If the segment\_3 condition is met with content, the zoo\_visitor:details field will then provide a result based on using the url\_title of segment\_3 and also the group and status of the entries.
> 1 votes

---
Tags: categories, zoo-visitor, dynamic
---


title: Admin 403 Forbidden Errors

text:
# Question
Title: Admin 403 Forbidden Errors
I'm running into a strange problem. I have a site that is managed by a client. A couple of days ago, they started noticing that things weren't working correctly in the admin. I checked it and found that there were errors showing up in the dev console. Here are the errors I get on the admin landing page:

> NetworkError: 403 Forbidden - ...admin.php?S=11606155886845716ce19d7cdde155fc5d604080&D=cp&C=javascript&M=load&file=css&theme=default&v=1312216958

> NetworkError: 403 Forbidden - ...admin.php?S=11606155886845716ce19d7cdde155fc5d604080&D=cp&C=javascript&M=combo\_load&ui=core,widget,mouse,position,sortable,dialog&plugin=ee\_focus,ee\_notice,ee\_txtarea,tablesorter,ee\_navigation&file=cp/global&effect=core&v=1312216960

> NetworkError: 403 Forbidden - ...admin.php?S=11606155886845716ce19d7cdde155fc5d604080&D=cp&C=javascript&M=combo\_load&file=cp/homepage&v=1312216960

> NetworkError: 403 Forbidden - ...admin.php?S=11606155886845716ce19d7cdde155fc5d604080&D=cp&C=javascript&M=load&file=css&theme=default&v=1312216958

> NetworkError: 403 Forbidden - ...admin.php?S=11606155886845716ce19d7cdde155fc5d604080&D=cp&C=javascript&M=combo\_load&ui=core,widget,mouse,position,sortable,dialog&plugin=ee\_focus,ee\_notice,ee\_txtarea,tablesorter,ee\_navigation&file=cp/global&effect=core&v=1312216960

> NetworkError: 403 Forbidden - ...admin.php?S=11606155886845716ce19d7cdde155fc5d604080&D=cp&C=javascript&M=combo\_load&file=cp/homepage&v=1312216960

All JavaScript interaction is killed (dropdown menus, tabs, etc.), and it happens in all browsers. I've checked all the file permissions that I'm sure about and they haven't changed. As far as I know, nothing has been touched for a long time on the server. The client makes frequent updates to the site, but I don't see how they'd be able to cause such errors.

Granted, it's an older version (v 2.2.2), but it's been working fine up until a few days ago. Anyone have any ideas?

**UPDATE:** Nevermind, folks. After finding the same thing happening on another site, hosted on the same server, I've determined it was a change in the server config by the host. Currently working it out with them.

# Answer
I recently had this problem when my hosting provider, Eleven2, updated our shared hosting server's configuration. The problem seems to be "mod\_security" blocking these requests.

To fix the problem disable mod\_security in your .htaccess file by adding the following lines:

```
<IfModule mod_security.c>
SecFilterEngine Off
</IfModule>

```
> 3 votes

---
Tags: admin
---


# Question
Title: Javascript Notification Plugin - Capture message and params
Please see JavaScript Notification Plugin for reference.

Question: Is it possible to "capture" the message and params of `$.ee_notice()` any time it's run in the CP?

I'd like to use destroy to hide the default notification but, still be able to use the message and params as I see fit via my own js/jQuery.

One place this appears to run is when saving publish layouts for what ever it's worth.

Thanks!

# Answer
*update* looks like this task is not so simple as looks like - can't find where some notice even is registered (like for save custom field setting - looks like it is flashdata).

I made a quick example using HubSpot Messaging \+ ee\_notice replacement as combination of JS & hooks - CP Notice

*before* Why just don't replace it with ext.?

```
function cp_js_end( $data ) {
    if ($this->EE->extensions->last_call !== FALSE)
    {
          $data = $this->EE->extensions->last_call;
    }

    $out = '
        $(function () {
            $.ee_notice = function (a, k) {
        alert(a);
        }
        $.ee_notice.destroy = function () {

    }

        });

    ';

     $data .= $out;

    return $data;
}

```
> 3 votes

---
Tags: control-panel, javascript, jquery, notification, messages
---


# Question
Title: Retrieve Assets file data from custom module
I'm writing a custom module that's going to need to retrieve channel data using a direct database query.

One of the custom fields is an Assets image and I need to get the full image URL and alt\_text in the most efficient way possible.

Is there a "best practice" way to get all this data out of Assets when armed with an entry ID and custom field ID? In pseudo-code I'd quite like to do this:

```
$assets = new Assets;
$file = $assets->getFileData($entry_id,$field_id);

$url = $file->url;
$alt_text = $file->alt_text;

```

Alternatively I could JOIN the necessary tables in my query but it looks like there would be quite a few.

# Answer
> 2 votes
The quick way would be to use an SQL query (something like http://pastie.org/private/x6uue9y6ieqvlqf6ai59q), but that would not get you the URL, though, as that depends on several other settings. If you're confident that the settings for the upload folder (or Assets external source) for that will never change, this will probably not be an issue for you.

The neat way would be to use the Assets API with something like this: http://pastie.org/private/bzcqi92f3wqy0htqm3w. That would return you an instance of Assets\_base\_file.

You would still have to use a query to get the file\_id from exp\_assets\_selections, though.

I'll add the "get\_file\_by\_entry\_and\_field" method to the feature list for the next release of Assets, but I don't have any estimates on when will that arrive, though..

# Answer
> 1 votes
I would load Assets library and use it. Example from one of my addons:

```
$this->EE->load->add_package_path(PATH_THIRD.'assets/');
$this->EE->load->library('assets_lib');
$src = $this->EE->assets_lib->get_file_url($file_id);
$this->EE->load->remove_package_path(PATH_THIRD.'assets/');

```

Unfortunately Assets don't really have developer's documentation, but function names mostly speak for themselves.

---
Tags: assets, add-on-development
---


# Question
Title: Variable recipients? (validation of name and email + name notification)
I'm using Freeform 4 and I have to create a Tell a friend page to send e-mails to multiple friends (maximum of 10). Each friend input will have the friends Name + their e-mail address.

The form is variable (1 friend name / friend email input is shown, with a button to add more)

I already found out that I can use brackets for multiple recipients, e.g. I know have:

```
<label>Name friend 1</label>
<input type="text" name="friend_name[]">
<label>Emailaddress friend 1</label>
<input type="text" name="recipient_email_user[]">

<label>Name friend 2</label>
<input type="text" name="friend_name[]">
<label>Emailaddress friend 2</label>
<input type="text" name="recipient_email_user[]">

<a href="#">+ Add another friend</a>

```

**My first question**

How can I set the friend\_name\[\] and recipient\_email\_user\[\] as required? I'm trying to show inline errors at the corresponding fields. Is this doable with Freeform?

**My second question**

How can I retrieve the friend\_name\[\] in the notification so I can begin every e-mail to friends with Hi {name}?

# Answer
> 1 votes
**First question**

I assume `friend_name` is a custom field, so you would use `required="friend_name"` as a parameter. If you have `recipients="yes"` and a recipient form field (i.e. recipient\_email or recipient\_email\_user), Freeform should be able to detect if recipients have been filled out or not.

**Second question**

Since you have potentially multiple `friend_name`s entered in the form, this data will be newline-delimited in Freeform's database table. You'll need PHP to break those apart (using PHP's explode() function for example), but this would be possible only in the email notification body. First, use an {embed} to a template that has PHP enabled, then break apart the friend\_names. This is a very loose example of what I mean by "breaking up" the names.

```
<?php $names = explode("\n", '{embed:friend_names}');?>
<?php foreach($names as $name) {
    echo $name . ',';
}?>

```

Unfortunately, there is no way to pick only **one** name out of your `friend_name`s. Freeform sends the same email notification to all recipients.

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


# Question
Title: Freeform 4.x doesn't upload files but no error occurs
When manually creating a freeform form, I have a series of file upload options which I'm creating as follows:

```
{exp:freeform:form form:id="freeform" template="career_applications" return="" collection="career_applications" file_upload="Careers" allowed_file_types="pdf|doc|docx|rtf|txt" notify=""}
<input type="hidden" value="{title}" name="job_title" />
<fieldset class="careers-application">
                    <legend class="hide">Apply for this job</legend>
                    <div>
                        <label for="textApplicantFullName">Full name:<span class="mandatory">*</span></label>
                        <input type="text" id="textApplicantFullName" name="name" class="input-text" required />
                        <label for="textApplicantEmailAddress">Email address:<span class="mandatory">*</span></label>
                        <input type="text" id="textApplicantEmailAddress" name="email" class="input-text" required />
                        <label for="fileApplicantCV">Attach CV:<span class="mandatory">*</span></label>
                        <input type="file" id="fileApplicantCV" name="file1" class="input-file" required />
                        <label for="fileApplicantCoverLetter">Cover letter:<span class="mandatory">*</span></label>
                        <input type="file" id="fileApplicantCoverLetter" name="file2" class="input-file" required />
                        <p><strong>Closing date:</strong> <span class="text-orange">{expiration_date format="%j %F %Y"}</span></p>
                        <div class="shadow top"></div>
                        <div class="shadow base"></div>
                    </div>
                    <div>
                        <button class="button green" type="submit">
                            Apply for this job now <i class="icon"></i>
                        </button>
                    </div>
                </fieldset>
{/exp:freeform:form}

```

the problem appears that the files aren't being uploaded, but the form is still being processed with no errors.

Checking the folder location permissions, path is correct, XSS filtering disabled, spellings etc all to no avail.

# Answer
The problem lies in that you can upload multiple files using FreeForms File Upload Field Type - so you can't just use name="file1" as your field name.

To make this work, you have to pass the field type as a post array, so name="file\[0\]" for the first file (and if you have multiple files name="file\[1\]", name="file\[2\]" and so on.

So, the resolution (for me at least), was to simply append \[0\] at the end of the field name. It's taken me a couple of hours to figure this out, hence why I'm writing it up here so that anyone else who comes across this problem, gets it resolved relatively quickly.
> 5 votes

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


title: Exp channel give category condition

text:
# Question
Title: Exp channel give category condition
I want to set a condition for category in exp channel tag which should result in a condition: "where category = 3 and category=2" How can I give this condition in exp? "category=3&2 " and category="3|2" not getting the correct results,they return the same query If anyone knows, please help.

Many Thanks

# Answer
> 2 votes
You'll want to use something like this:

```
{exp:channel:entries channel="your_channel" category_group="your_cat_group" category="2&3" dynamic="no"}

```

My understanding of it is as follows:

"2&3" - This returns all entries which are tagged as belonging to 2 AND 3.

"2|3" - This returns all entries which are tagged either 2 or 3.

So, the first will only return entries that have both categories set and the latter will get all categories where both are set OR only one of them.

---
Tags: channel
---


# Question
Title: Zoo visitor registration form hidden member group
Does anyone know how to have a hidden field within a zoo visitor registration form which automatically chooses which member group they will go in? This is my code, which doesn't work:

```
{exp:zoo_visitor:registration_form error_handling="inline" return='supporters/support-us/success' allowed_groups="9"}
<input type="hidden" name="group_id" value="9" id="group_id" />

```

My default options set in the control panel under member preferences are for 'self-activation via email' and they go in to the 'members' member group. But for this particular form I want anyone completing it to go to a different member group, called 'supporters', group id is 9. At the moment they're just going in to the 'members' group after activating through their email, so I guess it's ignoring my hidden field?

Any help would be very much appreciated.

# Answer
Everything looks fine with your markup. Make sure that the Supporters member group isn't locked at the moment as only Super Admin's can assign members to that group.

I'm assuming also you have the closing `exp:zoo_visitor:registration` tag in your template.
> 1 votes

---
Tags: zoo-visitor, registration
---


title: Multi Site Manager On Multiple Servers

text:
# Question
Title: Multi Site Manager On Multiple Servers
The user guide for the multi site manager states that one requirement is that all sites must reside on the same server. I was wondering if anyone could please explain why this is the case?

I need to possibly setup multiple instances of the same EE installation on different servers using the same domain and connecting to the same database. However, the EE installation I have uses multi site manager, which leads me to believe that this will not be possible.

Any clarification anyone can provide on this will be much appreciated.

# Answer
The index.php and admin.php files in each site's document root references the shared system directory for all the sites. So, if the sites were on different servers you wouldn't be able to access the system folder path which lies on another server.
> 1 votes

---
Tags: multi-site-manager, server
---


# Question
Title: Show list of entries from specific category while showing a detail
i'm creating a portfolio site where artists can show projects. artists are a category

on a project page (from an artist) i want to show the artists other projects as well. this seems simple but i'm not sure how to do this:

```
// get the category_id
    {exp:channel:entries channel="projects" status="open" limit="1" orderby="entry_date" sort="asc"}
        {categories show_group="1"}
           // parents from the categories are not artists but artist groups
            {if category_id != "1" AND category_id != "2" AND category_id != "3" AND category_id != "4"}
                <?php $artistid="{category_id}"; ?>
            {/if}
        {/categories}
    {/exp:channel:entries}

// show all titles from the category id (artist id)
    {exp:channel:entries channel="projects" category="<?php echo $artistid ?>" status="open" limit="50" orderby="entry_date" sort="asc" dynamic="off"}
         {title} /
    {/exp:channel:entries}

```

eg on portfolio/project/test-dave-eerste-van-de-dag, the artist\_id is 6 but it doesn't work in the second exp:channel:entries. php is on output. probably it goes wrong with both input and output. there must be an easier way to do this!

# Answer
I would try using an embed to pass through your php variable. So the first half stays the same then:

```
// show all titles from the category id (artist id)
    {embed="template_group/template_name" cat_id="<?php echo $artistid ?>"}

```

Then in your embedded template

```
{exp:channel:entries channel="projects" category="{embed:cat_id}" status="open" limit="50" orderby="entry_date" sort="asc" dynamic="off"}
         {title} /
    {/exp:channel:entries}

```
> 1 votes

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


title: Channel Form Custom Field

text:
# Question
Title: Channel Form Custom Field
Is there anyway to add a file custom fieldtype in a channel:form tag like so:

```
input type="file" name="photo_banner" value="{banner_photo}"
```

Instead of: {field:banner\_photo}

I can get the latter to work, but not the former.

Thanks,

Fabian

# Answer
I managed to achieve this by using the {field:custom\_field} method, then inspecting the DOM and copying the div.file\_field element, and adding it directly to my template. I also had to copy over the safecracker script tag that the {field:custom\_field} tag generated.
> 2 votes

---
Tags: channel-form
---


# Question
Title: Integrating recurring payments and Store
Here I am with another Expresso Store question. My client just decided to sell memberships along other items (books), and this kind of item requires a recurring payment.

I know that Store doesn't handle recurring payments natively, but I know that it's possible to do it with PayPal, and PayPal is the only payment method my client is using. Obviously I would like to use the same Store cart and checkout form for selling both regular items and memberships. I was wondering if either:

1. Someone else tried to integrate PayPal recurring payment with Store and if so which approach did you use?
2. Would it be possible to also add subscription management functionality using Zoo Visitor (or some other add-on)?? Suggestions?
3. There's some Store add-on around that does the trick - I've looked for it, but I could have missed it

Any suggestion about which kind approach I should choose would be much appreciated. I think this is a common problem and I'd like to share my solution for the benefit ot the community.

# Answer
As you mentioned Store does not currently support recurring payments with any of the gateways. It is a bit more complicated then just adding a gateway that allows recurring subscriptions to actually have them execute in Store.

Currently there isn't a way in Store to store the customers CC details or Payment Token that would allow the payment details to be kept so that they could be reused each payment. You would also need to add some mechanism that would recreate the cart or ordered items each month (or however often you want to bill) to increment orders and send out recipets. Depending on if your site members are able to access certain sections of your site or be in a separate member group you would need to build the functionality to check if the member has an active subscription and then act accordingly.

ZooVistor and similar add-ons for the most part just extend the default member module so they would require some custom development to add subscription management.

There isn't anything that I am aware of that extends Store to offer recurring payments.
> 4 votes

# Answer
I know it's a late reply, but does this do what you're looking for? http://www.membrr.com/
> 2 votes

# Answer
I was modifying Store 1.6.x's PayPal Express gateway to initiate a subscription in one shot. But I was never able to really focus on it, it was on/off here and there over a few weeks earlier in the year so it was really hard to make progress. I was real close actually with the billing agreement working, subscription being made on paypal's end (test version at least)... but I still hadn't completed the order. We may have to upgrade to Store 2.x, I don't know how much that may throw off the progress I had made before, also we may just want to try to somehow integrate SCM with Store somehow. Not sure, haven't looked into it yet.

If you don't need a paypal sub to integrate tightly with Store (e.g. with payment management, reporting, newly created order, etc.) then it *could* be done. But I can't comment on managing the subscriptions.
> 0 votes

# Answer
@notacouch ideally I would like to fully integrate paypal subscription with Store, but since this won't be one of Store's features, I tried to use at least Simple Commerce to manage subscriptions, but had a lot of problems with Paypal IPNs - see my other thread here. I also posted my question to the EE forum, but never had a reply.
> 0 votes

---
Tags: add-on, expresso-store, add-on-development, ecommerce
---


# Question
Title: How do I get the full uri of a selected entry from EE's Relationships field?
I'm trying to use EE's Relationships field to select a page and get the full URI of that page.

Basically I want to be able to allow the client to select an entry from several different channels, and link directly to that entry. Maybe noteworthy - this site does not use structure or the pages module.

Here is the code I'm trying to use, where `link_sbb` is my Relationships field name:

```
{exp:channel:entries channel="sidebar_banner" limit="1" dynamic="off"}
   <a href="{link_sbb}{link_sbb:page_uri}{/link_sbb}">Learn More<span class="arrow"></span></a>
{/exp:channel:entries}

```

I can get `url_title` to work but I don't want to use `path=""` as the path's can be different, they can select pages from different channels/sections of the site etc. The `permalink` and `page_url` variables don't return a value either.

Is there an easy way to achieve this with EE's Relationships field?

***EDIT:***

Examples of possible URL's

1. /products/category
2. /products/category/subcategory
3. /products/category/{url\_title}
4. /products/category/subcategory/{url\_title}
5. /applications/category
6. /applications/category/{url\_title}
7. /resources/category
8. /company/category
9. /news/category
10. /news/{url\_title}
11. /single-page

# Answer
The short answer is that **entries don't have URIs in EE**. Content is completely separated from URL routing - it will appear wherever you decide to call it in your templates (which are essentially analogous to routing in EE). (The exception is when you set a Pages URI, or use an add-on like Structure which subverts this fundamental tenet of EE.)

So, as Siebird pointed out, you have to decide where each related entry should link based on whatever data you have at your disposal (channel, entry\_id, segment variables, etc), and then construct each link directly in your template code.
> 4 votes

# Answer
In order for `page_uri` variable to work, either the pages or structure modules need to be installed. More here

Re: other options, I would either install one of the modules or you will have to have several conditions within the `link_sbb` tag pair to determine the correct path.
> 3 votes

---
Tags: relationships, page-uri
---


title: Member "change log" addon for EE

text:
# Question
Title: Member "change log" addon for EE
Is there an equivalent of a Change Log addon to track members actions in the CP for EE?

I'm haven't seen anything like that unless I'm missing some native functionality.

# Answer
> 4 votes
If you're looking for robust tracking of user actions in the Control Panel than what EE provides, there is Audit (and Audit Pro). Audit adds some additional user tracking beyond what EE does. Here is the list of what it tracks, from its page on Devot:ee

> 1. Member Logins, including Control Panel & front-end
> 2. Member Logouts, including Control Panel & front-end
> 3. New Entries, including Safecracker
> 4. Updates to Entries, via the Publish screen or multiple entries via the Edit screen, including Safecracker
> 5. Deleting Entries
> 6. New Members
> 7. Deleting Members
> 8. Editing of Members
> 9. Changing Templates (editing a template, not its preferences)

http://devot-ee.com/add-ons/audit
http://devot-ee.com/add-ons/audit-pro

# Answer
> 2 votes
There's a very basic Control Panel log file here: http://ellislab.com/expressionengine/user-guide/cp/tools/logs/cp\_log.html

It tracks certain actions, though not exactly sure what they are. :) Does that help?

---
Tags: add-on, members, control-panel, add-on-development
---


title: Seg2Cat blank values

text:
# Question
Title: Seg2Cat blank values
I've installed (new) seg2cat on a new EE upgrade (2.7.2) and it isn't behaving as expected:

`(1.143091 / 6.09MB) Snippets (Keys): segment_category_ids|segment_1_category_id|segment_1_category_parent_id|segment_1_category_group_id|segment_1_category_name|segment_1_category_description|segment_1_category_image|segment_2_category_id|segment_2_category_parent_id|segment_2_category_group_id|segment_2_category_name|segment_2_category_description|segment_2_category_image|segment_3_category_id|segment_3_category_parent_id|segment_3_category_group_id|segment_3_category_name|segment_3_category_description|segment_3_category_image|segment_4_category_id|segment_4_category_parent_id|segment_4_category_group_id|segment_4_category_name|segment_4_category_description|segment_4_category_image|last_segment_category_id|last_segment_category_parent_id|last_segment_category_group_id|last_segment_category_name|last_segment_category_description|last_segment_category_image|freelancer_version|site_id|site_label|site_short_name|last_segment|current_url|current_path|current_query_string
(1.143106 / 6.09MB)`

Note the blank values here:

`Snippets (Values): 241|||||||||||||||||||241|0|6|Attire for Grooms + Groomsmen||grooms.jpg|241|0|6|Attire for Grooms + Groomsmen||grooms.jpg|FALSE|1|Ashley's Bride Guide|default_site|attire-for-grooms-groomsmen|http://ashleysbrideguide.com/abg.php/nashville-wedding-ideas/gallery/attire-for-grooms-groomsmen/attire-for-grooms-groomsmen|nashville-wedding-ideas/gallery/attire-for-grooms-groomsmen/attire-for-grooms-groomsmen|`

Any ideas why a multitude of snippet values would output blank values without keys? Or numeric values like 241, without keys?

All advice appreciated.

Edit: Posting under low-seg2cat because this bug lead to blank seg2cat values. Thanks.

# Answer
For visibility, this is what your snippets look like:

```
[segment_category_ids] => 241
[segment_1_category_id] =>
[segment_1_category_parent_id] =>
[segment_1_category_group_id] =>
[segment_1_category_name] =>
[segment_1_category_description] =>
[segment_1_category_image] =>
[segment_2_category_id] =>
[segment_2_category_parent_id] =>
[segment_2_category_group_id] =>
[segment_2_category_name] =>
[segment_2_category_description] =>
[segment_2_category_image] =>
[segment_3_category_id] =>
[segment_3_category_parent_id] =>
[segment_3_category_group_id] =>
[segment_3_category_name] =>
[segment_3_category_description] =>
[segment_3_category_image] =>
[segment_4_category_id] => 241
[segment_4_category_parent_id] => 0
[segment_4_category_group_id] => 6
[segment_4_category_name] => Attire for Grooms + Groomsmen
[segment_4_category_description] =>
[segment_4_category_image] => grooms.jpg
[last_segment_category_id] => 241
[last_segment_category_parent_id] => 0
[last_segment_category_group_id] => 6
[last_segment_category_name] => Attire for Grooms + Groomsmen
[last_segment_category_description] =>
[last_segment_category_image] => grooms.jpg
[freelancer_version] => FALSE
[site_id] => 1
[site_label] => Ashley's Bride Guide
[site_short_name] => default_site
[last_segment] => attire-for-grooms-groomsmen
[current_url] => http://ashleysbrideguide.com/abg.php/nashville-wedding-ideas/gallery/attire-for-grooms-groomsmen/attire-for-grooms-groomsmen
[current_path] => nashville-wedding-ideas/gallery/attire-for-grooms-groomsmen/attire-for-grooms-groomsmen
[current_query_string] =>

```

The Snippets array also contains the current URI, which is:

```
nashville-wedding-ideas/gallery/attire-for-grooms-groomsmen/attire-for-grooms-groomsmen

```

All of this leads me to conclude you do not have the latest Low Seg2Cat (v2.8.0 at this time) installed. First of all, I don't see the `segment_category_ids_piped` key that v2.8.0 introduced. Secondly, there are duplicate segments in the URI (3 and 4 are the same) and only the category vars for segment 4 are set. This was addressed in v2.7.0.

The rest of the Seg2Cat vars are empty because they do not match category URL titles, which is intended behaviour, like Derek said. Setting the *Set all segments* option to Yes will do this for all possible segments, hard coded by EE to 9. Since you haven't got these set, and the default was set to Yes from version 2.6.2 onward. You've also got the `last_segment_category_...` vars there, so I'm going to guess you've got version 2.6.1 installed.
> 5 votes

# Answer
That looks like expected behaviour to me. I'm assuming that you're seeing this at a URL which has a category slug in `segment_3` and nowhere else, so all of the other Seg2Cat variables are empty.

What was the behaviour you were expecting?
> 3 votes

---
Tags: snippets, low-seg2cat
---


title: Method to Delete members in Addons

text:
# Question
Title: Method to Delete members in Addons
Is there a library, class or method that an addon can access to be able to delete members?

# Answer
> 5 votes
Yup, just load the Member model:

```
ee()->load->model('member_model');
ee()->member_model->delete_member($member_id, $heir_id);

```

`$member_id` can be a single member, or an array of ids.

`$heir_id` is the `member_id` that should take authorship of any existing entries belonging to the member being deleted.

---
Tags: members, delete
---


# Question
Title: Why do I get database error when I log into my updated ee site
I wondered if you could help.

I updated my local site to new ee 2.7 and that went swell. I pushed up my files to the server and I can get the /admin.php login page but when I press login i get this error:

```
A Database Error Occurred
Error Number: 1054

Unknown column 'used' in 'where clause'

UPDATE `exp_security_hashes` SET `used` = 1 WHERE `used` = 0 AND `hash` = '04ec7161468a13c61c984f39f646a76073bdab56' AND `session_id` = 0 AND `date` > 1381249552

Filename: core/EE_Security.php

Line Number: 169

```

Has anyone ever come across this from updating the ee cms before?

Cheers

# Answer
When you upgraded to 2.7, do you recall the first time you accessed admin.php seeing the upgrade screen? And once the upgrade was complete, removing the installer directory?

It sounds like your db has not been upgraded. For example, open your db and check exp\_security\_hashes table for the 'used' column. Sounds like it is missing. Could be others things missing too if upgrade wasnt completed.

Did you follow these instructions
> 3 votes

# Answer
Since your files transferred just fine, it's the database export/import process that failed you.

If you are transferring a database from one server to another it is ideal to do one or both of the following:

1. Export the database you are duplicating with DROP TABLES syntax and gzipped. If you don't add DROP tables syntax, you'll just merge the tables possibly leaving unnecessary tables and columns in the replaced database.
2. Before importing the above gzipped database to the second server, delete the second server database's tables completely. The DROP TABLES syntax will remove tables if they already exist before re-adding them, but you may have other tables that are not in the new database.
> 3 votes

---
Tags: ee2, database, ee2-upgrades
---


title: Error Upgrading to 2.7.2

text:
# Question
Title: Error Upgrading to 2.7.2
I tried to do an upgrade to 2.7.2 using Updater but found that the version of Updater was old. Hence, it didn't work! I know it's my fault and I should have checked first.

Now when I try to login to the Control Panel I get the following error message -

> A Database Error Occurred
>
> Error Number: 1054
>
> Unknown column 'hash' in 'field list'
>
> SELECT `hash`, `timestamp` FROM (`exp_developer_log`) ORDER BY `timestamp` asc
>
> Filename: libraries/Logger.php
>
> Line Number: 106

It's not critical as the site is in development, but when I get home tonight and have a chance to look at it, if I do a manual upgrade of the EE files for 2.7.2 will that solve the issue?

I do have a back up of the database before I began the upgrade and I host with enginehosting.

# Answer
Don't try and mess with a failed upgrade. Revert back to previous & start again.

Given the failure point was updater I'd recommend a manual update.
> 2 votes

# Answer
The error says the "hash" column is missing from the "exp\_developer\_log" table.

I suggest getting into the database using PHPMyAdmin and manually adding a new column to that table named "hash".
> 1 votes

---
Tags: database, updating
---


# Question
Title: Store API Rest response in entry form with PHP
I'm trying to save an API Rest response in entry with PHP. This is the functional PHP script:

```
{exp:channel:entries
   channel="products"
   limit="1"
   require_entry="yes"
   entry_id="{segment_3}"
}
<?php

/**
 * Ensure that you have cURL installed by uncommenting
 * ;extension=php_curl.dll
 * in your php.ini
 */

$url = "https://api.**************";

{product_uploaded_model}
$path = $_SERVER['DOCUMENT_ROOT'] . '/models/uploads/products/';
$filename = "{file_name}";
$tags = "{author} {file_id}";
$description = "{title}";
{/product_uploaded_model}
$token_api = "*********************";
$title = "{title}";
$private = 1;
$password = "****";

$data = array(
    "title" => $title,
    "description" => $description,
    "fileModel" => "@".$path.$filename,
    "filenameModel" => $filename,
    "tags" => $tags,
    "token" => $token_api,
    "private" => $private,
    "password" => $password
);

$ch = curl_init();
curl_setopt_array($ch, array(
    CURLOPT_RETURNTRANSFER => 1,
    CURLOPT_URL => $url,
    CURLOPT_POST => 1,
    CURLOPT_POSTFIELDS => $data
));

$response = curl_exec($ch);

curl_close($ch);

echo $response;

?>

{/exp:channel:entries}

```

The server's response is like this

```
{"result": {"id": "32c45b4fe5b74420a53ee8e76c247837"}, "success": true}

```

Now i need to put the "id" in a entry's field with this in single entry template:

```
{exp:channel:form channel="*****" return="*****/ENTRY_ID" entry_id="{segment_3}"}

{field:product_id}

{/exp:channel:form}

```

Extrapolating the id from the response and putting it in the field, and save the form.

The question is: How can I extrapolate the id from the response? How can I put in `{field:product_id}`? How can I save the form and redirect to another page?

# Answer
This StackOverflow answer shows how to extract a variable from a JSON string: https://stackoverflow.com/a/10689950/135935

Then echo that variable inside the exp:channel:form tag into a hidden field:

```
<input type="hidden" name="product_id" value="<?php echo $ID ?>">

```
> 1 votes

---
Tags: php, channel-form, channel-entries-api
---


# Question
Title: Optimization: Need to cut-down on server load
Our predicament is that we are using 3 media queries with different layouts which means that we're essentially generating all of the content 3 times. For instance:

```
<div class="small-media">
  {embed="template/view_small"}
</div>

<div class="medium-media">
  {embed="template/view_medium"}
</div>

<div class="large-media">
  {embed="template/view_large"}
</div>

```

You can see how ridiculous this is. We have tons of things being pulled in and we're starting to see overages on our data for doing it this way.

We're wondering if there's a way to use PHP (or EE itself) at the top of the document to load everything once and then send only the pertinent data to the nested templates at each media query.

Thanks for any input on this.

# Answer
What you're doing isn't really the way to use media queries.

Why is the 'data' (from which I read 'content') different based on the user agent? Is it actually different content or are you simply talking about layout?

I would say your options here are;

1. Output everything once and use CSS Media Queries properly to reformat the content appropriately for the device being used to access it. i.e Make the site responsive. There should be few, if any, instances where you'd need to duplicate output data like this.

Media queries should be used to alter how elements are displayed and interact with other elements, adjust page flow or show/hide elements from view. The underlying page markup and content should be identical regardless of the user agent properties.

There are numerous articles and tutorials around regarding this approach. Try http://mobile.smashingmagazine.com/2010/07/19/how-to-use-css3-media-queries-to-create-a-mobile-version-of-your-website/ to start with and descend down the rabbit-hole from there!
2. Use separate templates (or even domains) for each 'version' of the site and sniff the device when someone lands on a page, then redirect to the appropriate version. The disadvantage of this is multiple URLs for what is essentially the same content so be sure to specify canonical URLs for each page.

You could use PHP to sniff device properties and use a PHP conditional to add the template partial as required. There are a number of libraries available for doing this. I can't recommend any though since I haven't used them.

Try this library as a starting point https://code.google.com/p/php-mobile-detect/
3. Use an add-on to do the detection. Try http://devot-ee.com/add-ons/detect-mobile. I don't know whether this will ease the load as you may find that EE's parsing engine will still do more than it needs to. It depends when the add-on fits in the parse order.
4. Use Stash. Someone else mentioned this so I won't go into it further here.

Personally I'd go with option 1.
> 8 votes

---
Tags: optimization
---


title: Relationship field in a grid

text:
# Question
Title: Relationship field in a grid
I have a Grid field and in the grid I have relationship field. I can not seem to get anything to display for the relationship entry. I am using a custom status for my products and in the relationship setup in the grid I have chosen a custom status, not the Open status, this seems to return no results but if I setup products status to Open instead of the custom status then it returns the product information.

The following works if the status is set to Open but not if it is a custom status

```
{exp:channel:entries channel="video_gallery" dynamic="off" url_title="{segment_3}"}
    {video_gallery}
        <div style="float: left; margin: 20px;">
            <a class="youtube" data-id="{video_gallery:video_id}" data-title="{video_gallery:title}" data-description="{video_gallery:description}" data-product="{video_gallery:product search:status='wall'}<a href='/products/{video_gallery:product:url_title}'>{video_gallery:product:product_display_title}</a>{/video_gallery:product}"><img src="{video_gallery:thumbnail}" /></a>
            <br />{title}
        </div>
    {/video_gallery}
{/exp:channel:entries}

```

What do I need to do to get this to work? Any ideas?

# Answer
In your example code this:

```
{video_gallery:product search:status='wall'}

```

... is theoretically telling the relationship field to only display entries which have a custom field named `status` with a value of "wall". (Although Relationship field tags do not actually support the `search` parameter - see supported parameters.)

If you're talking about the `status` as determined by each related entry's "Status" menu, you want this syntax instead:

```
{video_gallery:product status='wall'}

```
> 2 votes

---
Tags: ee2, relationships, grid
---