title: Displaying entries from category groups

text:
# Question
Title: Displaying entries from category groups
Excuse my template tagging if is looks confusing. I am fairly new to ExpressionEngine and using categories is my latest adventure.

On this following page Click here under the "more sport" section of this page I want to display a max of 4 of the most recent post within it's category, I need to do the same for the other five category.

I have made attempts to this section but it seems to duplicate the same entry post 4 times rather than four different post within the category. This is also happening on my blog roll page Click here

Can someone guide me in the right direction?

```
      <ul class="post">
   {exp:channel:entries dynamic="yes" sort="asc" status="open" limit="4"}

        {categories}
        <li>
        <a href="{url_title_path='blog/full-post'}">
        <a href="{path='blog/blog-roll'}">
            <div class="featured-tab {url_title}"></div>
        </a>
            <a href="{url_title_path='blog/full-post'}"><img src="{blog_slide_image}" alt="placeholder" class="feature-preview-img"></a>
                <p>{exp:eehive_hacksaw chars="250" append="..."}{feature_copy}{/exp:eehive_hacksaw}</p>
</li>
    {/categories}

    {/exp:channel:entries}

```

Code for blog roll

```
<ul class="results-row">
{exp:channel:entries channel="blog" disable="member_data|trackbacks" dynamic="yes"}
{exp:channel:categories channel="blog" style="linear" show_empty="no" }
        <li>
        <a href="{url_title_path='blog/full-post'}">
            <div class="featured-tab {url_title}"></div>
            <img src="{blog_slide_image}" alt="placeholder" class="feature-preview-img"></a>
            <h2>{title}</h2>
            <p>{exp:eehive_hacksaw chars="150" append="..."}{feature_copy}{/exp:eehive_hacksaw}</p>
        </li>
        {/exp:channel:categories}
        {/exp:channel:entries}
        </ul><!-- RESULTS-ROW ENDS HERE-->

```

# Answer
Good morning!

Let's step back for a moment. First, if you are new to EE and especially categories then I'd recommend reading through this tutorial I wrote a while back.

Basically I think you are trying too hard, and shouldn't need to nest entries tags into category tags like that - it not only shouldn't be necessary but can be a performance drain as well.

On the first question if you are looking to display other entries in the same category as the entry being displayed then look at the related categories mode parameter for the channel entries tag.

If instead it's just a category page showing the most recent 4 entries in a category (and isn't showing an entire single entry) then all you'll need is the template loaded at a category URL with the channel:entries tag and a limit parameter set to 4 (and the tutorial I linked to above would demonstrate this).

I'm not sure what you mean by "tagging" - in EE-land tags are different from categories and require a 3rd party add-on to implement.
> 5 votes

# Answer
As Michael stated in his answer, you will need to use **Related Categories Mode parameter**. As stated in the docs:

> This parameter is intended for use only when you are using the channel tag within “single entry” pages. Single entry pages are ones that show only a single entry, specified by the ID number or URL Title in the URL.
>
> When enabled, this parameter alters the behavior of the {exp:channel:entries} tag, causing it to ignore the entry ID or URL title found in the URL, and ***instead show a list of entries that are in the same category as the entry specified in the URL. This lets you create a list of entries that are “related” to the primary one specified by the URL.***

---

Your "More Sports" section of the page would look something like:

```
<ul class="post">
{exp:channel:entries related_categories_mode="yes" limit="4"}
    <li>
        <a href="{url_title_path='blog/full-post'}">
            <div class="featured-tab {url_title}"></div>
        </a>
        <a href="{url_title_path='blog/full-post'}"><img src="{blog_slide_image}" alt="placeholder" class="feature-preview-img"></a>
        <p>{exp:eehive_hacksaw chars="250" append="..."}{feature_copy}{/exp:eehive_hacksaw}</p>
    </li>
{/exp:channel:entries}

```

Note: I removed the `dynamic="yes" sort="asc" status="open"` parameters because these are defaults on the channel:entries tag so are a given. You should probably add a channel="" parameter too.

This will return 4 articles in the same categories as the current "detail" article on the page.

---

You Blog Roll code would look something like:

```
<ul class="results-row">
{exp:channel:entries channel="blog" disable="member_data|trackbacks" related_categories_mode="yes" limit="4"}
    <li>
        <a href="{url_title_path='blog/full-post'}">
            <div class="featured-tab {url_title}"></div>
            <img src="{blog_slide_image}" alt="placeholder" class="feature-preview-img">
        </a>
        <h2>{title}</h2>
        <p>{exp:eehive_hacksaw chars="150" append="..."}{feature_copy}{/exp:eehive_hacksaw}</p>
    </li>
{/exp:channel:entries}

```
> 2 votes

---
Tags: templates, categories
---


# Question
Title: How can I capture site wide poll data to use later on
I have a client who wants what they call a 'Business Needs Survey Form' implemented into the site. The form will ask a series of around 30 business questions and once completed it will send off an email to sales team, and the user themself.

A subset of those 30 questions (Simple Needs Questions form (I did not come up with that name)) will be assigned to different areas of the site in order to entice the user to go and fill out the full Business Needs Survey.

The simple needs questions will have a simple yes or no answer option, which when chosen will reveal an answer that links off to one or more of the clients products or the full survey. **Those answers need to be progressively captured as the user flows through the site**. With me so far? Cool. Here comes the question.

How is the best way to attack this?

My initial thinking was to:

1. Set up a channel to hold the questions and 2 different answers (one for yes one for no)
2. Use playa to allocate the questions to the different pages throughout the site
3. and possibly—this is where I'm stuck—capture the responses using safecracker to another channel which can then be pulled out when the user is ready.

NOTE: The user of the site will not be logged in, or have membership of any sorts.

Is this a good idea? Has anybody done anything like this before, or are there any addons out there that service this type of requirement?

*I'm really unsure on how to capture and store that data site wide.*

Any help would be appreciated. Cheers Dan

# Answer
> 1 votes
There was no out of the box or current third party addon that would provide the functionality requires. A custom addon needed to be developed.

# Answer
> 3 votes
It sounds like you might be able to use FreeForm here. It takes the submissions from a form and stores it in an an entry (although it's not shown in the regular Publish/Edit lists). You should be able to get the information out of the stored entries.

It also supports multi part forms, handles the emailing bits and provides a number of other features that you may find useful. There is a free and Pro version - the Pro version has the features such as multi part forms.

As for the logic involved in showing/hiding different fields I think you'll need to use javascript and come up with the flow yourself.

EDIT: removed incorrect information about channel storage - mixed up my add-ons!

# Answer
> 3 votes
ProForm would support this pretty much out of the box. You could set each segment of questions as a step in the form, then use the simple form tag or a snippet to render the form. It will automatically render just the questions you ask for in that step.

If you do end up taking this route, I will provide full support for your design as I think this is really cool. You can post basically anything in the support forum and I will work with you until it works. :)

---
Tags: add-on
---


# Question
Title: What's the limit on entry views tracking?
Does entry views tracking allow you for 4 instances all together or 4 instances per channel?

# Answer
I know we talked about this on Twitter yesterday, but looking at the EE docs again it says:

> "Up to four different instances of the view counter can be used (each on a different page), enabling you to track different aspects of an entry independently"

Which isn't immediately clear (at least in a pre-coffee state). So I did a quick test on my local site, implemented a view\_count variable, and looked at the query to see where the data was getting stored. Turns out the view counts are stored in the exp\_channel\_titles table where there are 4 columns for tracking views.

So my answer is neither four instances total, or four instances per channel, but rather 4 instances per entry.
> 7 votes

# Answer
Be careful on using entry tracking on extremely busy web sites. exp\_channel\_titles is a generally heavy read table, add a lot of entry tracking on a busy site and you turn that into a heavy read/write table. Using InnoDB or similar replacement engines will help, but stock MyISAM table type and heavy read/write contention on that table will cause performance issues.
> 2 votes

# Answer
4 instances all together, but you can of course limit your results by channel(s):

```
{exp:channel:entries channel='news' orderby='view_count_one'}

```

or

```
{exp:channel:entries channel='news|portfolio' orderby='view_count_one'}

```
> 1 votes

---
Tags: templates, entries
---


# Question
Title: Site and theme URLs not correct in control panel settings
When I load Site \> CP Home \> General Configuration I see the right values in the field: http://www.example.com for an instant. When the page fully loads it will change to http://dev.example.com. The same happens in my local build. It too initially is correct (http://local.example.com) but then switches to http://dev.example.com an instant after the page loads.

Most everything works on these sites. The only issue (other than it being very strange to see) may be Lamplighter. That isn't working and they say the value in that field must match the actual page URL otherwise it will not work.

I read on the EE bug tracker that EE stores some config variables in the database. Does the base\_url value get stored in the database? I looked but could not find anything.

I was using Focus Labs multi environment config, but even after reverting back to the stock EE config, index, admin, and database files it is doing it. That leads me to believe the database is storing the information. I have imported and exported the database from Dev to Production and local.

# Answer
I make a few changes to the Master Config in my Base EE install. I made some pull requests to the core, but I am not sure if they were approved. I actually change my environment to the follow, it makes life much simpler with domains.

Basically the following code strips the WWW from the URL and ensure you only have to define the domain once. Real simple tweak that goes a long way. I am not totally sure if I understand your error, but I use this to do something similar.

```
if ( ! defined('ENV'))
{
    switch (str_replace('www.', '', $_SERVER['HTTP_HOST']))
    {
        case 'domain.com' :
            define('ENV', 'prod');
            define('ENV_FULL', 'Production');
            define('ENV_DEBUG', FALSE);
        break;

        case 'dev.domain.com' :
            define('ENV', 'dev');
            define('ENV_FULL', 'Development');
            define('ENV_DEBUG', FALSE);
        break;

        default :
            define('ENV', 'local');
            define('ENV_FULL', 'Local');
            define('ENV_DEBUG', TRUE);
        break;
    }
}

```
> 4 votes

# Answer
This doesn't directly answer your question about Master Config, but you might try giving the REElocate plugin a try: http://devot-ee.com/add-ons/reelocate

It gives you the ability to easily do a find and replace for URL and Server Path values, which can ease the pain of moving between environments and works wonders for issues like the one you're describing.
> 2 votes

---
Tags: database, config, focus-lab-master-config, site-url
---


title: Check if User Has Purchase w/ CartThrob

text:
# Question
Title: Check if User Has Purchase w/ CartThrob
Here's the situation: I have a site (not my build so I'm still learning it's process) that needs to check if a user has a successful purchase, and if so, display some content. Currently they're using submitted\_order\_info to check if authorized, but that only works if the order is still in session. In the event it no longer is, that tag doesn't do any good. What tag / check would you use in this case?

# Answer
> 7 votes
If your customers are required to have an account when you checkout I usually just check to see if the user has an entry in the orders channel. So I am going to assume that you have named your channel "orders" I would have something along the lines of:

```
{exp:channel:entries channel="orders" author_id="CURRENT_USER" status="paid|open" disable="pagination|categories|category_fields"}
<h1>You have purchased something from us!</h1>
{if no_results}
 <h2>You should probably go buy something now!</h2>
{/if}
{/exp:channel:entries}

```

---
Tags: cartthrob
---


# Question
Title: Early Parsed Low Variable inside Channel Tags
I have a couple Low Variables I'm using similar to the traditional `embed` template method. This variable has `query` module tag to find prev/next entry, but since it's within the `channel` tag I'm having issues getting the early parsed LV code to output the correct info - which I thought would take care of it.

So I then thought "why don't I take the `query` tag code and create a new LV that is parsed earlier than it's parent LV.

I'm pretty sure this is a parsing stage issue. So I was wondering if this is even possible since the LV is inside the `channel` tag? I also moved around the variables to different LV groups to change the parsing sequence, but that didn't work.

My coded simplified is like this:

```
{exp:channel:entries
    channel="case_studies"
    disable="categories|category_fields|member_data|pagination|trackbacks"
    require_entry="yes"
}
    ...
    {lv_tmpl_utility_belt}
    ...
{/exp:channel:entries}

```

`{lv_tmpl_utility_belt}`:

```
<div id="utility-belt"{if segment_1 != ""} class="nav-sticky"{/if}>
{exp:switchee variable="{segment_1}" parse="inward"}
    {case value=""} {!-- Show Home Utility Bar --}
        <ul id="nav-belt-tabs" class="wrapper clearfix">
            {exp:low_variables:pair var="lv_home_hero"}
                <li{if count == 1} class="active"{/if}><a href="#">{hero_tab}</a></li>
            {/exp:low_variables:pair}
        </ul>
    {/case}

    {case default="yes"} {!-- Show Interior Utility Bar --}
    <div class="wrapper">
        <a class="btn-flat btn-menu"href="#">Navigation Menu</a>

        {lv_ee_casestudy_prevnext_entries}

    </div>
    {/case}
{/exp:switchee}
</div> {!-- /#utility-belt --}

```

`{lv_ee_casestudy_prevnext_entries}`:

```
{exp:query sql="
    SELECT
        url_title,
        title
    FROM exp_channel_titles
    WHERE url_title < '{segment_3}'
    AND channel_id = '3'
    AND status = 'open'
    ORDER BY url_title
    DESC LIMIT 1
"}
<a class="btn-flat btn-prev" href="{url_title}" title="Previous: {title}">Previous Case Study</a>
{/exp:query}

{exp:query sql="
    SELECT
        url_title,
        title
    FROM exp_channel_titles
    WHERE url_title > '{segment_3}'
    AND channel_id = '3'
    AND status = 'open'
    ORDER BY url_title
    ASC LIMIT 1
"}
<a class="btn-flat btn-next" href="{url_title}" title="Next: {title}">Next Case Study</a>
{/exp:query}

```

# Answer
If you're using early parsed vars only, try putting both of them in the **same** LV group and make sure `{lv_tmpl_utility_belt}` comes **before** `{lv_ee_casestudy_prevnext_entries}`. This ensures that the vars will be put into the template correctly. Having the second var above the first will fail.

To clarify, you've got 2 vars, A and B. A *contains* B, so A needs to be parsed *before* B. Hence the order in their group matters.

However, looking at the contents of your vars, I can see an issue coming up. You've got `{title}` and `{url_title}` vars inside the Query tags. These will actually get parsed by the channel:entries tag before the Query tag can get to it. So, you either need to rename those, or, to avoid such conflicts altogether, you could use the low\_variables:single tag, along with the `preparse:` parameters, **available in LV 2.3.0+**.

Your code would then look something like this:

```
{exp:channel:entries
    channel="case_studies"
    disable="categories|category_fields|member_data|pagination|trackbacks"
    require_entry="yes"
}
    ...
    {exp:low_variables:single
        var="lv_tmpl_utility_belt"
        preparse:segment_1="{segment_1}"
        preparse:segment_3="{segment_3}"
    }
    ...
{/exp:channel:entries}

```

And just change the `lv_tmpl_utility_belt` var slightly, so it calls `lv_ee_casestudy_prevnext_entries` by also using the low\_variables:single tag:

```
{exp:low_variables:single
    var="lv_ee_casestudy_prevnext_entries"
    preparse:segment_3="{segment_3}"
}

```

This approach is what some people call Killing the Embed Tag.
> 3 votes

---
Tags: parse-order, low-variables
---


# Question
Title: Native Calendar Tag: Disable next_path or previous_path if no entries?
Anyone know how to "unlink" the `{next_path}` or `{previous_path}` for `{exp:channel:calendar}` if there aren't any entries for the next or previous month when building the mini-calendar?

# Answer
> 4 votes
I had an answer for this on the EE Wiki, but can't see that it exists anymore -- even the Wayback Machine can't find it. So, here is some EE template source which will show you how to do it, which I've used for years on a site - I believe it will fit EE1 as well as EE2.

The principle is to use database queries via the EE Query module - be sure to have it enabled. If I were doing this today, I would probably make an add-on to allow the code to be simpler to look at.

It works well, however, just to embed the queries as we're writing out the calendar. We look for whether there are later (or earlier) entries. If there are, we write out the link, visibly showing appropriate corner brackets which make the buttons. If there aren't, we write nothing, leaving a blank cell, which looks right.

Notes:

-- this solution is for the first-party (EE tag) calendar. It seems to me that's what's referenced in the question, and you should remove the solspace-calendar tag if that's so, per Anna's request. If it is for Solspace Calendar, you should then say so, and maybe the queries here will also be useful, since I imagine you could play a similar trick.

-- the queries here are on exp\_channel\_titles, which fits EE2.x. That will be exp\_weblog\_titles if you are on EE1. If you used a database prefix, you'll have to include that too - the queries may only reference real table names in the database. There are ways to get that, but they seem not worth the complication for this case.

-- further on the query, note that I'm hard-coding channel\_id = '6'. You can look up the channel\_id number for the channel you want by using the EE control panel Tool\>SQL Manager\>Manage Database Tables, and clicking Browser for the table exp\_channels.

-- there isn't much of a measurable performance hit using this method, among all the other queries which typically build a web page. If you want things to go really fast on a shared hosting, you can look into CE Cache, which is simple excellent.

-- the calendar tag used this way is one of the cases where you actually do want to have dynamic='yes', so that it follows the main channel entry you are showing.

-- if you're actually using some other kind of buttons, it's likely the queries should be used to set CSS labels to make them normally formatted or invisible, to achieve the effect you've asked for.

-- yes, it's a table -- that's the old EE way. Perhaps one place where tables actually make sense, since a calendar is one.

Good fortune, and nice holidays to all involved.

```
<h2 class="sidetitle">History</h2>
<br />
<div id="calendar">
 {exp:channel:calendar switch="calendarToday|calendarCell" channel="{my_channel}" dynamic="yes" show_pages="no" }
  <table class="calendarBG" border="0" cellpadding="5" cellspacing="1" summary="My Calendar">
    <tr>
      <th class="calendarHeader"><div class="calendarMonthLinks">
        {exp:query sql="SELECT year, month FROM exp_channel_titles where status = 'open' and channel_id = '6' and ((year = {date format="%Y"} and month < {date format="%n"}) or year < {date format="%Y"}) order by year desc, month desc limit 1;" } <a href="{path={my_template_group}/articles_all/{year}/{month}}"><<</a> {/exp:query}
        </div></th>
      <th class="calendarHeader" colspan="5">{date format="%F %Y"}</th>
      <th class="calendarHeader"><div class="calendarMonthLinks">
        {exp:query sql="SELECT year, month FROM exp_channel_titles where status = 'open' and channel_id = '6' and ((year = {date format="%Y"} and month > {date format="%n"}) or year > {date format="%Y"}) order by year asc, month asc limit 1;" } <a href="{path={my_template_group}/articles_all/{year}/{month}}">>></a> {/exp:query}
        </div></th>
    </tr>
    <tr> {calendar_heading}
      <td class="calendarDayHeading">{lang:weekday_abrev}</td>
      {/calendar_heading} </tr>
    {calendar_rows }
    {row_start}
    <tr>{/row_start}
      {if entries}
      <td class='{switch}' align='center'><a href="{day_path={my_template_group}/articles_all}">{day_number}</a></td>
      {/if}
      {if not_entries}
      <td class='{switch}' align='center'>{day_number}</td>
      {/if}
      {if blank}
      <td class='calendarBlank'> </td>
      {/if}
      {row_end}</tr>
    {/row_end}
    {/calendar_rows}
  </table>
  {/exp:channel:calendar}
</div>

```

---
Tags: channel, next-prev, calendar
---


# Question
Title: Birthdate in Channel Data - how to filter and display age?
I'm storing birthdates in a Channel field.

1. How do I display the birthdates as age in years? Is that something I just compute in the templates? Or is there a better way?
2. I'm planning to use Low Search. Is there a way I will be able to filter something like "age is 25-30?"

# Answer
> 3 votes
Interesting question. Several options. For display, it should be possible to use a simple calculation plugin and subtract the birthday year from current year, `current_time format="%Y"}` (e.g. 2013 - 1980 == 33). For this to work you probably need the fieldtype to be of the "date" kind for date-formatting to work on the field.

For searching by date, you'll probably need to write a custom query, or use the active record plugin. Because the standard search:field="needle" parameter only works as string. A custom plugin that queries the database is also an option. Fetch the ID's that meet the criteria and feed those to the channel:entries tag `entry_id="13|42|147"`

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


title: Member Module / Salesforce Integration

text:
# Question
Title: Member Module / Salesforce Integration
Has anyone ever integrated/synchronized the EE Member Module with Salesforce? Have an upcoming project that will likely require synchronization with Salesforce.

The website will be for a member organization and they store all of their members in Salesforce. They need to allow members to login to the website, update their contact info, etc. We'd need to develop a two-way integration/synchronization process.

Any pointers?

# Answer
> 6 votes
It can be done, Salesforce is integration using SOAP - so all you'd need to do is to write an EE Module wrapper for SF which encapsulates the necessary calls.

The API for Salesforce is available here and should identify all the things that you can do with it.

You can either have the data held in EE *and* in SF, or simply write a module which 'pulls' the information down from SF and stores it in EE temporarily for editing before pushing it back to SF when it's saved.

I will say now thats its not an easy 10 minute job - so you either need to be a) extremely confident/proficient or b) able to employ someone who can do it for you.

# Answer
> 2 votes
Jack Watkins created an extension to be able "*to carry out the submission of register data to Salesforce in a less intrusive way.*"

You can read all about it here: http://donebecause.co.uk/entries/integrating\_expressionengine\_salesforce.

It might be a nice starting point.

---
Tags: members, salesforce
---


# Question
Title: SafeCracker Registration: Looping Through Members - and their Channel entries
I'm using SafeCracker Registration so that I can use the power of Channels for Member fields. My members are being assigned between 2 Member Groups. Questions:

1. How do I loop through a list of Members filtered by Member Group?
2. How do I access the member's Channel data within the loop?

Also, I made the design decision to only use the bare minimum Member fields (which are `email` & `password`) and let everything else be in the Channel. So, if I the Member's location, I don't use the Member field's `location` field. Instead, I define a new Channel field, say, `member_location`. **Is this a good approach?**

# Answer
> How do I loop through a list of Members filtered by Member Group?

You could just use the `group_id` parameter. http://ellislab.com/expressionengine/user-guide/modules/channel/channel\_entries.html#group-id

```
{exp:channel:entries channel="members" dynamic="no" group_id="6"}

    {your_channel_field}

{/exp:channel:entries}

```

And the easiest way to display a member location is with my Google Maps for ExpressionEngine add-on, which works with Saferacker. The easiest way is to use the fieldtype (FT). You don't have to use the FT, rather you could use a standard lat/lng coordinate.

```
{exp:gmap:init id="map" style="width:100%;height:400px"}

{exp:channel:entries channel="members" dynamic="no" group_id="6"}

    {your_gmap_field id="map"}

{/exp:channel:entries}

```

Or alternative, use the `exp:gmap:marker` tag. This would also create an infowindow too with the `{title}` tag as the content.

{exp:gmap:init id="map" style="width:100%;height:400px"} {exp:channel:entries channel="members" dynamic="no" group\_id="6"}

```
    {exp:gmap:marker id="map" latitude="{your_lat_field}" longitude="{your_lng_field}"}
         {title}
    {/exp:gmap:marker}

{/exp:channel:entries}

```

http://objectivehtml.dev/google-maps

Obviously you don't have to use my Google Maps add-on, but it's definitely the easiest way to do what you want.

You may also want to check Entries, a new add-on designed get complex entry data. I will definitely add a method to pull out entries via member group, that's a good idea. This is still in beta, but I will be finishing it up in the next week or two.

http://objectivehtml.dev/entries

> Is this a good approach?

I think so, it's how I handle all my other client sites. It something isn't available that you think should be, just let me know and I will see about adding the feature.
> 2 votes

# Answer
I'm going to make a good faith effort, but be forewarned that I've actually never used, SafeCracker Registration.

Modules like Zoo Visitors, etc., give you replacement channel tags, bit from what I can see for SafeCracker Registration, the tags are focused on the registration and editing process, leaving the regular ExpressionEngine tags for handling pulling and looping through data.

So accessing member data would be the same as accessing a channel entry. The SafeCracker Migration Utility, (accessible via SafeCracker Registration Settings, I'd assume), seems to be the area where you'd map information. So if you regularly need to access the member\_id number, that should probably be mapped to a custom field. Otherwise, I'd assume that accessing member data would look like:

```
{exp:channel:entries channel="members" limit="10" orderby="member_lastname" sort="asc" dynamic="off"}
    <div class="member-list">
        <h3><a href="http://mysite.org/member/profile/{url_title}">{title}</a></h3>
        <p><em>Location:</em> {member_location}</p>
        <hr />
    </div>
{/exp:channel:entries}

```

Very similar to regular channel handling. Now handling member groups would be interesting, because I can't tell if you can map member groups to categories or not. If you can't you'd probably want to do this on the template itself, as a hidden field, if all members were going into one major category. If members were getting assigned to different categories/member groups, then you may need multiple registration forms or to assign groups and categories after the fact.

Or if you didn't need the other profile data for the listing, you could use the regular membership data tags or a custom query to pull a membership listing by group.

I'm not quite certain what you're attempting to accomplish with the members by member groups. SafeCracker Registration, from what I can tell works best for if you have a simple membership/registration process but want the flexibility of use channels. If you need to assign members to multiple membership groups or do other complex things, then based on the write up on Objective HTML site, SafeCracker Registration may not be for you.

But I can't tell if you needs are fairly simple or very complex.
> 2 votes

---
Tags: members, member-details, safecracker-registration
---


# Question
Title: How can I include the status message in an email template after changing the status of an order using Store?
In the back-end at order details you can add a message while changing the status of the order. I want to use this information in the email templates, but I can't find the appropriate tag for the message.

# Answer
> 5 votes
Go to

EE --\> Store --\> Settings --\> Email templates

There's quite a lot of information, nicely described.

I think the tag you're looking for is {order\_status\_message}

---
Tags: add-on, expresso-store, tags
---


# Question
Title: How do I assign custom global variables from my config file?
I'm currently developing custom config files.

Some of my files are deeply located in my architecture and I want to use some of my variables in the config as specific tag.

Example :

```
{site_url}assets/css/style.css

```

like that :

```
{css_url}style.css

```

Is there a way to do it ?

# Answer
I found the solution:

```
global $assign_to_config;
    if( ! isset($assign_to_config['global_vars']))
    {
        $assign_to_config['global_vars'] = array();
    }

    $main_global = array(
        'global:env'      => ENV,
        'global:env_full' => ENV_FULL
    );
$assign_to_config['global_vars'] = array_merge($assign_to_config['global_vars'], $master_global, $env_global);

```

Now I can assign custom global in my $main\_global.
> 4 votes

# Answer
You can still use the Global Variables Array, that formerly existed in the path.php file, but now exists in your primary index.php file for the site.

I've include an example of the formatting:

```
$assign_to_config['global_vars'] = array(
    'subsite_id' => 'subsite01',
    'subsite_no' => '259',
    'domain' => 'http://mydomain.org',
    'https' => $_SERVER["HTTPS"],
    ); // This array must be associative

```
> 4 votes

---
Tags: config, variable, config-overrides
---


# Question
Title: Undefined index: checkbox_fields error when submitting safecracker form
Here is my form

```
{exp:safecracker
    channel="dummy"
    class="form-horizontal"
    dynamic_title="Place"
    error_handling="inline"
    include_jquery="no"
    return="test/place-form-done"
    safecracker_head="no"
}
    <fieldset>
        <legend>Place</legend>

        <div class="control-group">
            <div class="controls">
                <input type="text" name="place" value="" id="place" />
            </div>
        </div>

        <div class="control-group">
            <div class="controls">
                <button type="submit" class="btn btn-primary">Submit</button>
            </div>
        </div>

    </fieldset>
{/exp:safecracker}

```

When I submit, I get this

```
A PHP Error was encountered
Severity: Notice
Message: Undefined index: checkbox_fields
Filename: libraries/safecracker_lib.php
Line Number: 1210

```

Any idea why this is happening?

# Answer
This is a known bug in ExpressionEngine 2.5.3, see BugTracker. You need to be logged in to view.

The fix requires adjusting some code in the SafeCracker modules file. See below…

```
Open system/expressionengine/modules/safecracker/libraries/api/Api_sc_channel_entries.php and find this code on line 66:

$checkbox_fields = explode('|', $data['checkbox_fields']);
And REPLACE it with:

$checkbox_fields = isset($data['checkbox_fields']) ? explode('|', $data['checkbox_fields']) : array();

```

This may have been patched in the EE 2.5.5 update, but I'm not certain. You can apply this fix manually.

I should also mention that for some people applying the fix caused another error to occur, see…

```
A PHP Error was encountered
Severity: Notice
Message: Undefined index: checkbox_fields
Filename: libraries/safecracker_lib.php
Line Number: 1210

A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /system/codeigniter/system/core/Exceptions.php:170)
Filename: libraries/Functions.php
Line Number: 402

```

This was logged as a separate bug, with it's own fix. But if that error occurs for you, the fix is listed below.

```
Find this code starting at line 1210 in /system/expressionengine/modules/safecracker/libraries/safecracker_lib.php:

foreach (explode('|', $_POST['checkbox_fields']) as $checkbox)
{
    if ( ! isset($_POST[$checkbox]))
    {
        $_POST[$checkbox] = '';
    }
}
Replace that block of code with this:

if (isset($_POST['checkbox_fields']))
{
    foreach (explode('|', $_POST['checkbox_fields']) as $checkbox)
    {
        if ( ! isset($_POST[$checkbox]))
        {
            $_POST[$checkbox] = '';
        }
    }
}

```

Good luck.
> 6 votes

# Answer
This was patched in 2.5.4, according to the changelog.
> 4 votes

---
Tags: safecracker, forms
---


# Question
Title: <div> in form preventing layout based on {switch} tag working
I am trying to implement a store using the bootstrap grid. I want products to sit in blocks of 3 in a grid.

```
<div class="row">

{exp:channel:entries channel="english_ciders" orderby="date" sort="desc" dynamic="no"}
    {exp:store:product entry_id="{entry_id}" return="{segment_1}/{segment_2}/{segment_3}"}

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

    {/exp:store:product}
{/exp:channel:entries}

</div><!--end row-->

```

This works fine without the store tag. When I add the `{exp:store:product}` tag to the layout the form produced has its own `<div>` and this messes up the layout. I am sure I am approching this wrong. Any suggestions? Thanks.

# Answer
The `{exp:store:product}` tag creates a form element. It sounds like the problem is that you have the div set to float left, but because it is inside the form element, it's messing up your layout.

You should be able to fix it simply by moving the product form inside your div:

```
<div class="span3">
    {exp:store:product entry_id="{entry_id}"}
        {title}
    {/exp:store:product}
</div>
{switch='|</div><div class="row">'}

```
> 4 votes

# Answer
Adrian is correct about putting the {exp:store:product} tag inside the div - I'd also suggest it might be useful to rethink your HTML flow here. Using a switch to close off HTML elements seems like the sort of thing which could confuse you later on, and it's definitely going to confuse the next developer who needs to work on your site.

I would suggest you take that div logic out of the entries flow, and use your own css to decide if it's a new row or not. This will make for more semantic markup, and would make more sense from the responsive layout perspective too. Don't know off the top of my head how bootstrap handles rows and column layouts, but it probably makes more semantic sense to do things like this than make each product a new column. Maybe bootstrap has built in styles that can accomplish something similar?

```
<style>
  .products {
    max-width: 600px;
  }

  .product {
    width: 190px;
    margin: 5px;
    float: left;
  }
</style>

<div class="products">
{exp:channel:entries channel="english_ciders" ... }

    {exp:store:product ...}
        <div class="product">
             {title}
        </div>
    {/exp:store:product}

{/exp:channel:entries}
</div>

```
> 2 votes

# Answer
This is a more general comment but, when having to insert an html element every x iterations of a loop, I use the following syntax, whch I find easy to understand.

```
{exp:channel:entries channel="news"}
    {if '{switch="one|two|three"}' == "one"}<div class="row">{/if}
        ... something ...
    {if '{switch="one|two|three"}' == "three" || "{count}" == "{total_results}"}</div>{/if}
{/exp:channel:entries}

```
> 2 votes

---
Tags: expresso-store
---


# Question
Title: Multi-Site Manager / Matrix / Image not appearing
I'm assisting a colleague and for the life of me I can't understand what's happening.

SCENARIO

-Multi-site (full site and mobile version) -Attempting to share "company information" social icons from the Full website to the Mobile site. -Using Matrix 2.4.3 and EE 2.5.3

CODE

```
    {exp:channel:entries channel="company_info" limit="1" disable="categories|member_data|pagination" entry_id="2" site="default_site"}
{company_social_media}{image}<a href="{url}" rel="publisher" target="_blank"><img src="{site_url}{image}" alt="{alt}"/></a>{/company_social_media}
{/exp:channel:entries}

```

WHAT IS WORKING

We are getting the {ALT} and the {URL} but NOT the image. We were using "ed\_img\_sizer" and stripped that code out to just hold the {image} (as shown above) to no avail.

## #

Does anyone know if this is a known bug or would a simple upgrade fix these issues? Doesn't make any sense why we would get the URL and ALT but not the IMAGE source.

Thanks for the help...

# Answer
I had this before in the same scenario - in my issue the global variable {file\_dir} would not parse in child sites - This was filed as a bug and got a resolution here (ps i dont think matrix is effecting it...)

https://support.ellislab.com/bugs/detail/18265

For people without access to the ee bug tracker

```
Open system/expressionengine/libraries/File_field.php and find this code on line 582:
$this->_upload_prefs = $this->EE->file_upload_preferences_model->get_file_upload_preferences(
    $this->EE->session->userdata('group_id')
);

```

And REPLACE it with this:

```
$this->_upload_prefs = $this->EE->file_upload_preferences_model->get_file_upload_preferences(
    $this->EE->session->userdata('group_id'),
    NULL,
    TRUE
);

```

I believe this is down as fixed in the next version, but this solved the issue for us

Cheers
> 1 votes

---
Tags: matrix, multi-site-manager
---


title: date field type displays as a string

text:
# Question
Title: date field type displays as a string
I'm using a date field type to display the date of an upcoming event, but when its rendered it displays as a string of numbers. For example, one date displays as "1356393654". I'm not using any plug-ins, and I've already set the date formatting, which doesn't seem to have an effect. Any ideas?

```
    <ul class="upcoming-events>
        <li class="section-post">
            {exp:channel:entries channel="home" disable="categories|member_data|pagination" sort="asc"}
            <h3><img src="{site_url}/images/interface/noun_project_8151.svg" width="18" alt="calendar"> {title}</h3>
            <h5>{event_date format=%D, %F %d, %Y}</h5>
            <p>{event_details}</p>
            {/exp:channel:entries}
        </li>
    </ul>

```

# Answer
You forgot the '' in your tag :

```
<h5>{event_date format=%D, %F %d, %Y}</h5>

```

Correct :

```
<h5>{event_date format='%D, %F %d, %Y'}</h5>

```
> 3 votes

---
Tags: channel-entries, date, fieldtype
---


# Question
Title: Issues with EE Flickr for ExpressionEngine and favorited photos
I'm using EE hive's flickr plugin. I've authenticated ExpressionEngine with my flickr account but i'm having issues getting the favorites tag pair to display any information. I'm using EE 2.5.3 and the extension is version 2.1.9.

**Here's my testing code**

```
<h1>Photo stream</h1>
{exp:eehive_flickr:photostream}{flickr_url}<br />{/exp:eehive_flickr:photostream}

<h1>Sets</h1>
{exp:eehive_flickr:photosets}{set_url}<br />{/exp:eehive_flickr:photosets}

<h1>Favorites</h1>
{exp:eehive_flickr:favorites}{flickr_img}<br />{/exp:eehive_flickr:favorites}

```

The favorites tag pair just returns the `{flickr_img}` variable in plain text.

Any ideas?

# Answer
OK I found the bug. I'll get in touch with Digital Wax Works to update the add-on, but in the meantime here's your fix:

Open up /system/expressionengine/third\_party/eehive\_flickr/pi.eehive\_flickr.php, and at around line 310 you should find:

```
// Retrieve favorites from Flickr
$favorites = $f->favorites_getPublicList($flickr_settings['option_nsid'], NULL, NULL, $this->api_extras, $numPhotos, 1);

```

That method call is missing a parameter, so add another NULL in there like so:

```
$favorites = $f->favorites_getPublicList($flickr_settings['option_nsid'], NULL, NULL, NULL, $this->api_extras, $numPhotos, 1);

```

Give that a go, I hope it works for you!

Cheers, John
> 5 votes

---
Tags: extension
---


# Question
Title: How do you show the recent Disqus comments feed?
Does anyone know of a plugin to show the latest few Disqus comments that have been made across the entire site. Disqus seems to have deprecated their recent comments widget.

# Answer
CX Disqus Comments and Disqus both have the ability to sync/store native comments on your EE site. Once you have the Disqus comments synced into EE, you can use comment tags to display recent comments across the entire site:

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

```
> 5 votes

# Answer
I found that even though they don't provide the JS widget any more, they do still work.

https://gist.github.com/4174893
> 2 votes

# Answer
You simply copy the following code where you want

```
<div id="recentcomments" class="dsq-widget"><script type="text/javascript" src="http://yourshortname.disqus.com/recent_comments_widget.js?num_items=5&hide_avatars=0&avatar_size=32&excerpt_length=200"></script></div>

```

For more details check link : http://www.growtechinfo.com/2012/12/add-disqus-recent-comment-widget-to.html
> 2 votes

# Answer
Take a look at CX Disqus Comments and Disqus. Disqus is free though CX Disqus Comments isn't. I'm not really sure if they do exactly what you're asking for but take a look.
> 0 votes

---
Tags: comments
---


title: How to display Channel entry page?

text:
# Question
Title: How to display Channel entry page?
When looping through Channel entries, is there a way to provide users with a link they can click on that will take them to that specific Channel entry? I seem to recall seeing some "url" variable available within `{exp:channel:entries}` tag pair, but can't find it again.

Also, once I'm on that specific Channel entry page, how do I know which entry it is so I can display the rest of the Channel's data?

# Answer
> 6 votes
If you have an index or listing page, like products, your code maybe like

```
{exp:channel:entries channel="products" limit="10" orderby="date" sort="desc"}

    <div class="pic-wall"><a href=/product/profile/{url_title}"><img src="/images/product/{product_image_file}" alt="{title}"></a></div>

{/exp:channel:entries}

```

then on your product profile page, you'd want something like

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

<h2>{title}</h2>
{product_description}
<hr />
{other_fields}

{/exp:channel:entries}

```

Additionally, you can use the `url_title="{segment_3}"` to make sure the record exists, or the if no\_results option so that random urls, if generated will result in a 404 call.

The key component is to either use the {url\_title}, {entry\_id}, {comment\_entry\_id\_auto\_path}, or {permalink}. There are a few more options, but they are basically variations of the above for example:

`{url_title}` will allow you to custom create the path to the entry like

```
<a href="{domain}/products/detail/{url_title}" title="{title}">{title}</a>

```

or you could use {url\_title\_path}. {url\_title\_path} assumes you've completed the details in channel profiles, when you were setting things up, so if you said the default path for products was `products/details` it will use that, but if you said it was `products/index` then it would have the wrong path.

I tend to use the {url\_title} because I like the flexibility, one of the other developers I work with prefers using the {url\_title\_path} option. But both will create a link, so that you can design a template with detail specific fields.

Take a look at http://ellislab.com/expressionengine/user-guide/modules/channel/channel\_entries.html#parameters to see all the various parameter options available to you.

# Answer
> 2 votes
My preferred method is to use **{comment\_url\_title\_auto\_path}**. I find that this is the most future proof method since if your urls change in the future for some reason then you only need to make a change in the url settings for that specific channel and not throughout all of your templates. In your specific channel go to admin \> channel Preferences \> channel name and be sure to fill out the **comment page url** with the segment of where that channel should appear. For example if it's for your blog page which has a url like this domain.com/blog/url\_title then in that setting you would put **blog**.

---
Tags: channel-entries
---


# Question
Title: Help with channels and structuring content
I read somewhere that its good to use a channel for each page on your site, that way it makes it easy for the person who will ultimately be updating content to easily understand how its structured. Is that the best way? If so, I have probably 30 pages on the site I'm currently working on, and the navigation has sub-menus that lead to more pages. It seems crazy to me to have 30+ channels listed in the publish content drop-down. Can someone help me clarify the best way to structure all of this?

# Answer
> 5 votes
Not a channel per page, closer to a channel per section. If you think of pages as the final contact, like an individual post, a single product description or say a mission statement; then sections are what groups them.

A section would be what separates, all the content related to say your About Us area versus say all your organizations research, blog posts or products.

If and when creating a section or content area ( template groups) you may end up with multiple content types (templates). For example, the index page of the section may display the most recent 10 items. That acts as a 'listing' page, and that would be, but doesn't have to be, seperate from an actual full content page, like an article, staff profile, publication, etc.

Let's give a better example. Let's assume you were creating a fairly basic 'portfolio' site (you want to give people information about you and your work). You might have these sections: About, Blog, Contact, Clients.

Some About areas are a single page, some are very detailed, listing staff, projects, newsletters, etc. A staff listing may differ far enough from a project or newsletter listing, that you'd want 2 separate templates. If so, your section may end up with the following:

```
template_group: about
templates:      about/index
                about/staff
                about/post

```

This is one section that references a single template\_group, that then has three different display options.

The index page would introduce people to the section. It could be a listing of recent items, or composed to introduce everything you consider relevant. See SnowShoe as an example. Not a site we designed, but I was just looking at it today for other purposes. It's about page, gives you the quick mission and then a listing of other items you can access—mainly staff profiles.

The staff profiles could be an overlay, like on that page, or could be separate template that specifies, picture size and placement, contact information, then the profile.

The post template, would then handle everything else— press releases, newsletters, project listings etc. Assuming that the formats are all similar (title, summary, body).

So **NO** you don't want 30 templates, you want to think about content areas and how people will interact with them. Then create the smallest number of templates that you need. For example, 80% of our sites are formatted with this formula:

Template Group name matches navigation section (About == about, Research == research, etc.). Each template\_group starts with three templates— index, archive, article. More templates are added if needed, sometimes 'archive' is removed.

So a site with five sections— about, contact, research, blog, links, may have 10-15 templates, that serve up between 50 to a couple hundred pages of data. Creating one template per page defeats the purpose of a content management system, which is to separate content from design, and allow your templates to be reusable.

If you has 20 staff members, you wouldn't want to create 20 templates, but one template that is the staff profile and a second template that is the staff listing or directory.

# Answer
> 2 votes
I like @nonprofit\_tech's answer, and I'll throw an example at you based on how I handle templating relative to channels. I too tend to create a channel per section or content area, though I specifically break it into a "pages" channel for the section and then, if needed, content-specific channels for specialized areas of content. An example will help make this approach a bit more clear. Sticking with an "about" section as an example, since I think it demonstrates this well... Let's say I have an "About" section. Within that section, I know I'm going to create a page that will list staff members, as well as link to each staff member's detailed profile. I will also include in that section a page of "locations" that will list my retail stores, again each with a details view. I often handle a setup like this as follows:

I create an "about pages" channel. I also create a channel for staff and a channel for locations. I do this because I want to create entry screens that use custom fields that are very deliberately tailored to the staff and locations info that are certainly very different from more "page-oriented" content.

My idea is that any entry in the "about pages" channel actually creates a page within the section. And so within that section's index template, I use two channel loops - one in the body area, which uses a limit of 1, and one in the sidebar with a limit of perhaps 30 (let's assume I don't expect the client to ever create more than that number of pages in the section, for example) and dynamic="no" to ensure that it displays the same way even when the URL changes.

That approach alone will allow each entry to act as a page within the section. And so the client can then easily create a page for "Staff" or "Locations" or "Our History" or "Returns Policy" - really whatever they dream up. But how do they tie the staff channel entries to the entry in the about channel that the client has created for the Staff content? The client doesn't need the ability to format the list of staff members - just to indicate that they would like that content to display on that specific "page" they created as an entry. And so I create a sub-template for the list view of the staff - all pre-formatted and ready to drop in where the client needs it.

To do this, I add a custom field to my "about pages" field group to allow the client to select which custom, section-specific subtemplate they would like displayed right after the body field content - I usually use a radio button so they can see all the options available, and i make the first one "none" (since clearly not every page entry actually needs a subtemplate to be displayed).

And so in my template, we look to see what they have selected in that field (I tend to use Switchee for this) and then if it's something other than "none", such as "staff list" or "locations list" then the sub-template is used. Since that subtemplate involves pulling content from another channel, you may need to approach this with an embed (since you can't have an entries loop inside another entries loop - though there are add-ons and techniques to get around that as well). It does require you to think ahead and plan specific options for them to select and display conditionally within the template. But I have used this approach many times now and clients really seem to like it and find it easy to use.

So then within the "about" section, like @nonprofit\_tech outlined, I wind up with only a couple of templates (and a couple of "embed" templates as well for the lists appropriate to the section). The index template handles the display of all the page content, and the embedded sub-templates handle displaying the listing of staff, locations, etc), and then I need a display template for a staff person's profile, for example. So something like this:

```
About Template Group
    - index
    - bio (single staff profile template)
    - location (single location details template)
    - staff-list-embed (list of staff)
    - locations-list-embed (list of locations)

```

I actually tend to actually put embeds all in one "embeds" template group, but I display then here to show you that with this example, you would have only 5 templates in total needed for the about section.

Hope you find the example useful.

# Answer
> 1 votes
I don't do a channel per page, that wouldn't even make sense for many dynamic sites with the same content spanning multiple pages. I make a channel for every stream of data (a news channel, a program channel) and one channel for all the fairly static pages that I want to be editable in the CP. I then use the pages module or one of the more complex Addon's to lay out their URL structure and hierarchy on the site.

---
Tags: channel
---


title: Store and Shipping by Category

text:
# Question
Title: Store and Shipping by Category
Has anyone set up a 'by - category' type shipping plugin in exp:resso store?

I want to allow the client to use the category list to manage their own categories for products, but at the same time put in a flat rate for shipping per category.

For example, if a category falls under the category of books, the shipping is $4. If it is something small like seeds, shipping is $1, etc etc. If they pick one of each, the larger is taken as the final shipping price.

I am looking at the: per\_item\_rate, per\_weight\_rate fields in the store tables and I am thinking of adding a: per\_category\_rate table, but don't want to modify core stuff, only extending what is there for easy upgrades.

So taking the default shipping plugin - would it be best to start from this and build upon it, making change to the database fields and logic within it?

Or, would it be better to pull from a category group, and use a custom shipping field for the category, and roll your own plugin for shipping this way?

Any points in the right direction will ensure I don't go too far down one route when another is the best practice or more flexible way of going about it.

# Answer
There is nothing like this built in, so you would need to create a shipping plugin from scratch.

If you just need a one-off, and don't mind hard coding the values, you would be best to take a look at this simple example shipping plugin for Expresso Store.

If you want to create a redistributable plugin with a nice interface etc, take a look at the default shipping plugin (which is significantly more complex than any of the other shipping plugins). You probably want to avoid creating extra database tables etc, so you can store the settings for your plugin as an array (this will get automatically serialized/unserialized when your plugin is loaded).

If creating a reusable plugin, I would either create an interface to select categories and assign prices to them, or use a custom category field for the price, and provide a dropdown to select which custom field contains the shipping price.

Probably the most important thing to think about will be defining what happens when more than one product is added to the cart, or when a product belongs to more than one category. It sounds like you have an answer for this for your specific needs, but if you want to create a flexible calculator you might want to provide options for this as well.
> 2 votes

---
Tags: expresso-store, ecommerce, expresso, shipping
---


# Question
Title: Why is this non-formatted member profile textarea stripping HTML markup?
I have a custom profile textarea, formatting set to none, with simple HTML markup in it. According to the EE docs, it should be left "as is." But when I view a template pulling this field into it, all markup is stripped out.

I've been dev'ing in EE for years, and I'm pretty familiar with most things, yet this has never happened to me (nor have I ever had the opportunity for it to be an issue--rarely mess with member profiles).

Originally, I'd assumed the default member bio field's formatting was set to "none," but I was experiencing the same issue, so I made a custom bio field. Same thing happens.

There's nothing surrounding the field in the template, it is literally dropped into a div by itself. There's nothing special about the `{exp:member:custom}` tag pair either, the only parameter I include is the `member_id`. All other fields display properly (`screen_name`, and a series of links to social profiles).

# Answer
> 2 votes
UPDATED: You should probably set your custom field to be formatted as "XHTML." Custom member fields are processed by the Typography class, which strips HTML tags when "none" is used (as a security precaution).

Since you have written your own custom field, you can verify my statement by reviewing these functions in the Custom Member Field call chain:

* `mod.member.php::custom_profile_data()`
* `EE_Typography.php::parse_type()`
* `EE_Typography.php::format_html()`

UPDATE: Since XHTML does not appear to work around this for all HTML tags, the following core hack will work for now:

1. Open system/expressionengine/libraries/EE\_Typography.php
2. Find `function parse_type`
3. Locate `$str = $this->format_html($str);` within the function.
4. Replace that line with this: `if ($this->text_format != 'none') { $str = $this->format_html($str); }`

---
Tags: templates, members
---


# Question
Title: Javascript Updated prices with exp:resso Store
I would like Expresso Store to update my product price every time I choose a modifier. Is there an easy way to do this built into the store?

# Answer
> 4 votes
Store has built in dynamic price variables you can use. You can see all of the avilable variables here. You would want to use

```
<span class="store_product_price"></span>

```

To adjust the price when modifiers are changed.

---
Tags: add-on, expresso-store, jquery
---


# Question
Title: Uploading file as a modifier in Expresso Store
I would like to have my clients upload a couple files when they add a product to the cart. I want to be able to do something similar to the print products on "missions linked.com".

# Answer
I don't think the Store module works with file upload fields as product modifiers. But, here's a possible way to achieve the functionality I think you're looking for:

1. Create a "designs" channel with a file upload field and any necessary meta fields.
2. Use SafeCracker to let the user submit a "design" with uploaded file, and upon submission, redirect the user to a URI containing the ENTRY\_ID of the new entry.
3. On that page, include a Product form, and pass the ENTRY\_ID of the design \[via segment variable\] into either a modifier parameter or hidden modifier field.
4. When the user adds the item to the Cart, you can now reference the design via it's unique ID, which is contained in the modifier value. You can even use an embedded template or partial to pull the data from the design entry into the Checkout process.
> 4 votes

---
Tags: expresso-store, file-uploads, expresso
---


title: Safecracker Registration Setup Problem

text:
# Question
Title: Safecracker Registration Setup Problem
I was trying to install Safecracker Registration with the steps from the site.

I was able to do all the steps with no problems...except the last one.

> Configuring Safecracker
>
> Since you are using Safecracker as a registration form (at least in this case), you must allow it to accept data from guests. Go to Add-ons \> Modules \> Safecracker and find your Member channel, and assign a member as a guest. It is recommended you create a new member named Anonymous.

This is the page that the above paragraph refers to

I am just confused about

> Go to Add-ons \> Modules \> Safecracker and find your Member channel

since I don't see "Member Channel" anywhere.

I am doing it correctly?

P.S. I am using ExpressionEngine 2.5.5 and Safecracker Registration 1.2.0

# Answer
You are doing everything correctly as far as I can tell. And you have a Members channel already, as it is appearing in the list. (The table with the header, "Members" is what I was referring to.) You could create a channel with any name and any field to store your member profiles, I just use the "Members" nomenclature by default.

Essentially what you are doing is telling Safecracker to allow members to post anonymously without being logged in. Since every entry must have an author, you must assign an "anonymous" author to each new profile until the member account is created. Once the member account is created, the profile is updated with the new member\_id.

Safecracker Registration v1.2 applies a series of overrides that allows users to skip this step entirely. Since 1.2 is not yet released, I have not documented this as such.
> 1 votes

# Answer
You need to create a new channel or use existing one to store the content from the Safecracker form. You also need to register a new member to so the posts have an author (who may need access to post in that channe). In short, I would create a new channel called 'forms', and a new member called anonymous to post in the 'forms' channel.
> 1 votes

---
Tags: safecracker-registration
---


# Question
Title: Backward Slash Added to Search Results Except
I have run into a strange situation where a Backward Slash \ is being added to the end of each sentence in the search excerpt field just before each period. For example:

```
Lorem ipsum dolor sit amet, consectetur adipiscing elit\. Vivamus et sodales nunc\. Aenean sit amet massa at ante porttitor euismod a sit amet ante\. Morbi vitae est eu ante rutrum cursus sit amet nec nunc\. Aliquam erat volutpat\. Curabitur eget odio arcu, vel fermentum felis\. Sed pellentesque lorem ac nibh…

```

It happens no matter what type of field I have set as the excerpt (RTE or Textarea).

The search results template is fairly straightforward:

```
<div class="content group">
        <h1>Resultados de la búsqueda</h1>

        <div class="article primary d-all">

        <p>You searched for <strong>{exp:search:keywords}</strong>
        and got {exp:search:total_results}{total_results}{/exp:search:total_results} result{if "{exp:search:total_results}" != 1}s{/if}.</p>
        <ul>
            {exp:search:search_results}
            <li><a href="{site_url}{auto_path}">{title}</a> {excerpt}</li>
            {/exp:search:search_results}
        </ul>
        </div>
    </div>

```

The slash is not being displayed within the entry template, just in the search results template.

Any thoughts would be appreciated.

Thanks!

Updated to show text with slashes. It was removed by the SE template for some reason.

# Answer
> 16 votes
This is a bug (see bug report #19102). It's because the excerpt is being filtered through PHP's `preg_quote()`. You can either remove the `preg_quote()` from line 1507 of `mod.search.php` for now and just leave it as `$excerpt` and hope you don't have anything that looks like a replacement pattern in your search excerpts, or just show the custom fields themselves in the template and limit the text with a character-limiter plugin.

---
Tags: search
---


title: weird CE Image & Better Workflow issue

text:
# Question
Title: weird CE Image & Better Workflow issue
First time using Better Workflow and it's been really great for the client.

However, we have a weird issue with previewing images. We're using the approach of having content images inside a Matrix and then placing image slugs within the content and using NSM Transplant to replace the slugs with CE Image.

When we look at the page preview in BW, the src for the image is empty. However, when we publish the page and look at it on the front-end, the images are output as we'd expect.

```
{exp:channel:entries {gv_param_disable_default}}
{!-- resolves a weird BW issue with Playa field --}
      <!--
{cf_content_related_documents:total_children}
{cf_content_related_content:total_children}
{cf_content_contact:total_children}
{cf_content_cta:total_children}
 -->

      <h1>{title}</h1>

      {exp:ce_img:single src="{cf_content_hero_image}" allow_scale_larger="yes" width="1067"}

      {cf_content_intro}

     {cf_content_body_images}
    {exp:nsm_transplant:content id="image_{row_count}"}
        {exp:ce_img:single src="{image}" width="{width}" class="{align}" alt="{alt}"}
    {/exp:nsm_transplant:content}
{/cf_content_body_images}

{exp:nsm_transplant:body}
{cf_content_body}
{/exp:nsm_transplant:body}

      {/exp:channel:entries}

```

# Answer
I started troubleshooting from Twitter. First off the caveats, I haven't used CE Image, Better Workflow or NSM Transplant. But my first thought was that the issue maybe NSM Transplant.

After watching the 'advanced' video for NSM Transplant, I'm fairly certain this maybe your issue.

> When we look at the page preview in BW, the src for the image is empty. However, when we publish the page and look at it on the front-end, the images are output as we'd expect. - Steve Grant

I believe the reason for this, is because NSM Transplant does the replacements at the template level, so unless you've created the Preview template to also contain and use the `{exp:nsm_transplant:content id="image_{row_count}"}{/exp:nsm_transplant:content}` tags, then the images won't display in preview, because they don't currently exist for the record, NSM Transplant hasn't been called yet.

Are your preview pages custom designed? or are they just the Better Workflow preview pages?

You can check with Better Workflow/Electric Putty. Based on their docs, occassionally…

> N.B. Better Workflow's preview feature relies on the standard /template\_group/template/entry\_id format for its URL so you should be able to simply select the channel's default template. However, depending on how your template is constructed, it may sometimes be necessary to create a 'preview specific' version. -ElectricPutty Documentation

But based on the video and reading skimming through the documentation, I wouldn't expect the images to fully display until after the post is published. So this maybe a situation where a specific preview template needs to be constructed for these items.
> 2 votes

# Answer
Just a thought, not an answer -- have you considered trying another snippet-move mechanism?

Stash (http://devot-ee.com/add-ons/stash) appears to be like all Mark Croxton makes, pretty solid stuff.

It might be taking a different approach that could matter, when you're using it in the Better Workflow previewer. One way to see...
> 1 votes

---
Tags: ce-image, better-workflow
---


# Question
Title: Is this a good use for the redirect tag?
How does Google view the redirect tag, e.g:

```
   {if segment_4 == ""}
        {exp:channel:entries limit="1" entry_id="{segment_3}" disable="categories|category_fields|custom_fields|member_data|pagination"}
            {redirect='forum/answers/{entry_id}/{url_title}'}
        {/exp:channel:entries}
   {/if}

```

For example I could redirect: site.com/forum/answers/123 to site.com/forum/answers/123/what-is-a-dog and have link rel="canonical" href="{path='{segment\_1}/{segment\_2}/{segment\_3}/{segment\_4}'}" on the template.

What will Google make of site.com/forum/answers/123, or will it never see it?

Perplexing...

Thanks.

# Answer
> What will Google make of site.com/forum/answers/123

It will see that as a 302 (temporary) redirect, as that's what EE sends with the `{redirect=""}` tag (which calls the `redirect` method of the `functions` class).

> ... or will \[Google\] never see it?

That all depends on where the links to your entries are coming from. If you want your links to appear a certain way, then make sure that the rest of your site links to these entries in that way (i.e., `template_group/template/entry_id/url_title`), and hence, Google will not have to be redirected (nor will anyone else).

But if you for some reason do not have control over the links which point to these entries, then yes, Google (and everyone else) will trigger that redirect, and the `rel="canonical"` meta tag *should* tell Google to remember the correct link (even though it was given a 302 \[temporary\] rather than 301 \[permanent\] redirect).
> 2 votes

---
Tags: seo
---


title: Problem with custom global variable

text:
# Question
Title: Problem with custom global variable
I created a custom config file with my own global variable.

When I'm using the EE debugger, I have an output of my global variables:

So, I guess, they exists and I can access to them.

The problem is that when I'm using them in my files, I have no output, my CSS files are not loaded, well, there is nothing.

Code:

```
<link rel="stylesheet" href="{global:css_url}style.css" media="screen" />

```

Did I do something wrong ??

# Answer
I found the solution and It was not a problem with my global variable.

One of my config line was wrong and the rest of the code was not executed so I couldn't use them.

Everything is back to normal, thanks you again.
> 0 votes

# Answer
> Have you tried just using the variable name?
>
> ```
> {css_url}
>
> ```
>
> If it's just a straight global variable, you shouldn't need to prepend it with "global:".
>
> User-defined Global Variable Documentation -- see the comments for the method I believe you're using to set the variable.

**Update**

Please disregard my previous answer. I wasn't fully grasping how you were naming the variables. Instead, let me answer with a question: Do your other global variables work? If not, try removing "global:" from the variable name (both when you set it and when you use it) and see if that gets you anywhere.
> 0 votes

# Answer
It seems the global variables you have defined that are specific to the environment seem unecessary. I would just use the standard `site_url` instead of having to define all those variables once the site is moved to a production/live server or just make them relative.

```
    <link rel="stylesheet" href="{site_url}/assets/css/style.css" media="screen" />
or
    <link rel="stylesheet" href="/assets/css/style.css" media="screen" />

```

Then any related uploaded content will be defined in the Upload Preferences: server path and URL path
> 0 votes

---
Tags: global-variables, debugging
---


# Question
Title: Only show future entries for specific channel in multi-channel entry loop
I have a channel entries loop where I am pulling data from multiple channels. These entries are then mixed together in the sort order they are returned in. With all but one channel I'd like to restrict it to not show future entries. However, I do need to show future entries for that one remaining channel. What are my options.

# Answer
> 2 votes
how about

```
{exp:channel:entries channel="alpha|beta|gamma"}
    {if channel_short_name == 'blah'}
        show me
    {if:else}
        {if entry_date > current_time}
            show me
        {/if}
    {/if}
{/exp:channel:entries}

```

# Answer
> 2 votes
You can only do that kind of conditional retrieval by using a custom SQL query that does some checking of dates for you. Fortunately it's a pretty trivial query - only a little bit of logic required. Without knowing more about what your data looks like, etc, it's hard to provide more details information, but I'd suggest you run something like the (**totally untested, probably broken, and and likely to corrupt your DB**) SQL below through the Query Module.

```
SELECT
  exp_channel_titles.entry_id AS id,
  exp_channel_titles.title AS title,
  exp_channel_titles.entry_date AS date_published
FROM
  exp_channel_titles
WHERE
  ((exp_channels.channel_name = 'no_future_posts_channel_name_1' OR
    exp_channels.channel_name = 'no_future_posts_channel_name_2') AND
    exp_channel_titles.entry_date <= NOW()) OR
    exp_channel_titles.channel_name = 'future_posts_ok_channel_name'
ORDER BY
  date_published DESC
LIMIT
  15;

```

# Answer
> 1 votes
You could maybe do this:

```
{if entry_date > current_time}
   {if channel_short_name == "channel-that-should-show-future-entries"}
      show stuff
   {/if}
{if:else}
   {if (channel_short_name == "channel-that-should-show-future-entries" && entry_date <= current_time) OR channel_short_name!="channel-that-should-show-future-entries"}
      show stuff
   {/if}
{/if}

```

# Answer
> 1 votes
I think a custom query in a simple plugin would be the most straightforward approach. However, it may be possible using just a template without a custom query if you:

1. Ran an entries loop that allowed future entries, ultimately returning more than you needed
2. Added those entries you wanted (filtered by channel short name and date conditionals) to Stash's set\_list tag
3. Used Stash's get\_list tag to display the results, specifying your overall limit there

---
Tags: channel-entries
---


# Question
Title: SafeCracker: change email address, change password, delete member account
I need to provide my members the ability to change their email address and password and delete their member account. I'm using SafeCracker. How do I do the following:

* Allow users to enter a new email address, but that address will only become effective once the user has verified the new email address (meaning they need to go to their inbox and click a link)
* Change the current password. Just in case, I also don't want the users to have to enter their existing password. As a matter of fact, I would prefer if they just entered the new password without having to confirm it. (I won't be using password input type.)
* Delete member account, which will delete some Channel entries, but not all

# Answer
For a custom plugin, you would probably want to build a module that has its own tables to manage elements 'outside' the normal ee processes. For the first element listed above:

> Allow users to enter a new email address, but that address will only become effective once the user has verified the new email address (meaning they need to go to their inbox and click a link)

* What I would do on a custom module is have a member lookup by logged in member id, pulling out their current email address.
* The form submission would send to a template that saves the current email and new email to a temporary email table.
* This would then fire off a custom email to the new address via postmaster.
* On receipt of the new email, the user would click the link which opens a new template and a custom tag generated by your mod file.
* This tag checks the same table as above, looks for both the old and new. If verified the mod does a lookup of the existing member id and them replaces old with new and removes the record from your temp db table.

A couple of things you would need to look for would be what happens if:

1. They don't click the link, but want to use their new email, what happens? or...
2. When they do click the link, it should probably redirect them to a login of some sort (assuming they aren't logged in and login by email is your preferred method.

For the second element:

> Change the current password. Just in case, I also don't want the users to have to enter their existing password. As a matter of fact, I would prefer if they just entered the new password without having to confirm it. (I won't be using password input type.)

You could do a lookup of the existing pass and place it into a hidden div or field and throw a little javascript verification to make sure the new pass != the old pass. Not sure you can submit this without a confirmation field, but haven't tried it before either.

For the last bit:

> Delete member account, which will delete some Channel entries, but not all

Again, some sort of custom module with tags would sort this, but the key would be to make sure the person deleting their account is the actual person, so tied to their logged in member id, and loads of 'are you sure?' messages.

The custom mod would remove the member account from member tables, making sure to kill anything related in the EE structure.

Also, whatever channel entries required removing would need to be looked at, because field types might be more complicated to kill than others (playa or relationships or channel images have a few tables linked). You need to make sure comments, if used, are not linked and you don't end up with orphaned entries in the DB.

But the key is to define which needs to be removed and go through it methodically.

Hope this helps.
> 2 votes

# Answer
The functionality you ask is very specific and
quite far of from the default behavior of EE or any member add-on.

to achieve this you will probably need a custom add-on.
> 0 votes

---
Tags: members, safecracker
---


# Question
Title: Pagination outside of channel entries tag? Part 2
RE: Pagination outside of channel entries tag?

Is this really the best way to place the pagination links outside the Channel entries tag? It seems ugly.

(And out of curiosity: is there a benefit to putting paginate inside the Channel entries tag? I'm wondering why EE was designed this way.)

Also, is there a way to control what is added to the URL segment? Say I wanted to change "P1", "P2", etc. to something else? What if I wanted it to be query string? I will paginating through search results and would like the GET param values in the URL.

**UPDATE 1:**

Trying the Stash solution, I did this:

```
// Inside the tag pair
{exp:stash:set name="pagination"}
    {paginate}
        <p>Page {current_page} of {total_pages} pages {pagination_links}</p>
    {/paginate}
{/exp:stash:set}

```

And the later on in the same Stash template file:

```
{exp:stash:get name="pagination"}

```

This approach results in two things that I do not want:

1. The pagination still shows inside the tag pair
2. The pagination does not show outside the tag pair

**EDIT 2:**

This solved my Stash problem: https://gist.github.com/1206694

# Answer
That's one way of doing it. You could also output the entire pagination-tag to Stash and then output it in the template somewhere else (see the examples @ Github).
> 1 votes

# Answer
> Is this really the best way to place the pagination links outside the Channel entries tag? It seems ugly.

IMHO, it is indeed the best way. Plus, it's always a good idea to use the `{if count == "1"}` and `{if count == total_results}` conditionals because it keeps all of your template code that relates to a particular query self-contained.

> (And out of curiosity: is there a benefit to putting paginate inside the Channel entries tag? I'm wondering why EE was designed this way.)

Because EE is much more than just the Channel Entries tag (i.e., other modules may well use the same URL-indicator for pagination), and you can have multiple Channel Entries tags within a single template. There would be no way for EE to know what it was paginating if the pagination code wasn't within the loop.

> Also, is there a way to control what is added to the URL segment? Say I wanted to change "P1", "P2", etc. to something else? What if I wanted it to be query string?

In a word, no - not with the Channel or Search modules. You could use a third-party search module that does keep search and pagination information in the URL though (like Super Search or Low Search).

As a side note - remember that the first-party modules that come with EE are not frameworks - they are complete modules, designed to work a certain way. Some of them may provide many hooks to alter their behaviour, but they should, for the most part, be used as designed.
> 1 votes

---
Tags: pagination
---


# Question
Title: Difficulty with whitespace and Editor add-on
I am using the Editor WYSIWYG add-on so that I can have WYSIWYG support in the category description editor. This has been working fine until the following issue arose.

When the category description is left in a way that appears empty, it actually outputs the following `<p><br></p>` which is bad for three reasons:

1. It is not XHTML compliant (the `<br>` should be `<br/>`).
2. There is no sense for there to be an `<br>` element in the first place... it should be blank. Sure I can understand the empty `<p>` element but why the other?
3. The following template logic fails to work (primary concern):

---

```
{if category_description}
<div class="category-description">{category_description}</div>
{/if}

```

How can I prevent the Editor add-on from generating junk for when an empty description is specified? or alternatively how can I safely determine when the description is empty?

*Note: I do not trust using `{if category_description != '<p><br></p>'}` for a number of reasons. a) browser compatibility, b) varying results for empty category description, c) it's too hacky*

# Answer
> 1 votes
For the time being I have created the following plugin to workaround this issue. I am still interested in a proper solution (if there is one) though:

```
public function excl_empty_html() {
    $this->EE = &get_instance();

    // If content is empty then waste no further time
    $content = trim($this->EE->TMPL->fetch_param('content'));
    if ($content == '')
        return '';

    // Strip HTML tags and trim to determine if there is any physical content.
    if (trim(strip_tags($content)) == '')
        return '';

    // Finally parse output
    $variables[] = array(
        'content' => $content
    );
    return $this->EE->TMPL->parse_variables($this->EE->TMPL->tagdata, $variables);
}

```

**Usage:**

```
{exp:yourplugin:excl_empty_html content="{category_description}"}
    <div class="category-description">{content}</div>
{/exp:yourplugin:excl_empty_html}

```

---
Tags: add-on, templates, categories, editor
---


title: Basic Channel Tag throwing PHP errors

text:
# Question
Title: Basic Channel Tag throwing PHP errors
> Solution was to save entries until the entries with "bad data" were saved over.

I wrote a quick tag to display all entries in a list from a particular channel. However, it threw a bunch of PHP warnings. This is the tag.

```
<ul>
{exp:channel:entries disable="categories|pagination|member_data" channel='member' dynamic='off'}
    <li><a href="{page_url}">{title}</a></li>
{/exp:channel:entries}
</ul>

```

In my first round of troubleshooting I found that if I limited the loop to a certain number (let's say 27) of entries the tag would render as expected. But if I'd change the limit to 28, the error would throw. I would assume that this means there is corrupt data in some entries... but not all?

I've since discovered that if I **disabled custom fields** the tag would render. Further troubleshooting led me to start disabling/uninstalling fieldtypes. After much of trial and error it seems that any fieldtype that has data stored in the database will cause the php warnings.

Now, what is odd (to me) is that if I declare a specific entry id's there is not an error. These entries include ones that are known to instigate the php errors.

> entry\_id="642|643|644|646|647|648"

There is definitely something awry in the database, I don't see anything that jumps out at me when I take a look at the sql, but I don't have the best mySQL skills.

Where do I look next?

**The errors read as following:**

> A PHP Error was encountered Severity: Notice Message: Undefined index: Filename: channel/mod.channel.php Line Number: 4785

> A PHP Error was encountered Severity: Warning Message: Invalid argument supplied for foreach() Filename: channel/mod.channel.php Line Number: 4787

> A PHP Error was encountered Severity: Warning Message: Cannot modify header information - headers already sent by (output started at /\***/system/codeigniter/system/core/Exceptions.php:170) Filename: core/Common.php Line Number: 412

> Fatal error: ob\_start() \[ref.outcontrol\]: Cannot use output buffering in output buffering display handlers in /\***/system/codeigniter/system/core/Exceptions.php on line 166

**System facts**

> - updated to 2.5.5
> - Errors happen locally and on live servers
> - Have around a thousand entries, so saving each one isn't a great option

# Answer
> 4 votes
Have a look at your 28th most recent entry in the Edit screen - chances are there's some bad data in one of your fields (or maybe data for a field that no longer exists). Re-save it and see if the error persists.

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


# Question
Title: Using Stash to Pull Matrix Data from a Related Entry?
I am trying to expand some code suppled by Mark Croxton in another thread to create a list of Matrix results from a related entry but without success. This is with Stash 2.3.5 on ExpressionEngine 2.5.3.

Here is my SET code from my main template:

```
    {exp:stash:set_list name="landing_slideshow" parse_tags="yes" parse_depth="2"}

      {exp:channel:entries channel="slideshow" sort="date" dynamic="no" disable="member_data|pagination" parse="inward"}

        {stash:stash_entry_id}{entry_id}{/stash:stash_entry_id}
        {stash:title}{title}{/stash:title}
        {stash:landing_slideshow_image}{landing_page_slideshow_image}{/stash:landing_slideshow_image}

        {exp:stash:set_list:nested name="lb_slideshow_credits_{entry_id}" parse_tags="yes"}
          {related_entries id="related_work_project"}
            {work_team}
              {stash:lp_slideshow_position}{mx_position}{/stash:lp_slideshow_position}
              {stash:lp_slideshow_person}{mx_person}{/stash:lp_slideshow_person}
            {/work_team}
          {/related_entries}
        {/exp:stash:set_list:nested}

      {/exp:channel:entries}

    {/exp:stash:set_list}

```

And here is the GET code I have in an embeded template:

```
  {exp:stash:get_list name="landing_slideshow"}
    <ul class="normal">
      <li>{stash_entry_id}</li>
      {exp:stash:get_list:nested name="lb_slideshow_credits_{entry_id}"}
        <li><span class="">{lp_slideshow_position} | </span> {lp_slideshow_person}</li>
      {/exp:stash:get_list:nested}
    </ul>
  {/exp:stash:get_list}

```

The Stashed values set outside the {related\_entries} loop — {stash\_entry\_id}, {title} and {landing\_slideshow\_image} are all displaying as expected. Nothing in the {related\_entries} loop is displaying or appears to be stashed.

Does using related entries change things enough that answers in the other thread aren't applicable?

# Answer
I solved this by removing Stash from the equation and instead using two {exp:channel:entries} tag. After 53 views of this question, my assumption is this is not a common use for Stash and thus the tradeoff between performance and supporting my own code 6 months down the line is low.
> 2 votes

---
Tags: stash
---


title: Safecracker Registration Database Error

text:
# Question
Title: Safecracker Registration Database Error
I am trying to use Safecracker Registration to register but upon submit I get this error,

```
A Database Error Occurred

Error Number: 1054

Unknown column 'ip_address' in 'where clause'

SELECT COUNT(*) AS count FROM exp_security_hashes WHERE hash='56bdf8c4561f360c63ed39ad076b03f4047066f3' AND ip_address = '120.28.235.198' AND ip_address = '120.28.235.198' AND date > UNIX_TIMESTAMP()-7200

Filename: third_party/safecracker_registration/libraries/Safecracker_registration_lib.php

Line Number: 459

```

Here is my form

```
{exp:safecracker
    channel="members"
    class="form-horizontal"
    dynamic_title="[email]"
    error_handling="inline"
    include_jquery="no"
    register_member="yes"
    return="/index.php/sign-up/"
    safecracker_head="no"
}

    {if global_errors:count > 0}
    <div class="errors group tencol">
        <h3>General Errors</h3>

        <ul class="bullets">
        {global_errors}
            <li>{error}</li>
        {/global_errors}
        </ul>
    </div>
    {/if}

    {if field_errors:count > 0}
    <div class="errors group tencol">
        <h3>Form Errors</h3>

        <ul class="bullets">
        {field_errors}
            <li>{error}</li>
        {/field_errors}
        </ul>
    </div>
    {/if}

    <fieldset>
        <legend>Sign Up</legend>

        <div class="control-group {if error:email != ''}error{/if}">
            <label class="control-label" for="email">E-mail<sup class="required">*</sup></label>
            <div class="controls">
                <input type="text" name="email" value="{email}" id="email">
                {if error:email != ''}
                    <span class="help-inline">{error:email}</span>
                {/if}
            </div>
        </div>

        <div class="control-group {if error:password != ''}error{/if}">
            <label class="control-label" for="password">Password<sup class="required">*</sup></label>
            <div class="controls">
                <input type="password" name="password" id="password">
                {if error:password != ''}
                    <span class="help-inline">{error:password}</span>
                {/if}
            </div>
        </div>

        <div class="control-group {if error:password_confirm != ''}error{/if}">
            <label class="control-label" for="password_confirm">Password Confirmation<sup class="required">*</sup></label>
            <div class="controls">
                <input type="password" name="password_confirm" id="password_confirm">
                {if error:password_confirm != ''}
                    <span class="help-inline">{error:password_confirm}</span>
                {/if}
            </div>
        </div>

        <div class="control-group">
            <div class="controls">
                <button type="submit" class="btn btn-primary">Register</button>
            </div>
        </div>

    </fieldset>

{/exp:safecracker}

```

Any idea what is happening?

P.S. I am using ExpressionEngine 2.5.5 and Safecracker Registration 1.2.0

# Answer
> 6 votes
This is a bug with SafeCracker Registration. EE recently dropped the ip\_address field from the security\_hashes database and this add-on still acts as if it's there. Try upgrading to the latest version of SafeCracker Registration or contact the developer to make sure they know and can put out a fix.

# Answer
> 2 votes
Per the comments in the other answer, I am working on a fix for this. Email support@objectivehtml.com and I will send you and email with the latest version once it is available.

EDIT:

**I have a fix for these issue now in my latest developer build. Just email me for the latest build.**

---
Tags: safecracker-registration
---


# Question
Title: Channel entry details - what's the template group/template?
I have a template the loops over the Channel entries and displays some basic information about each entry. I'd like to have each item link to more details about that particular entry. It seems that I should be linking to the one of the following: `{url_title}`, `{entry_id}`, `{comment_entry_id_auto_path}`, or `{permalink}`. **The problem is that the resulting values of those variables do not seem like they would map to a template group + template.** For example, `{permalink}` gives me something like this:

```
http://domain.com/2

```

(NOTE: I have removed index.php via .htaccess)

Shouldn't the URL be something like this:

```
http://domain.com/products/2/

```

Then maybe in my templates /products/index, I do a check on {segment\_2} to decide if I should be displaying the details page or not? So where does the details template go?

# Answer
The `permalink` variable will take into account template group and template if you specify them. So for example...

```
{permalink="products/detail"}

```

would give you...

```
http://example.com/products/detail/1

```

...where "1" is the entry id and "detail" is a template in the "products" template group.

But, as far as path variables go, my preference when building links that involve template paths is to use **`title_permalink`** (*works just like permalink above but uses the `url_title` instead of the `entry_id`*).

Finally, as you noticed `url_title` and `entry_id` don't take into account template group/template paths. They just reference a given entry (either by the url title or the entry id). But they are useful in manually building paths to single entries.

So if you prefer, just use a root-relative path in conjunction with `url_title`. For example...

```
/products/detail/{url_title}

```

As long as you are removing index.php the above works great. I have started to use this more than I do the path variables.

---

And to answer your other question:

> Then maybe in my templates /products/index, I do a check on {segment\_2} to decide if I should be displaying the details page or not? So where does the details template go?

Just put your "detail" template in the "products" template group and any time you load a path that matches `/products/detail` (or `/products/detail/etc/etc`) that template will be loaded as you'd expect. No extra work is required, ExpressionEngine will do that automatically.

If, instead (as you indicated in your comment), you are wanting to include all the logic and display of a "detail" template in your single index template and forego a second template, then doing a couple simple conditionals like...

```
{if segment_2 == "detail"}
    detail-template stuff here
{/if}

{if segment_2 != "detail"}
    non detail-template stuff here
{/if}

```

...is often enough to accomplish what you described. If it is not, or if more complicated template logic is needed, definitely take a look at Switchee.
> 5 votes

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


# Question
Title: Automatically set/unset category based upon field value?
I would like to automatically add blog articles to the category "Video" if a video embed is pasted into the provided field. Likewise I would like to automatically remove blog articles from the "Video" category if the provided field is cleared.

Is there a way to do this?

# Answer
> 1 votes
You can use a bit of javascript / jquery to set the corresponding category. And you can add it to the publish screen by making an Accessory.

---
Tags: add-on, categories, add-on-development, automation
---


title: How to add url_title as last segment?

text:
# Question
Title: How to add url_title as last segment?
I have a single entry url like site.com/forum/answers/12272 and would like to have the url\_title appended like site.com/forum/answers/12272/how-big-is-a-carp. Anyone got an idea how to do this please? I'm stumped.

Thank you...

# Answer
Thanks for the help everyone @nonprofit\_tech. I'm using the entries and comment module to build a forum and want the urls of single entry pages formated like site.com/forum/answers/{entry\_id}/{url\_title}.

I'm intending to use link rel="canonical" href="{path='{segment\_1}/{segment\_2}/{segment\_3}/{segment\_4}'}" so that the full url (site.com/forum/answers/{entry\_id}/{url\_title}) gets indexed by Google. As the entries module is looking at segment\_3 to return the entry, it leaves me free to tweak segment\_4 for better seo.

I came up with {if segment\_4 == ""} {exp:channel:entries limit="1" entry\_id="{segment\_3}" disable="categories|category\_fields|custom\_fields|member\_data|pagination"} {redirect='forum/answers/{entry\_id}/{url\_title}'} {/exp:channel:entries} {/if} to guard against segment\_4 being missing.

I'm concerned that if Google bot traverses the url it would see the same content at site.com/forum/answers/{entry\_id} and site.com/forum/answers/{entry\_id}/{url\_title}, hence the redirect and the canonical tag
> 0 votes

# Answer
You can use the `{url_title}` variable. That is assuming that you are actually using ExpressionEngine channels and not forums.

You don't actually need the entry\_id in the url, the url could just be

```
site.com/forum/answers/how-big-is-a-carp

```

But if you wanted to keep, the entry\_id, you can build the url on the template like:

```
site.com/forum/answers/{entry_id}/{url_title}

```

The process should be similar for forums, but I'd assume the tags/variables maybe different.
> 0 votes

# Answer
I came up with:

{if segment\_4 == ""} {exp:channel:entries limit="1" entry\_id="{segment\_3}" disable="categories|category\_fields|custom\_fields|member\_data|pagination"} {redirect='forum/answers/{entry\_id}/{url\_title}'} {/exp:channel:entries} {/if}
> 0 votes

# Answer
Are you saying that what you want is that if the user types one address into their browser bar, a different thing is displayed there after that request is sent to the server?

If you want to actually change the URL that the user sees, then one (not very good) option is to mess around with your .htaccess file to create a rewrite. Another, possibly better option is to use a redirect in your template code, which goes into effect if the extra section of the URI isn't there.

Check out http://ellislab.com/expressionengine/user-guide/development/reference/functions.html#redirect-location-string

I'm afraid that without a more in depth question or example of what you're trying to do it's difficult to understand what you want, exactly... :S
> 0 votes

---
Tags: url-title
---


# Question
Title: File manager modal appearing at the bottom of publish page
I'm getting the standard EE file upload modal showing at the bottom of the cp publish page. Any idea what might be causing it?

Many thanks Lee

# Answer
Turned out I needed Matrix 2.5.1.
> 0 votes

# Answer
9/10 times this is caused by JS errors. Check your error console to see if an add-on is breaking the CP, or something else. I see this all the time. If you find that you have errors in your console, report back and I can edit my answer for a possible culprit.
> 2 votes

---
Tags: control-panel
---