# Question
Title: Does ExpressionEngine 3 use Codeigniter?
Ok first off apologies if this seems like a silly question but I'm actually having a hard time finding the answer, even on Ellislab's website and Google.

In ExpressionEngine 2.x it used Codeigniter as the framework. There was a directory containing the framework files and you could use features of Codeigniter within EE projects.

I'm just building a site on EE 3.3.1 and can't see any such directory in 'system' or it's subdirectories. Is there an underlying framework that can be used?

The reason I ask is because a lot of plugins don't seem to have been updated for EE 3.x compatability. I'm wanting to develop something to send an email and in 2.x I would have used Codeiginters features to do this.

So, is EE 3.x using Codeigniter and if not is there a framework that can be accessed, e.g. by using PHP in templates and then getting an instance of the framework?

***Edit (15 Nov 2016)** \- this post seems quite frequently viewed. If anyone has any examples or information about how they've written custom PHP on an ExpressionEngine 3.x site please post it as an answer. The lack of a documented framework, or having to rely on one that might get removed, is a major issue for anyone doing custom PHP development on EE 3.x sites. Ellislab should really comment on this.*

# Answer
Yes and No.

Starting from v3, EE is gradually moving away from CI. This isn't happening all in one go, but as major versions progress. CI is still there, but it's all tucked in the `legacy` directory, along with old, non-ported libraries and such.

What is EE moving to? Not another framework. So no CI, Laravel, Yii or something similar. Rather, EE will be its own framework.

So, for now, EE is using both CI for "legacy" stuff, and its own set of libraries/models/whatnot for the new stuff. As a general rule of thumb, the difference in syntax is:

```
// Legacy
ee()->foo->bar();

// New
ee('Foo')->bar();

```
> 8 votes

# Answer
EE3 does not use Codeigniter - but it is indeed hard to find the information online: if you want confirmation contact Derek Jones at EllisLabs (e.g. via EE Slack Channel - eecms.slack.com)

EE3 is a major rewrite but a consequence is that it has broken a very large number (perhaps all) of EE2's add-ons and extensions.

EllisLab perhaps were not so good at managing this transition, and possibly launched the product too soon - some key add-ons had to wait for hooks and patches to be added to EE3.1 before they could migrate - so the transition has been bumpy.

The work required to rewrite complex add ons for EE3 is non-trivial - some vendors of well used EE2 add ons have said they are not supporting EE3 (e.g. P+T who wrote Matrix, Playa), while the work on others is promised but taking a very long time (e.g. Assets, Publisher, Structure, CE-Cache).

EllisLab has provided a good utility to migrate EE2 Matrix / Playa fields to EE2 built in equivalents fields (Grid / Relationships), but that's it for migration support from there.

There are some lists of EE3 compatible add ons around - e.g. look in EllisLab's blog list (https://ellislab.com/blog/entry/expressionengine-3-add-on-developer-update-status) or on Devot-ee.com which now has an EE3 tag you can search on - https://devot-ee.com/add-ons/filter?&f=ee3
> 4 votes

---
Tags: ee3, codeigniter
---


# Question
Title: If statement when layout variable contains whitespace
I'm using an if statement in a layout to check if a layout variable contains any content.

```
{if layout:sidebar}
  <div class="sidebar">
    {layout:sidebar}
  </div>
{/if}

```

This works well if `{layout:sidebar}` hasn't been set at all by the template that is using this layout, but sometimes `{layout:sidebar}` will have spaces or newline characters in it, but nothing else (because contents get set *conditionally* in the templates that use this layout).

Things I've tried:

```
{!-- Will display the sidebar if there are newlines/spaces in layout:sidebar --}
{if layout:sidebar}
  <div class="sidebar">
    {layout:sidebar}
  </div>
{/if}

{!-- Same result as above...which makes sense --}
{if layout:sidebar != ''}
  <div class="sidebar">
    {layout:sidebar}
  </div>
{/if}

{!-- Will never display the sidebar --}
{if {exp:streeng trim="both"}{layout:sidebar}{/exp:streeng} != ''}
  <div class="sidebar">
    {layout:sidebar}
  </div>
{/if}

{!-- Will never display the sidebar --}
{if {exp:streeng find='SPACE|NEWLINE' trim='' }{layout:sidebar}{/exp:streeng} != ''}
  <div class="sidebar">
    {layout:sidebar}
  </div>
{/if}

{!-- Breaks if {layout:sidebar} contains a double quote --}
{if "{exp:streeng find='SPACE|NEWLINE' trim='' }{layout:sidebar}{/exp:streeng}" != ''}
  <div class="sidebar">
    {layout:sidebar}
  </div>
{/if}

{!-- Breaks if {layout:sidebar} contains a single quote --}
{if '{exp:streeng find='SPACE|NEWLINE' trim='' }{layout:sidebar}{/exp:streeng}' != ''}
  <div class="sidebar">
    {layout:sidebar}
  </div>
{/if}

```

Other than combing through templates that use this layout and set `layout:sidebar` and removing any newlines or spaces, what is the best way to conditionally include or exclude the sidebar in this scenario?

# Answer
How about using streeng to replace the spaces / newline characters before you test.

If you use `find` in streeng and put no `replace` value streeng will delete the search terms from its object if it finds them there. You can use pipe to search for multiple values, and streeng has special terms for spaces and newline characters ... so something like:

```
{if {exp:streeng find="SPACE|NEWLINE" trim="both"}{layout:sidebar}{/exp:streeng} != ''}
  <div class="sidebar">
    {layout:sidebar}
  </div>
{/if}

```

This should get rid of any spaces and newlines in the layout variable before you test to see if it is empty.

HTH
> 0 votes

---
Tags: ifelse, string, layout-variables
---


# Question
Title: 403 error when moving a site from production to localhost
My question is very similar to this one.

I am new to Expression Engine and CMS in general. I'm trying to change an existing live site using EE2. So I copied all the files to my local machine (WAMP) and imported the database. I added config/config.local.php with my database credentials. When I try to access the site I get a 403 Forbidden error page saying:

> You don't have permission to access / on this server.
> Apache/2.4.17 (Win64) PHP/5.6.16 Server at localhost Port 8080

I have tried removing the .htaccess file from the root, but I get the same error.

**What additional configuration do I have to add to move a site from production to localhost?**

# Answer
> 0 votes
Instead of adding a config/config.local.php, I put my database credentials in the existing config.dev.php.

---
Tags: ee2
---


# Question
Title: How can I tell if a fieldtype is in use?
I'm trying to clean up my EE install and there are a few third-party fieldtypes that I'm reasonably sure aren't in use. But I'd like to make sure before removing them. Is there any way to tell, other than a manual check of all fields (including all fields in grids)?

# Answer
This MySQL query should give you a list of fieldtypes which are not currently in use as Channel or Grid fields:

```
SELECT name FROM exp_fieldtypes WHERE
    (SELECT COUNT(*) FROM exp_channel_fields WHERE field_type = name) = 0
AND
    (SELECT COUNT(*) FROM exp_grid_columns WHERE col_type = name) = 0

```
> 2 votes

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


# Question
Title: SEO lite {extra:desc} is not getting over ridden with the seo lite template description
I am using seo lite and it works fine with tag {extra:desc}.

But when I write in the seolite description in the template, it over writes the title and keywords but not the description. It overwrites if I dont use the tag {extra:desc}.

Can you please help me with this.

this is ma code ---

```
{if "{extra:desc}" !="" }

   <meta name='keywords' content='{meta_keywords}' />
  <link rel='canonical' href='{canonical_url}' />
  <meta name="google-site-verification" content="CGYXJx34stuBq6Ahar-eFmhCJL-egrm533wopJONBoY" />
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  <meta name="author" content="but.ae"/>
  <meta name='description' content="{exp:streeng characters="160" find="WHAT IS IT" replace=" "}{extra:desc}{/exp:streeng}" />

 <

 <title>{title}</title>

{if:else}

  <meta name='keywords' content='{meta_keywords}' />
  <link rel='canonical' href='{canonical_url}' />
  <meta name="google-site-verification" content="CGYXJx34stuBq6Ahar-eFmhCJL-egrm533wopJONBoY" />
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  <meta name="author" content="but.ae"/>
  <meta name='description' content="{meta_description}" />

 <title>The Future Build</title>
{/if}

```

Hope to hear from you soon.

# Answer
For anyone interested the user was helped over here:

https://getsatisfaction.com/addonbakery/topics/seo-lite-extra-desc-not-over-riding
> 2 votes

# Answer
I found that I wanted my meta description to be populated with the following priority:

* Custom SEO Description in entry edit SEO Lite tab
* Extracted {extra:desc} value from my entry
* Fallback site-wide Default description set in SEO Lite settings

I couldn't find a way to do this with SEO Lite as it stands, so I decide to add a new variables that I could use in my SEO Lite template, `{default_description}`, which contains the SEO Lite default description. That way, I can compare to see if my {meta\_description} is equal to that, and if so, use my fallback {extra:desc}.

I added the following code to mod.seo\_lite.php

```
$vars[$this->tag_prefix.'default_description'] = htmlspecialchars($seolite_entry->default_description, ENT_QUOTES);

```

And in my SEO Lite Template, I have the following:

```
<meta property="default_description" content="{default_description}" />
{if meta_description == default_description && extra:desc != ' ...'}
    <meta property="og:description" content="{extra:desc}" />
    <meta name='description' content='{extra:desc}' />
    <meta name="twitter:description" content="{extra:desc}">
{if:else}
    <meta property="og:description" content="{meta_description}" />
    <meta name='description' content='{meta_description}' />
    <meta name="twitter:description" content="{meta_description}">
{/if}

```

Now, if I have set a SEO Description in my entry, that will be output. Otherwise, if {extra:desc} has a value, that will be used. And if neither of those is set, it uses my default site-wide description.

Hope this helps someone!
> 1 votes

---
Tags: seo-lite
---


# Question
Title: Cartthrob discount settings database table
Can anyone point me in the right direction for finding the database table that corresponds to the information set in Cartthrob discount/coupon code settings?

I'm writing a query that needs to use the member group that's defined for a discount but trying to find this data in the database is proving a problem.

The `exp_channel_data` table has entries for discounts set up and `exp_channel_titles` all the usual data, but I fail to see any clues as to where the settings data for the related discounts reside.

We're using Cartthrob 2.70 in EE 2.10.2, any help is much appreciated!

# Answer
You should be able to get this from the proper `field_id_x` column in `exp_channel_data`. The column for the field is `base64_encode`d, but decoding it should get you a JSON object with the data you need!
> 0 votes

---
Tags: cartthrob
---


# Question
Title: Cartthrob: How to output Shipping address on order completion page?
I am new to cartthrob and am playing with it on my development site. I am still using OFFLINE PAYMENT while I work out how to get the information flow right. My question is this: How do I display the customer shipping address on the order completion page? At the moment I am collecting customer information and shipping information in the same place, so I want an output that will give the customer name and address if it is the same as the shipping address, or just the shipping name and address if it is different from the customer address. I am using the {exp:cartthrob:customer\_info} paired tag.

# Answer
> 1 votes
If you've specified in the CT settings to save orders to an 'orders' channel, then you can use the `submitted_order_info` tag to output fields from the completed order the same way you'd output any other channel entry.

https://www.cartthrob.com/docs/tags\_detail/submitted\_order\_info/index.html

# Answer
> 0 votes
Ok, so the CT examples use old syntax, which is why they don't work on CT3. This works:

- {if shipping\_first\_name=="{shipping\_first\_name}"}{shipping\_first\_name}{/if} {if shipping\_first\_name==""}{first\_name} {/if} {if shipping\_last\_name=="{shipping\_last\_name}"}{shipping\_last\_name}{/if} {if shipping\_last\_name==""}{last\_name} {/if}
- {if shipping\_address=="{shipping\_address}"}{shipping\_address}{/if} {if shipping\_address==""}{address} {/if}
-
- {if shipping\_address=="{shipping\_address}"}{shipping\_address2}{/if} {if shipping\_address==""}{address2} {/if}
- {if shipping\_city=="{shipping\_city}"}{shipping\_city}{/if} {if shipping\_city==""}{city} {/if}
- {if shipping\_state=="{shipping\_state}"}{shipping\_state}{/if} {if shipping\_state==""}{state} {/if}
- {if shipping\_zip=="{shipping\_zip}"}{shipping\_zip}{/if} {if shipping\_zip==""}{zip} {/if}

---
Tags: cartthrob
---


# Question
Title: 404 Redirect when there are too many segments
Having some issues forcing a 404 redirect when there are too many segments. Here is the page I am working on http://syntropy.highimpact.com/case-studies/aurora-flight-sciences/

I'm using the following code on the "case-studies" template:

```
{if segment_3 != ''}
  {redirect="404"}
{/if}

```

I thought doing this would force a redirect for any segments after segment 2. For instance, http://syntropy.highimpact.com/case-studies/aurora-flight-sciences/another-segment/ should be forcing a redirect, but instead it seems to be trying to load a page.

All of the other 404 redirect conditions are working fine. Any help would be much appreciated. Thanks.

# Answer
Try some debugging to help. Add this code block to your template:

```
{site_url} / {segment_1} / {segment_2} / {segment_3}

{if segment_3}
    Condition 1 works <br><br>
{/if}

{if {segment_3}}
    Condition 2 works <br><br>
{/if}

{if "{segment_3}"}
    Condition 3 works <br><br>
{/if}

{if segment_3 != ''}
    Condition 4 works <br><br>
{/if}

{if {segment_3} != ''}
    Condition 5 works <br><br>
{/if}

{if "{segment_3}" != ''}
    Condition 6 works <br><br>
{/if}

```
> 0 votes

# Answer
Keep it clean and simple. Install Resource Router and then add conditions like this to your config file, a lot faster (it's processed before templates), all in one place, keeps your templates clean and far better/thorough handling.

```
$config['resource_router'] = array(
    'case-studies/:any/:all'      => $router->set404()
);

```

Read the docs, there's so much that can be caught and done.
> 0 votes

---
Tags: conditionals, redirects, 404, segments
---


title: Display an array of pictures in order

text:
# Question
Title: Display an array of pictures in order
I need to display an array of pictures in order but i am not aware of how to accomplish this. this is an EE 2.4 system.

# Answer
You've tagged your question with Assets, so have you tried the `orderby` parameter in the output?

> "Order the files by a property or metadata value. Pair with the sort parameter to control the sort order."

This Stack Exchange answer might also help.

Otherwise assuming you want a solution to implement, rather than an existing setup this is what I'd recommend...

Problem is you're using EE v2.4 and the native grid wasn't introduced until v2.7. I'd highly recommend upgrading due to the security updates and bugs, let alone the additional features that have been introduced. But let's assume you can't upgrade, you can use Matrix which works from EE v2.4 to replicate the same ability.

Using Grid/Matrix, your editor/admin has control of the order of images by dragging and dropping the rows.

```
{images}
    {if url-link}<a href="{url-link}" title="{image-title}">{/if}
    {if video}<a href="{video}" class="fancybox-video" title="{image-title}">{/if}
        <img src="{image}" alt="{alt-text}">
    {if "{url-link}" || "{video}"}</a>{/if}
{/images}

```

Example above obviously adds more column features that you probably won't need. You might also want to utilise sized images (either natively with Upload Preferences or via CE Image).

If you want to change the order based on template or allowing re-ordering from user input (e.g. a gallery), then both Grid and Matrix allow for `orderby` parameter.
> 0 votes

---
Tags: assets
---


# Question
Title: Using item option as the search parameter of an orders tag
I have a Matrix field set up as a CartThrob options field and would like to list orders based on whether a certain option was part of the order.

Something like this:

```
    {exp:channel:entries
      channel='orders'
      disable="categories|category_fields|member_data|pagination"
      search:{order_items}{item:entry_id}{/order_items}="1088"
      }
      <tr>
        {order_items}
          <td>{item:entry_id}</td>
          <td>{item:title}</td>
        {/order_items}
        <td>{order_customer_full_name}</td>
        <td>{order_customer_email}</td>
      </tr>
    {/exp:channel:entries}

```

Is it possible to use options like that in the search parameter? It seems to be ignored.

# Answer
> 1 votes
You'll probably have weird EE template parsing order issues doing this. I think you'd need an outer loop to look it up, maybe with a custom query, and feed that to exp:channel:entries or similar.

# Answer
> 0 votes
Thanks Matt.

It seems what I was trying isn't possible but I have something similar working by using stash to set a list of orders with the item option as a stash variable. Than filtering it down based on that.

---
Tags: cartthrob
---


# Question
Title: Does DevDemon Updater 4.0.0 run on php5.6?
I am running Updater 3.3.0 with php5.6 and get these errors:

Message: Non-static method Updater\_helper::arrayExtend() should not be called statically, assuming $this from incompatible context Filename: updater/api.updater.php

If I make the functions static the error messages in the Control Panel go away, but Updater throws more errors when I try to run it and update EE from 2.10.1 to 2.11.1.

Does DevDemon Updater 4.0.0 run on php5.6 without these errors?

# Answer
I think you have to use updater 3.3.0 to run on EE 2. I'm having the same problem with Updater 3.3.0 on EE 2.11.1. I just moved a site from another host to a new host with some of my other sites which were on PHP 7, and I've had to move that new host down to PHP 5.5 to stop Updater throwing those errors. I'd like to move these sites back up to PHP 7.
> 0 votes

---
Tags: devdemon
---


# Question
Title: Solspace Freeform: Is there attr:type=“email” for freeform:field tag
I am wondering if you can specify the input type as an attribute in FreeForm.

I would like to give mobile users the right keyboard for the email field e.g. input type="email"

Can this be done on the freeform:field tag?

Thanks. =)

# Answer
You can add "attr:type" to specify the type of the input field.

```
{freeform:field:email
attr:type="email"
attr:class="email-class"
attr:placeholder="Please fill in your email address"
}

```

You can add any attribute you like. Just use it like `attr:name-of-attribute="value of attribute"`
> 4 votes

---
Tags: solspace-freeform
---


# Question
Title: How do I send meta data fields to Stripe with Cartthrob
Has anyone been able to get Carthrob to send custom meta data to Stripe? I have the 'Charge' add-on doing it perfectly but haven't managed to get Cartthrob doing it. I've tried

```
<input type="hidden" id="meta:custom-data" name="meta:custom-data" value="{segment_3}">

```

in the exp:cartthrob:checkout\_form but nothing seems to be passed through. (that is basically what you use in Charge). Anyone got this working?

# Answer
Unfortunately the Stripe gateway for CartThrob will not look for or pass any metadata to Stripe. You'd have to manually add this into the gateway code, or roll your own custom gateway for Stripe. Consider contacting them with a feature request!
> 2 votes

---
Tags: cartthrob, stripe, charge
---


title: gMaps installation on ExpressionEngine3

text:
# Question
Title: gMaps installation on ExpressionEngine3
At the start I just want to say hi to everyone as I am new to this message board.

I got a problem with gmaps plugin bought from devot-ee, after installing gmaps plugin and gmaps field type this error occures on everypage at the very top:

> Notice Use of undefined constant GMAPS\_FT\_AUTHOR - assumed 'GMAPS\_FT\_AUTHOR' user/addons/gmaps\_fieldtype/addon.setup.php, line 16 hide details
>
> Severity: E\_NOTICE Notice Use of undefined constant GMAPS\_FT\_AUTHOR\_URL - assumed 'GMAPS\_FT\_AUTHOR\_URL' user/addons/gmaps\_fieldtype/addon.setup.php, line 17 hide details
>
> Severity: E\_NOTICE Warning Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/cork-comedy-festival/backstage/ee/legacy/core/Exceptions.php:112) ee/legacy/core/Input.php, line 249 show details
>
> Severity: E\_WARNING Warning Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/cork-comedy-festival/backstage/ee/legacy/core/Exceptions.php:112) ee/legacy/core/Input.php, line 249 show details
>
> Severity: E\_WARNING Warning Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/cork-comedy-festival/backstage/ee/legacy/core/Exceptions.php:112) ee/legacy/core/Input.php, line 249 show details
>
> Severity: E\_WARNING Warning Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/cork-comedy-festival/backstage/ee/legacy/core/Exceptions.php:112) ee/EllisLab/ExpressionEngine/Boot/boot.common.php, line 463 show details

If someone could advise me how to fix this error.

Kind Regards, Remi.

# Answer
I found solution.. I have added These lines to config.php file in line 16

```
define('GMAPS_FT_AUTHOR', 'gmap');
define('GMAPS_FT_AUTHOR_URL', 'gmap');

```
> 0 votes

---
Tags: ee3, google-maps
---


# Question
Title: Disable freeform if user has submitted details and returns to the site
Is there a way to disable a freeform form if a user has already submitted their details? There is a plugin that can pull the users IP but how do I compare to that to the list of IP addresses of submitted freeform entries?

```
{if "{exp:get_post_var type='user_ip'}" == "127.0.0.1"}
    YES, it is 127.0.0.1
{if:else}
    NO, it is not 127.0.0.1
{/if}

```

# Answer
> 3 votes
Freeform has built in duplicate detection. https://solspace.com/legacy\_docs/freeform-4/form/#prevent\_duplicate\_on

# Answer
> 0 votes
You could check if an entry with a certain ip address is submitted with the entries function:

```
{exp:freeform:entries search:ip_address="127.0.0.1" form_id="your-form-id" dynamic="off" limit='1'}
{if freeform:no_results}
No, 127.0.0.1 has not submitted an entry
{/if}

Yes, 127.0.0.1 has submitted an entry
{/exp:freeform:entries}

```

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


# Question
Title: Want to display all but 1 category in channel entries loop
I would like to display all but 1 category in my channel entries loop. I tried doing category="not .." but it doesn't work. Here is my code

```
{exp:channel:entries channel="lm_edit" sort="desc" category="not 42" limit="5" disable="member_data|trackbacks|playa|pagination" status="open|LMonly" dynamic="no"}
    {if count == "1"}

    {if lm_main_image != ""}
    {exp:ce_img:single src="{lm_main_image}" border="1|b9b3be" width="150" height="75" crop="yes" align="left" class="img-responsive" id="tabimg"}
    {/if}
    {title}

    {if lm_deck == ""}{/if}
    {if lm_deck != ""}{exp:eehive_hacksaw chars = "100" append="..."}{lm_deck}{/exp:eehive_hacksaw}{/if}

    {if:else}

    {title}

    {/if}
    {if count == "5"}More News{/if}
   {/exp:channel:entries}

```

When I get rid of 'not' and just have category="42", all entries from 42 display. When I add back the not nothing is filtered out and all entries display.

# Answer
I had the same issue once and EL said you can't. Per the docs:

```
Using this parameter will automatically cause ExpressionEngine to ignore any category information specified via the URL. For instance, if you are on a "category page" (e.g. a /C13/ segment in the URL) that will be completely ignored in favor of whatever you have specified via the parameter.

```

The EL Supoprt response to acheive it:

> But I think you can work around it without it being too clunky. If there’s no category indicator in the url, you want to have the category=“not x”, but if there IS a category indicator, you want it to be purely dynamic- yes?
>
> Note- I would put all of the ‘guts’ of my channel tag in a snippet, so I don’t have to clutter up my template.
>
> Then I’d do a template along the lines of:
>
> {if segment\_3 == 'category'} {exp:channel:entries whatever…..} {snip} {/exp:channel:entries} {/if}
>
> {if segment\_3 != 'category'} {exp:channel:entries category="not 39" whatever…..} {snip} {/exp:channel:entries} {/if}
>
> Note I used 2 simple conditionals rather than an if/else- because I want them parsed early so that only one of those entry tags is run. That’s for optimization.
> 0 votes

---
Tags: ee2, channel-entries, categories, templates, filter
---


title: EE3 Template Partials

text:
# Question
Title: EE3 Template Partials
I upgraded a dev site to EE3 and my snippets are now placed into two folders, \_global\_partials and \_partials. I can't seem to find the difference on what these folders are. At first I thought it may have something to do with template variables but adding a new template variable just puts it in a folder called \_variables. EE3 docs don't seem to have what the difference between the two folders are. Has anyone figured out the difference?

# Answer
> 0 votes
I haven't heard from anyone in a while but I think I figured out the answer. I believe the \_global\_partials folder is used when you have multiple sites, while the \_partials folder is on a per site basis. Ellislabs still doesn't have any documentation so I can't provide a true answer.

---
Tags: template-partials
---


title: Every page outputs only a page title

text:
# Question
Title: Every page outputs only a page title
After migration to another server, all pages stop working. Now every pages displays only a "page title". Debug is set to 1, there is no PHP errors. I want to create a 2nd enviroment on the local server (XAMPP 3.2.2), for testing a new template. Any idea why i didn't see a proper page? Where i should start to searching a problem source?

# Answer
I'm still new to EE, hence no experience with WSOD. But others have. There are a ton of approaches and potential reasons in this thread. Maybe/probably it covers yours:

White screen of death after server move
> 0 votes

---
Tags: ee2, server-migration, blank-screen
---


# Question
Title: Logged out redirect not working for cartthrob:add_to_cart tag
I have add to cart buttons like this:

```
<a href="{entry_id_path='weekend-courses/add-to-cart'}" >Book now</a>

```

'weekend-courses/add-to-cart' contains only this:

```
{if logged_out}
  {redirect='account/login/return/weekend-courses/'}
{/if}

{if logged_in}
  {exp:cartthrob:add_to_cart entry_id="{segment_3}" quantity="1" return="weekend-courses/checkout/{segment_3}"}
{/if}

```

Clicking the book now link adds an item to the cart and goes to weekend-courses/checkout/{segment\_3} when I am logged-in AND when I am logged-out.

Changing to this

```
{if logged_out}
  {redirect='account/login/return/weekend-courses/'}
{/if}

{if logged_in}
  <p>Logged in</p>
{/if}

```

Works as expected.

Any ideas why this isn't working as expected?

# Answer
I'm almost positive this is a parse order issue with ExpressionEngine, not anything CartThrob can change. I agree with James's comment, that EE 2.9+ parse order might work better for this. You might consider adding your logic around the "book now" button, and using another template which just has "add to cart" logic.
> 0 votes

# Answer
Fixed this with Switchee

```
{exp:switchee variable = "global:member_id" parse="inward"}
    {case value="1"}
        {exp:cartthrob:add_to_cart entry_id="{segment_3}" quantity="1" return="weekend-courses/checkout/{segment_3}"}
    {/case}
    {case value="0"}
        {redirect='account/login/return/weekend-courses/'}
    {/case}
{/exp:switchee}

```

That's working fine. Thanks for the suggestions James & Matt
> 0 votes

---
Tags: cartthrob, conditionals, redirects
---


title: Complex Front-End View Permissions

text:
# Question
Title: Complex Front-End View Permissions
This is as much a philosophical as a technical question. We are using EE 2.11.1 for this project.

We have relatively complex front-end permission requirements. They are all need-to-know permissions, i.e. views not edits. I have researched the topic and found the hooblong and hookan add-ons. However, based on my dev experience, I believe I can create a custom system for our permissions requirements. But as I am new to EE, I am not sure if I should. So this is mostly a question of 'best practice' and if you can see issues down the road.

**Permission Requirements**

Member Groups:

* Super Admins
* Editor Type A
* Editor Type B, etc.
* B2B User
* B2C User

The difference between B2B and B2C user can be nicley solved through EE's internal template permissions. However, the B2B Users will have a very granular and mix-and-match permissions requirement:

* View Country 1
* View country 2, etc.
* Application View 1
* Application View 2, etc.

There are nine countries and the applications list will be extended post-publication. A B2B User can have a very individual combination of these permissions, i.e. it's not feasible to solve this through member groups. (Additionally there will be permissions synchronization from our CRM system.)

**User Setup**

Using Solspace's User Add-On, we are implementing a system where a user is always associated (as Associated Author) with a company channel entry. The permissions illustrated above will always be company-wide, i.e. all users associated with a company will have the same permissions.

**Considered Approach**

The solution that I am currently considering is:

* Store permissions as fields in company channel entry
* On member login use member\_member\_login\_single hook to load the user's asociated company profile including permissions (will have to do this anyway, as the company profile holds information which will be needed to connect to 3rd party tools)
* In the template, check permissions in the company profile and display content accordingly. (Often it will be a show / don't show case.)

So, is this a terrible approach? Are there any issues experienced EE devs see on the horizon? Are there preformance issues to be considered? Any other input I need to consider?

# Answer
Yes, your plan is a reasonable one. The only change I'd make is to use `sessions_end` rather than `member_member_login_single`. The latter only fires upon login, but presumably you'll need to know the member's permissions throughout their session. The former fires on every page load.

Inside of that hook you could simply set some global variables based on the permissions data you fetched for the logged-in member.

```
ee()->config->_global_vars['can_access_usa'] = true;
ee()->config->_global_vars['can_access_canada'] = false;

```

(As a very simple example.)

Alternately, skip the extension altogether and write a module with a tag pair which uses conditionals to process your permissions.

```
$vars = array(
    'can_access_canada' => false,
    'can_access_usa' => true
);
return ee()->TMPL->parse_variables_row(ee()->TMPL->tagdata, $vars);

```

Then in your template you can use:

```
{exp:my_addon:permissions}
    {if can_access_canada}
        // Do stuff
    {/if}
{/exp:my_addon:permissions}

```
> 2 votes

# Answer
Ultimately, "best practice" will come down to balancing the following factors: \- Your channel structure, the containers for all data. \- Your group structure which controls access \- Your template structure which gives, as you have stated, a certain amount of intersection between groups and data \- Finding some way to limit the number of different access/data combinations \- A way to overcome the limitation of One Member, One Group

Mixing and matching access using pure native EE is, as you have realised, not feasible, and Derek has given excellent advice on how to get around that limitation within the boundaries of the information you have provided.

However, you are no longer in "Native EE" territory whatever you do.

What is not entirely clear to me, is how dynamic are your access-control needs? Assuming that each user belongs to only one company at a time, your access control combinations come down to Company/Country/Application. I can't tell how many combinations you have to consider without knowing how many companies and applications as well as countries, but it really does not matter unless access will be static once set up, which seems unlikely.

Once you get over a few (ten to twenty) combinations, the job of visualising the security consequences of making any change becomes an impossible challenge, so you need a way to lock in how your access control works so that it cannot be bypassed by combinations that may not have been anticipated during the design phase.

I have wrestled with this extensively for a number of clients with similarly dynamic "need-to-know" content access needs, which is why I developed HooKan and HooBlong. While they in no way make your data and access-control design job any easier, they do simplify the post-deployment admin job.

View HooBlong Features
> 0 votes

---
Tags: members, permissions
---


# Question
Title: How to fix Google Maps for ExpressionEngine - Uncaught TypeError: this.lat is not a function
I'm getting this error all of a sudden when trying to add markers to a map in the CP:

> Uncaught TypeError: this.lat is not a function

I've previously followed all of the advice on devot-ee about using a previous version of the Google Maps API, but this has now happened despite doing that.

Any advice on how to work around this?

# Answer
The following fix works for me. The project in which I'm using this fieldtype does not require the use of most of the product's more advanced features so I can't guarantee that it fixes everything. Nor can I guarantee that it won't break something else. But hey, it's a start :-)

Open up /themes/third\_party/gmap/javascript/gmap\_field.js and search for "var updateValues". (The line number will vary depending on your addon version.) Modify the code as follows:

```
// @HACK VMG 2016-05-26
// Fixes "this.lat is not a function" error caused by
// the response object containing float values for lat
// and lng instead of a LatLng object.
$.each(response.markers.results, function(i, result) {
    response.markers.results[i].geometry.location = new google.maps.LatLng(result.geometry.location.lat, result.geometry.location.lng);
        });
$.each(response.waypoints.results, function(i, result) {
    response.waypoints.results[i].geometry.location = new google.maps.LatLng(result.geometry.location.lat, result.geometry.location.lng);
});
$.each(response.regions.results, function(i, result) {
    response.regions.results[i].geometry.location = new google.maps.LatLng(result.geometry.location.lat, result.geometry.location.lng);
});
var updateValues = [
    JSON.stringify(response.markers.results),
    JSON.stringify(response.waypoints.results),
    JSON.stringify(response.regions.results)
];

```

Hopefully that helps others of you who are facing the same problem.
> 20 votes

# Answer
You may have already tried this. This fix worked for me a while ago (I just checked - and GMAPS is still working fine on the site this fix was applied to).

Around line 180 in this file: system/expressionengine/thirdparty/gmap/ft.gmap.php

CHANGE THIS:

$this-\>EE-\>theme\_loader-\>javascript('https://maps.google.com/maps/api/js?sensor=true');

TO THIS:

$this-\>EE-\>theme\_loader-\>javascript('https://maps.google.com/maps/api/js?v=3.22&sensor=true');
> 1 votes

---
Tags: google-maps-for-ee
---


# Question
Title: set order to freeform pro field list type?
I have a checkbox group field in Freeform Pro where the value list type is from a channel field. Is it possible, using an attribute in the freeform tag to set the order (asc by title) of the items?

Thanks

Peter T

# Answer
Chalk this one up to operator error! I had the solution all along!

Just use:

```
{exp:channel:entries channel="channel_name" status="open" orderby="title" sort="asc" dynamic="no"}
<li>
    <input id="freeform_field_{entry_id}" type="checkbox" value="{entry_id}" name="freeform_field[]"
        {exp:query sql="select ff.entry_id as EID, ff.form_field_xxx  from apps_freeform_form_entries_xx as ff
        where ff.entry_id = '{segment_5}' AND ff.form_field_xxx LIKE '%{title}%'"}
        checked="checked"
        {/exp:query} >
        <label for="freeform_field_{entry_id}">{title}</label>
</li>
{/exp:channel:entries}

```
> 0 votes

---
Tags: solspace-freeform
---


title: Freeform and Abide

text:
# Question
Title: Freeform and Abide
What'd be the best practice to add Abide validation to Freeform?

http://foundation.zurb.com/sites/docs/abide.html

```
<form data-abide novalidate>

```

How do I drop something like 'data-abide novalidate' into an EE Freeform tag?

```
{exp:freeform:form
    collection="Contact"
    required="name|email"
    return="contact/thank-you"
    form:id="contact"
    }

```

# Answer
This works:

```
{exp:freeform:form
    collection="Contact"
    required="name||email|message"
    return="contact/thank-you"
    form:id="contact"
    form:data-abide="true"
    form:novalidate="true"
    }

```

This is the documentation on Abide:

```
<form action="" data-abide novalidate method="post">

```

This is how Freeform generates the HTML:

```
<form action="" data-abide="true" novalidate="true" method="post">

```

The confusion comes from the syntax for the attributes. Both of these above are interpreted the same way.
> 0 votes

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


title: Conditional if else Problem

text:
# Question
Title: Conditional if else Problem
I have an additional title called {long\_titles}, but do not use it for every entry. However, when I do use it, I want to suppress the {title}. I have tried several approaches but can't get it. Needs some help!

```
{if "{long_titles:count}" != ""}
      <h3>{title}</h3>{/if}
      {if:else}
<h3>{long_titles}</h3>{/if}

```

# Answer
Try this:

```
<h3>
{if long_titles}
    {long_titles}
{if:else}
    {title}
{/if}
</h3>

```
> 4 votes

---
Tags: conditionals, ifelse
---


# Question
Title: Refine by, returning results back to template
In a new site I am working on, I have a refine section that allows users to select from a range of checkbox questions (around 40 checkboxes, 7 questions). I have currently wrapped these in a form, which actions to a custom Expression Engine module. Here I want to complete the 'search' of which entries match the full 'refine by' the user has submitted.

My question is, how can I return the entries that are output by my 'refine by' criteria in the module. Somehow, I need to return back to the template the list of entry id's? Or is there another way to achieve this?

# Answer
> 0 votes
Whilst you could build this yourself the way you have been, it would be much quicker to use one of the ready-made add-ons that already do this.

Reefine is good for your use case: http://www.ralphmedia.co.uk/docs/reefine/

And also Low Search can handle that too: http://gotolow.com/addons/low-search

If you really do want to continue building the functionality from scratch, many EE devs like to hijack the native channel class for this - so first add your custom logic to fetch all the relevant `entry_id`s and then pipe them through to the native channel entries method (typically via the `fixed_order` or `entry_id` parameters).

Here's a rundown of how that technique works: https://webcache.googleusercontent.com/search?q=cache:sYbC0xhLkDIJ:https://dmlogic.com/blog/extending-the-expression-engine-channel-module+&cd=1&hl=en&ct=clnk&gl=uk

... still though, not much point re-inventing the wheel if you don't need to.

---
Tags: search, module, mysql
---


# Question
Title: How do I connect my Expression Engine Site to Google Search Console?
I'm not very familiar with Expression Engine. I normally use Weebly, Wordpress, Wix, etc. I'm having a hard time connecting my site to my search console. Not sure where to put HTML tag or which process works the easiest with Expression Engine. There doesn't seem to be any advance SEO settings through Exp. Engine.

# Answer
> 0 votes
Not sure what you mean, you just upload the HTML file provided by Google to your webspace, usually right next to EE's index.php at the top of your public\_html directory. That's not really EE-specific, is it?

Also, not sure what "advanced SEO settings" would be to you. You can certainly create keywords and such; if you don't want to to it by hand, as it were, take a look at SEO Lite.

---
Tags: search, seo, google
---


# Question
Title: Unable to Use PayPal Sandbox mode anymore
I have a site that is currently running CartThrob v2.7 and using "Paypal Website Payments Pro" for the gateway. I need to make some updates to the checkout process, and tried switching the gateway to "Sandbox" mode. However, when I do that and try checking out, I get a "SSL connect error (35)" error.

The checkout process works when the gateway is in "Live" mode (but obviously, that won't work for development.)

AFAIK, all of CartThrob's PayPal credentials are correct and up-to-date, and the PayPal account is in good standing. I know that "Paypal Website Payments Pro" is a legacy product, but switching to another gateway is not currently an option.

Any ideas?

# Answer
> 3 votes
(I'm with Vector; we're the people behind CartThrob)

You're almost certainly running into an issue because of PayPal's SSL certificate upgrades. You can find more information on that here: https://www.paypal-knowledge.com/infocenter/index?page=content&widgetview=true&id=FAQ1766&viewlocale=en\_US&direct=en

PayPal upgraded their sandbox first but their live endpoints are getting upgraded soon, which will likely break all transactions on your site.

Compatibility with this change is *completely controlled by your host* and not something CartThrob or ExpressionEngine can control. Your host needs to upgrade the version of cURL used by PHP on the server. You should be able to send them the above link.

If you're on an unsupported host/server and need help doing it yourself, or want us to verify that your host did it correctly, feel free to get in touch! We're support@cartthrob.com.

---
Tags: cartthrob, paypal
---


title: How to create an Addon

text:
# Question
Title: How to create an Addon
So I've been using EE for some years but I've never created an add-on before and I was hoping for some guidance on how to approach it and whether it should be an extension or a module.

Requirements:

1. When a channel entry is created or edited I need to trigger an email send. This email send will be using the Mandrill API ( a service of Mailchimp). Their API includes a PHP codebase option or Javascript / JSON call.
2. If an entry is created I need to trigger a specific email template and pass in some channel entry data.
3. If an entry has it's status changed I need to trigger one of two templates - approved or denied, again passing in dynamic data.
4. A nice to have would also be the ability to trigger an email on member registration but this is less important right now.

So it seems to me my add-on would need to be aware when an entry was created or modified, and I would need to know what the status of that entry is and then retrieve entry data and trigger the API. It would also be nice to be able to handle any API response such as success / failure.

Can anyone advise me on best approach for this?

Thanks.

# Answer
I am relatively new to EE, but for our current project, I have already written one Extension and one Module. It is a pretty straight-forward process.

Here is the explanation of how the AddOn types differ:

https://docs.expressionengine.com/latest/add-ons/add\_on\_types.html

And any information on how to actually develop an AddOn can be found in this collection:

Tools for learning ExpressionEngine addon development

As for your specific question regarding Extension vs Module. I would judge it as follows: if you don't need custom EE tags and manageable settings, you probably don't want to write a Module. It seems much of what you want to achieve are additional actions based on hooks/triggers. Therefore, you probably need to develop an Extension.
> 1 votes

---
Tags: add-on-development
---


# Question
Title: Category filters - how do you apply this from a url?
We have an event listings page that contains a filter to select from a range of event categories and I want to see if it's possible to provide a url that, when visited, will have automatically applied the filter?

For example, our events page is site.com/events/ when on there you click the dropdown and select one of the eight event categories is there a way to append the url to something like site.com/events/category1 so it is already filtered for that category? I've tried adding the category url title, category id etc... but still just gives me an unfiltered event list.

UPDATE As an example, we have various categories of news items that produces the url site.com/news/c/category\_name so I would assume that I could produce the same for events using site.com/events/c/category\_name however this doesn't filter them and just shows me all events, I've tried using category\_URl and category\_ID but none of these work.

# Answer
> 0 votes
Are you creating your list of available categories using the `channel:categories` tag? If so, just use the`{path}` variables to create the links and the URLs will be built correctly to apply the selected category filter to your `channel:entries` tag.

```
<a href="{path="events/index"}">{category_name}</a>

```

Depending on your setup, this will output:

```
http://site.com/events/C1

```

or:

```
http://site.com/events/category/category1

```

(The category trigger is customizable, so it could vary. See the Category URL Segment and Category URL settings.)

---
Tags: categories, url, filter
---


# Question
Title: DataGrab fails if not run from EE Control Panel (logged in)
We've had an odd issue with a new site that's running DataGrab via CRON on EE2 that I'm really hoping someone can help with.

Everything was working fine for the first few weeks and data was being fed through automatically every 10 minutes. However, we recently noticed that our import URL had stopped working for no apparent reason. Debugging the URL, we receive the following error:

`A PHP Error was encountered
Severity: Notice
Message: Array to string conversion
Filename: database/DB_active_rec.php
Line Number: 442
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /home/********/system/codeigniter/system/core/Exceptions.php:170)
Filename: core/Common.php
Line Number: 475
A Database Error Occurred
Error Number: 1054
Unknown column ‘Array’ in ‘where clause’
SELECT * FROM (`exp_member_groups`) WHERE `group_id` = Array
Filename: libraries/Session.php
Line Number: 369`

The feed runs successfully within the EE control panel and the Import URL also works if logged into EE. However, when ***not*** logged in, the Import URL fails. We’ve tried re-installing and re-configuring DataGrab but that hasn’t made any difference. I can't think of any changes we've made to EE that would have caused the Import URL to start failing.

So my main question is: Can anyone think of a setting within EE that could cause DataGrab to stop working if not logged in? Anything to do with Sessions?

FYI, I have a back-up version from a few weeks ago running on the same server which still works perfectly. I've spent time going through the Control Panel screens trying to compare settings and find something that's different but I can't see any anomalies.

I'm kinda out of ideas on things to try and haven't had a reply from DataGrab's developer.

Really hope someone can help.

Thanks, Gary

# Answer
I was running into this issue as well, I don't know if this will resolve your issue.

It tries to create a session for a member with a member\_id of 1, do you have a member with an id of 1 that belongs to the group id 1? If not, change a member with superadmin group id 1 access to a member\_id of 1.

```
function _check_member_status() {

    // If not currently logged in, create a dummy session
    // @todo: currently hard-coded, need to search db for admin user?
    $this->current_user = $this->session->userdata['member_id'];
    if( $this->session->userdata['member_id'] == 0) {
        $this->session->create_new_session(1, TRUE);
        //$this->session->userdata['username']  = "dummy";
        $this->session->userdata['group_id']  = 1;
        $this->session->userdata['can_edit_other_entries'] = 'y';
        $this->session->userdata['can_delete_self_entries'] = 'y';
        $this->session->userdata['can_delete_all_entries'] = 'y';
    }

}

```
> 1 votes

---
Tags: sessions, datagrab
---


# Question
Title: How to give categories open/closed status?
Long story short, I have a situation where categories are treated like channel entries as far as generating lists of content on the front-end (using gwcode\_categories inside channel entries.) I have a user who would like to turn some of the categories off the way she's done with channels, setting statuses to Closed.

Is there a way I can give categories open/closed statuses without having to resort to custom SQL/PHP? I would be willing to pay for a premium plugin to add this feature.

This is on EE 2.8.1.

# Answer
> 3 votes
Custom category field?

Which defaults to open:

Then your template code:

```
{exp:gwcode_categories channel="example" depth="1" custom_fields="yes" linear="yes"}
    {if cat_status == "Open"}{cat_name}{/if}
{/exp:gwcode_categories}

```

Note the additional parameter `custom_fields="yes"`.

---
Tags: ee2, categories, status, gwcode-categories, child-categories
---


# Question
Title: ExpressionEngine 3 add back index.php through file
Did a little stupid thing the other day by removing index.php through control panel but not .htaccess. Now I can't access CP, and I need to add back index.php through the file, sort of manual way.

I'm developing locally and If I remove index.php through htaccess too it redirects to localhost:8888/admin.php

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

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

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

```

But because I have the site inside folders etc and have other projects I cannot have this site in root directory as localhost:8888

My current URL is http://localhost:8888/sitename/ee/admin.php

How can I turn back index.php but the manual way.

I hope this makes sense.

# Answer
> 1 votes
Set, in your $config.php file

$config\['index\_page'\] = "index.php";

That will override anything else that was previously set.

---
Tags: control-panel, htaccess, index.php
---


# Question
Title: Modifying an entry by Channel Form throwing a PHP error : Call to a member function head_link()
I have a very simple Channel Form on my page :

```
    {exp:channel:entries channel="accueil" limit="1"}
    {exp:channel:form channel="accueil" entry_id="{entry_id}" require_entry="yes" return="accueil/index" error_handling="inline" show_fields="titre_de_laccueil|texte_de_laccueil|domaines_dexpertise"}
        {custom_fields}
            <p>
            <label for="{field_name}">{field_label}{if required}<span class="required_field_asterisk"> *</span>{/if}</label>
            {field_instructions}
            {formatting_buttons}

            {if error}
                <p class="error">{error}</p>
            {/if}

            {if textarea}
                <textarea id="{field_name}" name="{field_name}" dir="{text_direction}" rows="{rows}">{field_data}</textarea>
            {/if}

            {if text}
                <input type="text" dir="{text_direction}" id="{field_name}" name="{field_name}" value="{field_data}" maxlength="{maxlength}" size="50">
            {/if}

            {if select}
                <select id="{field_name}" name="{field_name}">
                  {options}<option value="{option_value}"{selected}>{option_name}</option>{/options}
                </select>
            {/if}

            {if checkbox}
                {options}
                  <label class="checkbox">{option_value}
                    <input type="checkbox" id="{field_name}" name="{field_name}[]" value="{option_value}"{checked}>
                  </label>
                {/options}
            {/if}

            {if grid}
                {display_field}
            {/if}

            {if wygwam}
                {display_field}
            {/if}

            {if field_name=='domaines'}
                {display_field}
            {/if}

            </p>
        {/custom_fields}

  <input type="submit" value="Enregistrer les modifications">
{/exp:channel:form}

{/exp:channel:entries}

```

If I just change the contents of the fields and click on submit --\> no problem, it saves the modified entry as intended.

If I empty a required field and click on submit --\> I get this error (that prevent the modified entry to be saved) instead of the validation :

> A PHP Error was encountered
>
> Severity: Notice
>
> Message: Undefined property: EE::$view
>
> Filename: libraries/File\_field.php
>
> Line Number: 718
>
> Fatal error: Call to a member function head\_link() on a non-object in \[...\]/system/expressionengine/libraries/File\_field.php on line 718

I don't even have a file field in this channel!

I didn't find the reason of this...

EE version : 2.11.1

# Answer
> 0 votes
Try not wrapping the channel:form in a channel:entries tag. You shouldn't have to.

---
Tags: safecracker, error
---


# Question
Title: FreeForm Pro {all_form_fields} ordering fields by order in form
I'm creating a Notification Template with this tag pair:

```
{all_form_fields}
    {field_label}
    {field_data}
{/all_form_fields}

```

But the order's ending up alphabetical, not in the order I put them in Composer.

After finding http://www.solspace.com/forums/viewthread/15678 then seeing that this appeared to be fixed at http://www.solspace.com/docs/freeform/change\_log/#v4.0.11:

> Fixed a bug where Notification templates using the '{all\_form\_fields}' variable pair were not ordering data by the field order set in the form edit screen in the CP and were going in Alphabetical order instead.

I'm not sure what to do. Anyone have any ideas?

# Answer
I ended up making so many custom notifications for long forms, I wrote this script to make it easy. You can run this and put the lines in the correct order.

```
<?
$sql = "SELECT `COLUMN_NAME`
    FROM `INFORMATION_SCHEMA`.`COLUMNS`
    WHERE `TABLE_SCHEMA`='ee_facs'
    AND `TABLE_NAME`='exp_freeform_form_entries_65';";
$result = mysql_query($sql);
for ($i = 0; $i < mysql_num_rows($result); $i++) {
    $column_name = mysql_result($result, $i, "COLUMN_NAME");
    if (strpos($column_name, "form_field") !== false) {
        // look up form field's label + name
        $field_id = trim($column_name, "form_field_");
        $sql = "SELECT field_name, field_label FROM exp_freeform_fields WHERE field_id = $field_id";
        $field_result = mysql_query($sql);
        $field_name = mysql_result($field_result, 0, "field_name");
        $field_label = mysql_result($field_result, 0, "field_label");
        echo "<p>" . $field_label . ": {" . $field_name . "}</p> <br>";
    }
} //for
?>

```

This outputs like:

```
<p>First Name: {first_name}</p>
<p>Last Name: {last_name}</p>

```
> 0 votes

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


# Question
Title: Allow Guests to Upload to Directory? FreeForm PRO / EE2.6.1
This question was asked earlier and the suggestion was the devot-ee addon LogMeIn.

Can anyone clarify that this is the only option?

# Answer
Sounds like you need to give your member group permissions to upload files in the "File Upload Preferences".

The setting is at the bottom of the page under the heading "Restrict file uploading to select member groups".
> 1 votes

# Answer
Be sure to append `[]` to the end of your file field's name. Simply using `{freeform:field_name}` or `{composer:field_name}` doesn't do it automatically.
> 0 votes

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


# Question
Title: Checking the channel in the channel entries tag
What I am trying to do is combine the output of 2 channels. They both have an image with a different name so I am trying to check the channel to determine the which image I need to output. Code below.

```
{exp:channel:entries channel="work"  dynamic="no" limit="3"}
            <a href="http://leith.co.uk/getting-blokes-thinking-drinking/">
               {if channel=="work"}
                <div class="latest-post latest-column" style="background-image:url({work_main_image});">
                {if:elseif channel == 'latest'}
                   <div class="latest-post latest-column" style="background-image:url({latest_main_image});">
               {/if}
                <div class="latest-title"> {title}</div>
                </div>
            </a>
        {/exp:channel:entries}

```

# Answer
try using

```
channel_short_name == "work"

```

You can find the short name in the list of channels.

Also in your channel tag, you'll need to specify both channels.

```
channel="work|latest"

```
> 2 votes

---
Tags: channel-entries, ee3, ifelse
---


# Question
Title: Limit events in calendar:cal and disable occurrences
How do i limit the event to like 3 and how do i disable the occurrences? I just want to list main events rather than listing one event with multiple occurrences.

```
{exp:calendar:cal date_range_start="today" pad_short_weeks="n" dynamic="off" date_range_start="today" date_range_end="+5 days" show_recurrences="no"}
                   {display_each_day}
                <li>

                {events}
                <div class="box">

                    <div class="img">
                        <a href="{path='events/event'}/{event_id}/{if event_recurs}{event_start_date format="%Y/%m/%d"}/{/if}">

                        </a>
                    </div>

                    <div>
                        <h3>
                            <a href="{path='events/event'}/{event_id}/{if event_recurs}{event_start_date format="%Y/%m/%d"}/{/if}">{event_title}</a>
                        </h3>
                        <div>{if event_summary  != ""} {exp:ce_str:ing truncate="100"}{event_summary}{/exp:ce_str:ing}{/if} </div>
                        <div class="dse">

                            <span>{event_calendar_title}</span> |

                        </div>
                    </div>
                </div>
                {/events}

            </li>

  {/display_each_day}
{/exp:calendar:cal}

```

# Answer
> 0 votes
Assuming you're using Calendar 1.x for EE 2.x, you would use the Calendar:Events template tag instead of Calendar:Cal template tag.

Calendar:Cal will show all events and their recurrences in chronological order, while Calendar:Events will show only the "parent" event entries (with no recurrences). See this overview diagram:

For more information, check out the Getting Started documentation. :)

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


title: CartThrob CT Admin Timezone setting

text:
# Question
Title: CartThrob CT Admin Timezone setting
I have recently taken over administration of a legacy EE (2.5.5) / CartThrob (2.1.4) site. I've moved this successfully to a new server, and for the most part everything seems to be working.

The site has CT Admin installed (1.4.4).

The problem I'm having is that the CT Admin monthly report for the current month isn't working because the first order placed this month was at 00:15 on 1st June, and the CT Admin code is identifying this as 23:15 on 31st May.

Does anyone have any suggestions as to what I might do to fix this? This is my first experience with EE, so I'm still getting to grips with it ...

Cheers,

Crac

# Answer
Have you tried checking the localization settings inside of EE, and for the member you're logging in with specifically?

(Also note that CT Admin 1.4.4 and CT 2.1.4 are pretty old versions at this point and you may have better luck after upgrading).
> 0 votes

---
Tags: cartthrob
---


title: Best Practices: Template Update

text:
# Question
Title: Best Practices: Template Update
Updating EE 2.9.2 with A COMPLETELY NEW "template". What are some best practices for implementing a completely new design (graphical site overhaul) without taking down current site or losing current entries?

IE.. Current Sections include Home / About / Embeds / etc... Plus my snippets and Global Variables

Should I leave the current sections and just add ... Home16 / About16 / Embeds16 / etc...

Or is there a better way to make the graphical overhaul. Ill be adding new channels and fields for new content as well.

Thanks.

# Answer
> 2 votes
You could duplicate templates and alter their names but I'd only do that if there where only a handful of items.

If you have more then is manageable by simple duplication then it warrants the creation of a dev server and work directly on the templates then transfer across to live once happy with new codebase.

You can always backup the code by using git and forking new design. As far as I know there's no best practice just what works well for you and your environment.

# Answer
> 0 votes
It appears that you will be changing quite a bit. It may be easiest to copy all the Templates to a New Template Group. Modify as needed in the New Template Group, test it, and then make the new Template Group the "Default" Group when you are ready to turn it on.

---
Tags: templates, update, bestpractice
---


# Question
Title: Super Search throws a "You are not allowed to search." when not logged in
Implementing Super Search (3.1.4) on a new site (running EE 3.3.1), all is fine and dandy and works better than expected, but only whilst one tab in my browser is logged in, in the CP. As soon as I log out, I get a "You are not allowed to search." error thrown in my face.

I also installed the Super Search demo-pages, just to error-hunt, and any search done in those templates also throws an error.

I've googled, but can't seem to find a reason for why this happens.

Any ideas?

# Answer
Look at me. Found the answer on my own by poking around in EE-settings.

It seems that Member Groups \> Guests does not have the power to search by default. Set to "Yes", and you don't get that error anymore.

Shame on me.
> 3 votes

---
Tags: solspace, supersearch
---


# Question
Title: expressionengine (expresso): How to implement existing webhooks
Hi I am really new to expressionengine and I'm currently using a module for store called expresso. Now I want to use their webhooks to update some functionalities before adding item to cart. Now, my problem is I don't know how to implement it.

I know I have to do this:

```
public function existing_webhook_name()
{
    //do php here..
}

```

but where should I place that function? Can I place it anywhere? I mean including in the templates? or there should be a file dedicated to webhooks in expressionengine.

Please help. Thanks!

# Answer
> 0 votes
Using Expresso Store's extension hooks is exactly the same as using EE's own extension hooks. Might be worth reading the full background on how extensions work if you're unfamiliar: https://docs.expressionengine.com/v2/development/extensions.html

In a nutshell, you'll need to create an extension file in the third\_party directory with some skeletal code, install that extension via the EE control panel, then proceed to edit your code until it does what you want.

Here's a handy extension boilerplate file from Rob Sanchez to get you started: https://github.com/rsanchez/generator-ee-addon/blob/master/app/templates/ext.php.handlebars

---
Tags: expresso-store, hook
---


# Question
Title: Cartthrob notifications for cancelled orders
In Cartthrob I notice a number of orders that have not been completed, looking under the payment error field I see "Transaction in process offsite" which means they cancelled their order while using the payment gateway. Is it possible to send an email when this error occurs with the customers details? I tried setting up notifications using the event "Customer completing order offsite" but that does not work. Any suggestions? Also is it possible to send to an email listed in the custom field e.g.{shipping\_region}

# Answer
> 1 votes
(I'm with Vector; we make CartThrob)

You may want to consider the Abandoned Cart Notifications add-on. Depending on your requirements and who should be emailed, it may help.

Otherwise, you could setup a cron job to query these, and if it's been long enough, email you the details. The reason is that CartThrob doesn't "know" if someone truly abandoned the checkout or are still there, filling in their information. We can help you with that if you'd like; get in touch via support@cartthrob.com!

---
Tags: cartthrob
---


# Question
Title: Class PT_Fieldtype contains 1 abstract method, must be declared abstract or implement (EE_Fieldtype::display_field)
When clicking on any of the Channel Fields created by CartThrob, I receive the following error.

I uninstalled pt\_fieldpack but the same issue. Wondering if I need to uninstall and reinstall CartThrob.

Fatal error: Class PT\_Fieldtype contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (EE\_Fieldtype::display\_field) in /var/www/vhosts/deathdirections.com/httpdocs/system/expressionengine/third\_party/pt\_field\_pack/pt\_fieldtype.php on line 148

# Answer
The answer is to perform the following:

Open up pt\_fieldtype.php and below the constructor (around line 29) add:

public function display\_field($data) { // This placeholder function will prevent the PHP error }
> 1 votes

---
Tags: error
---


title: Content staging

text:
# Question
Title: Content staging
A client has asked us if its possible to preview content changes on a Staging site and then when it's ready to be published, it would appear on the Production site without having to re-key all of the content and asset uploads/changes.

I wondered if anyone has looked into this kind of Content staging with ExpressionEngine before?

I know that some other CMS' have something similar, but i'm not aware of anything out of the box with EE.

Typically, we run the usual Local/Dev, Staging and Production environments and we regularly migrate a copy of the Production database over to Local and Staging so that they're in sync which helps when we're working on new features.

Our client also tests out content changes on the staging site, for example when they have a new season campaign.

I know that there are also some workflow add-ons that would have preview versions of content on the Production site as well, so this might be the route to take.

Thanks.

# Answer
> 2 votes
I'll elaborate more on my comment to answer the poster more fully...

There isn't a reliable, solid mechanism (especially automated) that I've come across that can **safely** migrate content forwards onto a live site - especially if you have living data (membership, commenting, forums, etc). If considering this, also remember environment configs and entry hit tracking also.

Here's a great Stack Exchange post that summarises the publishing flow of templates & files versus data.

There is an add-on called Site Manager referenced in the above post which was only in Alpha state and doubtful it will be compatible with the latest v2.x as it's 4 years old.

Hence the suggestion of keeping it simple and using a publishing module for a Production server, two I've used in the past:

Better Workflow (highly recommended)

Publisher

You could consider a content freeze on your live site, during the building and testing of a campaign in Dev or Staging (which have fresh copies of your live site), then export the finished campaign entries via SQL (and only the entries modified) and import into the live site database. You'll need a content freeze on live to ensure that the entry IDs don't get muddled up and remain unique.

Alternatively you could do as above without the content freeze and use DataGrab to import your entries (maybe exported via template code as a CSV) and import the entries with freshly generated Entry IDs. Issues may arise with certain fieldtypes and compatibility.

But that still doesn't allow for images or resources added via entries...!

# Answer
> 0 votes
I second Peter's suggestion of Better Workflow. https://devot-ee.com/add-ons/better-workflow

# Answer
> 0 votes
Rename the Staging site to Production when ready.

Change DNS/whatever on Staging to Prod. There I said it. Grab some pitchforks.

Seriously though, I develop on a cPanel/WHM cluster and have a specific machine for Dev, Staging and Production.

When ready, rename the cPanel hosting account from "beta.xxx.com" to "xxx.com" as well as the zone records for the production domain. I usually do an account move to a production machine in the cluster first.

I know this workflow is cPanel specific and kinda nasty but the principles are adaptable.

Saves moving data and replicating environments.

---
Tags: content, workflow, staging-server
---


title: Channel Set Export?

text:
# Question
Title: Channel Set Export?
EE 3.3.2 References the new Channel Set (importing/exporting channel configurations for setting up new sites).

While I will EXTREMELY miss the MSM site replication tools, in theory I understand that a "Channel Set" (Channel fields, category groups, status groups, etc) will get me close....HOWEVER, despite the documentation referencing the capability to Export/Import a Channel set, despite my searching, **I have not yet found where I can export a channel set**.

Anyone?

# Answer
> 0 votes
According to the docs its tucked away in the Manage section of the CP.

---
Tags: channel, export, category-group, settings
---


# Question
Title: Channel Form - Relationship Field - Custom Field
I have a channel form with a relationship field options: loop. I'm trying to also get a custom field from this relationship. Is that possible? If yes, how?

```
{exp:channel:form channel="message_on_hold"}
  {options:moh_voice_female}

     <input type="radio" name="moh_voice_female[data][]" id="moh_voice_female" value="{option_value}"{checked}> {option_name}

     ### Relationship Field : Custom Field ###

     {moh_voice_female}{moh_voice_female:voice_talent_sample}{/moh_voice_female}
     {relationhip_field}{relationship_field:custom_field}{/relationhip_field}

     ### This would work with exp:channel:entries ###

  {/options:moh_voice_female}
{/exp:channel:form}

# moh_voice_female is a relationship field
# voice_talent_sample is a custom field

```

# Answer
> 1 votes
You don't actually say if your trying to edit the field on the child entry or just display it?

If I assume your trying to just view it, try something like this :

```
{exp:channel:form channel="message_on_hold"}
  {options:moh_voice_female}
    <input type="radio" name="moh_voice_female[data][]" id="moh_voice_female" value="{option_value}"{checked}> {option_name}

    {!-- Display Data from related child entry --}
    {exp:channel:entries entry_id="{option_value}" dynamic="no"}
      {title}
      {voice_talent_sample}
    {/exp:channel:entries}

  {/options:moh_voice_female}
{/exp:channel:form}

```

What we're doing here is starting a standard channel:entries, feeding the entry\_id (value) from the relationship field and displaying some info.

Of course, you need to watch out for parse order (inward ect) but you should be able to sus that out. You may be tempted to try and incert a second `channel:form` inside the first to gain editing of the child, however this won't work as you'll end up with 2 forms, one inside the other (form inception, see this answer).

Otherwsie, if your trying to edit it :

What you're trying to achieve is not possible, just like in the admin section when you edit an entry with a playa on it you're only editing the parent entry, you can change the playa value but this is not pointing to the child entry, it's referencing the child entry.

while `channel:entries` will parse the child (as it knows what you set for the relationship value) when on the channel form for the parent entry you can only affect the entry being pointed to by the parent, you can't iterate into the desired child entry, after all who knows what child you might pick while editing the parent?

What you may be able to do is make a 2 step form, where :

1. Present a Channel Entry form for the parent, allow user to select child or create new
2. After the Parent is set, present a second entry form for the chosen child (or create a new entry for the child if it doesn't exist)

# Answer
> 0 votes
It is weird I tried the solution of @Blatant (that seems very wel, except I had to put name\_of\_the\_relashionship\_field:name\_of\_the\_custom\_field to have it outpouting something) but it only gives me the relashionship information for the last one of the options (and the empty value one).

```
{exp:channel:form channel="mychannelname" return="test/index" error_handling="inline"}
<label for="facture_de_reference">Facture de référence</label>
        <div>{instructions:facture_de_reference}</div>
        <div class="error">{error:facture_de_reference}</div>
        <select name="facture_de_reference[data][]">
        {options:facture_de_reference}
            <option value="{option_value}"{selected}>{option_name}
            {!-- Display Data from related child entry --}
            {exp:channel:entries entry_id='{option_value}' dynamic='no' status="open|closed|brouillon|checke|envoye"}
                {facture_de_reference:payement_recu}
            {/exp:channel:entries}
            </option>
        {/options:facture_de_reference}
        </select>
{/exp:channel:form}

```

it output :

```
<div id="facture_de_reference">
    <label for="facture_de_reference">Facture de référence</label>
    <div></div>
    <div class="error"></div>
    <select name="facture_de_reference[data][]">
       <option value="">-- non</option>
       <option value="5">F-2016-001</option>
       <option value="6">F-2016-002</option>
       <option value="7">F-2016-003 non</option>
    </select>
</div>

```

And what it shoud have gave me :

```
<div id="facture_de_reference">
    <label for="facture_de_reference">Facture de référence</label>
    <div></div>
    <div class="error"></div>
    <select name="facture_de_reference[data][]">
       <option value="">-- non</option>
       <option value="5">F-2016-001 non</option>
       <option value="6">F-2016-002 oui</option>
       <option value="7">F-2016-003 non</option>
    </select>
</div>

```

How to make it work correcty and have the content of "payement\_recu" custom field for every facture\_de\_reference's option as showed just above?

EE version : 3.3.2

---
Tags: safecracker, relationships, custom-fields
---


# Question
Title: EE 3.3.3 Error "Cannot modify header information"
Installed EE 3.3.3 with the default theme to start learning it, and got the error.

```
Notice Undefined offset: 2

ee/legacy/database/DB_active_rec.php, line 1876 show details

Severity: E_NOTICE
Warning

Cannot modify header information - headers already sent by (output started at /Users/jbreen/Sites/ee-3.02-dev-site/system/ee/legacy/core/Exceptions.php:112)

ee/EllisLab/ExpressionEngine/Boot/boot.common.php, line 463 hide details

```

Its a local install with MAMP Pro.Reinstalled again same error on homepage only. Checked DB Privileges and are OK. I am Stuck.

# Answer
The reason for seeing this error:

1. Some part/all of a page has been sent.
2. Cannot modify header info after a page has been sent.

Your notice is saying as much “Cannot modify header information - headers already sent”

As this is occurring only on your home page check PHP in \> Template Settings & Access, Allow PHP? = No. It probably is disabled already, if it is not enabled enable it and save then disable it. Also notice “PHP Parsing Stage” in that same dialog screen, Template Settings & Access, “When set to output, PHP will be parsed after the template.”

If that does not do it, duplicate that template and troubleshoot it by removing one section at a time until the error goes.

Suspect section - slideshow.
> 1 votes

---
Tags: ee3
---


title: Better Workflow equivalent for EE 3.x

text:
# Question
Title: Better Workflow equivalent for EE 3.x
Better Workflow will not be updated for EE 3.x - described here - http://betterworkflow.electricputty.co.uk/news/ee3-support/

I'd like to be able to save a channel entry in 'draft' format. An Admin should be able to preview the draft but members of the public should not.

Is there an EE 3.x compatible plugin that does this, or a method by which I can code it in?

As a side note I'm finding quite a lot of things which EE 3.x seems to lack, which seems like very standard functionality in every other CMS, this being a good example. It's also very frustrating that plugins that worked in EE 2.x are being abandoned and no equivalents or further developments are being done, although I understand 2.x and 3.x are very different. Has anyone else got any thoughts on this? It's to the extent that 2.x actually seems better than 3.x in terms of features, which does not seem right unless I'm missing something!

# Answer
> 1 votes
Have you tried using custom statuses? I typically have a 'draft' status, which ties in with an environment variable, which in turn allows you to filter all your channel entries tags to only show draft or open entries depending on which environment is being viewed. You can then instruct your editors to create new entries in draft status, preview them on the testing environment and then switch them to open status to launch live.

It's admittedly a much more simplistic workflow than Better Workflow provides, but it covers the most common client need for me. The only thing this technique doesn't allow for is previewing changes to entries that are already live. In those cases I usually recommend that an editor clones the entry they want to test. Once cloned, they can make changes to that clone in draft status, test/get approval on the test site and then set the entry to open. They just need to remember to then close or delete the previous entry.

# Answer
> 0 votes
Publisher is an alternative that is being worked on for EE3. Similar to Better Workflow, not as slick IMO, but still does the job.

---
Tags: ee3, better-workflow
---


# Question
Title: email notification when someone fills out form and downloads content from my site
I want to get an email notification sent to me from the site when someone fills out form and downloads content from my site. How can I do that?

# Answer
> 1 votes
Use the Email from Template add-on and include either on the page offering the download button, on a confirmation page after clicking button, or trigger via an ajax call on clicking the download button (along with firing the download).

# Answer
> 0 votes
One way, there are probably plenty more, is via PHP in the form when it is submitted. Remember, for this you would need to enable PHP on INPUT for the Form. I am sure that a LOT of people on this Forum would cringe with this approach, but as I said, this is one way.... Also, this is using the POST not the GET method....

```
<?php
   if ($_SERVER['REQUEST_METHOD'] == 'POST')
    {
         $to = "xyz@somedomain.com";
         $subject = "This is subject";

         $message = "<b>This is HTML message.</b>";
         $message .= "<h1>This is headline.</h1>";

         $header = "From:abc@somedomain.com \r\n";
         $header .= "Cc:afgh@somedomain.com \r\n";
         $header .= "MIME-Version: 1.0\r\n";
         $header .= "Content-type: text/html\r\n";

         $retval = mail ($to,$subject,$message,$header);

         if( $retval == true ) {
            echo "Message sent successfully...";
         }else {
            echo "Message could not be sent...";
         }

    }
      ?>

Your HTML code would follow the "?>".

```

---
Tags: email, notification
---


# Question
Title: How do I stop search results listing pagination as duplicate content
I use pagination to list articles on topics and those written by a n individual writer. How do I stop search results list the subsequent pages as duplicate content.

# Answer
> 0 votes
there is an answer on the EE forum which should help you out: https://ellislab.com/forums/viewthread/248465

Also, a link within the forum post says that Google won't punish you for duplicate content unless it's spammy: http://searchengineland.com/googles-matt-cutts-duplicate-content-wont-hurt-you-unless-it-is-spammy-167459

# Answer
> 0 votes
I would consider the use of canonical meta data: https://support.google.com/webmasters/answer/1663744?hl=en

And then as above dynamic queries to alter page, titles and meta title data.

---
Tags: ee2, pagination
---


# Question
Title: URL title prefix - use slashes in prefix?
EE3, Channel Settings. It allows you to specify a URL prefix, i.e. to help the user fill in this field. Nice, i can start every URL with /book/ or /album/... Good for organisation and SEO love.

However, prefixes including slashes are seen as spaces, and spaces are not allowed. Error message: This field cannot contain spaces

Am i being a dummy, is there a good reason for this, or?

# Answer
You can't include forward slashes in the URL Title because EE breaks up every URL using `pathinfo`, and always treats the first two segments of the URL as template group/template. (See docs on URL structure.)

If you want to organize your content into "types" via the URL for SEO purposes, I'd use template groups (or template routes) to achieve this instead.
> 1 votes

---
Tags: channel, url
---


title: Limit S3 Upload Size in P&T Assets?

text:
# Question
Title: Limit S3 Upload Size in P&T Assets?
I'm having a problem where my client keeps uploading 6MB 300PPI images and crashes the server when CE Image tries to process them. So I figured I could just go into Assets and limit the upload size for that asset source (it's an S3 source), but I didn't see any setting like that available.

Is it possible to limit the size of an upload in an external Assets source?

# Answer
Sorry, Kristen, Assets does not have that feature.
> 2 votes

# Answer
i also had a problem regarding uploading and file upload sizes, ended up updating my php.ini file. not sure if thats the issue here but its worth a try, also this thread might help https://ellislab.com/forums/archive/viewthread/145290
> 0 votes

---
Tags: assets, pixelandtonic
---


# Question
Title: Can postmaster send post dated emails through a hook?
I'm aiming to send a post dated email through postmaster. I'm (successfully) sending out emails though a custom addon, by triggering a hook inside the custom addon and passing some data through the hook.

However, I'm trying to send out a post dated email in the same fashion and I'm not sure if it's the 'correct' way to do it.

Basically, I've set up a hook in postmaster, this is being triggered and it's also queuing the email in the **exp\_postmaster\_queue** table. In this table it's storing the **to\_name**, the **to\_email** and even a fully parsed message.

Now, when I trigger the ping url it removes the email from the queue and chucks it into the the mailbox - however the message fails to send as it's trying to send to the non parsed email variable (and the message also contains non-parsed variables) - **{hook:participant\_email}**.

Does anyone know if sending a post dated email is possible through a hook, and if so how can I parse variables through?

The data seems like it's all in the queue table, so it must be reparsing (I started to pick the addon apart at which point I got a touch stuck).

Thanks

Dave

# Answer
> 0 votes
It looks like this was a bug occuring in the Postmaster addon when sending emails from the queue. The `send_from_queue` method is trying to reparse the hook template which is not working as there are no stored variables (email, to and variables in the template) in the row in `exp_postmaster_queue`. Instead, I believe it should be using the rendered message present in the column `message`.

I made and edit to the method `send_from_queue` method in the `Postmaster_lib class` \- **libraries/Postmaster\_lib.php** around **line 456**. Basically, I'm using the queue row data and passing that directly to the send method in the same class:

```
$parsed_object = $row;

```

I had to pass the hook settings through:

```
$parcel->settings = json_decode($parcel->settings);

```

And also a required property:

```
$row->post_date_specific = false;

```

And finally, copy the message over to the html\_message property (for some reason the html and plain messages were not present in row):

```
$row->html_message = $row->message;

```

This is a bit hacky I know - I would open a pull request but a) I'm not sure if this actual cause of the issue, and b) I don't think the dev is supporting anymore.

Full code method here:

```
public function send_from_queue($row)
{

  if(!empty($row->parcel_id))
  {
    $parcel = $this->model->get_parcel($row->parcel_id);
    $parcel->entry = $this->model->get_entry($row->entry_id);

    $parcel->settings = json_decode($parcel->settings);
    $parsed_object = $this->parse($parcel);
  }

  if(!empty($row->hook_id))
  {
    $parcel = $this->model->get_hook($row->hook_id)->row();

    $parcel->settings = json_decode($parcel->settings);

    $row->post_date_specific = false;
    $row->html_message = $row->message;

    $parsed_object = $row;
  }

  $this->model->remove_from_queue($row->id);
  $this->send($parsed_object, $parcel, TRUE);

}

```

Hope this helps someone (most likely me)...

---
Tags: postmaster
---


# Question
Title: Output of JSON addon is blank when embedded in another template
When using this json addon in a template, it outputs just fine. However, when I try to call that template using embed into another template, it ends up as

```
'[]'

```

My setup is similar to this:

```
template/json
{exp:json:entries channel="resources"...}

template/main
{exp:channel:entries}
...stuff
{embed="template/json"}
{/exp:channel:entries}

```

Any ideas on what is going on?

# Answer
> 2 votes
Found out through some more testing that it is a strange bug with how templates are being routed.

The json outputs fine on a page when seeing the rendered directly from the template.

However, when the page rendered through a page, this is when it fails.

Could not find a fix so far, but a workaround so far is to ajax in the json instead of directly embedding it on a page.

# Answer
> 1 votes
Probably need a dynamic="no" on your json tag.

---
Tags: json
---


# Question
Title: Pass a Hidden Field Variable to Order Notification Email
I have a site that needs to have the Expresso Store order emails go to one of two locations. What we will do is when the site is launched there will be a choice of store A or B. Both are the same store but they have two locations for the sale centers. Once selected, wee want to collect a hidden variable or session variable that will allow us to control what email address is used for the order notification. Is this possible and how can we do it?

# Answer
If you can live with all emails going to a default address you could add a hidden variable to the order data, possibly using two of Expresso's custom order fields.

Then on your server set up some email forwarders that forward to certain emails according to the hidden data variable, eg if the email contains the word "StoreA" send to email 1, if contains the word "StoreB" send to email 2.
> 0 votes

---
Tags: expresso-store, email, orders
---


# Question
Title: Blank / white page while there is an additional segment in the URL
I am using freemember to customize the password change process of EE. It allow to change the default page used for resetting the password. This page is accessed by a link provided in a mail send to the user. This link is formatted as following.

`site/template_group/my_reset_password_page/reset_token`

The reset token look like this one : `exldroeqlik4`

I can access my custom reset page flawlessly if I don't add the reset token, so if the URL is the following : `site/template_group/my_reset_password_page`

Unfortunately, I can't access the page with the reset token. I am just stock in front of a white page.

From this doc, I understand that these kind of URL are suppose to point to a specific entry. Here the entry channel is specified by the template\_group segment of the URL and the entry is specified by the last segment.

In my case, the template\_group segment does not refer to a channel.

What I am understanding is that since there is no channel EE can't find an entry and just show a white page.

Am I wrong?

How can I resolve this?

I am using :

* EE v2.6.1
* Freemember v2.3.2

## Edit 1 :

I don't think this will help a lot since the problem is on every page, but here is the code of my template.

```
<section class="main-wrapper">

    <div class="main-container container">

        <div class="span6">

            <h3>Reset password</h3>

            {exp:freemember:reset_password

            error_handling="inline"
            error_delimiters="<span class='error'>|</span>"

            reset_code="{segment_2}"
            }

            <input type="password" name="password" placeholder="New password" value="">
            {error:password}

            <input type="password" name="password_confirm" placeholder="Confirmation password" value="">
            {error:password_confirm}

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

            {/exp:freemember:reset_password}

        </div>

    </div>

</section>

```

# Answer
> 0 votes
Without seeing your template code, I'd wager that with a few tags we can sort it out.

```
{exp:channel: entries url_title="{segment_2}" limit="1" channel="ABC" }

```

This tells EE to look at segment 2 for the correct entry and will ignore segment 3 which it likely is now. You may also need to add `dynamic="no"` as well but see how you go with the extra tags to define the correct entry.

---
Tags: ee2, url, freemember, white-screen-of-death
---


title: Load ExpresionEngine in External API

text:
# Question
Title: Load ExpresionEngine in External API
This has been asked by @jrothafer before, but no answer was provided:

Load framework outside of folder structure

I need to develop several APIs for our web application. Mostly, these are data synchronization tasks. These APIs will run out of a an API folder on root as such:

/apis/xyz\_api/synchronize.php

Once I have the external data loaded into arrays, I would like to use EE2 to populate/update the channels. It will be much more concise if I can use the EE models for this, rather than MySQL queries.

So, how do I instantiate EE in this case?

Than you for your help.

# Answer
> 1 votes
Have you considered just keeping your API within EE's folder structure and building an add-on to trigger your API functions? Depending on how extensive your API will be, you could either create module action URIs to accept POST data, or for more readable API URIs you could piggyback on the `sessions_start` extension hook like the Open API does. Here's a quick rundown: https://medium.com/expressionengine-cms/building-an-api-for-your-add-ons-with-expressionengine-and-the-a-team-85c1c9bc9e2c#.9ztwkch2e

Here's Open API: https://github.com/putyourlightson/open-api

And for more simple read operations you can use the JSON add-on https://github.com/rsanchez/json

---
Tags: ee2
---


# Question
Title: Is it possible to send url or form variables o the built-in exp:query tag to build select queries?
Using the supplied EE add-on, is it possible to sen url or form variables or to the builtin exp:query tag to build select queries?

If so, can anyone point me to some examples?

# Answer
Yes, you can do such things. Post example:

```
WHERE DATE_FORMAT(from_unixtime(exp_members.join_date), '%Y-%m-%d') >= '<?php echo $this->EE->input->post('date-from'); ?>'

```

You need to turn on php in the template set to parse on input.

You can also load a page where you put your variables in as url segments.

```
WHERE DATE_FORMAT(from_unixtime(exp_members.join_date), '%Y-%m-%d') >= '{segment_3}'

```

GET can also work. `$this->EE->input->get_post('date-from');`
> 0 votes

---
Tags: ee3, query-module
---


# Question
Title: How can I fix broken URLs after migration
I copied my staged working EE site to a SiteGround production server and the URLs are now broken. I have the site in xyznew directory.
\- The homepage does come up and displays properly at www.xyz.org/xyznew \- But when I hover over all the top level menu items, my browser shows the links as www.xyz.org/xyznew/# which just returns back to the current page, the homepage. \- When I hover over all my second level menu items, they return links of the form xyznew//events/julyevent \[Yes with double slashes and not prefixed with the domain name. )

It seems like a configuration file issues, but I don't know what setting(s) are off.

Any assistance would be greatly appreciated.

# Answer
Please consider this question closed. I've turned the site migration over to a more experienced EE developer than me.
> 1 votes

---
Tags: migration
---


# Question
Title: Expresso Store checkout tag - ACT id not being inserted into form
This is a weird problem.

I have an existing site which uses Expresso:Store and has been working OK. Now suddenly, I am seeing intermittent problems adding items to the cart.

It seems that the add to cart form doesn't have an ACT Id inserted into the hidden field. Instead it's getting the value {AID:Store:act\_checkout}.

My client says that this is random and doesn't happen all the time. However I wonder if they are just viewing cached pages.

Has anyone encountered this problem or have any idea what may be causing it?

# Answer
> 0 votes
Typically, after puzzling over this for a while I came up with the answer just after posting this question.

It seems that this problem is caused by having template/page caching turned on. If the page is cached then future calls to it don't insert the ACT ID into the form.

---
Tags: expresso-store, checkout, action
---


# Question
Title: How do I upload a file from my template to my Channel Files field?
Apologies if this has already been asked and answered, but I couldn't find any tangible example on how to actually do this.

All I'm trying to do is create a template in ExpressionEngine, and upload a small JPG file to a channel field that's set to a Channel Files field type.

As this post suggests, it should work the same as uploading to a regular File field type using the Channel Form tag, but it doesn't seem to be uploading the file. The code below works perfectly for the normal File field type for adding new entries:

```
{exp:channel:form channel='other_details'}

    <input type='hidden' name='title' value='Some new title here.' />

    <input type="hidden" name="custom_upload_hidden_file" value="">
    <input type="hidden" name="custom_upload_hidden_dir" value="2">
    <input type="hidden" name="custom_upload_directory" value="2">
    <input type="file" name="custom_upload">

    <input type='submit' value='Upload' />

{/exp:channel:form}

```

The file upload location is a location with ID 2, which is perfect, but I need to upload the file to a Channel Files field type, not a normal File field type. How do you achieve this?

Thank you in advance for any assistance!

# Answer
> 1 votes
Easiest way to do this and see the markup used for channel form is to use the following.

```
{exp:channel:form channel='other_details'}

    <input type='hidden' name='title' value='Some new title here.' />

    {!-- This will output the correct syntax for your file upload field specified in the cPanel. --}

    {field:custom_upload}

    <input type='submit' value='Upload' />

{/exp:channel:form}

```

---
Tags: safecracker, file-uploads, channel-files
---


# Question
Title: Solspace User form not submitting correctly
I have EE 3.3.2 and Solspace User 4.0.6 running.

I build the form templates and they appear to be rendered ok. The template tags pull the data correctly for the user:edit form and all the form elements are there.

But neither the user:edit nor the user:registration forms would submit. Upon hitting the submit button they all redirect to the domain without recording any data.

If I hack the rendered page in the browser to append ACT to the action (e.g. action="http://example.com/?ACT=33) I get a permission error.

Any clue, anyone?

Thanks! Luke

```
<form id="member_form" method="post" action="http://example.com/"  >
<div class='hiddenFields'>
<input type="hidden" name="ACT" value="33" />
<input type="hidden" name="RET" value="http://example.com/member/registration-thank-you" />
<input type="hidden" name="params_id" value="26" />
<input type="hidden" name="site_id" value="1" />
<input type="hidden" name="csrf_token" value="ed7a4cdcdebe7b7349137c6ba5108d88b857f736" />
</div>

<p><label>Email Address <span class="required">*</span></label><input type="text" name="username" /></p>

<p><label>First Name <span class="required">*</span></label><input type="text" name="first_name" /></p>
<p><label>Last Name <span class="required">*</span></label><input type="text" name="last_name" /></p>

<p><input type="checkbox" checked="checked" name="accept_terms" value="y"  /> Accept <a href="http://example.com/about/disclaimer">Terms</a>? <span class="required">*</span></p>

<p><input type="submit" value="Submit" class="button" /></p>

</form>

```

# Answer
> 0 votes
I got the clue from Solspace support.

Apparently my htaccess www redirect was in discord with the path settings. I had to make sure if I redirect to www then the path must include www as well.

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