# Question
Title: Saving an entry gives a date format error for the entry date
Saving or updating an entry gives an error message "The date you submitted is not valid." Its on a fresh install of EE 2.9.3 with Publisher 1.6.2 (where Publisher shouldn't be the problem I guess). I had some extensions installed which most of them are uninstalled now (Event Helper, MX CP Notice, Limitee, single entry)

If I change the entry date "14/4/2015 09:05" to "14-4-2015 09:05" I can save the entry.

I also have not changed any of the config parameters.

I never had this before on EE 2.9.3.

Are there any ideas why this happens?

# Answer
> 2 votes
Update: Wes Baker posted, that there are "official solutions".

In ..../system/expressionengine/libraries/Localize.php around line 283 remove the following block of code:

```
if ( ! empty($date_string) &&
    ! is_numeric($date_string) &&
    @strtotime($date_string) === FALSE)
{
    return FALSE;
}

```

And:

Open system/expressionengine/fieldtypes/date/ft.date.php and find this block of code around line 100 and remove it:

```
if (preg_match(’/\d{1,2}-\d{1,2}-\d{2}\b/’, $data))
{
    return lang(‘invalid_date_ambiguous’);
}

```

Now, open up system/expressionengine/libraries/Localize.php and find the \_datetime() function around line 289 and add this to the top of the function:

```
// Checking for ambiguous dates but only when we don't have a date
// format.
if ( ! $date_format)
{
    if (preg_match('/\b\d{1,2}-\d{1,2}-\d{2}\b/', $date_string))
    {
        return FALSE;
    }
}

```

//

Original Answer:

Two changes seems to fix it in cp, PHP 5.4:

/system/expressionengine/fieldtypes/date/ft.date.php

In function validate, delete lines 100–103:

```
if (preg_match(’/\d{1,2}-\d{1,2}-\d{2}\b/’, $data))
{
return lang(‘invalid_date_ambiguous’);
}

```

/system/expressionengine/libraries/Localize.php

In function \_datetime, delete the “Fix for some versions of PHP 5.2 ...”, lines 283–290:

```
if ( ! empty($date_string) &&
! is_numeric($date_string) &&
@strtotime($date_string) === FALSE)
{
return FALSE;
}

```

# Answer
> 1 votes
Head on over to your EE backend. If you go to Admin -\> Localization Settings, you should set your default date format, and make sure to hit save to make it updated. It should be set to

```
mm/dd/yy

```

See if that does the trick.

**Edit:** In 2.9.3, it even shows the full four year format, so make sure you set it to

```
mm/dd/yyyy

```

---
Tags: entry-date
---


# Question
Title: WYGWAM 'Format' dropdown modification needed.
I would like to make some modification to the \[‘Format”\] dropdown box in WYGWAM but I can not find the file. (Normal, formatted, address, Heading, etc\]. I figured out how to make the modifications needed for the \[“Styles”\] dropdown box from the Wigwam Docs and that works great.

How do I change the \[‘Format”\] dropdown box or create a custom file like I did with the styles by adding ‘my\_styles’

# Answer
To simply remove options from the Format dropdown, navigate to the "Editor Configurations":

/system/index.php?S=0&D=cp&C=addons\_modules&M=show\_module\_cp&module=wygwam

Then under the Advanced Settings, add the option called: "format\_tags" which will display a checkbox list that you can use to specify which format options you would like to be available in the Format dropdown.

As for styling these selections (like you would with the Styles dropdown), I would suggest you try to use the "Styles" dropdown to do the work; however, you can explore specifying auto-classes on the header tags, etc. by trying to create a "customConfig".

Again, under Advanced Settings, add the option called "customConfig". Then specify your a different custom JS file that has the "format tag" rules in it. Here's the documentation on what you'd probably put in that custom config file.

http://docs.cksource.com/ckeditor\_api/symbols/CKEDITOR.config.html#.format\_tags http://docs.cksource.com/ckeditor\_api/symbols/CKEDITOR.config.html#.format\_h1 http://docs.cksource.com/ckeditor\_api/symbols/CKEDITOR.config.html#.format\_h2 etc...

e.g.

```
config.format_h1 = { element : 'h1', attributes : { 'class' : 'contentTitle1' } };

```

(Note that I haven't used the customConfig option before; so I can't confirm any success with this)
> 1 votes

# Answer
UPDATE: Based on your comment on my answer it sounds like you are looking for a way to style the content as it appears inside Wygwam when viewed on the edit entry page.

If that's the case go to *Add-ons \> Modules \> Wygwam \> Editor Configurations* and select the configuration you want to edit.

Look for the *CSS File* field and enter the path to the CSS file you want to use.

---

*(old answer...not what you were looking for...)*

This can be managed in the Control Panel. Go to *Add-ons \> Modules \> Wygwam \> Editor Configurations* and select the configuration you want to edit.

Under the *Advanced Settings* area add a new advanced setting for *format\_tags.* You'll see a series of checkboxes that allow you to control what elements appear in the Format dropdown in the toolbar.
> 0 votes

---
Tags: wygwam
---


# Question
Title: How to change the font colour in EE cPanel?
How to change the font colour in EE cPanel ? I never have taken to the idea using "Grey" text instead of Black text. It seems daft spending money to buy a large monitor, and then give the text a faded look ? I have copied the CP themes folder and renamed it as my custom scheme. But I am unable to see how to edit the font colour. In the CSS file some of the values are visible and can be changed. But, for example, 'subtext' shows a size etc, in the global css file, but no options for the colour. Can anyone help on this ? I want to change all of the light grey text to Black I am doing this on my localhost.

# Answer
You can accomplish this without installing or maintaining any add-ons by creating an override.css. You can then adjust any of the styling for any elements you wish.
> 1 votes

# Answer
Hi might want to have a look here: Control Panel Rebrand

It's free too.
> 0 votes

# Answer
In addition to Tom's suggested theme, here's another one (Sassy).

Alternatively you can customise it specifically without changing any of the core files using the CSS & JS extension.
> 0 votes

---
Tags: control-panel
---


# Question
Title: Can you add to the restricted tags filter for security in EE to secure the application further?
I have a client who got a security check done on their site (they are a security company) and they came back with this in relation to an expresso store checkout:

1. Checkout functionality

Although there was good input filtering in place on the checkout functionality, the team were able to inject html tags into the response. An attacker with sufficient time would likely to be able to construct a viable XSS payload. The following parameters were found to be vulnerable:

/shop/checkout \[billing\_address1 parameter\]

/shop/checkout \[billing\_address2 parameter\]

/shop/checkout \[billing\_city parameter\]

/shop/checkout \[billing\_first\_name parameter\]

/shop/checkout \[billing\_last\_name parameter\]

/shop/checkout \[billing\_phone parameter\]

/shop/checkout \[billing\_postcode parameter\]

/shop/checkout \[order\_email parameter\]

The team also observed that these values are stored in a database, meaning stored XSS attacks are feasibly possible, although the team could not identify a location where the values are subsequently output.

Basically, I can enter `<script>` into the field inputs, which comes back as \[removed\] in my form, which is great. But I was able to add the following into my input field for the billing name:

```
<object><APPLET><embed><form>

```

And it saved this into the database along with my name.

So my real question is: what are the security implications of this, and is there a 'dictionary of bad things' file somewhere I can add the above tags to in EE that when submitted, my form will come back with \[removed\] like it did with the script tag?

# Answer
> 2 votes
I too have been faced with rather demanding security injection testing on EE (and non EE) sites so I can fee lyour pain, and speak from some experiance.

First the direct answer to your question. There isn't a directory/list, however you can read and modify the security library here (it uses the CodeIgniter Lib, whcih is assimilated by the EE\_Security file) :

```
/system/codeigniter/system/core/Security.php
/system/expressionengine/core/EE_Security.php

```

Let me stress **You SHOULD NOT edit or tamper with these files** however warnings aside you'll see the defined naughty strings in the top of the file...

Next take a look at line 276 of the CI Security lib, you see how your naughty words are in there?

So one of 2 things is happening, either the naughty tags are getting properly encoded into the DB (ie `<applet>`) and are getting transformed or unencoded before display (uh ho), resulting in correct storage, incorrect display, or there is a problem with the sanitisor and it's not picking them up properly.

This tells us that in fact Expresso checkout might be avoiding the XSS filter somehow, or it is using its own...

If you look to this page (https://ellislab.com/expressionengine/user-guide/development/guidelines/security.html#cross-site-scripting-xss) you'll see the real hint, XSS filtering is not applied by default to GET or POST. ( I beleive the script check might be, but not extended XSS filtering)

What I would be inclined to do is check your Expresso version (ensure it's latest and greatest) and check your EE version for how it applies XS filtering to normal POST values.

If you can still inject `<applet>` ect then I'd get into the module files for expresso checkout and find where the values are taken from the POST. Expresso **should** be using `ee()->input->post('var_name', true);` to fetch values (the second parameter is for applying XSS filtering).

If this is missing you could simply add the `true` second parameter and you should be good to go (apart from having to edit a 3rd party module).

If they are using the $\_POST directly (tut tut) then you'll have to add a call to xss\_clean function, by example :

```
//expresso retreived the value
$retrievedValue = $_POST['myvalue'];

//START Added Code : we'll clean this for you!
$retrievedValue = ee()->security->xss_clean($retrievedValue )
//END Added Code

//expresso uses the value
...

```

Either way debug the values as you go and you should be able to identify the why and the resolution.

Let us know how you get on fella, and keep the faith, cleaning a site for a strict security pen test can be a bit of a grind, but you'll get there and you'll know all about securing EE sites next time! :)

**references**

Remember EE is built on CI, so in many cases you can refer to the CI docs.

See here for info on the input library of CI : https://ellislab.com/codeigniter/user-guide/libraries/input.html

And here for the security library : https://ellislab.com/codeigniter/user-guide/libraries/security.html

# Answer
> 0 votes
I'm going to start another answer as the question and solution seem to have departed from the previous answer. The previous answer shows that we have debugged and checked that XSS filtering is actually taking and the correctly encoded values are saved in the database.

So now we just need to determin that, anywhere these fields are displayed (frontend or CP) are they displayed in their encoded form (i.e. using html elements `<` and `>`) or are they being decoded before display (i.e. `<` and `>`).

The former would be considered safe, though not optimal. It's basically behaving a bit like `htmlspecialchars()`. You could improve this by decoding the sting in PHP, running it through `strip_tags()` and re-encoding (for saftey) before display anlthough this is just an enhancement to stop the naughty user from seeing their results.

The latter would be considered unsafe, as the malicious user can input some markup, allow it to be saved encoded and displayed uncoded, thus allowing injection. If this is the case the solution is the same, but required to 'make safe', either strip the tags before calling xss\_clean (let it clean a tidier string) to clean before save (the determined hacker could work out other ways to encode the lt and gt (like unicode) so this in itself is not 100%) or better would be to also ensure wherever it is displayed, make sure to pass the output through `strip_tags()` to obfuscate the tags that where saved as encoded.

I personally beleive that the OP is referring to the first case where the html encoded output is being displayed on the page, but I'm sure Aaron will re-confirm soon!

Perhaps Aaron can also confirm exactly what the security company has stated, did they indicate where the display was happening? Did they provide a recommendation on resolution? If they did we can probably fashion the solution to meet their requirements, which is much easier than trying to convince them that this case doesn't break their rules, or get them to modify their rules...

# Answer
> 0 votes
The fix for this (thanks Store guys!) is here:

/third\_party/store/src/Action/CheckoutAction.php

under this (line 57 ish)

> $form\_params = $this-\>form\_params(); $update\_data = $this-\>ee-\>security-\>xss\_clean($\_POST); $cart = $this-\>ee-\>store-\>orders-\>get\_cart();

Put this:

```
    // check to remove any html
    foreach ($update_data as $key => $val) {
        if (strpos($key, 'billing_') === false && strpos($key, 'shipping_') === false) continue;
        $val = html_entity_decode($val);
        $val = str_replace('[removed]', '', $val);
        $update_data[$key] = strip_tags($val);
    }

```

And all html, including the \[removed\] notice that EE catches is disappeared and never enters the DB

---
Tags: expresso-store, security, xss
---


title: Creating a multi-channel RSS Feed

text:
# Question
Title: Creating a multi-channel RSS Feed
I am trying to get a multi-channel RSS feed working. The feed seems to populate correctly if I use: `<link>{title_permalink="site/index"}</link>`, but as you can guess then each article just takes the subscriber to the index of the site.

I tried `<link>{title_permalink="{page_url}"}</link>`, but that broke the feed completely and it wouldn't populate.

How do I get it so that each entry in the feed links directly to the specific content item, regardless of channel?

My full XML code is here:

```
{preload_replace:master_channel_name="articles|blogs|news|reports"}
{preload_replace:master_channel_status="OPEN"}
{preload_replace:master_rss_uri="https://ntecheresearch.com/rss/content"}

{exp:rss:feed channel="{master_channel_name}" status="{master_channel_status}"}
<?xml version="1.0" encoding="{encoding}"?>
<rss version="2.0"
    xmlns:dc="https://purl.org/dc/elements/1.1/"
    xmlns:atom="https://www.w3.org/2005/Atom">
    <channel>
    <title>{exp:xml_encode}n-tech Rearch RSS Feed{/exp:xml_encode}</title>
    <link>{channel_url}</link>
    <description></description>
    <dc:language>{channel_language}</dc:language>
    <dc:creator>{email}</dc:creator>
    <dc:rights>Copyright {gmt_date format="%Y"}</dc:rights>
    <pubDate>{gmt_date format="%D, %d %M %Y %H:%i:%s %T"}</pubDate>
    <atom:link href="{master_rss_uri}" rel="self" type="application/rss+xml" />
{exp:channel:entries channel="{master_channel_name}" limit="30" rdf="off" dynamic_start="on" disable="member_data|trackbacks" status="{master_channel_status}"}
    <item>
      <title>{exp:xml_encode protect_entities="yes"}{title}{/exp:xml_encode}</title>
      <link>{title_permalink="{page_url}"}</link>
      <guid isPermaLink="false">{title_permalink="site/index"}#id:{entry_id}#date:{gmt_entry_date format="%H:%i"}</guid>
      <description><![CDATA[{summary}]]></description>
      {categories}<category>{exp:xml_encode protect_entities="yes"}{category_name}{/exp:xml_encode}</category>
      {/categories}
      <pubDate>{gmt_entry_date format="%D, %d %M %Y %H:%i %T"}</pubDate>
    </item>
{/exp:channel:entries}
    </channel>
</rss>
{/exp:rss:feed}

```

# Answer
> 2 votes
`<link>{title_permalink="{page_url}"}</link>` will never work because the `title_permalink` will be parsed before `page_url`. `page_url` also just works on Page Module.

It looks like the channels you're trying to add to the feed use different templates, which makes impossible to use the `{url_title_path=""}`. Is it?

If so, you have two options.

## first one

You can use `{relative_url}`, which returns the value of the Channel URL on its settings.

For each `<item>`, use:

```
<link>{relative_url}/{url_title}</link>

```

Or, if you're using **root** relative links on channels settings, which I prefer:

```
<link>{site_url}{relative_url}/{url_title}</link>

```

## second one

Conditionals! Check for the `channel_short_name`:

```
{if channel_short_name == "x"}
    <link>{title_permalink='x_template_group'} [...]
{if:else}
    <link>{title_permalink='y_template_group'} [...]
{/if}

```

---
Tags: rss
---


title: Playa - PHP error after moving server

text:
# Question
Title: Playa - PHP error after moving server
I have a site using 2.5.3 . I've moved this site to a new server and when logged onto the control panel, I get the following error on the front page of the site:

```
A PHP Error was encountered

Severity: Warning

Message: Parameter 3 to Playa_ext::channel_entries_tagdata() expected to be a reference, value given

Filename: libraries/Extensions.php

Line Number: 241

```

I've updated Playa to version 4.5.2 , but the errors are still there.

# Answer
See this bug report thread \- this error arises when you run 2.5.3 on certain PHP versions. Upgrading to at minimum 2.5.4 should fix this. From the release notes:

> Fixed a bug (#18263) where PHP may claim an object wasn’t passed by reference to an extension hook.
> 2 votes

---
Tags: playa
---


title: Zoo Visitor How to set it up

text:
# Question
Title: Zoo Visitor How to set it up
I have set up many sites in EE however I seem to have brain farted on how to use Zoo Visitor and how and where to begin? I have looked at the documentation and seem to be missing a step. Need a push in the right direction.

The concept is I have 2 groups (employees and employers) and need to set up each so that when they login they get access to that particular groups content.

# Answer
> 1 votes
What have you tried? How far have you got? Depending on exactly what you need, you might not even need Zoo Visitor. You can use conditionals and global variables to display different content in a template like:

```
{if member_group == '7'}  You're an "Employee"!  {/if}

```

See here in the docs for some more info. If you can be more specific I might be able to offer more assistance.

---
Tags: zoo-visitor
---


title: Tagger outputting duplicate entries

text:
# Question
Title: Tagger outputting duplicate entries
Trying to just output entries that share the same tag but it's outputting duplicate entries.

```
{exp:channel:entries channel="{news_channel}" url_title="{segment_2}"}
    {exp:tagger:related entry_id="{entry_id}"}

        {if tagger:no_entries}
            <div class="large-12 columns">
                <p>No related entries were found.</p>
            </div>
        {/if}

            <h2>{news-heading}</h2>
            {news-content}

    {/exp:tagger:related}
{/exp:channel:entries}

```

Any ideas how to stop this?

# Answer
Ok had to re-look at things and got the following working...

```
{exp:channel:entries channel="{news_channel}" url_title="{segment_2}" limit="3" dynamic="no" disable="{gv-disable-default}"}
{exp:tagger:related entry_id="{entry_id}" custom_fields="news-heading|news-content"}

    {if tagger:no_entries}
        <div class="large-12 columns">
            <p>No related entries were found.</p>
        </div>
    {/if}

        <h2>{tagger:news-heading}</h2>
        {tagger:news-content}

{/exp:tagger:related}
{/exp:channel:entries}

```
> 0 votes

---
Tags: devdemon-tagger, tagger
---


title: Login refreshes

text:
# Question
Title: Login refreshes
So I have a site on production, but I wanted to be able to work on it locally too, like when I have no web access. I know it's the backward way of doing things, and not sure how it's ended up like this. Anyway.

I installed EE locally, then imported my production database, now when I login it just refreshes. I keep asking for a new password, but it still refreshes and doesn't login.

What am I doing wrong?

# Answer
To troubleshoot, first try setting your control panel sessions to be cookie based only:

Add this to /system/expresionengine/config/config.php

```
$config['cp_session_type'] = 'c';

```

If that doesn't work, try disabling extensions via your config file:

```
$config['allow_extensions'] = 'n';

```

If that allows you to login, it's likely an add-on that's redirecting to a URI that's either invalid or redirected (thereby rejecting your POST data). You can confirm/observe this by viewing your "Network" log in your Developer Tools.

For me, the easiest solution is to just disable redirects on control panel login. You can either delete the cp\_member\_login hooks from the exp\_extensions database table or try updating Structure (or the suspected add-on) to not redirect on login. Note that it's possible that you have more than one app trying to redirect (e.g. Republic Analytics, Structure, etc)
> 0 votes

# Answer
I've had this problem before and, for me, it has nearly always been caused by cookie configuration. You can try adding your local address to the config file with `$config['cookie_domain'] = "[your local url]"` to make sure that cookies are being served from the correct domain (ie: the one you are using locally). You could also try putting in an empty config value in (such as `$config['cookie_domain'] = ""` ) to see if that works.
> 0 votes

---
Tags: login
---


# Question
Title: Reset POST value of Objective HTML Channel Search on button click
Pretty much after what the title says.

Is there a way to reset/unset a POST value if it is currently set utilizing a button. The idea here, is the button would be a filter of sorts, so clicking would remove certain portions of the URL if currently set.

As an example: Say we have a button, `<a href="#" class="unsetFilter1">Remove filter 1</a>` and upon clicking, it would do something along the lines of checking `{if '{exp:channel_search:is_set name="filter1"}' == 1}` where if **TRUE** (as the statement is setup), do something like `{exp:channel_search:reset name="filter1"}`

It seems possible, as all the components needed are there, just not sure how to actually set this up?

# Answer
So I think I've got this figured out. Here's what I did:

```
{if '{exp:channel_search:is_set name="filter1"}' == 1}
    {!-- If here, the filter is applied, unset it and go back to page one as results will differ --}
    <a href="{exp:channel_search:url set:filter1='' set:page='1'}" class="button secondary disabled">Show locations that match filter1</a>
{if:else}
    {!-- If here, the filter is NOT applied, set it and go back to page one as results will differ --}
    <a href="{exp:channel_search:url set:filter1='SOME_TITLE_TO_FILTER' set:page='1'}" class="button secondary">Hide locations that match filter1</a>
{/if}

```

Basically, I'm checking if the variable is set, and if so get the current URL, unset the variable, set the page to 1 and go to this URL in click. Do the opposite if not set.

I added a default search rule to accomplish the filtering
> 0 votes

---
Tags: objective-html
---


title: Structure entries bug

text:
# Question
Title: Structure entries bug
I am using Structure Entries and trying to use hide from nav. This works well when I'm trying to hide an entry on ground level, but when I'm trying to hide a sub item the whole menu collapses. I'm not doing anything weird and just copied the 4th example.

# Answer
> 0 votes
Turned out that Structure Entries does not support the option to hide children from navigation. I found a plugin for Structure that does support this, and makes it possible to create more complicated navigations for your website (like Structure Entries). Here's the link to the plugin: https://devot-ee.com/add-ons/structure-nav

---
Tags: structure, entries, navigation, bug
---


# Question
Title: Remove question mark from url after search submit
I have a multi-language website and my second language goes to a subdirectory `mysite.com/en/` Everything is fine but the search functionality. When I submit my search, it prints a question mark right after the subdirectory like this:

```
mysite.com/en/?/noresult/6bc629a9319d90a1e9703eaf2c00f7cd/

```

And because of it my site redirects to the homepage. I searched and tried many .htaccess codes but it did not work. The URL without question mark works fine. besides i set the "Force URL query strings" to "No" in admin panel but still not working. Here is my .htaccess:

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

  # 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,QSA]
</IfModule>

```

i don't know what to do

# Answer
> 0 votes
You need some .htaccess magic. This should do the trick, but might need tweaking based on your URL needs. Make sure you put this **before** your EE rewrites and index.php redirects.

```
RewriteCond %{THE_REQUEST} ^(GET|HEAD)\ /en/\?([^\ ]+)
RewriteRule ^ /en%2? [L,R,NE]

```

The problem is systemic to something else, so this is probably more of a band aid, but should work for you.

---
Tags: search, htaccess, simple-search, querystring, multiple-sites
---


# Question
Title: Random matrix image on homepage and interior pages
I have a Matrix channel field to display sponsor images in a sidebar. I want to output 1 random image on page load and give user the option to only show specific sponsors on the homepage with Switch Field Type (these are essentially our client's featured sponsors that appear on homepage in addition to interior pages).

For some reason I can't get this code to work properly. Any help is much appreciated...

```
{exp:channel:entries}
    {sponsors sort="random" limit="1"}
        {if segment_1 == ""}
            {if "{home_button}" == "y"}
                <a href="{link}" target="_blank"><img src="{image}" alt="{alt}"/>
            {/if}
        {if:else}
            <a href="{link}" target="_blank"><img src="{image}" alt="{alt}"/>
        {/if}
    {/sponsors}
{/exp:channel:entries}

```

**UPDATED ANSWER:** Found this to work...which gives me the ability to keep in "pages" channel without giving images their own channel.

```
                    {if segment_1 == ""}
                        {exp:channel:entries channel="pages"}
                                {!-- Load a random matrix row that has home button set to y --}
                                {sponsors sort="random" limit="1" search:home_button="y"}
                                    <a href="{link}" target="_blank"><img src="{image}" alt="{alt}"/></a>
                                {/sponsors}
                        {/exp:channel:entries}
                    {if:else}
                        {exp:channel:entries channel="pages" dynamic="off"}
                                {!-- Load a random matrix row that has home button set to y --}
                                {sponsors sort="random" limit="1"}
                                    <a href="{link}" target="_blank"><img src="{image}" alt="{alt}"/></a>
                                {/sponsors}
                        {/exp:channel:entries}
                    {/if}

```

# Answer
> 0 votes
I currently see two problems with your code.

Assuming that this is the exact code that you are trying to run, the channel entries tag must have more parameters in order to display anything on the page correctly. Since you will be reusing the code on the homepage and other pages as well you will need to do something along these lines

```
{exp:channel:entries channel="sponsors" dynamic="no" limit="1"}

```

If you already had those things, there is a logic problem with your conditionals and the way you are loading in your matrix field. First your homepage conditional should be placed outside of the matrix calls. Let's say that you have:

```
name | homepage button
sponsor1 yes
sponsor2 no
sponsor3 no
sponsor4 yes
sponsor5 no

```

Your current code would try and randomly grab one of the matrix values. Then it goes to your conditional. If we are on the homepage, it will check if the randomly selected row is supposed to display or not, then the page is fully loaded. There is a 3 in 5 chance that nothing will display. You can fix this by changing where that conditional happens and adding the search parameter to a different matrix call.

```
{exp:channel:entries channel="sponsors" dynamic="no" limit="1"}

    {!-- If current page is the homepage --}
    {if segment_1 == ""}

        {!-- Load a random matrix row that has home button set to y --}
        {sponsors search:home_button="y" sort="random" limit="1"}
            <a href="{link}" target="_blank"><img src="{image}" alt="{alt}"/>
        {/sponsors}

    {!-- This is not the homepage --}
    {if:else}

         {!-- Load any random sponsor including featured ones --}
         {sponsors sort="random" limit="1"}
            <a href="{link}" target="_blank"><img src="{image}" alt="{alt}"/>
         {/sponsors}
    {/if}

{/exp:channel:entries}

```

---
Tags: matrix, templates, switch
---


title: Incomplete orders in Store

text:
# Question
Title: Incomplete orders in Store
My client would like to turn incomplete orders into orders by automatically generating an email to send after a certain time period (eg 48 hours). I realise this cannot be done by default in Store, but is there any other way of doing this?

# Answer
> 0 votes
There is not an add-on that I know of that would be able to do this for you out of the box.

You would need to build an extension to handle this. There is currently not an extension hook in Store for abandoned carts so you would need to build an add-on. I have not updated a build to Store 2.5 but the release notes mention that incomplete orders no longer create an order in the orders table so you would probably need to query the `exp_store_carts` table to see carts that have not been completed and have sat unchanged for X amount of time.

IT should be noted that you would only be able to do this if the user is already logged in to your site.

---
Tags: expresso-store
---


# Question
Title: Unable to load the requested file: content/_assets/glossary_items.php after upgrade
Just upgraded a site from 1.6.6 to 2.5.5 and when I went to edit an entry or publish a new entry I got

```
Unable to load the requested file: content/_assets/glossary_items.php

```

From initial digging on EE forums, they all pointed toward Matrix being the issue, however this site had ZERO add-ons.

I installed Matrix and the issue is now non-existent. Having Matrix installed isn't really a solution.

# Answer
For whatever reason I never really got to the bottom of this.

However, installing Matrix and then removing it did the trick for us.
> 0 votes

# Answer
I just had this on a fresh EE install. Kinda weird, but thanks for the tip. Installing matrix worked for me as well.
> 1 votes

---
Tags: matrix, ee1, ee2-upgrades, bug
---


# Question
Title: Possible to "Buy All" Products on a Page or Purchase a Group?
We're looking into adding a "Buy All" button for a Charity / Auction site and the owner would like to have a buy all button that would add all items (each having a stock of 1) to the cart for purchase.

Second Question: Is it possible to visibly show when a product has been added to the cart? The reason being is that the items for sale will be in a grid side by side and the owner would like a way for people to know which items they have added to the cart by visibly altering a div tag (or something similar) once the item is residing in the cart.

# Answer
Buy All button:

Yes it is possible to add all items to the cart with a single button you would need to use the `{exp:store:product_form}` tag pair wrapped around your channel entries tag or Matrix/Grid or Relationship/Playa tag pair. Full documentation of the product\_form tag can be found here.

```
{exp:store:product_form}
  {exp:channel:entries channel="products" dynamic="no" limit="5"}
      {exp:store:product disable_form="yes" entry_id="{entry_id}"}
          <!-- add to cart form / product details -->
    {exp:store:product}
  {/exp:channel:entries}
{/exp:store:product_form}

```

In cart:

You would want to use the `{qty_in_cart}` tag in the `{exp:store:product}` tag. Something along the lines of:

```
<div class="{if qty_in_cart}inCart{/if}">

```

Full documentation for this can be found here
> 2 votes

---
Tags: expresso-store, subscriptions
---


# Question
Title: How to update record using angular post?
I am trying to update record by angular post, below is code:

```
 $.post(url, data, function (result) {
                var error = false;
                if (result.success == 1 && (result.entry_id) != false) {
                    //alert('Saved Successfully!!')
                } else {
                    error = true;
                }
                $scope.$apply(function () {
                    $scope.loading = false;
                    if (error) {
                        $scope.error = true;
                        $scope.ErrorMessage = 'Internal server error occured.';
                    } else {
                        $scope.success = true;
                        window.location.href = "#/trVenueDetail/" + result.entry_id
                    }
                });

            });

```

But it's always made the new entry. Page URL is some thing like below:

http://example.com/new#/trAddVenue/47452

47452 is entry\_id, I have tried to set it in hidden field:

The entry\_id hidden field is automatically created by form tag.

```
  {exp:channel:form channel="venues" include_jquery="no" json="yes"
id="addVenu" name="addVenu" }

     -- Controls Html Is Here---

  {/exp:channel:form}

```

The Same code is working in case of add new record, but how to update existing.

And yes I am able to populate the value.

# Answer
> 0 votes
So I have found the answer by myself, in case of update we have to set the require\_entry="yes" and need to pass the entry\_id.

```
 {exp:channel:form channel="venues" entry_id="{segment_3}" require_entry="yes" include_jquery="no" json="yes" id="addVenu" name="addVenu" }

       -- Controls Html Is Here---

  {/exp:channel:form}

```

It will force to update rather then the new entry.

I hope this will help someone else.

---
Tags: channel-entries, update, js
---


title: Customer Report showing blank

text:
# Question
Title: Customer Report showing blank
I'm seeing a strange behavior in the Customer Reports screen where none of the customer names are showing. We're seeing the customer totals and also the ability to export to CSV, and even more interesting, the pagination; none of the customers are listed in the table though. The rest of the CT reports are all working properly, but this specific report is showing blank.

Using EE 2.9.2 and CT 2.61

# Answer
I think the simple answer is that the report only shows entries with an open status. Are the few entries you're seeing set to open? Are the rest set to some other status?
> 0 votes

---
Tags: cartthrob
---


# Question
Title: What I do wrong with Low Search and Tag in result page?
I try to understand how Low Search works and been trying to get Solspace Tags as human words instead of ID's in my result page like: Your search keywords were: foo, bar.

But I dont understand what I need to do to make this happen.

Here is example with what I have tried a lot of different setups with no luck.

Would be thankful if someone point me what's wrong, thanks.

```
<p>Your keywords: <strong>{exp:low_search:param:loop get="tag_id" as="tag_name" query="{segment_3}"} {exp:tag:tag_name}{tag}{/exp:tag:tag_name}{/exp:low_search:param:loop}</strong></p>

```

# Answer
If you're using tag IDs, then you can use the Cloud tag to display the names.

The most important thing you'll read about Low Search is **how parameters work**. With that in mind, if you follow this example, then you could use this code to display the tags:

```
{exp:low_search:filters query="{segment_3}"}
  {exp:tag:cloud tag_id="{low_search_tag_id}"}
     {tag}
  {/exp:tag:cloud}
{/exp:low_search:filters}

```
> 2 votes

---
Tags: search, low-search, solspace-tag
---


# Question
Title: How to encode emails contained within channel entries automatically?
I'm working on a site that will have various email addresses entered within paragraphs of text in channel entries by the client.

These email address are automatically turned into links by EE which is great, but I'm struggling to find a way to protect these email addresses from spammers.

I've heard that EE can do this but have struggled to find any information about how to set EE to do this automatically without using the 'encode' tag (which is going to be too complex for the client).

**Does anyone know how to set EE to protect or encrypt email addresses contained within channel entries automatically? Or alternatively, does anyone know of any plugins that might help?**

As always, any thoughts or ideas are appreciated.

Thanks in advance,

Tom

# Answer
The **WYGWAM** field has this setting option. I just used it on my last project. Worked perfectly.
> 4 votes

# Answer
For those users who do not use WYGWAM take a look at CE String which elegantly solves this issue. (and lots more - a real swiss army chainsaw to use a Perl expression)

http://dvt.ee/cestring

In the custom method docs take a look at 'encode\_email\_script' or encode\_email\_bulk

http://www.causingeffect.com/software/expressionengine/ce-string/user-guide/custom\_methods

To quote the docs for usage of 'encode\_email\_bulk':

```
{exp:ce_str:ing encode_email_bulk="script"}
    Ut wisi <a href="mailto:example@example.com">Example</a> enim ad minim veniam, quis nostrud test@example.com.
{/exp:ce_str:ing}

```

Output:

```
Ut wisi <span data-eeEncEmail_GDleXCqLAm='1'>.(JavaScript must be enabled to view this email address)</span><script type="text/javascript">/*<![CDATA[*/var out = '',el = document.getElementsByTagName('span'),l = ['>','a','/','<',' 101',' 108',' 112',' 109',' 97',' 120',' 69','>','\"',' 109',' 111',' 99',' 46',' 101',' 108',' 112',' 109',' 97',' 120',' 101',' 64',' 101',' 108',' 112',' 109',' 97',' 120',' 101',':','o','t','l','i','a','m','\"','=','f','e','r','h','a ','<'],i = l.length,j = el.length;while (--i >= 0){out += unescape(l[i].replace(/^\s\s*/, '&#'));}while (--j >= 0){/**/if (el[j].getAttribute('data-eeEncEmail_GDleXCqLAm')){el[j].innerHTML = out;}}/*]]>*/</script> enim ad minim veniam, quis nostrud <span data-eeEncEmail_qxlETSuEFT='1'>.(JavaScript must be enabled to view this email address)</span><script type="text/javascript">/*<![CDATA[*/var out = '',el = document.getElementsByTagName('span'),l = ['>','a','/','<',' 46',' 109',' 111',' 99',' 46',' 101',' 108',' 112',' 109',' 97',' 120',' 101',' 64',' 116',' 115',' 101',' 116','>','\"',' 46',' 109',' 111',' 99',' 46',' 101',' 108',' 112',' 109',' 97',' 120',' 101',' 64',' 116',' 115',' 101',' 116',':','o','t','l','i','a','m','\"','=','f','e','r','h','a ','<'],i = l.length,j = el.length;while (--i >= 0){out += unescape(l[i].replace(/^\s\s*/, '&#'));}while (--j >= 0){/**/if (el[j].getAttribute('data-eeEncEmail_qxlETSuEFT')){el[j].innerHTML = out;}}/*]]>*/</script>

```
> 1 votes

# Answer
how do you confirm this is actually working? If I disable javascript the email links look the same in the source
> 0 votes

---
Tags: channel-entries, email, spam
---


# Question
Title: Amazon Web Services (AWS) Products plugin Error
Having an issue w/ this EE add-on where if an Amazon product isn't found with a specific ID I get this error:

```
You have an invalid conditional in your template. Please review your conditionals for an unclosed string, invalid operators, a missing }, or a missing {/if}.

Parser State: Unexpected end of Template “article/index” on line 157; expected ENDIF tag for opening on line 46 in Template “layouts/.html-layout”.

```

Here's how I'm using the tags in my template:

```
{if amazon_product_asin_or_isbn}
<div class="panel PanelProduct clearfix">
  {exp:aws_products:search
    item_id="{amazon_product_asin_or_isbn}"
    associate_id="{associate_id}"
    public_key="{public_key}" private_key="{private_key}"
  }
  <div class="PanelProduct-imageContainer left">
    <img src="{img_large}" alt="">
  </div>
  <div class="PanelProduct-content right">
    <h3 class="Article-subheading">Related Product:</h3>
    <h4 class="PanelProduct-heading">{product_name}</h4>
    <div class="PanelProduct-info">{catalog_type} | {publisher}</div>
    <a class="button small u-mediumTopMargin u-noMarginBot" href="{amazon_link}" target="_blank">{best_price} on Amazon</a>
  </div>
  {/exp:aws_products:search}
</div>
{/if}

```

I then tried using this if statement within the tags to only render the product panel if there is a product found:

```
{if aws_count > 0}   {/if}

```

But then I get this error in the template:

```
Severity: Notice

Message: Undefined index: !-- ra:000000003bf7ea8400000001087a7b32 --

Filename: aws_products/pi.aws_products.php

Line Number: 237

```

It seems like any if statements within the tags break the plugin. So how can I integrate the tags in a way that detects if there's a valid product ID filled in without totally breaking the page?

Using AWS Products 3.1.0 on EE 2.9.2

# Answer
Louis at Hop Studios has posted an update of this plugin which fixes the above issue.
> 0 votes

---
Tags: plugin, amazon
---


# Question
Title: CE Image + Assets + S3 = Really Long and Ugly URL
I'm using a combination of Assets (with S3) and CE Image to store and manipulate my images respectively.

Here's an example of the tag I use:

```
{exp:ce_img:pair src="{url}" width="1280" height="720" crop="yes" save_type="jpg" allow_scale_larger="yes" quality="81" cache="yes" refresh="360"}{made}{/exp:ce_img:pair}

```

And this is an example of the URL it produces:

```
http://bucketname.s3.amazonaws.com/images/made/images/remote/http_s3.amazonaws.com/bucketname/articles/imagefile.jpg

```

Is there any way to get around producing such a long and ugly URL when using these two add-ons together?

# Answer
I know this issue has been addressed multiple times in the support forums (and possibly already on EE Stack Exchange), but hopefully answering here too will be helpful to others down the road:

The long URLs are the automatic naming convention that CE image uses to prevent naming conflicts, and to mitigate the possibility of overwriting images. However, you can use hide\_relative\_path="yes" and the cache\_dir= param to have more control over your S3 URLs.

There are several other parameters in the documentation that give even more control over the cached (saved) image names and paths.
> 1 votes

---
Tags: assets, image, ce-image, s3, image-path
---


# Question
Title: Faceted search with categories using Low Search
So I am trying to set up a faceted search which is based on categories - but EE's default category parameters aren't clever enough for me with just the `&` or `|` separators, so I was wondering if I could do what I need to with Low Search.

I have 5 category groups: Age, Artists, Type, Medium and Topic. In each of these is an unknown number of categories. I am displaying checkboxes on the front end for each category group, and have entries assigned to at least 1 category in each group. Here is my list of filters so you can see the options:

The default view when nothing is ticked is all entries. If I tick 'Multiple' I want all entries categorised with 'Multiple' to show. When I have 'Multiple' and '8-10' ticked I would like everything categorised as both 'Multiple' **and** '8-10' to show. So far so easy - but here is where EE's default breaks:

I tick 'Multiple', '8-10' and '11-14' I want to show everything that is categorised as 'Multiple' **and** '8-10' **or** 'Multiple' **and** '11-14'.

I hope this makes sense and isn't too long winded - ask if something isn't clear and I'll try to clarify. Does anyone know if this is possible with Low Search, and if not - how might I go about it?

Thanks!

# Answer
> 3 votes
Yep, that would be a job for the Categories filter.

For each group of categories, use a `category:group_name` parameter name to combine AND and OR matching. For example:

```
{exp:channel:categories category_group="1" style="linear"}
  <label>
    <input type="checkbox" name="category:group1[]" value="{category_id}"
    {if category_id IN ({low_search_category:group1})} checked="checked"{/if} />
    {category_name}
  </label>
{/exp:channel:categories}

{exp:channel:categories category_group="2" style="linear"}
  <label>
    <input type="checkbox" name="category:group2[]" value="{category_id}"
    {if category_id IN ({low_search_category:group2})} checked="checked"{/if} />
    {category_name}
  </label>
{/exp:channel:categories}

...

```

And repeat for each other category group. Note: this code should be put inside the Form tag.

# Answer
> 0 votes
If hitting "Unexpected ‘IN’ (VARIABLE); expected RD in Template" error in EE 2.9.2 try swapping conditional from

```
{if category_id IN ({low_search_category:group2})} checked="checked"{/if} />

```

to

```
{if category_id ~ '/(^|\|)'.low_search_category:group2.'($|\|)/'} checked="checked" {/if}

```

---
Tags: categories, low-search
---


title: Fatal Error - Website down!

text:
# Question
Title: Fatal Error - Website down!
I have a live site currently down with the message:

{!-- ra:00000000638f5ffd00000000469f18aa --} Fatal error: Cannot use object of type stdClass as array in /xxx/system/expressionengine/libraries/Functions.php(688) : eval()'d code on line 33

Added a channel entry yesterday and I know the site worked fine after that yesterday afternoon. This morning the site was down with that error so no obvious cause.

The admin section still works, running ExpressionEngine v2.9.2

# Answer
> 3 votes
This is a PHP parse error. It's exactly what Derek Hogue said. On line 33 you are trying to use a stdClass as an array in some functionality on a template that has PHP parsing turned on.

EE template:

```
Hello from {site_url}!

<?php
$stdclassvar = new stdClass;
echo gettype($stdclassvar);
// this outputs "object"

$arrayvar = array();
echo gettype($arrayvar);
// this outputs "array"

// ... down to line 33 on your template, you are confusing these two types
// here's an example that will give your error:

$stdclassvar['random_key'] = 'random_value';
// this kills the crab (PHP parser)
?>

Goodbye from {site_url}!

```

The function from Functions.php is part of EE's template evaluater. Please review your template and PHP code, or post it with your answer so we can fix it for you. I tested the exact code above and got your error:

```
{!-- ra:000000004a226f8000007f5841b7ebd8 --} Hello from {site_url}!     objectarray
Fatal error: Cannot use object of type stdClass as array in     /var/www/html/system/expressionengine/libraries/Functions.php(688) : eval()'d code on line 15

```

# Answer
> 0 votes
Thanks for pointing me in the right direction! It was indeed a php enabled template causing the issue. I was at a loss as I hadn't changed anything to cause the error from the site working which made me think it was another issue. The error was in a php script that uses the twitter api to show latest tweets on the site. It turned out my client had changed their twitter username without me knowing and that was causing the error in the script.

---
Tags: ee2, php, error, php-errors
---


# Question
Title: SQL query issue while trying to count the entry (row)
Trying to produce a current entry count / total entries within a channel\_entry tag by using a SQL query.

```
{exp:channel:entries
  channel="{channel}"
  limit="1"
  require_entry="yes"
  status="open"
  disable="{disable_default}"
  orderby="title"
  sort="asc"
  }

    <!-- entry number (row number) -->
    {exp:query sql="
        SET @row_number:=0;
        SELECT @row_number:=@row_number+1 AS row_number,title FROM exp_channel_titles
        WHERE channel_id = 10 AND status ="open"
        ORDER BY title;
        "}
        {row_number}
    {/exp:query}

    /

    <!-- total entries -->
    {exp:stats channel="{channel"}{total_results}{/exp:stats}

{/exp:channel:entries}

```

The Query works perfect while running it directly on the DB in the Navicat query editor. However it doesn't run (outputs nada) from within the template.

# Answer
Could you not use a simpler query? I notice that your query is actually 2 queries (note, the 2 semi-colons)...

Does the following work (done using MySql native) :

```
{exp:query sql="SELECT COUNT(*) AS row_number FROM exp_channel_titles WHERE channel_id = 10 AND status ='open';"}
    {row_number}
{/exp:query}

```

Also, you've got some double quote hell going on, use double quote for the EE attribute and single quote inside the query (as per example)...

**Edit**

Seems I'm also missing the 'FROM' clause in my example, I have corrected the above.
> 0 votes

---
Tags: mysql, query, sql, query-module
---


# Question
Title: Freeform Pro Show message when email is invalid
I'm using Freeform Pro composer to build a form. Validating with inline error messages.

Template code

```
{exp:freeform:composer
  form_name="contact_us"
  form_id="2"
  composer_template_name="contact_us"
  return="contact_us/thank_you"
  inline_errors="yes"
  form:class="contact-us"
}

```

I have an email field that is required. The email Field Type is text and the Field Content Type is set to email.

If I submit the form without any data in the email field I get a message "Please fill in this field".

If I fill in the field with text that's not a valid email address, I would like it to display a message telling them a valid email address is required.

Is this something that can be done without any additional coding?

Thanks

Wayne.

# Answer
> 0 votes
2 options, one is adding server side validation which will involve extending all sorts of internal's, the other which I feel you'd like is to use a HTML5 email type field (freeform uses a text field for the email import).

You can do this easily, please see this example that I am currently using on a site :

```
    {freeform:field:email
        attr:type="email"
        attr:id="email"
        attr:required="required"
        attr:size="36"
        attr:placeholder="Enter your email here..."}
    {if freeform:error:email}<p>{freeform:error:email}</p>{/if}

```

This produces the email field as so :

```
<input type="email" placeholder="Enter your email here..." size="36" required="required" maxlength="150" id="email" value="" name="email">

```

Note this is client side validation, HTML5 validation only! But the server side option can be alot more complex! the irony is that CodeIgnitor has a valid\_email filter, it's just that Freeform doesn't seem to use it!

---
Tags: solspace-freeform
---


# Question
Title: Adding New Grid Entries With Channel:Form
I am using the grid field as a custom field for one of my channels. My form is setup correctly from what I can tell. What happens is, when trying to add to an entry and already having added a few grid rows worth of data from the CP.

After I submit a new entry using Channel:Form it overrides all the other data and leaves me with 1 field only. I am wanting the grid field to just update and leave the other grid data alone in that channel entry, but it replaces all of my data with just the one newly submitted record. How do I go about simply adding onto the data already present in the Entry with my Grid field using Channel:Form?

This is what I am using in my form, any ideas?

```
<input type="text" name="field_id_10[rows][new_row_0][col_id_21]">

```

# Answer
> 1 votes
From this answer : How to work with the new channel forms and the new grid fieldtype ( and updateing it)

Is using the {field:field\_name} variable not to your requirements? I tested this and it works a treat. Otherwsie if you want to insert manually you can do it but you'll need a little php to get the right col and row indexes...

To do it manually, or without revealing the grid I've an example below, **you will need to add the existing values within hidden fields**, as without them the existing data is wiped.

```
<?php
    //first we need the column ID's for the grid. In my example these happen to be 3 and 4, you can get these id's from the exp_grid_columns table in the DB, I hard code them here as I know then but for portability you could write a query to get these
    $col1 = 3;
    $col2 = 4;

    //next we need to know what the new row index is, we also need the existing values so I'll do a little query here to get it all...
    // my grid field ID is 5, label is 'children', this entry ID is 11
    $res = ee()->db->where('entry_id', '11')
                   ->order_by('row_order', 'ASC')
                   ->get('channel_grid_field_5');

    //so lets count and display our results if any, for the input names, first its the grid field label (children) then rows, then the row ID and then col ID
    $new_row = 1;
    if ( $res->num_rows() > 0 ) {
        //remember next row (starts at 1 not 0)
        $new_row = $res->num_rows() + 1;
        //echo out the hidden fields
        foreach ( $res->result_array() as $row ) {
            //First Column
            //create the input name separate for readability!
            $inputName = 'children[rows]';
            $inputName .= '[row_id_' . $row['row_id'] . ']';
            $inputName .= '[col_id_' . $col1 . ']';
            echo '<input type="hidden" name="' . $inputName . '" value="' . $row['col_id_' . $col1] . '" />';
            //Second Column
            $inputName = 'children[rows]';
            $inputName .= '[row_id_' . $row['row_id'] . ']';
            $inputName .= '[col_id_' . $col2 . ']';
            echo '<input type="hidden" name="' . $inputName . '" value="' . $row['col_id_' . $col2] . '" />';
        }
    }

    //lastly, lets output text boxes for the new row
    //First Column
    echo '<input type="text" name="children[rows][new_row_' . $new_row . '][col_id_' . $col1 . ']" value="" dir="ltr" field_content_type="all" maxlength="256" />';
    //Second Column
    echo '<input type="text" name="children[rows][new_row_' . $new_row . '][col_id_' . $col2 . ']" value="" dir="ltr" field_content_type="all" maxlength="256" />';
?>

```

There you go!, this works well on my sandbox EE install, in my test I had 2 rows populated in CP, so I ended up with 4 hidden fields, and 2 new value text boxes each with `new_row_3` in the name. Worked fine to append new rows to the grid.

Please note, my test was using the nice basic Text Input fields, other fiedl types might require different fashioning of their input names, and if one of the fields is a relationship field you're right in it! this wiuld constitute another question though, the example above shows how to add grid rows, without displaying the existing rows (if you want the entire matrix as it is in CP then see the answer linked at the beginning of this post).

Let us know how you get on!

PS\> Sorry for the late reply, its been hectic here!

# Answer
> 0 votes
If I recall correctly, you just need to number the 'new\_row' correctly, lets say you have 2 rows already, when you submit the form it should be `field_id_10[rows][new_row_2]` (numbering starts from 0 obviously).

Also, I'm not sure if you have to resubmit the existing rows as well, like it does on the CP. you can easily confirm this by echoing out the existing days in hidden inputs.

My memory isn't what it was and is been a while since I did matrix/grid via channel entry form so I'll try to test this in the morning (UK) for you and solidify my answer, but in the meantime this will get you started.

---
Tags: safecracker, grid
---


# Question
Title: Add form to EE Module for front end processing
I am trying to add a form on the front end so my users can use crud functionality and allowing me to add responsiveness to the form.

I have been pointed in the direction of an article and examples over at ee-recipes and this have given me a good starting point. But I need to add some validation to the process. Firstname and lastname are required as well as checks to so if the player being added is already in the system.

I have added a form and action and I am able to save the data into the database.

```
public function player_form() {

    // Build an array to hold the form's hidden fields
    $hidden_fields = array(
        "ACT" => $this->EE->functions->fetch_action_id( 'Clubmanager', 'create_club_player' )
    );

    $action_id = ee()->functions->fetch_action_id('Clubmanager', 'create_club_player');

    // Build an array with the form data
    $form_data = array(
        "action" => "{site_url}?ACT=$action_id",
        "id" => $this->EE->TMPL->form_id,
        "class" => $this->EE->TMPL->form_class,
        "hidden_fields" => $hidden_fields
    );

    // Fetch contents of the tag pair, ie, the form contents
    $tagdata = $this->EE->TMPL->tagdata;

    $form = $this->EE->functions->form_declaration($form_data) .
    $tagdata . "</form>";

    return $form;
}

public function create_club_player() {

    $firstname = $this->EE->input->post('firstname');
    $lastname = $this->EE->input->post('lastname');
    $knownas = $this->EE->input->post('knownas');
    //$club = $this->EE->input->post('club');
    $position = $this->EE->input->post('position');
    $dob = $this->EE->input->post('dob');
    $url_title = strtolower(str_replace("'", "",$firstname)).'-'. strtolower(str_replace("'", "",$lastname));

    $data = array(
                    'firstname' => $firstname,
                    'lastname' => $lastname,
                    'knownas' => $knownas,
                    'url_title' => $url_title,
                    'position' => $position,
                    'dob' => $dob
                );

    $this->EE->db->insert('tm_players', $data);

    $ret = $this->EE->functions->fetch_site_index();

    $data = array(
        'title' => 'Add Player',
        'content' => "Player added successfully",
        'link' => array($ret, "Back to site")
    );

    $this->EE->output->show_message($data);

    //print_r( $_POST );
    //exit;
}

```

I know that I need to use form validation for the name etc and have what I need already as part of the CP module but not sure how to put it all together especially when reloading the page if there are errors. I have seen a post like this one here. page reload after postback answer by @Adrian Macneil that references ee()-\>core-\>generate\_page(). Are there any simple examples for me to try and follow

**BACKGROUND** Some more background information for you, should answer some questions. My site was originally built on CI and added bits here and there. I had a vision of integrating the site with EE but unfortunately it wasn't straight forward or so I was told.

I paid to get my football stats into EE and with that I lost a of functionality and didn't have the knowledge or money to fix that. I ran with EE for two years but it just couldn't cope the stats and how it pulled it all together. I got lucky and teammanager module was then available and I was able to change this slightly and just plugin my database tables from my CI site.

With EE there are many ways to build websites and I am sure there are better ways to use EE for me but I do not have the expertise and just have to try to get there myself somehow.

I have control panel access for updating and adding all information including a separate one for Club Admins to add player information. As most of my users use mobiles to visit the site and I want to try and push members to use the club admin feature I thought best way would be to have responsive design rather than mess with the CP CSS or try and build a mobile app.

Unless I am wrong the CP process for forms are different from building a form for front and this is the reason why I am asking this question. My form will also require a validation routine to check whether this player exists and also allow an override for different players with the same name. I have this code already but as I said the CP form and front end form are processed differently. Hopefully this clears some questions up.

And thanks for all comments.

# Answer
> 2 votes
Take a look at the Code Ignitor Validation Helper. You can use this within PHP on an EE template, it really is as easy as this (example from the CI Docs), just replacing $this with a reference to EE :

```
    function gmail_only($value){
        return ( stripos(strtolower($value), '@gmail.com') !== false );
    }

    ee()->load->helper(array('form', 'url'));

    ee()->load->library('form_validation');

    ee()->form_validation->set_rules('username', 'Username', 'required');
    ee()->form_validation->set_rules('password', 'Password', 'required');
    ee()->form_validation->set_rules('passconf', 'Password Confirmation', 'required');
    ee()->form_validation->set_rules('email', 'Email', 'required|valid_email|callback_gmail_only');

    if (ee()->form_validation->run() == FALSE)
    {
        //validation failed, back to form, show error messages!
    }
    else
    {
        //GREAT SUCCESS, do what you need to do!
    }

```

That is literally it, in the exampe there's a form with 4 fields, username, passwrod, password confirm and email. All are required and email needs to be a valid email too. You can even use custom validation callbacks for complex things (see the docs linked above for this too).

**Edit:** You also get the error's array when you run form validation, so you can use that to populate inline errors ect. as for routing what I tend to do is run the submission code on the same template as the form itself and post the form back to the current URL.

This way you can create your error array if validation fails, or a success message if it all worked out, then on the template where the form is displayed you can do an `if ( count($errors) )` or something to detect if you're siaplying errors, `if ( !empty($success) )` or similar to display a success message and just display the form if it's not a submission (errors and success are empty). No need for redirects.

PS\> When it comes to EE, I am very much a 'roll your own' kind of guy. I find the extra work of creating modules, tag parsers and routing quite erronious especially if the function your developing has very little re-usability, i.e. a specifically crafted form for a specific client/website/page.

# Answer
> 0 votes
This is one solution I am working on, I had been looking over ee-recipes and Andrew Weaver has been giving me some code as well

Main Form

```
public function test_form() {

// Build an array to hold the form's hidden fields
$hidden_fields = array(
    "ACT" => ee()->functions->fetch_action_id( 'Clubmanager', 'action_form' ),
    "return" => ee()->TMPL->fetch_param('return')
);

// Build an array with the form data
$form_data = array(
    // Send form back to this url - the action must be the same as the form
    "action" => ee()->functions->create_url( ee()->uri->uri_string ),
    "id" => ee()->TMPL->form_id,
    "class" => ee()->TMPL->form_class,
    "hidden_fields" => $hidden_fields
);

// Make sure errors is actually an array
if( ! is_array( self::$errors ) ) {
    self::$errors = array();
}

// Set up array to parse tagdata
$variables = array(
    "errors" => array( self::$errors ), // list of error messages
    // repopulate form with these variables
    "firstname" => isset( self::$formdata["firstname"] ) ? self::$formdata["firstname"] : "",
    "lastname" => isset( self::$formdata["lastname"] ) ?  self::$formdata["lastname"] : ""
);

// Fetch contents of the tag pair, ie, the form contents
$tagdata = ee()->TMPL->tagdata;

// Parse tagdata for errors/submitted values
$tagdata = ee()->TMPL->parse_variables_row( $tagdata, $variables );

// Create the form
$form = ee()->functions->form_declaration($form_data) .
    $tagdata .
    "</form>";

return $form;}

```

Action Form

```
 public function action_form() {

// use CI validation library to check submission
ee()->load->library('form_validation');
ee()->form_validation->set_rules('firstname', 'lang:firstname', 'required');
ee()->form_validation->set_rules('lastname', 'lang:lastname', 'required');

// Fetch data from the form
$firstname = ee()->input->post("firstname");
$lastname = ee()->input->post("lastname");

if(ee()->form_validation->run()==FALSE){
    self::$errors["error"] = ee()->form_validation->error_string();
}

// If there are no errors, redirect to the "return" url
if( empty( self::$errors ) ) {
    ee()->functions->redirect( ee()->functions->create_url( ee()->input->get_post('return') ) );
}

// Store submitted data to static formdata array
self::$formdata = array(
    "firstname" => $firstname,
    "lastname" => $lastname
);

// Continue loading this page
ee()->core->generate_page();}

```

Hopefully this with what has been suggested I will get there.

---
Tags: module, validation, action
---


title: ExpressionEngine beta 2.10

text:
# Question
Title: ExpressionEngine beta 2.10
I heard about ExpressionEngine beta 2.10.0 for developers with the Zoo Visitor, and DevDemon Updater updates.

Does someone knows what will are the new features of EE 2.10.0 ?

# Answer
> 1 votes
No new features - view changelog.

EE v3 is being released this year and the developers confirmed that there are no more features to be released in the v2 family, it will only be security additions and bug fixes.

---
Tags: update
---


# Question
Title: Show one product with multiple quantity as one entry with Cartthrob
I've been learning cart throb for about a month off and on and there's one functionality that seems to be missing. If I'm trying to purchase three black shirts I will use a quantity tag:

```
{exp:cartthrob:multi_add_to_cart_form class='forms product-forms id{purchasable_products:entry_id} off' entry_id="{purchasable_products:entry_id}" no_tax="{no_tax}"}

                <input type="hidden" name="entry_id[{count}]" value="{entry_id}" />

                    {exp:cartthrob:item_options entry_id="{purchasable_products:entry_id}"}

                        {select class='width-70 margin-bottom' limit="1"}
                            <option {selected} value="{option_value}">{option_value} {if option_price_numeric != 0} ({option_price}){/if}</option>
                        {/select}

                    {/exp:cartthrob:item_options}

                    <input type="text" class="product_quantity" name="quantity[{count}]" value="1">

                    </label>

                    <p>
                        <button type="submit" class="btn btn-green add-to-cart" data-target="cart-update">Add to Cart</button>
                        <a href="/shopping/view-cart" class="btn btn-blue btn-disabled view-cart-button"><i class="icon icon-shopping-cart"></i>View Cart</a>
                        <a href="/shopping/checkout" class="btn btn-green btn-disabled checkout-button">Checkout</a>
                    </p>
                {/exp:cartthrob:multi_add_to_cart_form}

```

When I add those three items, they show in my cart as three separate entries rather than one entry with one quantity.

Which says items are added, but the cart total is $0.00 and still shows as multiple entires in the view cart page. View cart code is

```
{exp:cartthrob:cart_items_info}
    {product_photos limit='1'}
            <img src="{product_photos:photo}" alt="{product_photos:photo_title}">
    {/product_photos}
    <h3 class="pull-left">{title}</h3>

```

Which results in looped out items, but adds no money to the cart. My goal is to only show a single item, with its proper quantity and proper cart price.

# Answer
> 1 votes
This is a settings in your CartThrob options, I don't have the latest version of CT installed but should be able to goto CartThrob \> Products \> Product Options \> Split multiple quantities into single items. In your case you would probably want "No".

From the cartthrob\_lang.php file since I don't think it is mentioned in their docs:

> If your prodcts can be configured with unique options (like color, shape, size, personalization) set this to "yes." Normally, if your products do not have configuration options, setting this to "no" add quantiy if "add to cart" is used multiple times on the same product. If this is set to "yes" each time "add to cart" is used on one product a completely new product will be added to the cart.

Since it appears you are only adding a single item to the cart you would be perfectly fine using the add\_to\_cart\_form instead of the multi.

Your view cart\_items\_info tag does not look complete which would cause some issues with proper outputting. I think you are interested in the `{exp:cart throb:cart_total}` or `{exp:cart throb:cart_subtotal}` tags among others to show the actual cart value along side of `{exp:cart throb:cart_items_info}` tag pair.

---
Tags: cartthrob, ecommerce
---


# Question
Title: Transcribe always redirects to homepage after switching language
I use Transcribe's {exp:transcribe:language\_links} tag in an embedded header template to output a language switcher.

The website has two languages and uses Structure to manage pages.

When I'm on a certain static page, that has been associated with language A, and does have a 'sister'-page in language B, and I use the language switcher, it always redirects me to the homepage, instead of the same page in language B.

Is this intended behaviour? Shouldn't I be redirected to the same page in the other language?

Also; I'm pretty sure it used to work at some point before the website went live. Could it have anything to do with the website being accessed from a different URL than during development?

# Answer
> 2 votes
You could have pasted your complete tag as an example :), however I guess you're doing sometihng like this (from the docs) :

```
{exp:transcribe:language_links}
    {languages}
        <a href="{link}"{if current} class="active"{/if}>{name}</a>
    {/languages}
{/exp:transcribe:language_links}

```

Right? I'm not sure if this is the desired beghaviour (I dobn't have transcribe installed) but couldn't you modify it to be somethnig like this (also from the docs):

```
<form action="{exp:transcribe:action_url}" method="post">
    <input type="hidden" name="XID" value="{XID_HASH}">
    <input type="hidden" name="RET" value="{current_path}">
{exp:transcribe:language_links}
    <select name="lang">
        {languages}
            <option value="{abbreviation}"{if current} selected="selected"{/if}>{name}</option>
        {/languages}
    </select>
{/exp:transcribe:language_links}

<input type="submit" name="submit" value="Submit" />

```

Here we are making a form that posts tothe language changing ACTion, but additionally I have added a hidden RET (return) parameter. If this form is handled like any other EE form this should dictate where to return the user after the ACTion.

As a bonus, you could also use transcribe to check if there is a translated entry for the current page, if there is set the RET value, if there isn't don't set it so they get sent ot the homepage...

Regarding the "it used to work", can you check that your channel entries have their linked language content still set? this should jsut be an entry relationship so no URL's stored, however it does seem like transcribe has 'lost track' of its Associated Entries. You didn't import any data did you?

Also, take a gander at the answers to this question : Transcribe - After AJAX request, when i switch language it directs me to the AJAX endpoint , while it's not directly related the solution describes how tracker is used to determin the last URL visited, perhaps the tracker is out of kilter??

---
Tags: transcribe
---


# Question
Title: Zoo Visitor Email Retreive Issue into input form field
The issue I seem to be having is that I have a member template set up with form fields and 2 of the fields seem to be buggy. For the most part all the fields submit to the admin but the issue is when I try to edit the form on the site after logging in, I get errors displayed in the email area (span data-eeEncEmail\_sPFGNXeWik=)(JavaScript must be enabled to view this email address)'/\> and the Web Address area.

The template code for those fields looks like this {exp:zoo\_visitor:update\_form include\_assets="yes" return="/employee-portal" } {exp:zoo\_visitor:details}

### Edit profile

```
            <label for="member_email_address">{label:member_email_address}</label>
            <input type="text" name="member_email_address" id="member_email_address" value='{if visitor:email_address}{visitor:email_address}{/if}'/>
        </p>
        <p>
            <label for="member_website">{label:member_website}</label>
            <input type="text" name="member_website" id="member_website" value="{if visitor:website}{visitor:website}{/if}"/>
        </p>
        <p>

```

Not sure why this is displaying in the form?

# Answer
**EDIT**

Scrap my last, I've worked out what your issue is. EE automatically encodes URL's and Email addresses on output! this is what you're seeing...

Unfortunatly there's no way to turn it off per use, so to speak...

What you'll have to do is turn off auto encoding (see below) for the Zoo Visitor channel (Zoo Visitor uses a channel to add extra fields to users), then call it manually whenever you want to display the encoded version (encoding basically turns URL's into links and email addresses into JS obfuscated output to stop crawlers).

You’ll need to turn off “Automatically turn URLs and email addresses into links?” here: Admin \> Channel Administration \> Channels \> \[Your Channel\] \> Edit Preferences.

To use the encoded version you can use the `{encode}` tag to force it.

That should get you rocking :) Let us know how you get on...

Looks to me like the `{visitor:email_address}` and `{visitor:website}` tags are returning HTML for the email address/website fields. i.e. for the email it looks like its serving you a span with some stuff in it, for the website it looks like a link. of course if you push these straight into the value fields they'll break all over the place.

Can you append the following to your template and let us know the output ?

```
<pre>
    {visitor:email_address}
    ----------------------------
    {visitor:website}
</pre>

```

Can you also tell us exactly what field type these 2 fields are (i'm guessing ome form of specific email address field and a Link field)? I can then take a punt at the exact answer for you... This should tell us if HTML is being output, then all we need to do if figure out how to get the correct value you're looking for!
> 0 votes

---
Tags: zoo-visitor
---


# Question
Title: Low Search - have channel as search criteria
I've been wrestling with this for too long and it's doing my head in now!

I am using the low search plugin for expressionengine and want to search: a) by keyword (which is working fine) b) by channel - selected by dropdown (which I can't get to work)

So the results would show channel entries with the relevant keywords ONLY in the selected channel.

Currently I have:

```
{exp:low_search:form
        form_class="header-search"
        form_id="search-keywords"
        required="keywords"
        result_page="search/results"
}
            <select name="searchChannel">
                <option value="channel1|channel2">All</option>
                <option value="channel1">Channel1</option>
                <option value="channel2">Channel2</option>
            </select>
            <input type="text" name="keywords"id="keywords">
            <input type="submit">
{/exp:low_search:form}

```

results page:

```
{exp:low_search:results
   disable="{gv:disable_default}"
   limit="18"
   orderby_sort="title|asc"
   query="{segment_3}"
}

```

I can pass through the searchChannel field through to the results page by adding:

```
{low_search_searchChannel}

```

to the results page; and of course I can set the channel filter in the results page by hard coding it:

```
channel="channel1"

```

but if I try:

```
channel="{low_search_searchChannel}"

```

I get nothing. There's probably a better way anyway to pass it straight in via the form tag, but have tried everything I can think of!

Thanks in advance

# Answer
> 1 votes
There is no need to approach it like that. Low Search handles both native and custom parameters the same: like this. So **any parameter can be an input field**.

That means that if you name your select element `channel`, you're already done, eg:

```
<select name="channel">
  <option value="channel1|channel2">All</option>
  <option value="channel1">Channel1</option>
  <option value="channel2">Channel2</option>
</select>

```

No need to set the `channel=""` param on the Results tag, let alone for PHP in your template.

Better still, since you're using the Keywords filter, you might want to consider targeting the `collection` param rather than `channel`, eg:

```
<select name="collection">
  <option value="">All</option>
  {collections}
    <option value="{collection_name}">{collection_label}</option>
  {/collections}
</select>

```

# Answer
> -1 votes
Ahhh, good old parse order :)

`{low_search_searchChannel}` can't be parsed until it is inside of the `{exp:low_search:results }` I would suspect. How about a little PHP to get you out of stuck-ville?

*PHP on Input*

```
<?php
    $query = ee()->uri->segment(3);
    $query = json_decode(base64_decode($query));
    //validate your channel here
    $channel = 'channel1|channel2'; //default
    if ( !empty ( $query->searchChannel ) ) {
        $channel = $query->searchChannel;
    }
?>
{exp:low_search:results
    disable="{gv:disable_default}"
    limit="18"
    orderby_sort="title|asc"
    query="{segment_3}"
    channel="<?php echo $channel ; ?>"
}

```

This should check if searchChannel was submitted (you can further check it where I put the comment) and fetch it into a PHP variable, completely seperate from low\_search. on output if `$channel` is empty (perhaps someone tried to inject something and it got cleaned) it puts the default channels in, synonymous with your All option.

Give that a little try and see how you get on.

**Edit**

Added code to examplify how to decode the Low Search URL parameter...

PS\> Making a site about biking or holidays per chance?? lol, I decoded your example from the comments, channel = tours, keywords = france.... :D

---
Tags: low-search, ee
---


# Question
Title: tracking down malware in expression engine
I am getting a malware warning from google but I can’t track down how to access these files/pages. not in the ftp or in the CMS. can anyone tell me were I should look?

http://www.tsgw.org/index.php?/member/email\_console/191/

http://www.tsgw.org/index.php?/member/icq\_console/416/

# Answer
> 1 votes
Google's diagnostic page for that site reveals some additional details. When I curl the page (not visiting it in my web browser to avoid any JavaScript or malicious client scripts from executing), I can see that there is an iframe injected at the bottom of the page just before the closing `</body>` tag:

```
<iframe name=Twitter scrolling=auto frameborder=no align=center height=2 width=2 src=http://plansweightloss.com/hewd.html?i=1885560></iframe></body>

```

It appears to be on ALL of your member pages, so I would look in your member theme templates first.

# Answer
> 0 votes
first steps would be to check your htaccess file(s) to see if anything strange is there. next check if there are any files or folders that shouuldn't be there. take specific care to files and folders that are 777

are you on shared hosting? You might want to contact your provider to see if they have any records of unwanted access or sql injections

# Answer
> 0 votes
These links are to your member templates. As Derek says get in there and check them out, it seems someone has managed to edit them...

Do you use the default member templates in your implimentation? If not you may be safest just deleting all the member templates from the server, otherwise someone with an account might be doing things you never even realised.

You can see the member template sif you goto /member and log in.

To delete them (I doubt this is best practice but it will remove the offending pages) take a gander in /themes/profile\_system. there are 2 folders in here that contain a myriad of 'member area' default templates that could allow users to much about. If you dleete them you can't use them (obviously) but you won't get those errors again!!!!

---
Tags: control-panel
---


title: Full Paths from WYGWAM?

text:
# Question
Title: Full Paths from WYGWAM?
EE 2.7.3c / WYGWAM 3.3.2 / MSM / Native EE File Management

All images/files are loaded on one domain but need to be used on both. WYGWAM is returning relative paths so the client has to manually insert the correct domain.

Is there a way to get WYGWAM to return a full path?

# Answer
> 1 votes
CKEditor has a "config.baseHref" parameter - check http://docs.cksource.com/ckeditor\_api/symbols/CKEDITOR.config.html Maybe use the wygwam\_config hook ( https://docs.pixelandtonic.com/wygwam/developers/wygwam\_config.html ) to set that parameter per site?

# Answer
> 1 votes
Missed the easy answer - I had relative paths configured on the file upload directories. Changed to full paths there and it comes through in WYGWAM.

---
Tags: wygwam
---


# Question
Title: Store module is working only the control panel logged in members
I am new to the Store module. Store module is working only the **Control Panel** logged in members. If I'm not logged into the Control Panel, Side bar Cart is showing that: "Your cart is empty". When I click on Add to Cart it's not working either. It is working only when CP is logged in.

How can I solve this? any Configuration settings please.

I am using ExpressionEngine 2.6.1 and Store module is: 1.6.4

# Answer
> 1 votes
There are no settings which would cause this to happen or known bugs.

It's likely to be caused by either caching on your front end, or a misconfiguration of your server. I suggest you start by disabling all caches, and also try different browsers etc.

# Answer
> 0 votes
I know it's late but one thing to note is that you have installed the cookie consent module and the user hasn't already given permission the cart tag creates an order in the CP but leaves the cart empty on the front-end.

---
Tags: expresso-store
---


# Question
Title: How can I integrate a reservation system with a retail based cart in EE?
We have a client who will be selling:

1. Memberships
2. Merchandise
3. Reservations for classes (prepay)

The classes have different rates based on the course. They are on various days, with limited spaces.

Ideally I would like to go with BrilliantRetail for the memberships/merchandise, and rEEservation for the classes, but I don't think there is an easy solution for integrating the two, in order to have a single checkout.

Has anyone managed to pull something like this off or have any ideas of what the best approach would be?

# Answer
> 1 votes
Cartthrob would be the way forward in my eyes. You'd have everything you need (after a few addons are bought). For the events, I'd go with Low Events and set it up in CT as a product channel. You could the use inventory like ticket/seats.

Channels \- merchandise, standard CT products \- membership, CT subscriptions. Re-billing is quite straightforward etc \- events, product channel with low events

I've only used brilliant retail once, and found it very limiting. Getting the right data out for the clients bookings etc would prob be a pain. I'd also check out the docs for rEEservations as I avoided using it in the past because it too is quite limiting.

Sounds like a good project! Good luck with it.

# Answer
> 1 votes
We are replacing a very faulty Magento store with BR for the exact same purpose. We sell Insurance Education courses, online and classroom. We store the courses as products and of course we have had to make a whole lot of modifications to make our stuff work due to the unique nature of our business but it should work out of the box for you unless you need some extra processing.

One of our requirements was to synchronize membership with our Oracle DB as well as verification for purchases, continuing education, etc. with data on our Oracle system. This required writing several extensions and plugins but we're almost done.

# Answer
> 0 votes
I know this is a bit old, but I'm going to pipe in with a link...

http://withchief.com/blog/expressionengine-selling-tickets-with-cartthrob

I'm just embarking on such a project, except there's likely to be hundreds of "events" - so I'm toying with using a matrix field for product options (with CT) and setting the date, time, location and "facilitator" within a matrix row.

---
Tags: shopping-cart, brilliantretail, reeservation
---


title: Template Routes help and tutorial

text:
# Question
Title: Template Routes help and tutorial
I read the EE Template Routes documentation, no have concrete tutorials and examples. It's hard to understand how to use it.

Does someone have a simple and concrete example ??

thanks

# Answer
You can start from this Mike Boyink's tutorial it is very clear and help me to understand better templates route
> 2 votes

---
Tags: template-routes
---


title: Channel image and htaccess redirection

text:
# Question
Title: Channel image and htaccess redirection
I'm working on a multilingual site.. Everything is working except Channel Images from DevDemon..

there is some infos and the structure

```
-root
|-index.php
|-fr
  |-index.php
  |-htaccess (fr)
|-en
  |-index.php
  |-htaccess (en)

```

root index is a simple 301 redirect using preg\_match as

```
if(preg_match('/en-us/', $_SERVER['HTTP_USER_AGENT'])){
    header("Location: http://wwww.domain.com/en/");
    exit();
}
else {
    // Permanent redirection
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: http://www.domain.com/fr/");
    exit();
}

```

the htaccess in fr and en folders look like

```
Options +FollowSymlinks
  RewriteEngine On

  RewriteCond %{HTTP_HOST} ^domain.com/en$
  RewriteRule ^(.*)$ http://www.domain.com/en/$1 [R=301,L]
  RewriteCond $1 !^(css|documents|images|img|js|en|fr|themes|admin|index\.php|favicon\.ico|robots\.txt|sitemap\.php|apple-touch-icon\.png|info\.php) [NC]
  RewriteCond $1 !^(index\.php)
  RewriteRule ^(.+)$ index.php?$1 [L,QSA]

```

and the index.php in eache fr and en folder are standard ee index.php with fr and en global variable as.:

```
$assign_to_config['site_url'] = 'http://domain.com/en/';
    $assign_to_config['deft_lang'] = 'english';
    $assign_to_config['global_vars'] = array(// This array must be associative
        "lang" => "en",
        "language" => "english" );

```

So far everything is fine .. but when i want to use Channel Images, i have to access domain.com/?Act=XX XX is integer And when i "Test Location" within Channel Image fieldtype.. i get this error : Request unsuccessful: error

Any ideas!?

THanks

UPDATE : I changed my method using this link : http://www.shortcuts.nl/index.php/weblog/comments/ee\_multi-language\_sites\_revisited/

Everything is working now... I guess the problem was the 301 redirection from the root index.php..

UPDATE #2 :

I had the same problem few times on different website and i found that having a index.html on the root was the problem!!! I then modified the htaccess and Voila!!..

# Answer
After posting this question, i had the problem several times (under subdomain, main account etc.. .)

I found that having a index.html file at the root was the problem!.. Removed the file and Voila!! it's working now..

I maybe should have change the htaccess to redirect the .html file but i didn't need it then...

Hope it will help someone!
> 0 votes

---
Tags: htaccess, redirects, channel-images, devdemon
---


title: Member page - 500 Error EE 2.10

text:
# Question
Title: Member page - 500 Error EE 2.10
After updating EE to 2.10.. I have a blank (500 error) when i try to edit a member!

I tried to

* flush all the cache,
* Create and edit new member
* Other browser

Any ideas?

Thanks!

UPDATE:

I replaced /expressionengine/controllers/myaccount.php with the 2.9.3 version and it's working..

# Answer
I believe I've found the answer.

If you want the quickest, non core file modifying answer, then it is simply Upgrade to PHP5.5 or better! Otherwsie read on...

Basically this all comes down to **PHP Version**. The actual issue is in the file `/system/expressionengine/controllers/cp/myaccount.php` as the OP suggests. The function at fault is `update_signiture()` and the line numbers are 1358 to 1365. Excerpt :

```
    // Do we have what we need in $_POST?
    if (empty(ee()->input->post('signature'))
        && empty(ee()->input->post('remove'))
        && (empty($_FILES) && ee()->config->item('sig_allow_img_upload') == 'y'))
    {
        return ee()->functions->redirect(
            cp_url('myaccount/edit_signature', $params)
        );
    }

```

Do you notice the function calls within the `empty()` statements? Well, according to the PHP Documentation on empty(), and I quote :

> Prior to PHP 5.5, **empty()** only supports variables; anything else will result in a parse error. In other words, the following will not work: **empty(trim($name))**. Instead, use **trim($name) == false**.

SO, armed with this knowledge the fix is quite straigh forward. If you are using PHP \< 5.5 you need to patch this statement, unfortunatly the advise on php.net will also cause the WSOD error, but what you can do is call the 2 `ee()->input->post()` functions prior to the `if` statement and test the result, or to make it easier update the code to the following :

```
    // Do we have what we need in $_POST?
    $sig = ee()->input->post('signature');
    $rem = ee()->input->post('remove');
    if (empty($sig)
        && empty($rem)
        && (empty($_FILES) && ee()->config->item('sig_allow_img_upload') == 'y'))
    {
        return ee()->functions->redirect(
            cp_url('myaccount/edit_signature', $params)
        );
    }

```

There you go, tested on a fresh install, that should get you rocking and rolling.

In point of fact, in EE 2.9.3 this code chunk is as so :

```
    // Do we have what we need in $_POST?
    if ( ! ee()->input->post('signature')
        && ! ee()->input->post('remove'))
    {
        return ee()->functions->redirect(
            cp_url('myaccount/edit_signature', $params)
        );
    }

```

So while the workaround (use myaccount.php from EE 2.9.3) will work, you are removing the added security checks for `empty($_FILES)` and `ee()->config->item('sig_allow_img_upload') == 'y'`. Either solution is as adaquate as the other IMHO, as either method results in core file changes. However if you use myaccount.php from an older version I would consider adding those 2 extra checks in so you don't lose any desired patch work EllisLabs have contributed.

I have submitted this bug to EllisLabs here : https://support.ellislab.com/bugs/detail/20954 , as they state the PHP requirment for 2.10.0 is PHP 5.3.10 or newer, either they can patch this function or change the requirement to \>PHP5.5.

Hope this helps someone on the bleeding edge of EE!

In order to regain the missing Account Edit screens, all you need to do is go into CP, then `Member -> Preferences` and update the `Allow New Member Registrations?` field to `Yes`.

I am just looking at why this effects the edit account screen now. I will add to my answer (and submit a bug report to EllisLabs, as you can replicate this behaviour out the box, fresh install) once I've ironed out why the My Account screen is now linked to the Allow New Member preference.
> 1 votes

# Answer
I found a solution/workaround...

I replaced /expressionengine/controllers/myaccount.php with the 2.9.3 version and it's working..
> 0 votes

---
Tags: control-panel, admin, member-management, member-details
---


# Question
Title: Expresso Store add shipping insurance based on Payment method
My customer wants to charge a 2% shipping insurance cost if the user selects credit card as Payment method is there a way to add tis cost in Expresso Store?

# Answer
> 2 votes
There is nothing out of the box that would allow you to do this. The best option would be to build an extension that uses one of store\_order\_recalculate hook to add the percentage to the order.

The other option would be to modify the payment gateway in question to add the 2%. If the gateway is one of the default you will need to reapply this each time you update Store.

# Answer
> 0 votes
You could create a "tax" for it, that applies to any country and region, and call it "Shipping Insurance". That seems to be the most straight way, but of course it would be applied to all payment methods.

View docs here

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


# Question
Title: Disable New Relic Script for one template
Is there any way to disable the New Relic script tag from being output in a single template?

EllisLab's docs say you can disable it via the control panel overall, but I really need it removed just from a single template (which becomes an email template).

https://ellislab.com/expressionengine/user-guide/monitoring/new-relic.html

Thanks!

# Answer
Have you tried the New Relic PHP api??

https://docs.newrelic.com/docs/agents/php-agent/configuration/php-agent-api

Specifically

```
newrelic_disable_autorum (  )

```

Perhaps if you turned PHP (output) on in your header embeds/templates, you could do something like this before your doctype declaration:

```
<?php
if (extension_loaded('newrelic') &&
    "{segment_1}/{segment_2}" == "email/contact")
{
    newrelic_disable_autorum();
}
?>

```
> 1 votes

# Answer
There's no way of doing this currently, but I can add it to our list of things to think about. Maybe a hidden config where you can add template group and template pairs:

```
$config['newrelic_template_ignore'] = array(
    'template_group/template',
    'other_template_group/*'
);

```
> 1 votes

---
Tags: email, javascript, html-email, settings, newrelic
---


# Question
Title: Why Is It Necessary to tell Expression where it is the file system and why more than once?
Don't say it's for flexibility! If flexibility is all that matters, where is software for making a whole website by typing everything freeform all into one field.

So we draw lines, make judgments, to make the system practical.

I AM MOVING AN EE SITE NOW Right now I am moving an ee site I have moved a few times, and every time, it is a super pain the butt.

I am going to give an example, below, of how EE handles a new path to where it runs, then how another system does it. I pray no one will defend the dumb way EE has this setup. I pray also the mastermind of this scheme, come forward, admit the problem, apologize, promise to fix it, and then fix it.

EXPRESSION ENGINE SETUP

ANOTHER SYSTEM

# Answer
You are probably not going to get the answer you are looking for and I have no idea why EllisLab chose to do what they did when building EE as I am not part of their team. Having said that I recommend you email them and ask them personally.

But to answer your main issue of changing paths and urls easily. EllisLab has setup EE to handle a bunch of configuration details via the config.php file in your system folder. More documentation for those can be found in their user guide. While not shipped with EE there are many great tools to help you with this Focus Lab Master Config is a free option that I use as a base for every site I work on, and allows easy migrations. I move at least a site or two a week for people and after the 15-20 minutes it takes to make sure everything is configured I can do a complete server move in under 5 minutes.
> 3 votes

---
Tags: config
---


title: Export it - Zoo Visitor

text:
# Question
Title: Export it - Zoo Visitor
Has anyone used the following add-on 'Export it' : https://mithra62.com/projects/feature/export-it/

I am looking to export all Zoo visitor members from the database and I've had no joy with "AJW\_Export". Anyone any advice if this add-on does the job?

Thanks

# Answer
> 1 votes
Zoo Visitor stores data as channel entires so you should be fine using Export It since it allows exporting of channel data. I have not personally tried exporting Zoo Visitor data but I assume passwords might be your only issue since they are not stored in the DB as plain text but are salted.

---
Tags: zoo-visitor, export, csv
---


title: Multilingual site - login landing pages

text:
# Question
Title: Multilingual site - login landing pages
We've got a site which is in 10 or so languages, each of them being contained in a template group, en, es, de etc - so essentially the index page of each of these template groups is the homepage of that language and usually, clients from that region don't go to any other language.

However, when they first login they go to the default template group - English - which is the site main template group. From there they choose the language they require.

Is there any way to skip this and have the user redirected to their own language page on login?

Anyone done something like this?

# Answer
Using template groups for different language identifiers is always going to be limiting and not easily scaleable, but to resolve your issue I'd suggest a redirect plugin that takes the user to a specific template that then decides where to take them: Login Redirect

But not sure what you're going to use as an identifier to know where to take them...? The previous plugin may have the option to return to original page, or you could use Page History to see which language page they came from before logging in and taking them there.

Alternatively use Freemember to handle your login which could be on your language page itself and I'm fairly certain can redirect back to the page they came from (if that's suitable).
> 1 votes

# Answer
You can either use 'pupe PHP' approach, as described in this EE SE thread.

Or you can use Browser Sniff add-on.
> 0 votes

# Answer
To expand on Peter's answer above,

I would add a hidden field named language and use EVOPost to send the value to another template which redirects the user based on the value of the hidden language field.
> 0 votes

---
Tags: multi-language
---