# Question
Title: Site load periodically blowing up, EE Cache related?
I have an error showing up in the logs for a site:

"\[Sun Jan 13 13:27:11 2013\] \[error\] \[client IP\] mv: cannot move `/path/public_html/system/expressionengine/cache/page_cache' to`/path/public\_html/system/expressionengine/cache/page\_cache\_delete': No such file or directory \[Sun Jan 13 13:26:48 2013\] \[error\] \[client IP\] cannot move `/path/public_html/system/expressionengine/cache/page_cache' to`/path/public\_html/system/expressionengine/cache/page\_cache\_delete/page\_cache'"

'IP' and 'path' represent a real ip and system path.

This site doesn't make use of page caching, but I understand EE can still try to manage it's cache. Normally I wouldn't be concerned, but this particular site has periodic spikes where server load will jump from an average of .5 to 1.5 up to 80 to 100. This crashes the server, and one happened this afternoon.

My host is running loadwatch on the site, and it shows a large number of apache processes without a correspondingly large number of user connections. They also said that there was an overload on the servers memory, which was followed by the load / process spike.

Why do I think these might be related? http://ellislab.com/forums/viewthread/152522/#753282 This forum thread from several years ago on an EE 1 site. It's the only lead I have right now on why this site could be running perfectly fine 99% of the time and then periodically blowing up and taking down a VPS that's more than capable of running it.

Has anyone seen something like this happen on their own sites? If not, any suggestions for how to monitor what's causing spikes like this? My host doesn't seem to have any more to offer as far as tracking, so I can't trace it down to specifically what's causing the spike right now. Any help is appreciated.

# Answer
> 2 votes
Jacob, it occurs to me that CE Cache could come to the rescue here, perhaps in more than one way.

If you are able by intended site content patterns to use it in the sense normally intended, and choose for example the easiest Static Caching mode, you'll have EE actually not serving most of the page hits -- they'll come straight from CE's cache of precompiled html pages, except once each time the cache is broken by a new template or posting edit.

Thus you won't be driving into whatever unforeseen fault mode is causing your immediate problem, and you'll also be getting very high performance. I'm seeing consistent sub-second page loads at any time on a shared server, after going to CE Cache in this simple mode.

Now, what could be causing your situation actually? I would put some money on an old friend, collision of asynchronous processes. If for example one EE PHP instance is still running when another EE instance wants to mess with the cache for itself, that it has a file open (or directory; same thing at internal level in Unix) will prevent other action on that file (or directory). That's pretty likely what you're seeing.

If that's the problem, then the fix would be to assure only one EE PHP can fork at a time on a single server -- and then if you need more horsepower, you'd need a multi-server form of load balancing. The shared database would be the contention issue then, and it has the collision management to handle it, provided transactions are used properly in the EE application.

If you wonder, there are ways to design for servers to handle such contention also, but they would be far too involved for web situations, and I think everyone uses the shared database to handle consistency, which is again what the file system can't do beyond locking you out. I mention this just for background, but presume you'd like to know it, and from a history.

I'd try the CE Cache route, myself -- it's pretty easy to set up, and you can probably work out cache busting settings pretty easily to handle whatever CP activity EE is likely to be providing your client.

Good fortune on this, my friend.

# Answer
> 0 votes
Thoughts about this question have kept burbling up, and while the first answer may be on a good and practical track, I'd like to point to another.

What bothers me particularly seems to be the idea that EE is doing any writing to its cache when simply emitting pages. It really shouldn't, and probably doesn't, until cache intervals wear out. Presumably you've set those relatively long.

However, EE is known to be writing to other tables per site access when under ordinary configuration; in particular to be recording page counts, access IPs and the like. Depending on how transactions may be used, and given the vagaries of ISAM etc. packages, lockups can occur that may occlude multiple access at indeterminate times as you observe.

Thus it may be worth trying some of the overrides Ellis discusses on this page, which turn off hit by hit tracking, unless for some reason you need that.

http://ellislab.com/expressionengine/user-guide/optimization/handling\_extreme\_traffic.html

These are simple config items, and may clear your problem without having to put a page cache out in front -- though that may be quite useful in its own right if it fits the pattern of your site use, as it takes so much load off the server.

CE Cache can provide more flexibly than simple caches also, if you need to have some part of pages dynamically available, but this would require you have one of the MemCache etc. flavors available on the server, which costs, and that you made some level of effort to arrange a detailed implementation.

Hoping then that the simplest way of these configs can clear the issues for you.

---
Tags: cache-folder
---


title: Stash vs. Embeds

text:
# Question
Title: Stash vs. Embeds
I am using Stash only recently and was wondering how the performance is boosted over using embeds? I know there are a few less queries used in general, and I know you can subvert the parse order, but is there better reason to use it in templates?

I made a simple blog page with embeds and one with a layout partial and stash for the same exact content and there was little or no difference in {elapsed\_time} - however for some reason there was one more query for the 'stashed' version.

The effort it is taking to think 'inside out' with stash, I am wondering what the big benefit it is over embeds with good caching?

This code would be included in an embed:

```
{exp:channel:entries channel="blog" limit="3"}
    <div class="recent-post">
       <a href="{site_url}blog/{url_title}" class="thumb">{exp:ce_img:single src="{blog_image}" height="54" width="54" crop="yes"}</a>
        <div class="post-head">
        <a href="{site_url}blog/{url_title}">{title}</a><span>{entry_date format="%d/%m/%Y"}</span>
        </div>
    </div>
{/exp:channel:entries}

```

Vs this 'stashed':

```
{exp:channel:entries channel="blog" limit="3"}
{exp:stash:append name="recent_blogs"}
<div class="recent-post">
    <a href="{site_url}blog/{url_title}" class="thumb">{exp:ce_img:single src="{blog_image}" height="54" width="54" crop="yes"}</a>
    <div class="post-head">
        <a href="{site_url}blog/{url_title}">{title}</a><span>{entry_date format="%d/%m/%Y"}</span>
    </div>
</div>
{/exp:stash:append}
{/exp:channel:entries}
{exp:stash:get name="recent_blogs"}

```

# Answer
> 17 votes
Since the question is quite broad I'll try to summarise the advantages of the template partials pattern in general and Stash embeds in particular.

### Template partials

* allows code to be encapsulated into reusable chunks, to help you respect the DRY principle
* allows markup (the 'view') to be separated from the code that retrieves and formats your data (the 'viewModel')
* eliminates the need for multiple embedded templates and many common parse order problems that lead to degraded performance

As a consequence of the above the following becomes true:

* code is more maintainable and less likely to break because it is separated into discrete concerns
* the presentation layer for a single set of content can be swapped out easily, and can be done so on the fly using conditional logic. For example, a news story viewModel might have multiple views: HTML, RSS, JSON, print.

### Stash embeds

Out of the box Stash embeds are configured to mimic EE embeds, and you won't see much of a performance gain. The real performance advantage comes from 'tuning' the embed parameters. With Stash embeds you can:

* control the process stage - when in the parse order of the host template that the embed is included. This can be at the start of template processing, inline with the placement of the embed tag relative to other tags, or at the end of template parsing
* control the parse stage - whether the template is parsed on set and cached, or cached then parsed on retrieval, or both
* demarcate non-caching regions of the template with {stash:nocache}{/stash:nocache} tag pairs
* precisely control the order of processing of embeds with the priority parameter
* precisely control the parse depth when a template is parsed (the number of passes made by EEs template parser), and enable/disable conditional, variable and tag parsing per template
* set caching duration per embed
* use multiple instances of the same template without extra overhead
* compile nested embeds into a single cached template
* access native Stash variables in the the form {stash:my\_variable}

# Answer
> 13 votes
You'll probably need to show more of your template code but where Stash could benefit you is that you could use a single channel entries tag to output both the single entry view data and the recent blog posts at the same time. Here's a good example from Mark Croxton which shows how he approaches a similar thing.

# Answer
> 10 votes
It's hard to tell what you're trying to achieve with Stash in that code sample. Since you are both 'setting' and 'getting' in the same place you aren't benefiting from a separation of markup and data, and as you're not using any caching you won't see any performance benefits either. Here's a quick example that would add caching for subsequent requests:

```
{exp:stash:set
    name="recent_blogs"
    output="yes" {!-- Set and display the stash in one hit --}
    save="yes" {!-- Store the output in the DB --}
    parse_stage="set" {!-- Parse the content BEFORE caching it --}
    parse_tags="yes" {!-- We do want to parse module/plugin tags --}
    refresh="60" {!-- Our cache is valid for 60 minutes -- }
    replace="no" {!-- For subsequent requests inside the 60 minute window don't regenerate anything --}
    scope="site" {!-- This stash is valid for all users on all pages --}
}
{exp:channel:entries channel="blog" limit="3"}
    ...
{/exp:channel:entries}
{/exp:stash:set}

```

That said, template partials are what Stash does best. If you want an intro to the subject there are plenty of good articles about.

# Answer
> 10 votes
"I am using Stash only recently and was wondering how the performance is boosted over using embeds? I know there are a few less queries used in general, and I know you can subvert the parse order, but is there better reason to use it in templates?" Those were some of my own questions and with a couple of podcast from Lea Alcantara and Emily Lewis I got them solved:

Look for Adrienne Travis's http://ee-podcast.com/episodes/stash-template-partials and Mark Croxton's (Stash developer) http://ee-podcast.com/episodes/add-on-development-with-mark-croxton

# Answer
> 6 votes
The performance gains are not just about using fewer embeds, they're equally about using fewer channel:entries tags, which are expensive. Your example is obviously not a complete web page, but if it were, how would you set the page's title and meta data and any other dynamic stuff that belongs in the \<head\>? How would you send related dynamic content into a sidebar area or the footer? How would you handle pages that need a slighty different layout? The native approach would be to pepper the templates with channel:entries tags to fetch and output data in the same breath.

Using Stash you can set those kind of things in a single channel:entries tag that also sets the body content, side content, footer content, extra javascripts or css, page options, and then spit them out again multiple times wherever you like in an embedded 'view' template or make conditional sections based on the stashed values.

The template partials approach also avoids the old 'dynamic sandwich' approach (ie, two embedded templates for your document header and footer)... Aside from the fact that one embedded template is better than two, it's also nice to have your entire 'view' markup contained in a single template.

# Answer
> 2 votes
Sorry to throw a cat amongst the pigeons but stash is very much a purist approach. Sure there are advantages of it but it takes a multi designed and structured site to a whole new level of complexity.

For me and now... Low Variables will do for the performance hit of embeds.

---
Tags: stash, embeds, performance, cache, dry
---


title: Low Freeform Database Error

text:
# Question
Title: Low Freeform Database Error
When trying to publish to a channel with the the Low Freeform fields I’m getting the following error. ( example: http://gotolow.com/addons/low-freeform-field/docs#example )

> A Database Error Occurred Error Number: 1054
>
> Unknown column 'name' in 'field list'
>
> SELECT name, label FROM exp\_freeform\_fields ORDER BY field\_order ASC
>
> Filename: third\_party/low\_freeform\_field/ft.low\_freeform\_field.php
>
> Line Number: 66

On the solspace support forum I found this: http://www.solspace.com/forums/viewthread/13184/#54340

But I'm looking for a quick fix, instead of having to create all my forms from scratch.

# Answer
I got it working:

In third\_party/low\_freeform\_field/**ft.low\_freeform\_field.php at line 66**, change the query to:

```
$query = $this->EE->db->query("SELECT field_name, field_label FROM exp_freeform_fields");

```

**at line 72**, change this line:

```
$options[$row['field_name']] = $row['field_label'];

```

that should do it.
> 2 votes

# Answer
Low Freeform Field isn't compatible with FF4 (yet), so a quick fix is hard.

You could either look up where FF4 stores its field data (obviously not in `exp_freeform_fields` anymore) and use that in the query inside ft.low\_freeform\_field.php. Or use FF3 if you must use LFFF.
> 1 votes

---
Tags: add-on, ee2, solspace-freeform
---


# Question
Title: ExpressionEngine over SSL - HTACCESS ISSUE
I have a problem with my EE installation. When I try to browse any page (other than the homepage) over SSL i get a 404 error. The whole site works fine over HTTP. Its only when accessing via HTTPS this issue occurs.

My HTACCESS file looks like:

```
<IfModule mod_rewrite.c>
RewriteEngine On
# Removes index.php
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
# If 404s, "No Input File" or every URL returns the same thing
# make it /index.php?/$1 above (add the question mark)
</IfModule>

```

I've tried adding the ? in as per the comment on the last couple of rows, but to no avail.

I think the problem is my HTACCESS file, in particular the section that removes the index.php from the URL. If i add the index.php back into the URL then all my pages do work again under SSL.

For example:

```
https://mysite.com/store/checkout **does not work**
https://mysite.com/index.php?/store/checkout **DOES work**

```

I'm not enough of an htaccess expert to know how to resolve this. Any advise much appreciated.

# Answer
Having gone round in circles for the best part of a day the issue was caused by a painfully simple issue.

My .httaccess file was in the wrong place. Following best practice advise I have moved my system folder above the web root and have the .htaccess file at that level.

Instead **the .htaccess file should have been placed in the web root**. As soon as I moved it there everything worked as expected.

My folder structure is as follows:

```
config
content <- web root
    *THIS IS where the htaccess file should be*
system
templates
*this is NOT where the htaccess file should be*

```
> 2 votes

# Answer
Take a look at this: http://kevinthompson.info/blog/2011/03/04/completely-remove-index-php-from-expressionengine-urls.html

I just recently discovered that solution and it's working great on our ecommerce website running with CartThrob and certain pages with https.
> 3 votes

# Answer
Try changing the `$config['uri_protocol']` setting in `config.php`, as I suggested in this thread:

```
$config['uri_protocol'] = 'PATH_INFO';

```

In that thread there are also a few other suggestions to try for the rewrite line:

* `RewriteRule ^(.*)$ index.php/$1 [L]`
* `RewriteRule ^(.*)$ /index.php?/$1 [L]`
* `RewriteRule ^(.*)$ index.php?/$1 [L]`
* `RewriteRule . index.php [L]`

Some combination of those two settings usually fixes things.
> 2 votes

---
Tags: htaccess, ssl
---


# Question
Title: Only outputting the same article once using relationships
I have the following code:

```
<ul>
  {exp:channel:entries channel="activity"}
    {related_entries id="activity_location"}
    <li><a href="{url_title_path='locations'}">{title}</a></li>
    {/related_entries}
  {/exp:channel:entries}
 </ul>

```

This outputs all activities (activity) that have an activity location (activity\_location is the channel field with the relationship), so I get multiple results which is fine, but a lot of these multiple results are the same. I want to only output one of each.

For example currently I'll get:

England, Wales, England, England, Wales, Scotland

I want it to simply output:

England, Wales, Scotland

Is there any easy way of doing this?

# Answer
Unless this is a really simple site I would highly recommend switching to Playa relationships - you'll have lots more flexibility as the site grows. However, if you want to stick with native relationships, try using the `unique` parameter offered by Stash's `get_list`. Something like this works, whilst having the added benefit of keeping your markup cleanly separated from the data fetching part:

```
{exp:stash:set_list name="locations" parse_tags="yes"}
  {exp:channel:entries channel="activity"}
    {related_entries id="activity_location"}
        {stash:location}{title}{/stash:location}
        {stash:url}{url_title_path='locations'}{/stash:url}
    {/related_entries}
  {/exp:channel:entries}
{/exp:stash:set_list}

<ul>
  {exp:stash:get_list unique="yes" name="locations"}
     <li><a href="{url}">{location}</a></li>
  {/exp:stash:get_list}
</ul>

```
> 4 votes

# Answer
**Updated:** The solution I first posted (below) was for the unique entries that match 1 parent entry. This query should pull all unique entries for your channel:

```
<ul>
  {exp:channel:entries channel="activity"}
    {exp:query sql="Select distinct t.title related_title, t.url_title related_url_title
                    from exp_relationships r join exp_channel_titles t
                    on r.rel_child_id = t.entry_id
                    where rel_parent_id in (Select entry_id from exp_channel_titles where channel_id = 1)"}
    <li><a href="/locations/{related_url_title}">{related_title}</a></li>
    {/exp:query}
  {/exp:channel:entries}
</ul>

```

Replace `channel_id=1` with your channel's ID. Or use:

```
Select distinct t.title related_title, t.url_title related_url_title
                        from exp_relationships r join exp_channel_titles t
                        on r.rel_child_id = t.entry_id
                        where rel_parent_id in (Select entry_id from exp_channel_titles tt join exp_channel w
                        on tt.channel_id = w.channel_id where w.channel_name = 'activity')

```

Hopefully that works. The only site I have handy that uses native relationships is a 1.6.x site and the table/field names are different, so I'm writing the queries one way and then fixing them.

As was suggested in another answer, Playa offers many more options for this sort of thing, and conversion instructions.

First posting, that pulled related entries for 1 entry.

```
<ul>
  {exp:channel:entries channel="activity"}
    {exp:query sql="Select t.title related_title, t.url_title related_url_title
                    from exp_relationships r join exp_channel_titles t
                    on r.rel_child_id = t.entry_id
                    where rel_parent_id = {entry_id}"}
    <li><a href="/locations/{related_url_title}">{related_title}</a></li>
    {/exp:query}
  {/exp:channel:entries}
</ul>

```

The exp\_relationships table is pretty straightforward.
> 0 votes

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


title: Playa sorting across entries

text:
# Question
Title: Playa sorting across entries
I've got a playa field that pulls data from a few entries. I'd like to sort all the results alphabetically. However right now it returns each entry and then alphabetizes each. So I get something like: Apple Banana Cabbage Alfalfa Broccoli etc

My code:

```
{exp:channel:entries channel="somechannel" site="default_site"}
{exp:playa:children field="playafield" orderby="title" sort="asc" site="default_site"}
    <li>{title}</li>
  {/exp:playa:children}
{/exp:channel:entries}

```

# Answer
Have you tried that outside of the channel entries tag?

```
{exp:playa:children field="playafield" orderby="title" sort="asc" site="default_site"}
<li>{title}</li>
{/exp:playa:children}

```

Try the above code alone in your template. Does that give you the output you need?
> 1 votes

---
Tags: playa
---


# Question
Title: Channel Specific Shipping based on Quantity Threshold
I have a site where I have 2 product channels: one for webinar registrations, the other for physical products to ship (and in the future we will offer digital downloads so I'll be creating a channel for that)

As shipping settings are site-wide, I can't simply enable quantity specific shipping for just the physical products. However I know you can specify Shipping Per Item and I can create a field for that.

However, how would that field be set up if the shipping rules are:

* **Qty** 1-2 $10
* **Qty** 3-5 $20
* **Qty** 6+ $35

I can create a matrix field of 2 columns, I guess, with these details, but how can CartThrob automatically figure out that there's 2 of this particular item and only add shipping for THAT item based on that quantity?

And ONLY for this channel. Other channels are automatically zero shipping because a) registration and b) digital download.

Help!

# Answer
Sure thing Lea - just make sure that when each of the items in the other (non-physical) channels get added to the cart, they have the shipping\_exempt parameter (I believe this parameter used to be called `no_shipping`) set to `yes`. They will then be excluded from the quantity-based shipping calculations.
> 2 votes

---
Tags: cartthrob, shipping
---


# Question
Title: Comparing session variable against an input field
I was wondering if there is a way to set a session variable (using Session Variables Plugin) and then when a user completes an input field (promo code), the field compares the input against the session variable to either allow a user onto another page or to rejects them.

Thanks in advance.

# Answer
> 1 votes
I'm pretty sure that using Mo Variables (https://github.com/rsanchez/mo\_variables) to receive a POST value from a form you could then perform a simple EE comparison on the session var (that you're setting with the Session Variables plug-in) and the POST var. You could then show/hide content based on the result of that or redirect the user back to the page from which they came.

As Anna suggested you could also use some jQuery to compare the value in the promo field with a hidden field elsewhere on the page.

---
Tags: ee2
---


# Question
Title: Comment form throwing "this field required" on submit
I'm not sure how long this has been happening, but I realized today that the comment form on a site of mine is throwing this error:

> The form you submitted contained the following errors
>
> The name field is required The email field is required

This is happening even when both fields are filled out.

My template code is here: http://pastie.org/6168028

Any idea why this would be happening?

# Answer
> 3 votes
Have you tried adding names to your form fields that correspond to the EE comment fields? I believe these would be required for the form to work.

```
<input name="name" type="text" id="comment_name" placeholder="Enter your name.">
<input name="email" type="email" id="comment_email" placeholder="Enter your email."> ...etc

```

---
Tags: comment-form
---


title: Importing CSV/JSON/XML + images

text:
# Question
Title: Importing CSV/JSON/XML + images
I have a CSV that I need to import in a Channel. The CSV contains an id column that is used as part of a naming convention for a series of images associated with each row. For example, say the id was ABC123, then I might have the following images:

* ABC123\_001.jpg
* ABC123\_002.jpg
* ABC123\_003.jpg
* ABC123\_025.jpg

How could I import the CSV and the images?

NOTE: The images are in a Matrix field with one mandatory column: the file field.

# Answer
> 3 votes
Have you looked into the EE addon called DataGrab from Brandnewbox?

http://devot-ee.com/add-ons/datagrab http://brandnewbox.co.uk/products/details/datagrab

There's notes here on how it can support Matrix fields:

http://brandnewbox.co.uk/support/details/datagrab\_and\_matrix\_fields

I've had it used on quite a few large projects with great success so don't see why it wouldn't work for you. Sometimes you need to massage the CSV file prior to the import.

---
Tags: add-on, add-on-development, import
---


# Question
Title: Better workflow for ongoing site development
We have a number of client sites which are pretty much always evolving so we often find ourselves in a place where we're adding new structure and content to a site and trying to adjust the existing structure and content whilst the client may also be publishing new content or editing existing content!

Previously we've approached this using a number of different methods:

1) Creating a 'dev' server on which we carry out the development but we then have to mirror all edits and amends to the live server at a later date to avoid trashing any new content on the live server.

2) Working new developments into temporary 'template groups' and 'channels' and then adjusting the template group names and channel names accordingly once we're done.

3) Using conditionals in live templates to allow a logged in admin to preview changes without us having to resort to a full staging server.

There has to be a better way to do this, some way to marry ongoing site development (changes to templates, sections, fields and content) with a database full of live changing data.

Any ideas? I would be interested in solutions for both EE1.x and EE2.x.

Thanks in advance for your time! :)

# Answer
Nathan, the first answer on this Q/A explains the standard method of development. Generally when you get the point that you're at, it makes sense to use a versioning tool such as Git and develop locally, deploy to Dev and/or Staging for testing and finally to Production. It's a little scary to begin with but I've had to adopt just this approach in the last 12 months as projects become more complicated and exponentially larger in scope.

Migrating between Development, Staging and Production for a pre-existing ExpressionEngine site

The main thing to take away from Adrian Macneil' response in the above post is the following:

> Code should flow in this direction:
>
> Development \>\> Staging \>\> Production
>
> Content, on the other hand, should flow in the opposite direction:
>
> Development \<\< Staging \<\< Production

Myself I currently use CodeBaseHQ (for repository) and DeployHQ (for deployment) services. Codebase has the additional plus of allow you to setup tickets for each of the development members and discussion areas where knowledge can be documented for future retrieval.

Regards Brendan
> 2 votes

---
Tags: development, workflow
---


# Question
Title: Add a custom field value in a hidden input to the order in CartThrob and then email notification
Probably simple but I have a custom field that I would like to add to the Orders channel and then use that value in the customer notification email.

This field will not be populated by the customer, it's a custom date field that the admin has set for a course.

In the add to cart form I have:

```
<input type="hidden" name="date_booked_for" value="{course_date}" />

```

where the date\_booked\_for is the new field in the Orders Channel and course\_date is the custom field that needs to be passed to checkout and then the email.

Stuck on the hidden field part in the checkout form and email notification.

Any ideas please?

TIA

# Answer
let's try storing the date\_booked\_for as custom item\_options data

in your add to cart form replace this line...

```
<input type="hidden" name="date_booked_for" value="{course_date}" />

```

with this

```
<input type="hidden" name="item_options[date_booked_for]" value="{course_date}" />

```

and in your email notification template you can output the custom item option within the order\_items tag pair as shown below

```
{exp:cartthrob:submitted_order_info}
    {order_items}
        {item:date_booked_for}
    {/order_items}
{/exp:cartthrob:submitted_order_info}

```
> 0 votes

# Answer
In your form use:

```
<input type="hidden" name="date_booked_for" value="custom_data[course_date]" />

```

In your email use:

```
{custom_data:course_date}

```
> 0 votes

# Answer
Thank you Anna but it's not working, I tried that myself before I posted. It just renders in the outputted HTML:

```
<input type="hidden" name="date_booked_for" value="custom_data[course_date]" />

```

I can see in the source for the page where the add to form is that the date is placed in the hidden field value. The flow is to then visit the cart and then checkout.

But: `<input type="hidden" name="date_booked_for" value="custom_data[course_date]" />`

is not populating that hidden fields value in the checkout form?
> 0 votes

# Answer
Hi mjr and thank you for taking the time to answer.

That is correct, I have that custom field in my orders channel.

I have a Structure listings page with a a cartThrob add to form call with a hidden field:

Which works as I can see the rendered HTML as:

The user adds to cart and then if they wish, view the cart and checkout.

On the checkout template I have added your suggestion and no joy and nothing is rendered in the email confirmation OR entered in the Orders channel.

Just to repeat, this course\_date is entered by the site admin, it is not at any time chosen as an item option by the user. I just want to take that entries custom date field and use it in the email confirmation.

TIA
> 0 votes

# Answer
Thanks - here is the code as requested for the add to cart section:

```
    {exp:channel:entries channel="domestic_courses" disable="categories|member_data|pagination" status="open|featured"}
<div class="row">
<!-- start 8 cols -->
<div class="eight columns">
<section class="box">
<div class="frame">
<h1 class="intro">{title}<h1>
<div class="row padding-bottom-10">
<div class="five columns"><img src="{domestic_course_image}" class="intro-image" />
<ul class="course-list">
<li><strong>Cost (inc VAT):</strong> {course_price:plus_tax decimals="2"}</li>
<li><strong>Course Length:</strong> {course_length}</li>
{if {places} > 0}
<li>There are {places} place/s remaining.</li>
{if:else}
<li class="full">This course is fully booked.</li>
{/if}
</ul>
</div>
<div class="seven columns">
<p class="large-text">{domestic_course_summary}</p>
{full_domestic_course_details}
</div>
</div>

<div class="row">
<div class="twelve columns padding-bottom-10">
<h4 class="info-label">Enter amount of places required below:</h4>
</div>
{exp:cartthrob:add_to_cart_form entry_id="{entry_id}" return="" error_handling="inline" required="quantity"}
<input type="hidden" name="date_booked_for" value="{course_date}" />
<div class="one column">
<input type="text" name="quantity" value="">
</div>
<div class="eleven columns">
{if field_errors_exist}
<ul class="errors">
    {field_errors}
    <li>{error}</li>
    {/field_errors}
</ul>
{/if}
{if global_errors_exist}
<ul class="errors">
    {global_errors}
    <li>{error}</li>
    {/global_errors}
</ul>
{/if}
<div class="message">Updating... </div>
<input type="submit" id="go" class="but yellow normal-but light-border" value="BOOK NOW"></div>
</div>
{/exp:cartthrob:add_to_cart_form}
{/exp:channel:entries}

```

And the checkout code:

```
{exp:cartthrob:checkout_form secure_action="yes" error_handling="inline" class="custom" create_user="no" group_id="5" return="store/order_info" required="first_name|last_name|address|city|address|state|zip|phone|email_address"}
<input type="hidden" name="custom_data[date_booked_for]" value="{course_date}" />
{exp:cartthrob:customer_info}
<fieldset class="billing" id="billing">
<legend>Billing Info</legend>
<div class="row">
    <div class="six columns">
     <label for="customer_first_name" >First Name</label><input type="text" name="first_name" value="{customer_first_name}" id="customer_first_name" {if error:first_name} class="required" {/if} />
    </div>
    <div class="six columns">
    <label for="customer_last_name" >Last Name</label><input type="text" name="last_name" value="{customer_last_name}" id="customer_last_name" {if error:last_name} class="required" {/if} />
    </div>
  </div>
<div class="row">
    <div class="six columns">
     <label for="customer_address" >Address</label><input type="text" name="address" value="{customer_address}" id="customer_address" {if error:address} class="required" {/if}  />
    </div>
    <div class="six columns">
    <label for="customer_address2">Address 2</label><input type="text" name="address2" value="{customer_address2}" id="customer_address2"  />
    </div>
  </div>
<div class="row">
    <div class="four columns">
     <label for="customer_city">City</label>
     <input type="text" name="city" value="{customer_city}" id="customer_city" {if error:city} class="required" {/if}   />
    </div>
    <div class="eight columns">
    <label for="customer_county">County</label>
    <input type="text" name="state" value="{state}" id="state" {if error:state} class="required"{/if} />

    </div>
  </div>
<div class="row">
<div class="four columns">
<label for="Postcode">Postcode</label><input type="text" name="zip" value="{customer_zip}" id="Postcode" {if error:zip} class="required" {/if}   />
</div>
<div class="eight columns">
<label for="customer_country_code" >Country</label>
<select name="customer_country_code"  id="customer_country_code" >
<option value="GBR" selected="selected">United Kingdom</option>
</select>
</div>
<div>
</fieldset>
<fieldset class="shipping" id="shipping">
<legend>Shipping</legend>
<div class="row small-info-area">
<div class="twelve columns">
<div class="six columns"><label for="use_billing_info"><strong>Use same billing details for shipping?</strong> <input type="radio" value="yes" name="use_billing_info" /></label></div>
</div>
</div>
<div class="row">
    <div class="six columns margin-top-10">
     <label for="shipping_first_name" >Shipping First Name</label><input type="text" name="shipping_first_name" value="{shipping_first_name}" id="shipping_first_name" />
    </div>
    <div class="six columns margin-top-10">
    <label for="shipping_last_name" >Shipping Last Name</label><input type="text" name="shipping_last_name" value="{shipping_last_name}" id="shipping_last_name"/>
    </div>
  </div>
<div class="row">
    <div class="six columns">
     <label for="shipping_address" >Shipping Address</label><input type="text" name="shipping_address" value="{shipping_address}" id="shipping_address" />
    </div>
    <div class="six columns">
    <label for="shipping_address2" class="">Shipping Address (line 2)</label><input type="text" name="shipping_address2" value="{shipping_address2}" id="shipping_address2"  />
    </div>
  </div>
<div class="row">
    <div class="four columns">
     <label for="shipping_city" >City</label><input type="text" name="shipping_city" value="{shipping_city}" id="shipping_city" />
    </div>
    <div class="eight columns">
    <label for="shipping_state">County</label>
    <input type="text" name="shipping_state" value="{shipping_state}" id="shipping_state" />

    </div>
  </div>
<div class="row">
<div class="four columns">
<label for="shipping_zip" class="">Shipping Postcode</label><input type="text" name="shipping_zip" value="{shipping_zip}" id="shipping_zip"/>
</div>
<div class="eight columns">
<label for="shipping_country_code" class="">Shipping Country</label><select name="shipping_country_code"  id="shipping_country_code">
<option value="GBR" selected="selected">United Kingdom</option>
</select>
</div>
</div>
</select>
</fieldset>
<fieldset class="additional_info" id="additional_info">
<legend>Additional Info</legend>
<div class="row">
<div class="six columns">
<label for="phone" class="">Phone</label><input type="text" name="phone" value="{phone}" id="phone" {if error:phone} class="required" {/if}  />
</div>
<div class="six columns">
<label for="email_address" class="">Email Address</label><input type="text" name="email_address" value="{email_address}" id="email_address" {if error:email_address} class="required" {/if} />
</div>
</div>
<div class="row">
<div class="twelve columns">
<label for="requirements" class="">Any dietary requirements or additional message?</label><textarea name="requirements" value="{requirements}" id="requirements"></textarea>
</div>
</div>
</fieldset>

<input type="submit" id="checkout_complete" class="but normal-but yellow" value="Confirm Booking" />
{custom_data:phone}

{/exp:cartthrob:customer_info}

{/exp:cartthrob:checkout_form}

```

For now, I would just like to concentrate getting this hidden field in the Orders Channel, if that works, I can get it in the email confirmation.

TIA again.
> 0 votes

---
Tags: cartthrob
---


# Question
Title: Expresso Store not registering memberaccount on checkout
What I have (simplified) in my template is:

```
<input type="email" name="order_email" value="{order_email}">
{if logged_out}
    <label>{field:register_member} Create an account</label>
    <input type="password" name="password">
    <input type="password" name="password_confirm">
{/if}

```

And some more fields for address, shipping, etc.

When I check the checkbox generated by {field:register\_member} I expect my useraccount to be created after submitting my order. Everything works correctly: I receive the e-mail confirmation and the order is correctly stored in the database. But my useraccount is not created.

I have read the documentation at https://exp-resso.com/docs/store/checkout\_tag.html#registering\_members but the example seems to be wrong, in the text above the example it states the password field is mandatory. In the example it's optional. But I have both the password and password\_confirm fields, so that shouldn't be the problem.

What could be wrong?

# Answer
Found the solution by debugging the Store Orders model. Store (ab)uses the EE Member\_register class to register the new member. One of the first things the register\_member() function in this class does is:

```
if ($this->EE->config->item('allow_member_registration') == 'n')
{
    return FALSE;
}

```

So enabling member registrations in the CP fixed the problem.
> 2 votes

---
Tags: expresso-store, registration
---


# Question
Title: Expresso Store: How to check if product is already in the cart?
This is my first time working with Expresso Store, so forgive me if this question is extremely basic, but...

How do I show in my `{exp:store:product}` tag pair do a test like:

`if product is in cart,
 show 'Product is in your cart',
 with option to add another`

Make sense?

Thanks for any help. Alex

# Answer
A similar question is here:
https://expressionengine.stackexchange.com/a/271/28

That answer may help in your situation... Not sure if it works inside the tag where you are trying to set the conditional.

> **Store: In\_Cart Conditionals**
> http://devot-ee.com/add-ons/store-in\_cart-conditionals
>
> "This extension adds certain "in\_cart" conditionals within Exp:resso Store Cart and Checkout tags.
>
> Available variables: `{store:entry_id_in_cart:XX}` and `{store:sku_in_cart:XX}`
> 2 votes

# Answer
As of Store 1.6.2 there is a `{qty_in_cart}` variable which allows you to do this on a per-entry basis (though not if your entries contain multiple SKUs).

```
{exp:store:product entry_id="{entry_id}"}
    {qty_in_cart}
{/exp:store:product}

```
> 3 votes

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


# Question
Title: How to pass php variable from one EE template to another
I am using a Freeform Pro form where the user can edit a numeric field (number of of places booked for an event). When they click on submit, they are sent to a processing template to do the calculation in order to update the remaining number.

In the processing template that's doing the calculation, I can always access the new number set by the user in the freeform form ({freeform:field:numberofplaces}).

What I need is the number of places booked before the edit. I am trying to save it in a php variable like this on the edit freeform edit page:

```
<?php
 $numPlacesBeforeEdit = {freeform:field:numberofstudents};
  ?>

```

But how can I pass this variable from the edit page to the processing template (the freeform edit page "return" is set to go to the processing template).

Thanks

# Answer
Someone suggested using Stash and that works. Any other ideas are welcome.

**Update** for Yuri Salimovskiy: My "edit form" where the user is changing the number of seats they require, on submit goes to a processing template that updates the relevant field with the new number. My problem was "how do I I need to keep track the original number before the user changed it" as I need both the new number and the original in the processing template to workout how many seats are left from the total available. So "saved" the original number if the form (e.g. {exp:stash:set name="numStudentsBeforeEdit" save="yes" scope="site"}{freeform:field:numberofstudents}{/exp:stash:set}) and I accessed in the processing template like this {exp:stash:get name="numStudentsBeforeEdit" scope="site"}. Hope this makes sense.
> 0 votes

# Answer
You can try using PHP and EE Session Flash Data \- but I believe this will work only if you use `$this->EE->functions->redirect` and not form submission (worth trying though)

You can also store data in PHP session using Session Variables Plugin
> 0 votes

---
Tags: templates, php, variable
---


# Question
Title: Per author enable/disable comment notification
Is it possible to enable/disable comment notifications for each author? Some authors want to receive comment notifications. Others prefer not to get notified.

# Answer
> 3 votes
This is or should be the default behavior. Generally, there is a checkbox, to request to receive notifications regarding comments for a particular post, see Comments Notification Link about also adding this function for members who haven't commented.

**Updated:** You'd want to use the same 'Comment Notification Link' provided above. Turn notifications of comments 'OFF' in Channel Preferences, and allow each author to subscribe to the article they want notifications for.

Additionally, if authors are posting from a SafeCracker form rather then inside the Control Panel, you can probably have them subscribe at the time of posting. If they are posting from within the control panel, you would either need an `custom extension` to handle the subscription **OR** if you had a custom member field, that indicated an author wanted to receive notifications from ALL their posts, this could potentially be used to somewhat automate that process.

But if you want to give authors full control, then let them subscribe to comments.

---
Tags: members, comments, notification
---


# Question
Title: PHP Syntax Error from ExpressionEngine Template
Here's some code I'm using to generate Breadcrumbs on my site. Unfortunately the client has quite specific requirements in terms of URLs, so I've had to play around with Crumbly's tag a little using an If statement:

```
{if segment_1 == "search"}
    {exp:crumbly:breadcrumbs custom_url:pattern="template_group/template/ignore"}
{if:elseif segment_2 == "search"}
    {exp:crumbly:breadcrumbs}
{if:else}
    {exp:crumbly:breadcrumbs}
{/if}

    {if count > 1}
        {if 1 == 1}
            <span class="divider">»</span>
            <li>
                <a href="{if count != total_results}{breadcrumb_url}{if:else}#{/if}">
                    {breadcrumb_title}
                </a>
            </li>
        {/if}
    {/if}
{/exp:crumbly:breadcrumbs}

```

Unfortunately, EE's template, when saved, warns me this:

> {exp:crumbly … No closing tag found. Note: some tags do not require closing. Please consult the module's documentation if you experience problems.

However I hope you can see it *should* just be a warning, as the closing tag is present.

**Here's the main problem.** When I load the page, I get this:

`Parse error: syntax error, unexpected T_ELSEIF in /nfs/c09/h02/mnt/135913/domains/mysite.com/html/system/expressionengine/libraries/Functions.php(683) : eval()'d code on line 75`

Any ideas?

# Answer
> 4 votes
For deeper understanding, read about Rendering Stages in EE user guide. Advanced conditionals are processed after module tags.

Putting it simply, `exp:crumbly:breadcrumbs` is processed before `if` statements, so EE engine is receiving 3 `exp:crumbly:breadcrumbs` opening tags and just one closing tag.

There are 2 possible solutions:

1) Have separate code for each `if` (note that actually 3 tags will be processed, but just 1 displayed)

2) Use IfElse or Switchee module (this is the approach I'd choose)

# Answer
> 3 votes
You can't separate heading and closing tags by `{if}` statements like that. I've never used Crumbly specifically, but with ExpressionEngine native tags, **BOTH** the open and closing tags need to be within the \`{if} area to be properly evaluated, so this should work

```
{if segment_1 == "search"}

    {exp:crumbly:breadcrumbs custom_url:pattern="template_group/template/ignore"}
     {if count > 1}
        {if 1 == 1}
            <span class="divider">»</span>
            <li>
                <a href="{if count != total_results}{breadcrumb_url}{if:else}#{/if}">
                    {breadcrumb_title}
                </a>
            </li>
        {/if}
    {/if}
    {/exp:crumbly:breadcrumbs}

{if:elseif segment_2 == "search"}

    {exp:crumbly:breadcrumbs}
     {if count > 1}
        {if 1 == 1}
            <span class="divider">»</span>
            <li>
                <a href="{if count != total_results}{breadcrumb_url}{if:else}#{/if}">
                    {breadcrumb_title}
                </a>
            </li>
        {/if}
    {/if}
    {/exp:crumbly:breadcrumbs}

{if:else}

    {exp:crumbly:breadcrumbs}
     {if count > 1}
        {if 1 == 1}
            <span class="divider">»</span>
            <li>
                <a href="{if count != total_results}{breadcrumb_url}{if:else}#{/if}">
                    {breadcrumb_title}
                </a>
            </li>
        {/if}
    {/if}
    {/exp:crumbly:breadcrumbs}

{/if}

```

but this **WILL NOT**

```
{if segment_1 == "search"}
    {exp:crumbly:breadcrumbs custom_url:pattern="template_group/template/ignore"}
{if:elseif segment_2 == "search"}
    {exp:crumbly:breadcrumbs}
{if:else}
    {exp:crumbly:breadcrumbs}
{/if}

    {if count > 1}
        {if 1 == 1}
            <span class="divider">»</span>
            <li>
                <a href="{if count != total_results}{breadcrumb_url}{if:else}#{/if}">
                    {breadcrumb_title}
                </a>
            </li>
        {/if}
    {/if}
{/exp:crumbly:breadcrumbs}

```

---
Tags: templates, conditionals, advanced-conditionals, ifelse
---


# Question
Title: Getting the field ids of fields with certain field types
Assume that we have module A which has it's own field type.

We add field(s) in Channel X that is has the field type of module A.

Is there a way inside a module method to know the field id of the field(s) that has those field type?

UPDATE:

Here are the assumptions that I have inside the module method

* The module method already knows the channel name
* The module method does not know the field\_name nor the field\_id
* The module method knows the fieldtype name

# Answer
Assuming that your fieldtype is called "My Great Fieldtype", with a class name of `My_great_fieldtype_ft`, use this query:

```
SELECT field_id FROM exp_channel_fields WHERE field_type = 'my_great_fieldtype'

```

(Note that the `field_type` column is all lowercase, without the `_ft` suffix.)
> 1 votes

# Answer
You can easily find out the field's group id assigned to that channel and then you can fetch field id associated with that channel just by a simple query from the database table exp\_channel\_fields.

For example, you are having a channel ABC associated with the field group having the id "x". The query will be:

```
SELECT field_id FROM exp_channel_fields WHERE field_name='FIELD_NAME' AND group_id=x AND site_id=1

```

I hope, it would help you.
> 0 votes

---
Tags: fieldtype
---


# Question
Title: Assets2 borked after removing index.php (official Ellislab method)
Using Assets 2.0.5 on EE2.5.5

When I remove index.php using Ellislab's official method Assets simply stops working. It's hard to explain without screenshots, but on existing entries all thumbs are gone and when you click add or remove file in an entry form you simply get a blank screen. More specifically what especially seems to trigger it, is leaving "Name of your site's index page" blank, the htaccess file doesn't seem to be the issue. More specific if I make Name of your site's index page blank, the behaviour happens, if I put index.php back it's working fine, even with the htaccess file.

Any suggestions?

# Answer
> 4 votes
I've had a similar issue, which in the end had to do with me not being consistent with the usage of www. Is the behaviour the same when you use www or not? You could also add

> $config\['assets\_site\_url'\] = '/index.php';

To the config file of EE, maybe that helps?

# Answer
> 0 votes
Do you have this part in the htaccess?

```
# Redirect index.php Requests
# Turn this off until index.php is removed from ExpEng Control Panel.
# -------------------------------------------------------------------
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteCond %{THE_REQUEST} !/system/.*
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,L]

```

There is likely something in the Assets (I've no experience with it) code that is using an URL to run a query, or something like that, and the rewrites are messing with it.

Also, you might try setting "Strict URLs" in the settings where you set the 404 page.

* Bob

---
Tags: assets
---


# Question
Title: Is there a way to limit display of entries to a within a recent time period?
I have a news section on a site and would like to limit entries on certain pages to "fresher" content so that it will only show entries that have been entered within the last three months.

In reviewing all the parameters **start\_on** looks like the closest fit but it would have to be dynamic so that it was something like today's date minus 90 days or something like that.

Is anyone familiar with a way to do this?

Thanks.

# Answer
What Derek said. If you are not a fan of PHP in templates, you could use the date and time plugin (free). Used it in the past for what you are describing, in combination with the start\_on and stop\_before parameters.

The current date can be obtained using:

```
{current_time format="%Y-%m-%d"}

```
> 3 votes

# Answer
I'm no fan of PHP in templates, but that's the simplest solution here. Enable PHP in your template (on input) first.

```
<?php $from = date('Y-m-d h:i A', strtotime('90 days ago')); ?>
{exp:channel:entries start_on="<?php echo $from; ?>" ...

```
> 2 votes

---
Tags: channel-entries, entry-date
---


title: Is it possible to sort related_entries?

text:
# Question
Title: Is it possible to sort related_entries?
When I'm pulling related\_entries into a channel:entries tag, I want to be able to sort those related entries (for example by date).

Example:

```
{related_entries id="related_field" orderby="entry_date"}

```

I know that the above orderby parameter is not accepted by the related\_entries tag, but is there any other clever way to get those entries sorted?

# Answer
Using P&T's Playa a lot these days for relationships but, if you don't need all that raw power, my advise would be to flip your logic a bit and use reverse\_related\_entries which support orderby and sort parameters.
> 5 votes

---
Tags: related-entries
---


# Question
Title: Error using Store with PayPal Express: Security header is not valid
I am using Store with PayPal Express. I have entered my credentials from my PayPal account.

When I try to make a purchase I get the payment method error "Security header is not valid."

I have tried setting and unsetting the Require SSL connection for checkout and order tags setting in store - makes no diff.

I need help with where to look.

# Answer
This sounds like an issue with PayPal credentials according to these threads:

http://premium.wpmudev.org/forums/topic/10002-security-error-security-header-is-not-valid

http://www.paidmembershipspro.com/2012/03/security-header-is-not-valid/

If you are connecting to "Live", recheck your credentials and make sure you are using the correct ones for "Live".

If you are connecting to "Sandbox", make sure those credentials are correct.
> 4 votes

# Answer
Generally this happens when you are using PayPal live account credentials, but you have set the gateway to "Test Mode" in the Store settings, or vice versa.

Note that you can only set the PayPal gateway to test mode if you have created a PayPal developer account (this has completely separate credentials from your normal PayPal account).
> 3 votes

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


# Question
Title: Bizarre upgrade from 2.5.3 - 2.5.5 issue
I just updated EE from 2.5.3 to 2.5.5 and it shows the message below:

Your ExpressionEngine installation’s version (2.5.3) is not consistent with the reported version (2.5.5). Please update your installation of ExpressionEngine again.

I re updated and it shows it again... and again... I checked the config file and it shows 253. I guess this is the issue? I changed it to 255 and the message went away, but I presume the upgrade was completed? The version everywhere else shows 2.5.5.

# Answer
To answer your question, I'd say the upgrade is complete but you'll need to check the install to be sure. Manually updating the version in config.php is the correct step.
> 2 votes

# Answer
Did you check the permissions on your config.php file? I've seen this happen when the config.php file is not writeable.
> 3 votes

---
Tags: updating
---


title: Moblog and Channel Images

text:
# Question
Title: Moblog and Channel Images
I am wondering if there is a way to use the Channel Images (by Devdemon) fields with Moblog. I've tried a bit and have not found a way...yet. Tomorrow, though, is another day and I can give it more attention but I don't want to reinvent the wheel if someone has been successful. Thanks to you all. This is a great resource and I hope it continues. Carole

# Answer
The moblog module unfortunately does not offer any integration with third-party fieldtypes, and has no extension hooks to allow you to do so. Honestly (as you can see by the comment by Adrian - an experienced EE developer - above) most people have no idea this module even exists.

So, you're either hacking core, or writing your own moblog-type module from scratch for this I'm afraid.
> 1 votes

# Answer
The Moblog Module hasn't seen any new development for many years so I'm positive there is not a way to connect it to more modern modules without using is as a foundation for your own custom code.
> 0 votes

---
Tags: channel-images
---


title: Expresso Store Downloads

text:
# Question
Title: Expresso Store Downloads
I must be missing something obvious.

I am trying to add a downloadable product in Expresso Store.

I have a channel with a custom file filed {products\_download} as well as the Store Product Details field

I create the entry, upload the file, then after I purchase the product there is no link to download on my order page.

```
<h2>Order Summary / Tax Invoice</h2>
{exp:store:orders member_id="CURRENT_USER"}
<h1>Thank you for your Order:</h1>

<h2>Ordered Items:</h2>
    <ul>
    {items}
    <li>
        <h3>{title} -- {price}</h3>
        {exp:channel:entries entry_id="{entry_id}"}
            {exp:store:download url="{products_download}"}
                Download
            {/exp:store:download}
        {/exp:channel:entries}
    </li>
    {/items}
    </ul>
{/exp:store:orders}

```

The above outputs the title and price fine, just not the link to download

EE ver 2.4 Store ver 1.6.2

# Answer
> 1 votes
This was it:

```
{exp:channel:entries entry_id="{entry_id}"}
    {exp:store:download url="{products_download}" order_id="{order_id}"}
        Download
    {/exp:store:download}
{/exp:channel:entries}

```

thanks John

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


# Question
Title: Looking for a way for clients to upload files, need obfuscated links on front-end and need to group files with headings
I've used Channel Files(DevDemon) field to upload files and list them with obfuscated links on the front end successfully. But on a new site I need to group files and give them headings. Channel Files allows grouping by category, but the client can't add categories on the fly.

I need to display the files on the front end similar to this...

Any ideas on how I can do this? Will the Assets plugin allow me to do this? Thanks for any ideas.

# Answer
Well, if you don't need all of that functionality in a single add-on, you can obfuscate your links (and track the downloads, etc) using Link Vault, which pretty much works with any file field.
> 3 votes

---
Tags: assets, file-uploads
---


title: Couple of Google Maps for EE questions

text:
# Question
Title: Couple of Google Maps for EE questions
I recently switched from MX Google maps, to Google Maps for EE, and so far it's been pretty good. I do however just have a couple of issues that I hope I can fix up.

I have a map within a safecracker form, for users to plot a marker so I can capture location data within the entry.

I have applied some custom css to the map in order to get it to fit in with my site design, however, when the page is first loaded, the map does not show straight away, and the Geocoder form elements are un-styled. After a second or two it kicks in and looks fine.

goes from this...

until a few seconds later when it shows like this....

Now is there anything I can do to either prevent this happening, or at least mask it whilst it loads?

Secondly, if the user plots a marker, but tries to submit the form with other fields that still need filling in, the form reloads, shows the other errors, but the map fails to load.

Like this...

Any ideas?

# Answer
> 1 votes
Unfortunately, I don't think there is anything you can do. The issue is EE is extremely inefficient at serving JavaScript. In fact, that's one of EE's weakest links is the poor JavaScript support across the board. Essentially each fieldtype loads its own JS, and it takes time to run all these requests.

Chris Imrie wrote a nice little library for RequireJS that auto-loads this stuff asynchronously. I have added support to Google Maps, but this is still somewhat experimental. Sometimes it works well for me, other times there are JS conflicts.

https://github.com/ckimrie/RequireJS-for-EE

Regarding the user submission with errors, that is new to me. Everything works fine on my end regarding that, but I will run some tests to make sure it's working locally on my end. One option would be to duplicate this error, and take a screenshot of your JavaScript error console in Chrome. If the map fails to load, it's almost always a JS error of some kind.

---
Tags: safecracker, google-maps, google-maps-for-ee
---


title: How do I change the theme of my site?

text:
# Question
Title: How do I change the theme of my site?
I am seriously going crazy trying to figure out how to change the theme of my site.

Does ExpressionEngine support pre-built themes? If so, how do I switch between them?

If not, how do I change the front-end design of my site?

# Answer
While what @Adrian Macnell states is primarily true. It's primarily true, because most people choosing ExpressionEngine for their websites are `web developers`. EE CMS isn't like Drupal or WordPress, where tons of people offer free or for a price themes.

That said, ExpressionEngine makes it fairly to easy to use other themes. If you don't know much about HTML and CSS, then EE2 allows you to use the HTML from any rendered Drupal or WordPress theme or you could find a site that just specializes in basic HTML themes to use. Additionally, as @BKY has mentioned, there are a few EE theme vendors such as ThemeForest, AddOnBakery, WooThemes, and ThemeSquirrel.

The `themes/site_themes/` folder is for importing themes that were made available pre-installation. I believe it stores information that will automate creating templates, template groups, field groups and other information to set-up a basic site. But then, as @Adrian mention, you would actually edit and modify your new them via the `Template Manager` in the Control Panel.

The fact is, with ExpressionEngine swapping out themes will never be as easy as WordPress or Drupal, because that's **not** the type of Content Management System (CMS) EE is. ExpressionEngine is mostly used by people who want **powerful control** over designing their websites, which general means, in the control of the look and feel of the site as well. That's why you won't find too many `themes` for it.

But when you do find a theme. Please take care to read the `theme installation` instructions. I know the AddOnBakery provides directions and I'd assume this is true for other vendors. Though if the theme is basic HTML, it would need to be added directly in the `template manager`.
> 5 votes

# Answer
ExpressionEngine doesn't have support for multiple themes, and so far no-one has been successful in launching any sort of "theme shop" for ExpressionEngine. ExpressionEngine is more of a framework to build a site than a ready-to-go CMS solution, and you need to hand craft the front end of your site by writing HTML and CSS code. This is seen as one of the main advantages to using ExpressionEngine by most EE developers.

In most cases you will be able to edit the design templates for your site by logging in to the control panel, and visiting *Design \> Templates \> Template Manager*. For help getting started theming ExpressionEngine, you should start by reading the User Guide. If you don't see the *Design* menu in your ExpressionEngine CP, you will need to ask the person who set up the site to give your account permission.

If the idea of writing HTML and CSS code scares you, you should either hire a professional web developer, or try starting with a more "drag & drop" CMS.
> 4 votes

# Answer
Let's put this another way - with EE you don't just "change the site theme". Instead you "re-implement the site using different front-end code".

There is no easy way, EE just doesn't work that way.
> 4 votes

# Answer
Themeforest is now providing ExpressionEngine build-in theme also. Check out from here: http://themeforest.net/category/cms-themes/expressionengine
> 1 votes

---
Tags: themes
---


# Question
Title: How would I go about integrating a jquery slider in EE with CE Img?
I'm currently trying (without much luck) to properly integrate the Allinone Thumbnail Banner into an EE template. I use CE Img with Matrix to feed the images.

The original Allinone Html looks like the following:

```
    <div id="containingDiv">

        <div id="allinone_thumbnailsBanner_simple" style="display:none;">
            <ul class="allinone_thumbnailsBanner_list">
                <!-- IMAGES -->
                <li data-bottom-thumb="images/simple/thumbs/01_simple.jpg" data-text-id="#allinone_thumbnailsBanner_photoText1"><img src="images/simple/01_simple.jpg" alt="" /></li>
                <li data-bottom-thumb="images/simple/thumbs/02_simple.jpg" data-text-id="#allinone_thumbnailsBanner_photoText2"><img src="images/simple/02_simple.jpg" alt="" /></li>
                <li data-bottom-thumb="images/simple/thumbs/03_simple.jpg" data-text-id="#allinone_thumbnailsBanner_photoText3"><img src="images/simple/03_simple.jpg" alt="" /></li>

           </ul>

            <!-- TEXTS -->

           <div id="allinone_thumbnailsBanner_photoText1" class="allinone_thumbnailsBanner_texts">
                <div class="allinone_thumbnailsBanner_text_line textElement11_simpleResponsive" data-initial-left="0" data-initial-top="60" data-final-left="0" data-final-top="305" data-duration="0.5" data-fade-start="0" data-delay="0">   UP TO <a href="http://codecanyon.net/user/LambertGroup" target="_blank">4 TYPES</a> OF SLIDERS<br />   Each with multiple SKINS</div>
           </div>

           <div id="allinone_thumbnailsBanner_photoText2" class="allinone_thumbnailsBanner_texts">
                <div class="allinone_thumbnailsBanner_text_line textElement21_simpleResponsive" data-initial-left="200" data-initial-top="60" data-final-left="45" data-final-top="60" data-duration="0.5" data-fade-start="0" data-delay="0"><span style="font-weight:bold;">16 TRANSITION EFFECTS<br /> FOR IMAGES</span><br />optional can set the transition<br /> for each image</div>
           </div>

    </div>

```

--Where the Images are the thumbs and displayed image. And the Texts are the subtitles for each image.

This is as far as I could get

```
   <div id="containingDiv">

        <div id="allinone_thumbnailsBanner_simple" style="display:none;">

          <ul class="allinone_thumbnailsBanner_list">
            <!-- IMAGES -->
            {exp:channel:entries channel="top_photos|gallery|recent" limit="8" offset="1" status="Open|fixed"}

           {article_images}

             <li data-bottom-thumb="{image_matrix_image}" data-text-id="#allinone_thumbnailsBanner_photoText1">

              {exp:ce_img:single src="{image_matrix_image}" disable_xss_check="yes" width="960" height="500" allow_scale_larger="yes" crop="yes" quality="60"}" alt="" /></li>

                        <div id="allinone_thumbnailsBanner_photoText1"     class="allinone_thumbnailsBanner_texts">
                        <div class="allinone_thumbnailsBanner_text_line textElement11_simpleResponsive"  <a href="{site_url}{channel_short_name}/view/{url_title}"  "{image_matrix_cutline}"</a> </div>
                   </div>

                {/article_images}

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

       </div>

    </div>

```

But I still can't display the subtexts for the images properly or at all. And I know I've heard something about using the {row\_count} variable along with the div classes but I haven't had any luck with that either. I would appreciate any hints as how to go about EE'ing up jquery Html and the classes. Thanks in advance.

# Answer
> 7 votes
It's a little tricky to help since I can't find a documentation page for the Allinone Thumbnail Banner jQuery plugin. But if I had to guess based on what the HTML output is supposed to look like, then these are the issues you are likely to be having:

**The first issue is that you are not closing your `ul` tag.** It needs to be closed before you output your thumbnails and captions. The simplest solution, at least to get started, is to use two channel:entries loops. One to create the list of images, the other to create the associated captions.

**The second issue relates to uniquely identifying your captions.** Since your channel:entries loop is pulling multiple entries, and thus multiple Matrix fields, `{row_count}` will not uniquely identify your captions. You'd end up outputing a row count of "1" up to eight times. This is because your channel:entries limit is set to 8 and I'm guessing all of your Matrices have at least one row.

So instead, try using `{row_id}` which *will* be unique.

**Other HTML errors:** It also looks like you're missing a closing bracket on the opening tags of `div.allinone_thumbnailsBanner_text_line` and its nested `a` tag.

Definitely view source and/or inspect the HTML that is generated by your template and compare the *actual* output to your desired output. In addition, running it through an HTML validator can help you catch basic errors that are easy to overlook.

If I understand your setup this should do the trick:

```
<div id="containingDiv">

  <div id="allinone_thumbnailsBanner_simple" style="display:none;">

    <ul class="allinone_thumbnailsBanner_list">
      {exp:channel:entries channel="top_photos|gallery|recent" limit="8" offset="1" status="Open|fixed"}

         {article_images}

            <li data-bottom-thumb="{image_matrix_image}" data-text-id="#allinone_thumbnailsBanner_photoText{row_id}">
              {exp:ce_img:single src="{image_matrix_image}" disable_xss_check="yes" width="960" height="500" allow_scale_larger="yes" crop="yes" quality="60"}" alt="" />
            </li>

          {/article_images}

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

    {exp:channel:entries channel="top_photos|gallery|recent" limit="8" offset="1" status="Open|fixed"}

      {article_images}

        <div id="allinone_thumbnailsBanner_photoText{row_id}"     class="allinone_thumbnailsBanner_texts">
          <div class="allinone_thumbnailsBanner_text_line textElement11_simpleResponsive">
            <a href="{site_url}{channel_short_name}/view/{url_title}"> "{image_matrix_cutline}"</a>
          </div>
       </div>

      {/article_images}

    {/exp:channel:entries}

  </div>

</div>

```

**If this doesn't get you where you need to go, I'd recommend simplifying your template first, then build up from there.** This will ensure all your EE tags are working as expected and you don't have typos in your custom field names, syntax errors, or other errors of that nature.

---
Tags: ee2, matrix, jquery, .html
---


# Question
Title: Development (Local) with multiple sites using host file and IIS7 - Can't get FCPATH to recognize - Encoded characters
I am stuck again using IIS7 on a windows server. Trying to replicate the production environment for some testing on a Win7 box using IIS7 and host file to point o the sites.

I have tried using various methods to get a multi-server environment setup, but all have failed. This client in particular wants a development, staging, and production environment. I was looking at using Erik's setup for FocusLab (Thanks Erik!), but for this one in particular, I am trying to implement the one here.

Even trying to clean up my config file seems to break the site though. I can see the site index page, but the CP is jacked. (See screen)

Here is the code I have tried:

```
<?php //if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/* ExpressionEngine Configuration
-------------------------------------------------------------------*/
$config['app_version'] = "255";
$config['license_number'] = "MY LICENSE";
$config['debug'] = "1";
$config['install_lock'] = "";
$config['system_folder'] = "MY SYS";
$config['is_system_on'] = "y";
$config['allow_extensions'] = "y";
$config['site_url'] = "http://".$_SERVER['HTTP_HOST'];
$config['server_path'] = FCPATH;
$config['cp_url'] = $config['site_url'] . '/MY SYS/';
$config['theme_folder_url'] = $config['site_url']."/themes/";
$config['theme_folder_path'] = $config['server_path']."/themes/";
$config['save_tmpl_files'] = "y";
$config['tmpl_file_basepath'] = $config['server_path']."/templates/";

/* CodeIgniter Configuration
-------------------------------------------------------------------*/
$config['base_url'] = $config['site_url'];
$config['uri_protocol'] = 'AUTO';
$config['language'] = 'english';
$config['charset'] = 'UTF-8';
$config['subclass_prefix'] = 'EE_';
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\\-';
$config['enable_query_strings'] = FALSE;
$config['directory_trigger'] = 'D';
$config['controller_trigger'] = 'C';
$config['function_trigger'] = 'M';
$config['log_threshold'] = 0;
$config['log_path'] = '';
$config['log_date_format'] = 'Y-m-d H:i:s';
$config['time_reference'] = 'local';

/* End of file config.php */
/* Location: ./system/expressionengine/config/config.php */

```

Even if I turn off the direct script access denial, I can't display FCPATH. It seems to be an issue with IIS7 and FCPATH.

Any ideas how I can get this going?

*** EDIT *** I started looking at the paths that EE was trying to use and they are showing this: http://bootstrap.com/%3C?=$cp\_avatar\_path%20?%20$cp\_avatar\_path%20:%20$cp\_theme\_url.'images/site\_logo.gif'?%3E

%3C is for the '\<' character, %20 is space, and %3E is the '\>' character.

This is obviously an image being attempted to be rendered.

Is there a reason for the encoded characters showing instead?

# Answer
Why not use http://eeinsider.com/articles/multi-server-setup-for-ee-2/ as a basis and work from there?
> 2 votes

---
Tags: ee2, global-variables, iis
---


# Question
Title: Member Group permissions and editing comments — can't get it to work
I've set up my templates to add in-place comment editing and deletion. It's working great, and should be a useful feature.

However: Now that I'm ready to roll it out I'm attempting to test it with non-Super Admin users… and they can't see the Edit and Delete buttons.

Here's the code in question:

```
{if can_moderate_comment}
<a href="#" class="edit-link">Edit</a>
<a href="#" class="mod-link">Delete</a>
{/if}

```

(I've also tried `if editable`.)

The editing time limit is 0 (I tried setting it to something other than 0 without results).

It's obviously a permissions thing. but I can't find any combination of Member Group permissions that lets a Member see the Edit/Delete buttons on their own posts, but not on every other comment as well. I think I've tried just about every combination you can make in the Comment Administration section.

# Answer
> 3 votes
I'm pretty sure the "set to 0 for no limit" instruction is BS. I've had success using {if editable} and setting an arbitrarily *high* number like 9999999.

---
Tags: members, comments, permissions, groups
---


title: CartThrob order status issue

text:
# Question
Title: CartThrob order status issue
Occasionally after a user places an order their order is listed in the Orders Channel but the status is set to "Processing" then within a couple minutes there is another entry in Orders with a status of "Completed". The only consistency in the orders that have a status of "Processing" is that the "Transaction ID" field is blank.

I recently upgraded CartThrob to 2.2.9 and EE to 2.5.5 and didn't notice this issue until after the upgrade.

Could this possible be an issue of the user clicking the Order button twice?

# Answer
If you have any offsite gateways, it's very possible that a user clicks to go offsite ( to complete the transaction) and then cancels, or clicks the back button. And then submits the order again. Basically the first order was generated, but not completed… so it's processing. And it's never going to finish processing. Generally speaking, you should consider processing orders that are older than your session expiration time as non explicitly canceled by the user.

Each time a checkout form is submitted, there's a record of that. If it goes through, it completes… if it doesn't, internally it's marked as declined, failed, or processing, canceled, refunded, etc. If you have statuses mapped to these things, when something outside the system notifies it of a change, the EE status will change. In the case of a processing order… the customer basically started the transaction and then just abandoned it.

Typically all offsite transactions start their life as a processing order… when the offsite system completes the order, then it updates their status. If the customer doesn't finish the transaction offsite, and doesn't use any of the methods that might trigger an official cancellation, it just sits as processing forever.
> 6 votes

---
Tags: cartthrob
---


# Question
Title: SIM Payment Gateway Response/Receipt URL not displaying
I am using the SIM Payment Gateway with Cartthrob but the response/receipt URL is not displaying after submitting the payment on authorize.net. Interestingly, I got it to work previously after adjusting the name of my system directory in the extload.php file. But now I get the following error message:

> An error occurred while trying to report this transaction to the merchant. An e-mail has been sent to the merchant informing them of the error. The following is the result of the attempt to charge your credit card.
>
> > This transaction has been approved.
>
> It is advisable for you to contact the merchant to verify that you will receive the product or service.

I recently updated to CT version 2.2.2 and now 2.2.91 so that could potentially be related. I did make sure to keep the correct system path in extload.php though.

Any ideas where I might have gone wrong?

# Answer
> 0 votes
No changes were made to SIM between 2.2.2 and 2.2.9x. ExpressionEngine updated their secure forms system recently in version 2.5.5 which has wreaked some havoc with items that redirect. 2.2.9 *should* have fixed this, but I haven't tested with this specific gateway.

Though you said you've maintained the system folder location in extload, I'd double check it to make sure you haven't overwritten it with the old location.

The other thing you may want to check is that the response / receipt URL is devoid of Javascript and insecure includes (including css files, images, etc). SIM generally fails templates that contain insecurely loaded content and JS.

Lastly, if you have a return variable in the checkout form, make sure it's just set to something like this: return="template\_group/template" rather than a full URL. Some servers may end up choking when generating return locations if they're input as full URLs.

---
Tags: cartthrob
---


# Question
Title: How to create a Freeform multipage form inside of two separate form tags?
I'm trying to create a form which passes field values over multiple pages. The first part is in the footer of the website, which, when filled out, should take you to an expanded version of the same form (with added fields), filling out whichever fields were submitted through the first form.

The problem is that I need to do this in two separate form tags (one which exists in my footer template, another for my form page), but all of the examples I've seen have all form "pages" in one tag pair.

E.g. http://www.solspace.com/docs/freeform/form#multipage\_surveys

Anyone know if it's possible to do the above, but not within the same form tag?

# Answer
It looks like the Solspace example is submitting the form to itself, and revealing different chunks with each submit. If you wanted to start the form in the footer, you'd have to have the first chunk there, and then each subsequent chunk would be revealed in the same spot.

I'm not sure how to tackle your goal with something concise that will only send the email when the form is completed.

You could use Safecracker. The first form page would have enough to get the entry started, and you could use hidden input fields to reference the entry on each subsequent page. You'd be creating an entry with a bunch of fields left incomplete, and then editing the entry on each subsequent page, revealing different chunks of fields to fill in.

You could then use a post-processor template or Postmaster to send notifications when the entry is complete. The post-processor template might give you more control over that, as Postmaster relies on triggers, such as a new channel entry.
> 1 votes

# Answer
You could do this with an embed using the paging\_url and multipage\_page parameters and force multipage to always be on page one in the footer, but also force submit to go to the segments of your choosing for page 2 after filling it out in the footer. Notifications do not send until a multipage form is complete.
> 0 votes

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


title: EE1 - Every URL Displays Homepage

text:
# Question
Title: EE1 - Every URL Displays Homepage
I'm updating an EE1 site to v2, but first I need to get it set up on my local server. The homepage and control panel are working great, but every URL on the site displays the homepage template.

Not sure what additional information would be useful here, please let me know and I'll post it, thanks!

* EE 1.6.8
* Structure 1.3.1

# Answer
You'll need to go into the CP in Admin \> System Preferences \> Output and Debugging and set "Force Query Strings" to yes.

If that still doesn't work, please open up your primary index.php (root of your site) and change qtype to 1.

Do either of those fix it up?
> 3 votes

---
Tags: url, ee1
---


# Question
Title: Basic security for entries using checkboxes
I'm trying to put in place a basic security system for entries and this is what I've put in a checkbox field. Is it possible to put these global variable in the conditional or do I need to find a better solution?

```
{if ({document_security:selected option=logged_in_group_id})}
    ... content ..
{/if}

```

# Answer
user809 - I think you're trying to restrict who can view entries on the front-end. Have you tried something like Entry Access?
> 0 votes

---
Tags: security, pixelandtonic
---


# Question
Title: Profile:Edit Not Sending Activation Emails
I submitted a support request to Mighty Big Robot, but I could use all the help I can get, so I'm posting here, too.

The activation email is not being sent after registration form submission. The form submits successfully, and the user is added to the “Pending” member list, but no activation email is sent. Here is the registration template:

```
{exp:profile:register
  include_jquery='no'
  safecracker_head='no'
  return='notifications/submission-success/register'
  group_id='5'
  json='yes'
  class='member-register'
  rules:age='required'
  rules:email='required|valid_email'
  rules:member_first_name='required'
  rules:member_last_name='required'
  rules:screen_name='required'
  rules:password='required'
  rules:terms='required'
  activation_return='profile/registration-complete'
}
  <div class="fieldgroup form-select register age">
    <label for="age">Your Age<span>*</span></label>
    <div>
        <select name="member_age_range" id="age" class="required">
            <option value="">Select your age range</option>
            <option value="18-29">18-29</option>
            <option value="30-39">30-39</option>
            <option value="40-49">40-49</option>
            <option value="50-59">50-59</option>
            <option value="60-69">60-69</option>
            <option value="70 or Over">70 or Over</option>
        </select>
        <p class="small">You must be 18 or over to register.</p>
    </div>
  </div><!--/.row.form-select-->

  <fieldset class="display">
    <div class="fieldgroup five columns">
      <label for="first-name">First Name<span>*</span></label>
      <input type="text" name="member_first_name" id="first-name" class="required">
    </div><!--/.five-columns-->

    <div class="fieldgroup five columns">
      <label for="last-name">Last Name<span>*</span></label>
      <input type="text" name="member_last_name" id="last-name" class="required">
    </div><!--/.five.columns-->

    <div class="fieldgroup ten columns">
      <label for="address-1">Address 1</label>
      <input type="text" name="member_address" id="address-1">
    </div><!--/.ten.columns-->

    <div class="fieldgroup ten columns">
      <label for="address-2">Address 2</label>
      <input type="text" name="member_address2" id="address-2">
    </div><!--/.ten.columns-->

    <div class="clearfix">
        <div class="fieldgroup five columns">
          <label for="city">City</label>
          <input type="text" name="member_city" id="city">
        </div><!--/.five.columns-->

        <div class="fieldgroup five columns">
          <label for="state">State</label>
          <select name="member_state" id="state">
            <option value="">Select</option>
            {exp:reegion_select:states}
              <option value="{region_alpha2}">{region_name}</option>
            {/exp:reegion_select:states}
          </select>
        </div><!--/.five.columns-->
    </div><!--/.clearfix-->

    <div class="fieldgroup five columns">
      <label for="zip">Zip Code</label>
      <input type="text" name="member_zip" id="zip">
    </div><!--/.five.columns-->
  </fieldset>

  <fieldset>
    <div class="fieldgroup">
      <label for="screen-name">Screen Name<span>*</span></label>
      <input type="text" name="screen_name" id="screen-name" class="required">
      <p class="small">This is the name that will show when you share your comments.</p>
    </div>

    <div class="fieldgroup">
      <label for="member-email">Your Email<span>*</span></label>
      <input type="email" name="email" id="member-email" class="email required">
    </div>

    <div class="fieldgroup">
      <label for="email-confirm">Repeat Email<span>*</span></label>
      <input type="email" name="email_confirm" id="email-confirm" class="email required" equalto="#member-email">
    </div>

    <div class="fieldgroup">
      <label for="member-password">Password<span>*</span></label>
      <input type="password" name="password" id="member-password" class="required password">
    </div>

    <div class="fieldgroup">
      <label for="password-confirm">Repeat Password<span>*</span></label>
      <input type="password" name="password_confirm" id="password-confirm" class="required password" equalto="#member-password">
    </div>
  </fieldset>

  <fieldset>
    <div class="fieldgroup inline-checkbox">
      <input type="checkbox" name="accept_terms" id="terms" class="required">
      <label for="terms">I agree to the <a href="{path='privacy-policy-and-terms-of-use'}" target="_blank">terms and conditions</a></label>
    </div><!--/.inline-checkbox-->
  </fieldset>

  <div class="hp">
    <label for="beep">Don't type anything here.</label>
    <input type="text" name="beep" id="beep">
  </div><!--/.hp-->

  <input type="submit" value="Register" class="button">

{/exp:profile:register}

```

Everything was working great on the dev server, but then we pushed to the live server and it stopped working. The biggest difference between the two servers is the live server has an SSL certificate installed, not sure if that’s relevant.

I sent a test email from the communicate tab, and that went through with no problems.

* Profile:Edit 1.0.7
* EE 2.5.5

# Answer
From MightyBigRobot Support:

> Recently EE updated its secure forms systems, to use a completely different method.
>
> Profile:Edit has been updated to 1.0.9 which addresses this problem.

Unfortunately they haven't updated the software version on Devot:ee yet.
> 1 votes

# Answer
I had a similar issue with Zoo:Visitor and my production install. This may not be the complete answer, but I highly recommend signing up for a Mandrill account and setting your server to send using SMTP settings from Mandrill. I too was able to send emails via the communication tool, yet my member notifications weren’t going throguh. Once I used a transactional delivery system, my problems disappeared. I’m still not 100% certain what was the cause on our server, but it should at least get you up and running.
> 1 votes

# Answer
> I sent a test email from the communicate tab, and that went through with no problems.

This is the confounding part, because they should be using the same system. Are they really not sending? Or are they not being received? The recipient server may be rejecting them.

If you have a Gmail account handy, I'd recommend setting up the Control Panel to send through Gmail. At least then you could truly test that the emails are not sending, because you'll see copies in your sent folder if they send.

In addition to setting ssl://smtp.gmail.com as your SMTP Server Address, to use Gmail you'll need to hack system/codeigniter/system/libraries/Email.php as follows:

```
//var $smtp_port     = "25";      // SMTP Port
var   $smtp_port     = "465";      // SMTP Port
var   $newline      = "\r\n";      // Default newline.
var   $crlf         = "\r\n";      // The RFC 2045 compliant CRLF
//var $newline      = "\n";      // Default newline.
//var $crlf         = "\n";      // The RFC 2045 compliant CRLF

```

See if all your emails are getting out through Gmail. If they are, then there's something blocking them on the recipient side. If they aren't, you'll need to troubleshoot your server.

In your add-ons, in profile/models/profile\_model.php, there's a `send_email` function. I'm guessing that's the place to look. Instead of `return`, try doing an `echo` on the function that sends the email. It might give you back an error. You'll need to follow that with `exit();` or the server will just continue on with the code & redirect without you seeing the `echo`.

When we launch sites, I urge clients to set me up with a mail server account to use SMTP instead of PHP Mail. Installing Postfix on a server or using built-in email options is straightforward enough, but it's one more thing to maintain/troubleshoot and you risk your web server's IP being flagged if there's ever an issue with emails originating there.
> 1 votes

---
Tags: members, profile-edit
---


# Question
Title: How do I display the next n future entries?
All,

I am trying to display the next *n* future entries for a channel. The query I'm using is posted below, but I've realized that since I limit the entries in the channel entries query, the *if* statement applies to the limited group of five entries. Rather than producing the next five entries.

Instead, I'm looking for a query that will:

1. Pull the entries for a channel
2. Determine whether or not the entry occurs in the future
3. Display the next five upcoming entries.

I am working on someone else's site without FTP access to load a plugin, so I'm hoping to do this within the template.

My current code:

```
{exp:channel:entries
  channel="blocks"
  show_future_entries="yes"
  dynamic="on"
  orderby="entry_date"
  sort="asc"
  disable="pagination|member_data|trackbacks"
  limit="5"}
     {if entry_date > current_time}
       <li>
         {entry_date format="%l at %g:%i %a"}:
         {block-venue}
           {block-events show_future_entries="yes"}
             <a href="{path='events/{url_title}'}">{title}</a>
           {/block-films-events}
       </li>
     {/if}
     {if no_results}<li>See you next year!</li>{/if}
{/exp:channel:entries}

```

Thanks in advance for any help you can provide!

# Answer
> 4 votes
Would simple adding of `start_on` parameter help you?

```
 start_on="{current_time format='%Y-%m-%d %H:%i'}"

```

---
Tags: channel-entries
---


# Question
Title: undefined constants FALSEOR and FALFALSEORFALSE
In a template I was working on recently, I started to get PHP Notices about undefined constants FALSEOR and FALFALSEORFALSE:

```
A PHP Error was encountered
Severity: Notice
Message: Use of undefined constant FALSEOR - assumed 'FALSEOR'
Filename: libraries/Functions.php(683) : eval()'d code
Line Number: 205

```

\[and\]

```
A PHP Error was encountered
Severity: Notice
Message: Use of undefined constant FALFALSEEORFALSE - assumed 'FALFALSEEORFALSE'
Filename: libraries/Functions.php(683) : eval()'d code
Line Number: 260

```

The template code that generated these messages was:

```
{if STYLE}
    <tr>
        <td>Style</td>
        <td>{STYLE}</td>
    </tr>
{/if}

{if YEARBUILT}
    <tr>
        <td>Year Built</td>
        <td>{YEARBUILT} {if YEARBUILTSRC}({YEARBUILTSRC}){/if}</td>
    </tr>
{/if}

```

The variable names in all caps are variables provided by a plug-in. It is possible that they may have empty values, but I haven't been able to produce a case where any would be undefined \[in the array consumed by TMPL-\>parse\_variables() in the plugin\].

I'm stumped as to why they're being parsed as PHP constants... And even so, I don't see where the strings 'FALSEOR' or 'FALFALSEORFALSE' are being created. Those strings don't appear anywhere in the EE source \[that I can find\], and none of the template variables are so named.

Should I report this as a bug? Has anybody seen something like this before?

# Answer
> 1 votes
PHP has four values when it evaluates an if condition, true, truthy, false, and falsey.

http://www.phabricator.com/docs/phabricator/article/PHP\_Pitfalls.html

Depending on what you're getting back from your add-on, or the add-on's datasource (especially if the data from the source is inconsistent) PHP's conditional logic may act strange if you don't check the value explicitly (ex: STYLE != '').

Also since it sounds like you'll be checking for empty strings. I might take an additional step and fashion your IF statements like this:

```
{if "{STYLE}" != ""}
   ...
{/if}

```

This will ensure that "STYLE" is always interpreted as a string rather than being evaluated as an object or PHP reserved value

---
Tags: php, conditionals
---


# Question
Title: Methods of including other EE fields in a custom field type
I am developing a custom field type which needs to display fields from two different channels in the CP Edit and Publish pages. Users of this field type will need to edit the data from those different channels.

When the data is from a text field it is relatively easy to display it and allow users to edit. However this gets more difficult if I need to display data from a relationship field.

I have read through the developer add-on docs but can't figure out a method of displaying data using another field type within my own. Is there a way of displaying another field type within my custom one?

# Answer
> 3 votes
Each field type stores it's data differently, some custom add-ons will create one or more extra tables to store fieldtype data for entries. For instance, Matrix will create a table: exp\_matrix\_cols and exp\_matrix\_data to store column settings and data that will populate those columns.

Relationships (I'm assuming you're talking about stock EE) are in the exp\_relationships table and the data stored in the rel\_data column is actually a serialized channel entry object (yuck).

Playa in contrast, uses an association table that will link entries to other entries in a table called exp\_playa\_relationships.

As far as I know, there's no easy API to get a complete entry and all of its custom field data. So you'll have to target in advance the field types you want to support and investigate how each field type stores the data. Then your add-on logic will have to detect the fieldtype and run custom logic to pull the data specific to the field type.

---
Tags: custom-fields, fieldtype
---


title: If recently added/edited

text:
# Question
Title: If recently added/edited
I wish to display images from channel entries and if they have been created/edited within the last 14 days I want to add another image on top.

What would be the logic for detecting whether the entry was new or not?

# Answer
> 1 votes
You'd want to use the display limit functions in ExpressionEngine's channel entries tag. Like

```
{exp:channel:entries channel="images" display_by="day" limit="14" orderby="edit_date"}
  <div class="display">{image}</div>
{/exp:channel:entries}

```

You can learn more about using the `display_by` parameter using options other than the standard `display_by="number"` in the **User Guide***Channel Entries Tag*.

Also, if you want to include **both** edit and entry dates, then using `order_by` edit date will probably work best, since new entries should have the same entry and edit date, while edited entries will just have the most recent edit date. Otherwise the standard option is `order_by="entry_date"`.

---
Tags: channel-entries
---