title: exp:channel:form ajax

text:
# Question
Title: exp:channel:form ajax
I am creating a form using exp:channel:form to add an entry to a channel using ajax I have a hidden title, utl\_title fields that are programmatically set and an entry\_id field that is initially set to 0. This works fine, with the data return returned from the ajax call I update the form that is created and set the entry\_id field with the return entry\_id so that in hopes that when the form is posted again it would update channel entry instead of adding another channel entry.

The problem is that everytime the form is posted it creates a new channel entry, is there a way using the ajax option to update the entry that was just previously posted?

Here is my form template and the JavaScript code I use to do the ajax call and update the form entry\_id field and url parameter.

```
Template Form
=============
{exp:channel:form channel="ads" json="yes" datepicker="no" include_assets="no" include_jquery="no" logged_out_member_id="2"}
    <input type="hidden" name="title"       id="ee_form_title"      value="">
    <input type="hidden" name="url_title"   id="ee_form_url_title"  value="">
    <input type="hidden" name="ad_email"    id="ee_form_ad_email"   value="">
    <input type="hidden" name="ad_image"    id="ee_form_ad_image"   value="">
    <input type="hidden" name="ad_message"  id="ee_form_ad_message" value="">
    <input type="hidden" name="ad_persona"  id="ee_form_ad_persona" value="">
    <input type="hidden" name="ad_tagline"  id="ee_form_ad_tagline" value="">
{/exp:channel:form}

JavaScript
==========
$('#publishForm').ajaxForm({
    dataType: 'json',
    async: false,
    cache: false,
    success: publishFormResponse
});

function publishFormResponse(responseText, statusText, xhr, $form) {
    if (statusText == "success") {
        // xhr.responseJSON.entry_id is always a new incremented id instead of the id from the first form post
        if (!entry_id) {
            // Update the form entry_id field and the form entry_id url parameter
            entry_id = xhr.responseJSON.entry_id;
            $("#publishForm .hiddenFields input[name='entry_id']").val(entry_id);
            $('#publishForm').attr('action', $('#publishForm').attr('action').replace("entry_id=0", "entry_id="+entry_id));
        }

    } else {
        alert('Failed with the following errors: '+data.errors.join(', '));

    }
}

```

# Answer
> 1 votes
I ran into the same problem. After talking to EE support, they informed me I'd need to update the meta hidden field as well if I wanted to update the entry, instead of creating a new one.

The meta hidden field is an encrypted string representing the settings for the form. This includes the entry\_id, so if the meta value isn't updated, it posts a new entry instead of updating.

A module could be written to do this, and I may do that at some point, but I ended up getting the meta value I needed by creating a template, passing it the newly-created entry\_id (the one you want to edit) as a segment variable, asynchronously calling the template and grabbing the meta value from the returned HTML.

The template that';s called just contains a Channel Form tag pair with the entry\_id parameter set to the entry\_id you want to edit (the segment variable I passed in). When the template is called, it renders out a new form that contains the meta value you need.

At that point, all you have to do is grab the meta value from the returned HTML and replace your initial form's meta hidden field value with the new one. Once you've done that, you'll be able to update the form.

It definitely feels a little wonky to do it this way, but it got the job done. A module would be cleaner, but since I was already working with AJAX it didn't seem egregious to handle the meta update this way.

---
Tags: safecracker, ajax, update
---


title: Low Variables parsing grid

text:
# Question
Title: Low Variables parsing grid
I'm using Low Variables. This specific variable is of the type 'Grid'. What I'm having in my template is this:

`<select name="country" id="country" class="form-control">
 {exp:low_variables:pair var="var_eleads_country"}
 <option value="{var_eleads_country:code}">{var_eleads_country:label}</option>
 {/exp:low_variables:pair}
</select>`

In my actual template though, it doesn't work. I'm only seeing one option, with {var\_eleads\_country:code} as value and {var\_eleads\_country:label} as text.

What should I do?

EDIT: This is happening inside of a Freeform. Also, I'm using Croxton's Stash. This is the stash\_template, but the Form itself is wrappen in a {stash:nocache}.

# Answer
Alright, I did a fix.

I renamed my en, fr and es fields with a prefix label\_.

In my template I did this:

`{/stash:nocache}
 {exp:low_variables:parse var="var_eleads_countries"}
 <option value="{var_eleads_countries:code}"> {var_eleads_countries:label_{segment_1}}</option>
 {/exp:low_variables:parse}
{stash:nocache}`

The nocache tag is wrapped around my form, but it's important to close it and reopen it when parsing here, because otherwise, you'll have parsing issues on the {segment\_1} tag.

Also, I fixed my typ in the var (*insert shame here*), which had to be var\_eleads\_countries rather than var\_eleads\_country.
> 1 votes

---
Tags: solspace-freeform, stash, low-variables, low, parsing
---


title: Nolan, not available as Grid field

text:
# Question
Title: Nolan, not available as Grid field
I've installed Nolan 2.5.1 in EE 2.9.2. It's showing up ok in Addons \> Plugins, but with the wrong version number. It's showing as version 1.0 . It's also not showing up as an option as an option under data type when I set up a Grid Field type:

# Answer
> 2 votes
Simple answer in the end, forgot to install the field type as well.

---
Tags: nolan
---


# Question
Title: Updated to 2.9.3, Unknown column 'order' in 'order clause'
we've recently updated a website to EE 2.9.3, but when linking to an non existent page, it should redirect to a 404 page. Instead, we get this:

Error Number: 1054

Unknown column 'order' in 'order clause'

SELECT `route_parsed`, `template_name`, `group_name` FROM (`exp_templates`) JOIN `exp_template_routes` ON `exp_templates`.`template_id` = `exp_template_routes`.`template_id` JOIN `exp_template_groups` ON `exp_templates`.`group_id` = `exp_template_groups`.`group_id` WHERE `route_parsed` is not null AND `exp_templates`.`site_id` = '1' ORDER BY `order`, `group_name`, `template_name` ASC

Filename: libraries/Template\_router.php

Line Number: 83

Now, I checked the database and there is indeed no 'order' in exp\_templates. To know what type this field should be, I did a clean install elsewhere on 2.9.3 and noticed this field isn't there at all. The request to it though, in Template\_router.php, is.

Any ideas?

Thanks!

# Answer
> 0 votes
Thought I'd contribute an 'answer' as I hate unanswered questions!

You are correct in your comment, I have looked at the upgrade files with a fresh install of 2.9.3 and the order column you mention is actually added during the upgrade to EE 2.9.0. There is an excerpt below :

```
/**
 * Add a column to the Template Routes table for storing the parse order
 *
 * @access private
 * @return void
 */
private function _update_template_routes_table()
{
    ee()->smartforge->add_column(
        'template_routes',
        array(
            'order' => array(
                'type'          => 'int',
                'constraint'    => 10,
                'unsigned'      => TRUE,
                'null'          => TRUE
            )
        )
    );
}

```

As you can see, it is indeed a column of type `INT`, also to answer your question on the type of the field, as you can see it is an ``order` INT(10) unsigned DEFAULT NULL` in SQL syntax.

As to why this column was not added during your update, I can't be sure, and this is definatly something to report to ElliLabs as an upgrade bug. Remember you mention what version you are upgrading from too!

However, with the above info you should be able to at least replicate this missed upgrade. In case it helps I can confirm that there are no database changes at all from 2.9.0 to 2.9.2, there are a few changes in 2.9.0 and 2.9.3, prior to 2.9.0 upgrade the last database change was upgrading to 2.8.0 (there's a number of changes here!).

In case your interested the updates with version numbers are in the folder `/system/installer/updates/*` **prior** to installing, obviously once you've deleted your install folder these files are gone! You can read them and make sure the changes have been applied to help you debug what went wrong and where during upgrade.

Hope this helps at least re-assure you that your patch is right!

---
Tags: error, update
---


# Question
Title: Simple search form shows entries with closed status
I use the following simple search tag:

```
{exp:search:simple_form channel="content|symposium|whos_who|nieuws" results="9" search_in="entries" where="all" result_page="zoeken/index" no_result_page="zoeken/no-result" status="not closed"}

```

But weirdly enough, it displays entries when the search is done which are closed. It doesn't matter what I put the status parameter on. How can this happen?

# Answer
Your question peaked my interest, so I put together a test on my sandbox. I admit this is an out of date EE2.8.1.

I tried out a number of variations however the one thing that springs out to me is that the "not" in status seems to cause unexpected results. For example I did a search with `status="not open"` and got no results (expecting 2), when I say "no results" I mean I got an error message about invalid action! Certainly not as expected.

I re-did the search with `status="closed"` and immediately got the 2 results I was execting.

So my conclusion is that the not part seems less than iron cast. through experimentation can I suggest you list the acceptible statuses in the status attribute, instead of "not" statuses?

If this works out for you, I'd perhaps pose it as a bug...
> 1 votes

# Answer
Turns out it was a bug in the module Publisher. If anyone is experiencing the same problem, update Publisher and if that doesn't work, contact Boldminded.
> 0 votes

---
Tags: search, status, simple-search
---


title: Unable to upload PDF using File Upload

text:
# Question
Title: Unable to upload PDF using File Upload
I have a channel that includes a File field type. I have set two user groups to be able to upload all file types to that field. As a Super Admin I am able to upload there, but members of the other group cannot. I have set the upload directory permissions to 777 and I have confirmed that the group has permissions in EE to upload there - see attached. However, when logged in as a user of the other group, when I try to upload a PDF, I get an error that says:

> The file could not be written to disk.

The file size is far less than the max file site allowed.

Normally I would think this is a directory permissions error. Any help would be appreciated for sorting this out.

# Answer
> 3 votes
With that error when uploading a PDF the first thing to take a look at is *Admin ‣ Security and Privacy ‣ Security and Sessions* and see whether *"Apply XSS Filtering to Uploaded Files"* is set to *"yes."* If it is, try setting it to *"no"* instead.

If that clears it up and you don't want to globally stop applying XSS filtering to uploaded files then there is a config override that will let you make only certain member group(s) exempt from the filtering. For example:

```
$config['xss_clean_member_group_exception'] = "6|7";

```

See this answer for more.

---
Tags: file-uploads, error, permissions
---


title: EE Built in contact form

text:
# Question
Title: EE Built in contact form
I'm using the built in contact form, but the only element that gets emailed is the message. Nothing else.

```
{exp:email:contact_form user_recipients="no" recipients="nick@pixelsandcode.co.uk" charset="utf-8" form_class="form form--full"}
    <p id = "ajax-message"></p>
    <fieldset class="controls">
        <label for="from" class="controls__label">Your Email:</label><br />
        <input class="controls__control" type="text" id="from" name="from" size="40" maxlength="35" value="{member_email}" />
    </fieldset>
    <fieldset class="controls">
        <label for="budget" class="controls__label">Your Budget:</label><br />
        <input type="hidden" name="budget[]" value="--Your Budget--" />
        <input class="" type="range" name="budget" id="budget" min="1000" max="10000" step="1000" value="3000" oninput="outputUpdate(value)" list="ticks" />
        <datalist id="ticks">
            <option>1000</option>
            <option>2000</option>
            <option>3000</option>
            <option>4000</option>
            <option>5000</option>
            <option>6000</option>
            <option>7000</option>
            <option>8000</option>
            <option>9000</option>
            <option>10000</option>
        </datalist>
        <output for="range" id="your_budget" class="output">£3000</output>
        <script>
            function numberWithCommas(x) {
                return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
            }
            function outputUpdate(amount) {
                document.querySelector('#your_budget').value = "£"+numberWithCommas(amount);
            }

        </script>
    </fieldset>
    <fieldset class="controls">
        <label for="message" class="controls__label">Message:</label><br />
        <input type="hidden" name="message[]" value="--Message--" />
        <textarea class="controls__control" id="message" name="message" rows="18" cols="40"></textarea>
    </fieldset>
    <fieldset class="controls">
        <label for="extra" class="controls__label">Extra:</label><br />
        <input type="hidden" name="extra[]" value="--Extra--" />
        <textarea class="controls__control" id="extra" name="extra" rows="18" cols="40"></textarea>
    </fieldset>
    <fieldset class="controls">
        <input name="submit" type='submit' value='Submit Form' class="btn btn--primary" />
    </fieldset>
{/exp:email:contact_form}

```

What am I doing wrong here?

# Answer
> 1 votes
The Email module doesn't know what to do with arbitrary POST data, it can only recognize fields that it is looking for. To build an email from multiple fields, use only the `message` field, but as an array. e.g.:

```
<input type="text" name="message[]" />
<textarea name="message[]"></textarea>

```

---
Tags: email-contact-form
---


# Question
Title: Is it possible to set up a custom date range for a Low Entries tag that looks for events in the current school year?
I'm having trouble figuring out how to do this - I have a Low Events template tag that I'd like to set up with a custom date range that searches for events within the current year, BUT that current year is based on a Jul-Aug span instead of a Jan-Dec span. Any guidance or examples would be hugely appreciated!

# Answer
According to the Low Events documentation on custom date ranges:

> There are two ways to define a custom date range: using just the `date` parameter or using both the `date_from` and `date_to` parameters.

If you opt to use just the `date` parameter then you'll want to use a `;` to separate the start and end dates. For example:

```
{exp:low_events:entries
    channel="events"
    disable="categories|category_fields|member_data|pagination"
    date="2014-09-01;2015-06-12"
}
    <li>{title}</li>
{/exp:low_events:entries}

```

Check the documentation for the Entries tag and if you are still having trouble after that, update your original question with some template code and I can try to be more specific.
> 0 votes

---
Tags: date, low, events, custom
---


# Question
Title: XSS cleaning for discussion forum module
How do I clean a discussion forum post from XSS attacks in EE?

A bit of background, I'm using the EE discussion module and I've dropped in ckeditor so the user can easily embed youtube/vimeo videos and images. I set "HTML Formatting in posts" to "Allow all HTML" so it will accept the iframed videos. However this leaves it open to XSS attacks as users can then put in any scripts they like. I'd like to whitelist just iframes to youtube & vimeo, links, images and a few tags like p and strong.

I thought of adjusting the settings in the discussion module but they seem very much hardcoded. I thought of using http://htmlpurifier.org/ to whitelist tags but the forum\_submit\_post\_start hook doesn't contain the post content and I guess by the time the forum\_submit\_post\_end hook is called it's too late.

Any ideas?

# Answer
You have tried to use this simple solution: https://devot-ee.com/add-ons/custom-bbcode ?
> 0 votes

---
Tags: forum, xss
---


title: I can't add mailto-links with Editor

text:
# Question
Title: I can't add mailto-links with Editor
We're using Editor (3.2.3) but we can't add a mailto-link. When using the link-button you get 3 options: URL, Site page and Email. When selecting e-mail we see a dropdown with the label 'link item' but the dropdown is empty. When creating a link this way it creates a empty href.

Any idea how to do this?

# Answer
Contact our DevDemon support. I believe this has been fixed with a bugfix.
> 1 votes

# Answer
I went over to Redactor to try the editor out but the standard 'link' button behaves differently to how you describe. When I click the link icon it drops down with "Insert Link" and "Unlink".

Incidentally, if I select "Insert Link" I get 2 text boxes for "URL" and "Text" and a checkbo for "Open link in new tab", if I enter URL:`mailto:me@my.com` Text:`me@my.com` I get a mailto link exactly as I wanted!

Perhaps you could try adding a "URL" link, and for the URL entering the full mailto syntax, does that give you a decent link??

Also, can I ask what Redactor plug ins are loaded in with Editor? I don't have a licence to download Editor from DevDemon so I can't see for myself! Perhaps its loading the PredefinedLinks or another custom plugin to allow for EE integration (Site page for router pages, ect)?
> 0 votes

---
Tags: devdemon, editor
---


# Question
Title: Connection refused (error 111) when sending SMTP mail
Have a site where when sending mail using an SMTP connect, I'm getting a "connection refused" error.

When sending email using PHP or Sendmail, site owner is not receiving the emails at all.

Site is hosted on GoDaddy... and can't be moved to new hosting company.

# Answer
> 0 votes
Turns out that I needed to enable "Remote Mail Exchanger" setting in the MX Records section of the cPanel.

Once I did this, I was able to use PHP mail.

---
Tags: email, godaddy
---


# Question
Title: Expresso Store - Register Member not working
Can't seem to get the register member on Expresso Store v2.4.1 to work.

I've the following but submitting the form does nothing (stay on same page):

```
{if logged_out}
    <fieldset id="register_member">
    <legend>Member Account</legend>

    {field:register_member} <label for="register_member">Register Member Account?</label>

    <!-- These fields are optional -->
    <div class="toggle">
      <div>
        <label for="password">Password</label>
        {field:password}
      </div>

      <div>
        <label for="password_confirm">Confirm Password</label>
        {field:password_confirm}
      </div>

      <div>
        <label for="username">Username</label>
        {field:username}
      </div>

      <div>
        <label for="screen_name">Screen Name</label>
        {field:screen_name}
      </div>
    </div>
    </fieldset>
    {/if}

```

Do I need anything else for this to work. I have allow new member registrations set to yes in the member preferences?

I've even tried the register\_member="yes" on the checkout form which allowed me through to the next page but still no account has been created.

# Answer
> 1 votes
Ok needed register\_member="yes" on the checkout form. NOTE: The member account only gets created if the order is successful.

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


title: Create WordPress Export File

text:
# Question
Title: Create WordPress Export File
I'm working with a client that wants to migrate from ExpressionEngine to WordPress. I have an EE template that is supposed to (and seems to) generate a WP XML Import file.

However, when I import the file into my new WP installation, only the very last entry is imported. Everything associated with that entry is correct, but it skips the hundreds of posts that precede it.

Here is my EE template code. Is there something that I'm missing?:

```
<?xml version="1.0" encoding="UTF-8" ?>
<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your site. -->
<!-- It contains information about your site's posts, pages, comments, categories, and other content. -->
<!-- You may use this file to transfer that content from one site to another. -->
<!-- This file is not intended to serve as a complete backup of your site. -->

<!-- To import this information into a WordPress site follow these steps: -->
<!-- 1. Log in to that site as an administrator. -->
<!-- 2. Go to Tools: Import in the WordPress admin panel. -->
<!-- 3. Install the "WordPress" importer from the list. -->
<!-- 4. Activate & Run Importer. -->
<!-- 5. Upload this file using the form provided on that page. -->
<!-- 6. You will first be asked to map the authors in this export file to users -->
<!--    on the site. For each author, you may choose to map to an -->
<!--    existing user on the site or to create a new user. -->
<!-- 7. WordPress will then import each of the posts, pages, comments, categories, etc. -->
<!--    contained in this file into your site. -->

<!-- generator="WordPress/3.3.2" created="2012-06-25 23:09" -->
<rss version="2.0"
    xmlns:excerpt="http://wordpress.org/export/1.1/excerpt/"
    xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:wfw="http://wellformedweb.org/CommentAPI/"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:wp="http://wordpress.org/export/1.1/"
>

<channel>
    <title>{site_name}</title>
    <link>{site_url}</link>
    <description></description>
    <pubDate></pubDate>
    <language>en</language>
    <wp:wxr_version>1.1</wp:wxr_version>
    <wp:base_site_url>http://domain.com/</wp:base_site_url>
    <wp:base_blog_url>http://domain.com/</wp:base_blog_url>

    <generator>http://wordpress.org/?v=3.3.2</generator>
{exp:channel:entries {if segment_3 != ""}channel="{segment_3}"{/if} orderby="date" sort="desc" limit="500" rdf="off" }

    <item>
        <title>{exp:xml_encode}{title}{/exp:xml_encode}</title>
        <link></link>
        <pubDate>{entry_date format="%r"}</pubDate>
        <dc:creator><![CDATA[{author}]]></dc:creator>
        <guid isPermaLink="false">http://domain.com/?p={entry_id}</guid>

        <description></description>

        <excerpt:encoded><![CDATA[{summary}]]></excerpt:encoded>
        <content:encoded><![CDATA[{body}
         ]]></content:encoded>

{categories}
        <category domain="category" nicename="{category_url_title}"><![CDATA[{category_name}]]></category>
{/categories}

        <wp:post_type>post</wp:post_type>
        <wp:post_id></wp:post_id>
        <wp:post_date>{entry_date format="%Y-%m-%d %H:%i:%s"}</wp:post_date>
        <wp:post_date_gmt>{gmt_date format="%Y-%m-%d %H:%i:%s"}</wp:post_date_gmt>
        <wp:comment_status>open</wp:comment_status>
        <wp:ping_status>open</wp:ping_status>
        <wp:post_name>{url_title}</wp:post_name>
        <wp:status>{if status == "open"}publish{if:elseif status == "review"}pending{if:elseif status == "closed"}private{if:elseif status == "draft"}draft{if:else}publish{/if}</wp:status>
        <wp:post_parent>0</wp:post_parent>
        <wp:menu_order>0</wp:menu_order>
        <wp:post_password></wp:post_password>
        <wp:is_sticky>0</wp:is_sticky>
        <wp:postmeta>
            <wp:meta_key>_edit_last</wp:meta_key>
            <wp:meta_value><![CDATA[1]]></wp:meta_value>
        </wp:postmeta>
        <wp:postmeta>
            <wp:meta_key>_su_rich_snippet_type</wp:meta_key>
            <wp:meta_value><![CDATA[none]]></wp:meta_value>
        </wp:postmeta>
        <wp:postmeta>
            <wp:meta_key>_encloseme</wp:meta_key>
            <wp:meta_value><![CDATA[1]]></wp:meta_value>
        </wp:postmeta>
    </item>
{/exp:channel:entries}
</channel>
</rss>

```

# Answer
I found the answer. The way the XML file was being rendered, there was no line break between the item closing tag, and the next item's opening tag (`</item><item>`).

This passed all validation tests, but WP wouldn't process it properly. I added the line breaks, and everything worked as expected.

Thanks to everyone for the effort!

ty
> 0 votes

---
Tags: templates, xml
---


# Question
Title: Is it necessary to hide the system folder from search robots?
Does this make any sense in a robots.txt?

User-Agent: * Disallow: /your\_system\_folder

I'm guessing since the robots.txt file can be read it makes it even more dangerous to expose the system folder's name... but, is that folder hidden from bot's eyes'?

# Answer
> 1 votes
I would not put it in your robots.txt file. As you noted, it exposes the path to your system folder. Malicious bots or users will certainly look at that file and poke around the paths you have in there. So long as you don't have a hyperlink to your system folder in your site, an SEO bot won't stumble upon or find it anyways

---
Tags: security, seo
---


# Question
Title: How do you correctly display entry tags within a tagger:entries_quick loop?
I have a News landing page with Tagger tags displayed by each entry. You can filter the view with tags, but once the entries are displayed within the `tagger:entries_quick` loop, the `tagger:tag_name` variable is overridden by the tag that defines the loop.

That is to say, all the tags for each entry render as the tag we're filtering by, but the `tagger:urlsafe_tagname` is correct.

Example:

Output of the standard entries loop output:

```
Related tags for this post:
<a href="/tag/tag-1">Tag 1</a>
<a href="/tag/tag-2">Tag 2</a>

```

Output of the `tagger:entries_quick` loop, filtered by Tag 1:

```
Related tags for this post:
<a href="/tag/tag-1">Tag 1</a>
<a href="/tag/tag-2">Tag 1</a>

```

Hopefully I'm missing something? Is there a different variable for use within this loop?

# Answer
> 1 votes
Try utilizing the "prefix" parameter to avoid variable collisions:

```
{exp:tagger:entries_quick prefix="test"}
    <a href="{test:urlsafe_tagname}">{test:tag_name}</a>
{/exp:tagger:entries_quick}

```

---
Tags: tagger
---


title: Can't get Wyvern to show YouTube button

text:
# Question
Title: Can't get Wyvern to show YouTube button
I want to add the YouTube button to Wyvern fields. I enabled it in Wyvern's config.php:

```
    'Styles' => 'no',
    'Syntaxhighlight' => 'no',
    'YouTube' => 'yes',

```

etc...

placed the YouTube plugin in the correct folder http://ckeditor.com/addon/youtube

and added

```
config.extraPlugins = 'youtube';

```

to CKEditor's config.js.

The button shows up in Wyvern's config screen in EE, but does not show up in the Wyvern fields.

# Answer
> 1 votes
Stop the presses,

I don't see in your question if you followed the documented process over at bold minded here : https://boldminded.com/add-ons/wyvern/documentation (all my quotes below are from this site)

So Step one (which I assume you've done as you can see it in the field list) :

> Adding 3rd Party Plugins (after version 1.2.7)
>
> Place your CKEditor plugin inside the /themes/third\_party/wyvern/plugins/ folder. In the ExpressionEngine control panel go to Add-ons » Fieldtypes » Wyvern and select your plugin in the multi-select menu to enable it.

Now, Step 2 all you need to do is add it to the toolbar :

> Adding buttons to the toolbar
>
> By default, Wyvern intentionally comes with a limited set of CKEditor buttons in the Fieldtype settings page. I have chosen to keep the default list to the essentials for simplicity. If a button you need is not found in the Toolbar list, open the system/expressionengine/third\_party/wyvern/config.php file. You will see an array which defines the default list, as well as the rest of the available CKEditor buttons, which are commented out. To enable a button, simply remove the code comment prior to that button. Go back to the Add-ons \> Fieldtypes \> Wyvern page and the button will be available within the Toolbar list.

**Note** This is not CKEditors "config.js" but Wyverns "config.php".

I'm not sure from your question if you have seen this page or anything, but can you try this process and let us know how you get on! I would recommend rolling your changes back and trying this first...

---
Tags: wysiwyg, wyvern
---


title: Add tags to Safe HTML

text:
# Question
Title: Add tags to Safe HTML
When I select "Allow only safe HTML" for EE's discussion forum it correctly allows tags for links, images, bold etc but it doesn't seem to allow `<ol>` or `<li>`. Is there any way to add these to the list of safe HTML tags for EE?

# Answer
**Word of Warning** First let me warn you the below technique involved modifying core files, and is not recommended. If you update EE you may overwrite these chnages!

What you want to do is add tags to the EE Typography class. `/system/expressionengine/libraries/EE_Typeography.php`.

To add UL, OL and LI open this file, look to lines 143 to 165 (ish), you will see sometihng like this :

```
    /** -------------------------------------
    /**  Allowed tags
    /** -------------------------------------*/

    // Note: The decoding array is associative, allowing more precise mapping

    $this->safe_encode = array('b', 'i', 'em', 'del', 'ins', 'strong', 'pre', 'code', 'blockquote');

    $this->safe_decode = array(
        'b'             => 'b',
        'i'             => 'i',
        'em'            => 'em',
        'del'           => 'del',
        'ins'           => 'ins',
        'strong'        => 'strong',
        'pre'           => 'pre',
        'code'          => 'code',
        'blockquote'    => 'blockquote',
        'quote'         => 'blockquote',
        'QUOTE'         => 'blockquote'
    );

```

To allow the BB style version, add the tags to the `safe_decode` array, to allow the html version to be encoded as well add them to the `safe_encode` array. So to allow both BB and HTML OL's and UL's :

```
    /** -------------------------------------
    /**  Allowed tags
    /** -------------------------------------*/

    // Note: The decoding array is associative, allowing more precise mapping

    $this->safe_encode = array('b', 'i', 'em', 'del', 'ins', 'strong', 'pre', 'code', 'blockquote', 'ol', 'ul', 'li');

    $this->safe_decode = array(
        'b'             => 'b',
        'i'             => 'i',
        'em'            => 'em',
        'del'           => 'del',
        'ins'           => 'ins',
        'strong'        => 'strong',
        'pre'           => 'pre',
        'code'          => 'code',
        'blockquote'    => 'blockquote',
        'quote'         => 'blockquote',
        'QUOTE'         => 'blockquote',
        'ol'            => 'ol',
        'ul'            => 'ul',
        'li'            => 'li'
    );

```

Enjoy :) Mark as answer if you accept :D
> 1 votes

---
Tags: xss, discussion
---


title: Comment Page URL for entry

text:
# Question
Title: Comment Page URL for entry
So. I have one channel 3 categories in this channel and 5 entries

Every entry need comment form

How i can do that? What i should put in Channel Preferences - Comment Page URL ? And how to create template for comments?

# Answer
> 1 votes
You'll need to read and understand the documentation for this : https://ellislab.com/expressionengine/user-guide/add-ons/comment/ You can go down to here for the comment form specifically.

The Comment Page URL is also explained throughout this page, the Channel Preferences form field is also explained here

Essentually the Comment Page URL is really for if you have all your comments on the one page...

---
Tags: ee2
---


# Question
Title: Grid with Bootstrap carousel not displaying correctly.
I am using bootstrap carousel with EE's Grid and the page is not displaying correctly. All 3 slides are displaying on top of each other. I think its the "active" class is being applied to each slide in each div. I think I need a conditional on the active class but I don't know how to do it.

here is the code:

```
    <div class="carousel slide" data-ride="carousel" id="carousel-example">
            <ol class="carousel-indicators">
                <li data-target="#carousel-example" data-slide-to="0" class="active"></li>
                <li data-target="#carousel-example" data-slide-to="1"></li>
                <li data-target="#carousel-example" data-slide-to="2"></li>
            </ol>

            <div class="carousel-inner">
                  {exp:channel:entries channel="slider" {snp-disable}}
                  {home_page_slider}
                <div class="item active"><img src="{home_page_slider:slider_image}" alt="Slide"></div>
                   {/home_page_slider}
                    {/exp:channel:entries}

             </div>

            <a href="#carousel-example" class="left carousel-control" data-slide="prev">
                <span class="glyphicon glyphicon-chevron-left"></span>
            </a>
            <a href="#carousel-example" class="right carousel-control" data-slide="next">
                <span class="glyphicon glyphicon-chevron-right"></span>
            </a>

        </div>

```

# Answer
Here's what I would do:

```
{exp:channel:entries channel="slider" {snp-disable}}
{if count == "1"}
<div class="carousel slide" data-ride="carousel" id="carousel-example">
        <ol class="carousel-indicators">
            <li data-target="#carousel-example" data-slide-to="0" class="active"></li>
            <li data-target="#carousel-example" data-slide-to="1"></li>
            <li data-target="#carousel-example" data-slide-to="2"></li>
        </ol>
<div class="carousel-inner">
{/if}

    {home_page_slider}
    <div class="item{if home_page_slider:count == "1"} active{/if}">
        <img src="{home_page_slider:slider_image}" alt="Slide">
    </div>
    {/home_page_slider}

{if count == total_results}
</div>
<a href="#carousel-example" class="left carousel-control" data-slide="prev">
            <span class="glyphicon glyphicon-chevron-left"></span>
        </a>
        <a href="#carousel-example" class="right carousel-control" data-slide="next">
            <span class="glyphicon glyphicon-chevron-right"></span>
        </a>
{/if}
{/exp:channel:entries}

```

That way if the entries loop fails to get your content, none of the carousel markup would display either
> 0 votes

# Answer
Simply check the count and output the active class in the first item that you iterate:

```
{if home_page_slider:count == "1"}active{/if}

```

Or specifically using your example:

```
<div class="item{if home_page_slider:count == "1"} active{/if}">

```
> 0 votes

---
Tags: grid, bootstrap
---


# Question
Title: MSM & Super Search results howto retrieve site info for each result
We're using MSM with Solspace Super Search, each sub site is reached through a subdomain, eg:

site\_1.oursite.com

site\_2.outsite.com

But, on a search results page that displays results from across all sites, all of the path tags I have tried, such as 'auto\_path', get resolved to the current sub domain for all results, and not to the site for each entry.

I could group the results according to sub domain and then set the paths, but is there a way to get the full path for each entry without doing this?

```
    {exp:super_search:results paginate="bottom" limit="40"}
        <?php $class = {count} % 2 == 0?'even':'odd';?>
        <tr>
        <td class="<?=$class?>" width="30%" valign="top"><b><a href="{url_title_path='/article'}">{title}</a></b></td>
        <td class="<?=$class?>" width="10%" valign="top">{author}</td>
        <td class="<?=$class?>" width="10%" valign="top">{entry_date format="%d/%m/%y"}</td>
        </tr>

        {paginate}
                <p>Page {current_page} of {total_pages} pages {pagination_links}</p>
        {/paginate}

    {/exp:super_search:results}

```

# Answer
> 1 votes
Which version of EE and Super Search are you using? I tested this with each of these variables and they worked perfectly (of course, each one needs to be configured manually for each channel's preferences in each site):

* {auto\_path}
* {comment\_auto\_path}
* {comment\_entry\_id\_auto\_path}
* {comment\_url\_title\_auto\_path}

---
Tags: solspace, multi-site-manager
---


# Question
Title: "Only allowed to search every 15 seconds" setting for non-logged-in users?
According to EE documentation, you can set the 'seconds between searches' for each member group. But where is the setting for members who are not logged in?

# Answer
Anyone that's not logged in is part of the "Guest" group:

Members \> Member Groups \> Edit Member Group (Guest)

Should be here:

/system/index.php?S=0&D=cp&C=members&M=edit\_member\_group&group\_id=3
> 6 votes

---
Tags: search
---


# Question
Title: How to correct misformatted URLs in input
I'm trying to use Low Replace to correct URLs in a standard text field in EE.

Sometimes the URL is inputted correctly, for example http://www.a-website.com other times they are inputted incorrectly ie www.another-website.com

I think I nearly have the solution, but the colon after http isn't being rendered on the page, so the corrected URL for the above example comes out as http//www.another-website.com. Please see my code below.

```
{exp:low_replace find="www." replace="http://www."}
    <p><a href="{website}" target="_blank">Website</a></p>
{/exp:low_replace}

```

# Answer
A lot of people doesn't know, but EllisLab has a first party add-on for that:

```
<p><a href="{exp:valid_url}{website}{/exp:valid_url}" target="_blank">Website</a></p>

```

There's several first party add-ons available for download, despite not included on EECMS by default.
> 2 votes

---
Tags: url, low-replace
---


# Question
Title: How to keep EE from rendering invalid urls as valid pages?
Google's Webmaster Tools tells me I have a bunch of pages without titles. Upon examining the URLs listed, it would appear these are a mix of faulty links, deleted posts, changed titles. Somewhere, they must still be referenced (probably not on my site), and because the url structure is essentially correct, EE outputs a page with everything but an entry on, so of course it lacks a title.

What are the options for dealing with something like this? I may be somewhat limited by the fact that I use some non-standard rewrites to compensate for how the site was initially setup. I'll include an example below:

```
RewriteRule ^/?((About|Contact|Copyright|Privacy_Policy|Search)(/.*)?)$ /index.php/Westeros/$1 [NC,L]
RewriteRule ^/?((Digest|Links|Store|Updates)(/.*)?)$ /index.php/$1 [NC,L]
RewriteRule ^/?Citadel/((Editions|Spoilers)(/.*)?)$ /Citadel/index.php/Citadel/$1 [NC,L]
RewriteRule ^/?Citadel/((Articles|Concordance|FAQ|Gallery|Heraldry|Prophecies|SSM)(/.*)?)$ /Citadel/index.php/$1 [NC,L]

```

The first rule is of course an iffy one, since it breaks the rule of not taking out template groups. The second is just a variant on the typical index.php removal.

The third and fourth rules exemplify the same thing except for one of the subsites which reside in an actual subdirectory and use their own index.php (but the same .htaccess).

Given that setup, is there anything I can do to keep EE from treating incorrect urls following /Entry/ as valid pages?

# Answer
It sounds like you have single entry pages that should be outputting a 404 instead of rendering the page without a valid entry. Check your tags on these pages to ensure they are using the `require_entry=` parameter. Used in conjunction with a `{redirect="404"}`, that will address landing on entry URLs that are not valid.
> 2 votes

---
Tags: url, .htaccess
---


# Question
Title: Can I add place for notes by the admin in order details?
I've got a client who would like to add notes to the Order Details of the admin section. For example, a field that the order admin can add the tracking number of the item shipped or if the item was returned/exchanged.

The only place I've seen the admin able to input anything is in the message field of the Order Status - and if I'm not mistaken, that message actually goes to the customer and it not just for the admin's reference.

Is there any way possible to accomplish this?

# Answer
> 0 votes
The order status message is only sent to the customer if you template the status message field in one of your email templates. Without doing that you shouldn't have a problem with using it an admin only readable field.

---
Tags: expresso-store
---


# Question
Title: Relationships – How to know which one is the parent and which one is the child
I am designing a website for a fashion label who have collections every season, and they do multiple 'projects' for each collection. For instance artwork, videos etc. For instance Collection A may have 3 projects attached to it, and Collection B may have 2 projects.

Collections
\- title (text input)
\- url\_title (text input)
\- collection-year (text input)
\- season (select dropdown)
\- images (channel images)

Projects
\- title (text input)
\- url\_title (text input)
\- project-collection (relationship to collection)
\- project-images (channel images)

Relationships seem like the best way to link a project with a collection. What I'm struggling with though is creating a submenu for the projects that are grouped by collection. For instance...

```
Collection A
- Project 1A
- Project 2A
- Project 3A

Collection B
- Project 1B
- Project 2B

```

Any ideas?

Thanks! Michael

# Answer
If on every **project** you have to choose the **collection** it points to, the collections turns being **their child entries**.

On the menu, grouping by the collections, you gonna have to look for each one parent:

```
{exp:channel:entries channel="colletions"}
  {title}
  {parents field="project-collection"}
    {parents:title}
  {/parents}
{/exp:channel:entries}

```

To who is submitting the data, is quite the opposite: they can see every project as a child of the collections. This is why, from a template coding perspective, it can looks like a little confusing.

Think this way: the channel entry which has to be submitted before is always the child and the channel which has the relationship field is always the parent. As the *collection* have to be created before the *projects*, they're the **child** entries.
> 1 votes

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


# Question
Title: AJW-Export date formating in CSV is off 6 hours
I'm using ajw\_export for my CSV,

I have:

```
DATE_FORMAT(from_unixtime(exp_channel_data.field_id_454), '%h:%i') AS Start_Time,

```

works but shows time with 6 hour difference.

I have tried:

```
DATE_FORMAT(DATE_ADD(from_unixtime(exp_channel_data.field_id_454), '%h:%i')INTERVAL 6 HOUR) AS Start_Time

```

but it gives me erros in my sql.

Can anyone tell me what Am'I doing wrong?

Thank you

# Answer
After playing around and learning about SQL I have found solution . It works. For thouse who are strangling here it is. Please NOTE the difference from the above.

```
DATE_FORMAT(DATE_ADD(from_unixtime(cd.field_id_454), INTERVAL 6 HOUR),'%h:%i %p') AS 'Start Time',

```
> 1 votes

# Answer
Could it be something with time zones? Maybe try doing

```
SET time_zone = 'America/Denver'

```

https://stackoverflow.com/questions/930900/how-to-set-time-zone-of-mysql
> 0 votes

---
Tags: date, sql
---


title: Playa DB field structure

text:
# Question
Title: Playa DB field structure
This question is more of I'd like to know rather than an issue for me right now.

In the table exp\_channel\_data Playa fields store a string using the following fields from the relationship channel entry: "\[entry\_id\] \[url\_title\] title".

However the table exp\_playa\_relationships is the one that stores the IDs between parent, child etc. This is the only table that is updated if one of the entries are edited. So why is the string stored in the exp\_channel\_data table?

# Answer
Searchability.

Storing data in the exp\_channel\_data table makes the field searchable by the native search module as well as third party add-ons like Low Search.

Additionally, it also allows the field to be targeted by the channel:entries' search:field\_name parameter, eg. `search:playa_field="[123]"`
> 1 votes

---
Tags: playa
---


title: Setting Custom Email Headers

text:
# Question
Title: Setting Custom Email Headers
I need to provide an email form on my website that'll email members. I want to be able to set custom mail headers before the email is sent (I'm using Mandrill, so custom headers allow me additional features). I don't see anything in the docs about custom mail headers: https://ellislab.com/expressionengine/user-guide/development/usage/email.html

Is this possible to do in EE?

**UPDATE 1:**

I created an extension. And looking at this: https://ellislab.com/expressionengine/user-guide/development/extension\_hooks/global/email/index.html -- it seems I should be able to set the headers by manipulating `$data['headers']`. I have this in my extension:

```
function email_send(&$data)
{
    $data['subject']        = 'Hello World';
    $data['headers']['foo'] = 'bar';
}

```

When I receive the email, the subject is "Hello World". However, when I look at the headers, I do not see `foo` =\> `bar` in it. I've checked with my host to see if there is anything that the hosting might be doing to strip custom headers. They claim no. So, the next question: **is there anything in EE that might be preventing me from setting custom headers?**

I'm currently configured to use PHP Mail, but I do want to use SMTP for this eventually.

**UPDATE 2:**

When I configure CPanel to use either `Sendmail` or `SMTP`, the subject does not get set to "Hello World". Instead, it says "Contact Form Email". Summary:

1. Subject only gets set when in PHP Mail
2. Email headers not set in PHP Mail, Sendmail, or SMTP

# Answer
> 2 votes
```
ee()->email->set_header($header, $value);

```

This isn't documented anywhere, but I see this function in CodeIgniter's Email library (which EE Email library extends), so I assume it should work fine.

# Answer
> 1 votes
The answer lies in CodeIgniter's Email library. You'll see that in many places the `header_str` is used, not the whole `headers` array. So you'd have to add to the `header_str` instead.

As for sending with other methods, you'll see that the `subject` is never used with SMTP or Sendmail - instead those assume that the subject is already in the `header_str`.

Shameless plug: my Escort add-on allows you to easily send email with Mandrill (and other services) and offers a simple hook to add any data you want to your email before it gets sent (see escort\_pre\_send extension hook). E.g.,

```
function escort_pre_send($service, $data)
{
    if($service == 'mandrill')
    {
        $data['headers']['foo'] = 'bar';
    }
    return $data;
}

```

---
Tags: email
---


title: Transcribe and channel:forms

text:
# Question
Title: Transcribe and channel:forms
I've upgraded EE to **2.9.2** and have found some strange behaviour with Transcribe. The problem is that some channel entries did not have a language set in the **exp\_transcribe\_entries\_languages** table. This was not a big problem because I could just run a script to fix the issue.

However, I have found that entries created via channel:forms do not even get an entry in the exp\_transcribe\_entries\_languages table which means that these entries will not get displayed to the user.

e.g. A member entering a delivery address. This address is stored but no record is created in the exp\_transcribe\_entries\_languages table so that address will never be of use. There must always be a valid language\_id mapped to each channel entry for it to be displayed correctly.

How can I fix this?

# Answer
The answer is to use this parameter in your tag pair:

> transcribe="disable"
> 0 votes

---
Tags: safecracker, transcribe
---


# Question
Title: Not able to add matrix rows after 99 rows
I am not able to add more than 99 rows in my matrix field though I have already set Maximum rows to 1000, not sure whats happening. Is it a **BUG** or **LIMIT** of matrix field type?

EE version : 2.6.1 Matrix version : 2.5.6

Note : Its an old project so cant take risk of upgrading EE or matrix

# Answer
Matrix doesn’t have any built-in limits, but PHP has a configurable limit on how many values that it will check in POST (max\_input\_vars). Try adjusting that.
> 0 votes

---
Tags: matrix, pixelandtonic
---


# Question
Title: Parse Order: how to pass a value from PI as an embed variable?
I have a plugin that outputs a value, which I ***think*** I need to pass as an embed variable as I need to use that value as a parameter when calling the plugin again from within the embed. Here's the basic structure:

```
{exp:my_plugin)
     {embed="foo/bar" my_plugin_value="{some_value_from_my_plugin}"}
{/exp:my_plugin)

```

In the embedded template, `{embed:my_plugin_value}` is empty. I have double checked to make sure the value is indeed set before calling the embed. Am I running into parse issues? If so, how do I resolve this?

# Answer
> 2 votes
If it's two plugin tags that you are needing to nest, see changing parse order for nested tags using the `parse="inward"` parameter.

# Answer
> 0 votes
That should work.

Try testing your parameter logic for your plugin to ensure you're properly retrieving the parameter value.

If that's not the issue try passing a string into the embed to see if it's in fact an issue with the embed variable.

---
Tags: templates, parse-order, parsing
---


title: Where to view order hash?

text:
# Question
Title: Where to view order hash?
I'm new to Exp-resso store. According to the docs; I can view an order through its order hash as per below:

```
{exp:store:orders order_hash="xxxx"}

```

How do I retrieve the order hash?

Edit: Referring to this answer: Printing Order Summary in Expresso Store

It seems that order hash only available via success page? Is there a way I can retrieve it for later viewing; ala url\_title or entry\_id?

# Answer
There are a few ways to get access to the `{order_hash}` tag, the most common way that you would probably see it is a result of placing a successful order. This would be achieved by adding `return="order/ORDER_HASH"` to the final checkout tag.

The next way you can access the order\_hash is in your receipt templates that will get sent out to customers on a completed order. You will want to use the `{exp:store:orders}` tag pair in your receipt templates to get all of the relative order details and this would allow you to create a link to the particular hash (this assumes you have a template group called orders and the template is looking for the hash in the segment\_2. You may need to adjust to your site.)

```
{exp:store:orders}
 Order ID: {order_id}
 View Invoice: {path="orders/{order_hash}"}
{/exp:store:orders}

```

The other way you can access the order\_hash was touched on by Rodrigo in his answer but you should be able to use the `{order_hash}` tag even though it is not listed on the orders documentation page.

```
{exp:store:orders member_id="CURRENT_USER"}"}
 Order ID: {order_id}<br />
 <a href='{path="orders/{order_hash}"}'>View Invoice</a>
{/exp:store:orders}

```

The nice thing about using the order\_hash over the order\_id as has been mentioned is that it prevents a malicious user from being able to quickly guess other order numbers which might include sensitive information such as address or phone number.

If you do decide to use order\_id instead you should make sure that your template to show single orders also includes a conditional for the current member to prevent users from seeing other users orders.

```
{exp:store:orders member_id="CURRENT_USER"}" order_id="{segment_2}"}
 Order ID: {order_id}<br />
{/exp:store:orders}

```
> 1 votes

# Answer
Yes, you can have a listing of orders by the logged user using:

```
{exp:store:orders member_id="CURRENT_USER"}
  <a href="{path='/order/{order_id}'}"> view order </a>
{/exp:store:orders}

```

Then on that template:

{exp:store:orders order\_id="{segment\_2}"}
> 1 votes

---
Tags: expresso-store
---


# Question
Title: Parsing code in a textarea field pulled in with Playa
I am trying to allow a user the ability to select code snippets (widgets?) to show in a sidebar area on a page-by-page basis. These snippets could have plain old HTML code or could be EE channel entries loops.

I setup a Code Snippets channel with a single "code\_snippet" textarea field (format NONE) where the code would be pasted in. Then in the Pages channel, I created a Playa field called "page\_sidebar\_items" that pulls from the Code Snippets channel.

On my template, plain old HTML code will display correctly but EE channel entries tags (actually, I'm using a Low Events tag) will not. It will output the actual EE code on the page instead of parsing it first.

Is there a way to tell EE to parse that code before displaying it? I have tried placing `parse="inward"` in a few different places with no luck.

I have tried this:

```
{exp:channel:entries channel="Pages" disable="member_data|pagination|categories|category_fields"}
    {exp:playa:children var="page_sidebar_items"}
        {code_snippet}
    {/exp:playa:children}
{/exp:channel:entries}

```

And this:

```
{exp:channel:entries channel="Pages" disable="member_data|pagination|categories|category_fields"}
    {page_sidebar_items}
        {code_snippet}
    {/page_sidebar_items}
{/exp:channel:entries}

```

Code Snippet:

```
<h3>Upcoming Events</h3>
{exp:low_events:entries channel="events" show_future_entries="yes" sort="asc" dynamic="no" disable="member_data|pagination|categories"}
<p><span class="sidebar-event-date">{if '{event_dates:one_day}' == 'y'}{event_dates:start_date format="%F %j, %Y"}
{if:else}
{if '{event_dates:start_date format="%F"}' == '{event_dates:end_date format="%F"}'}
{event_dates:start_date format="%F %j"}-{event_dates:end_date format="%j, %Y"}
{if:else}
{event_dates:start_date format="%F %j"}-{event_dates:end_date format="%F %j, %Y"}{/if}
{/if}</span><br />
<a href="{page_url}">{title}</a><br />
<span class="sidebar-event-host">{event_host}</span><br />
{event_city}, {event_state}<br />
<a href="{page_url}">Details</a>
</p>
{/exp:low_events:entries}

```

This code snippet works fine if placed directly into my template, but does not work (HTML bits are fine but EE bits are not parsed) when pulled from the channel via Playa.

What am I missing here? Thanks in advance!

**Side Note:** I've also tried using Low Variables instead (code snippets live in LV and add a LV fieldtype to my Code Snippets channel) with pretty much the same results. If I could get that approach working, I would prefer that over code living in a channel.

**Versions:** EE 2.9.2, Low Events 1.3.1, Structure 3.3.14.7, Playa 4.5.2, Low Variables 2.5.0

# Answer
Wow! This looks so complex...

Please, try using this first party add-on:

```
{exp:channel:entries channel="Pages" disable="member_data|pagination|categories|category_fields"}
  {exp:playa:children var="page_sidebar_items" parse="inward"}
    {exp:allow_eecode}
      {code_snippet}
    {/exp:allow_eecode}
  {/exp:playa:children}
{/exp:channel:entries}

```

I confess that I never used it, but maybe it can help you.

There's a good list of first party add-ons on EECMS user guide.
> 2 votes

---
Tags: playa, parse-order, low-events
---


# Question
Title: SSL Subdomain Staging Site in Subfolder is Resolving Webroot Instead
I'm trying to set up a staging subdomain in a subfolder under the webroot of the main production site for testing and deploying changes for a EE e-commerce website.

I hope one or two of the more experienced EE Devs that contribute here can easily spot how I can make things work for this set up.

For the most part, things are working as they should except for testing transactions on the checkout pages, which are the only SSL templates on the website.

Directories:

```
public_html (http://www.domain.com or https://www.domain.com)
↳ staging (http://staging.domain.com or https://staging.domain.com)

```

When going to http://staging.domain.com the 2nd installation in the subfolder runs just fine.

When going to https://staging.domain.com the 1st installation is being rendered instead. The production site DOES NOT have a wildcard domain SSL setup... which looks to be the reason this is happening. This previous SE post has been insightful.

On other CMSs, I've easily solved this issue simply by adding the following to the webroot .htaccess file:

```
RewriteCond %{HTTP_HOST} ^staging\.
RewriteCond %{HTTPS} on
RewriteRule ^(.*)$ staging/$1 [L]

```

The subdomain commerce pages do not actually need to be properly secured to avoid certificate warnings, because it is locked off from public access and it is only used by myself and a staff member to test changes before they are pushed to production.

I don't have access to httpd.conf on this server, so over recent days I've tried numerous htaccess approaches. They all result in either 500 internal server errors, 404s or 403s.

Here are a few. All of these are being placed in the webroot to try and catch the subdomain SSL misdirection:

```
################# Redirect requests to subfolder EE index file = White Death
RewriteCond %{HTTP_HOST} ^staging\.
RewriteCond %{REQUEST_URI} !^/staging/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /staging/$1
RewriteCond %{HTTP_HOST} ^staging\.
# Direct requests to subfolder EE's index file
RewriteRule ^(.*)$ /staging/index.php/$1 [L]

################# Document Root rewrite = Displays webroot not subdomain
RewriteCond %{HTTP_HOST} ^staging\.
RewriteRule %{DOCUMENT_ROOT} /home/user/public_html/staging/$1

################# Document Root rewrite 2 = White Death
RewriteCond %{HTTP_HOST} ^staging\.
RewriteCond %{DOCUMENT_ROOT} /home/user/public_html
RewriteCond %{DOCUMENT_ROOT} !/home/user/public_html/staging
RewriteRule (.*)  /home/user/public_html/staging/$1 [PT] (Tried pretty much every flag I could think of here)

################# SSL 443 port subdomain redirect webroot to subfolder = 403 errors
RewriteCond %{SERVER_PORT} ^443$
RewriteCond %{HTTP_HOST} ^staging\. [NC]
RewriteCond %{REQUEST_URI} !^/staging/
RewriteRule ^(.*) staging/$1

```

And This is the current webroot EE rewrite for removing index.php:

```
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteCond %{REQUEST_URI} !/system/.* [NC]
RewriteCond %{REQUEST_URI} !/staging/.* [NC]
RewriteCond %{HTTP_HOST} !^staging\. [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]

```

I've also played around a bit with the config file settings on the subdomain install, to see if altering the DOCUMENT ROOT helps if SSL is detected for traffic being redirected from the webroot. I'm not sure this is the solution, but perhaps it is and I'm not applying things correctly. Here is an example:

```
$protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://';
if ($protocol == 'http://') {
  $base_path = $_SERVER['DOCUMENT_ROOT'];
} else {
  $base_path = $_SERVER['DOCUMENT_ROOT'] . '/staging';
}

```

So what I'm basically trying to do is set up the subdomain to test a few templates as SSL, without having a wildcard domain SSL in place.

Any ideas?

Thank you for any help.

# Answer
Your comment referring to CPanel and pointing the subdomain to the subfolder means that it's created as another virtual host type setup. Without control over the server, you can't have multiple virtual hosts setup for SSL on the same IP (unless utilising SNI). This isn't fully supported in browsers either, but would be fine for testing. Doubtful if your hosting provider would support it though.

From your initial description I had assumed that you had both domains pointing at the same location, but your htaccess rewrites the staging to use the subfolder - this may then work as the webroot for the SSL is the same. Hence the comment for the htaccess example. Otherwise there's no point in making it a subfolder - it could be anywhere on the server as the 2 are separate in your current setup.

I'd suggest you point the staging subdomain to the same folder as your main site and try out some of your original rewrites in the htaccess to deliver the subfolder on matching subdomain under the non-http, then if you can get that working, there's more chance of trying the https. But I don't think the https://staging subdomain will be identifiable in the httaccess.

Assuming it can work, this should be sufficient:

```
RewriteCond %{HTTP_HOST} ^staging\.
RewriteRule ^(.*)$ /staging/index.php/$1 [L]

```

And under your main index rewrite you're already excluding the staging.
> 0 votes

---
Tags: htaccess, ssl, subdomain, staging-server
---


# Question
Title: Tag caching seems not to be reducing number of queries
I'm just applying some tag caching to templates on a client's site to improve performance (which isn't bad, but having no caching currently set could obviously be improved). I'm no expert at implementing caching in EE but I'm not seeing any reduction in database queries or in the memory used. So either I'm misunderstanding what I should be seeing, or I'm doing something wrong, or perhaps there is some setting that is preventing tag caching from taking place. (I'm aware of the disable\_tag\_caching config variable; mine is set to 'n').

Here's my testing process:

1. Add cache="yes" refresh="720" parameters to a template's channel:entries tag
2. turn on template debugger and output profiler via config variables
3. Clear caches from the CP
4. Load page template in front end, examine number of queries and memory used
5. Reload page template, compare queries and memory usage to \[4\]

I would expect there to be a difference in the reported number of queries and, perhaps, the memory used, between stages 4 and 5, since -- as I understand it -- the content of the channel:entries tag will be generated by database queries in stage 4 but ought to be taken directly from the cache in stage 5. But I'm seeing the *exact same* numbers from both stages.

This really isn't a high traffic site at the moment, so I don't want to go down the road of buying a third party cache add-on if I can help it. I'd much prefer, at this stage, to understand either what I'm doing wrong (or misunderstanding) or, if my process is correct, what might be interfering with it.

Does anybody have any advice?

# Answer
> 0 votes
Rick, I guess after step 4 you change the parameter to cache="no" and just then do step 5. But you should not forget to clear the EE-cache *before* taking step 5, because possibly the entry-loop is still cached.

Also you should assure in your tests that the template you use is not cached as whole: go to Template-Manager, then preferences of your template, set "enable caching" to "no".

# Answer
> 0 votes
Well... The reason I can think of is... Are the cache settings fine? Take a look at Control Panel \> Admin \> General Configuration \> Caching Driver.

In case the cache driver being used is *file*, check if the cache directory is writable. Its default location is `system/experessionengine/cache`.

---
Tags: cache
---


# Question
Title: Expresso Store: Reorder button for previous orders
I'd like to add a "Reorder" button to the previous orders (store:orders) in Store so when a user clicks the button that same item, quantity and modifiers will be placed in to their shopping cart. I've cobbled together the following but it loads slowly, the modifiers don't work as the {modifier\_input\_name} tag doesn't exist in the {items} tag and it only seems to process the first four of the {exp:store:product} tags. Is there a better way to do this?

Order history template:

```
{exp:store:orders member_id='CURRENT_USER' order_by='order_date' sort='desc'}
{items} {title}
{embed="includes/order_history_reorder" entry_id="{entry_id}" hidden_fields="<input type='hidden' name='item_qty' value='{item_qty}' class='item_quantity' />{modifiers}<input name='UNKNOWN' value='{modifier_value}' type='hidden'>{/modifiers}" }
{/items}
{/exp:store:orders}

```

includes/order\_history\_reorder template:

```
{exp:store:product entry_id="{embed:entry_id}" disable_javascript="yes"}
{embed:hidden_fields}
<input type="submit" name="submit" class="submit-button" value="{lv_reorder_text}" />
{/exp:store:product}

```

# Answer
> 2 votes
I haven't tested this but off the top of my head I would recommend using the Product Form tag to allow you to add all of the items to the cart without the need for embeds. If you have issues change the hidden fields to text fields to see what they are being populated with.

```
{exp:store:product_form return="store/checkout"}
    {exp:store:orders member_id='CURRENT_USER' order_by='order_date' sort='desc'}
    <h1>{order_id} -- order_date format="%m.%d.%Y"}</h1>

        {items}
            {exp:store:product entry_id="{entry_id}" disable_form="yes"  disable_javascript="yes"}
                {title}
                <input type="hidden" name="items[{item:count}][entry_id]" value="{entry_id}" />
                <input type="hidden" name="items[{item:count}][item_qty]" size="3" value="1" />
                {modifiers}
                    <input type="hidden" name="items[{item:count}][{modifier_input_name}]" value="{modifier_value}">
                {/modifiers}
        {/items}
    {/exp:store:orders}
    <p>
        <input type="submit" name="submit" value="Repeat this order" />
    </p>
{/exp:store:product_form}

```

Ideally DevDemon would add variable prefixing to all of the Store tags so you could make sure that you don't have conflicts with variable names.

# Answer
> 0 votes
This form won't work if there are no modifiers: Store: Can't find product (entry ID: 32, modifiers \[\]) when you submit cart.

Here is a working example:

```
{exp:store:product_form return="cart/index"}
    {exp:store:orders order_hash="{segment_3}"}
    <section>
        <h1>Order History</h1>
        <div class="order_status">
            <h2>Order Status: <span>{order_status}</span>
        </div>
        <div class="order_totals">
            <dl>
                <dt>Order Placed:</dt>
                <dd>{order_date format="%j %M %Y"}</dd>
                <dt>Sub Total:</dt>
                <dd>{order_total}</dd>
                <dt>Shipping:</dt>
                <dd></dd>
                <dt>Account Credit Used:</dt>
                <dd></dd>
                <dt>Promo Code Used:</dt>
                <dd></dd>
            </dl>
        </div>
        <div class="order_person">
            <dl>
                <dt>Delivered To:</dt>
                <dd>
                    {shipping_name}<br/>
                    {shipping_address1}<br/>
                    {shipping_address2}<br/>
                    {shipping_city} {shipping_postcode}<br/>
                    {shipping_state_name}<br/>
                    {shipping_country_name}<br/>
                    {shipping_phone}<br/>
                </dd>
            </dl>

        </div>
    </section>
    <section class="order_details">
        <h2>Order Details: Products Ordered</h2>
        <div class="order_headings">
            <div> </div>
            <div class="qty_head">Qty</div>
            <div class="price_head">Price</div>
            <div class="total_head">Total</div>
            <div class="reorder">Reorder</div>
        </div>
        {items}
        {exp:channel:entries channel="products" entry_id="{entry_id}" dynamic="no"}
        {exp:store:product disable_form="yes" entry_id="{entry_id}"}
        <div class="item">
            <div class="item_information">
                <img src="http://placehold.it/350x150">
                <h4><a href="{path='store_example/product'}/{url_title}">{title}</a></h4>
                <p><small><b><a href="/shop/{categories show_group='1' limit='1'}{category_url_title}{/categories}/{url_title}#reviews" class="button--action">Review this product</a></b> </small></p>
                <ul class="categories">
                {categories show_group='2'}
                    <li class="list__item">{category_name}</li>
                {/categories}
                </ul>
            </div>
            <div class="item_qty">{item_qty}</div>
            <div class="item_price">{price}</div>
            <div class="item_subtotal">{item_subtotal}</div>
            <div class="item_reorder">
            {!-- ===/ for redordering these items /=== --}
                <input type="hidden" name="items[{item:count}][entry_id]" value="{entry_id}" />
                <input type="text" name="items[{item:count}][item_qty]" size="3" value="1" />
            </div>
        </div>
        {exp:store:product}
        {/exp:channel:entries}
        {/items}
    </section>
    {/exp:store:orders}
    <div class="item_reorder">
        <input type="submit" name="submit" value="Repeat this order" />
    </div>
    {/exp:store:product_form}

```

---
Tags: expresso-store
---


# Question
Title: Search Members and Channel Entries at the same time?
Is it possible to setup a search form that searches both Members and Channel Entries.

I want to then show a single results page where i can show both the members and channel entries that come from the search request.

I have Low Search and Solspace User.

Possible?

# Answer
> 0 votes
Not that I know of (Low or SolSpace may chime in if I'm wrong about their modules capacities), however you could do some "magic" on the results template. I'm thinking if you just do a content/entries search, then on your results page you could do a manual/PHP user search (as users have limited fields!) on the results template, appending these results as needed.

By example, something like this :

```
<?php
    //get the search term
    $searchTerm = ee()->uri->segment(3);

    //here split the actual search term from the search string

    //Now search the members table
    $searchedUsers = array();
    //search username, screen name and email...
    $query = ee()->db->like('user_name',$searchTerm)
                     ->or_like('screenname',$searchTerm)
                     ->or_like('email',$searchTerm)
                     ->get('members');
    foreach ( $query->result_array() as $row ) {
        $searchedUsers[] = $row;
    }
?>

{!-- here we display the channel entries results --}
{exp:low_search:results query="{segment_3}" limit="10"}
    {if count ==  1}<ol>{/if}
        <li>{title}</li>
    {if count == total_results}</ol>{/if}
    {if no_results}No search results{/if}
{/exp:low_search:results}

{!-- And now the member results --}
<?php
    if ( !empty($searchedUsers) {
        echo "<ol>";
        foreach ( $searchedUsers as $sUser ) {
            echo "<li>".$sUser['screenname']." - ".$sUser['email']."</li>";
        }
        echo "</ol>";
    }
?>

```

*(you'll probably need PHP on Output so you can parse the search tags and get the search term)*

By example, absolutely untested but should be a good starting point!

**After thought - please read**

Now I think about it, doesn't SolSpace User use a channel to store users data? I could be wrong but maybe you just need to identify the User Channel and feed that into Low Search? Hopefully SolSpace will pop in and confirm if this works (They're regularly active so shouldn't be too long ;) )... *Scrap this, I was thinking of another module*

---
Tags: members, search, low-search, solspace-user
---


# Question
Title: Remove index.php - interior pages are blank
I've got a site that works correctly on localhost and the staging domain, but after moving to the live server all interior pages return a 404 page.

.htaccess has the following

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

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

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

```

EE is not running in a subdirectory, i've tried adding the query string option from the docs but no change. Also removed the leading slash from index.php but that didn't make a difference.

Any thoughts? hosted on rackspace

# Answer
Are you sure mod\_rewrite is installed & enabled? My guess is no!
> 2 votes

---
Tags: htaccess, 404, index.php
---


title: Expresso Store batch printing orders

text:
# Question
Title: Expresso Store batch printing orders
Does anyone know if it's possible to batch print invoices from the Orders screen in the CP on Expresso Store? At present my client has to click on "Details" for every order and then click print. This is obviously time consuming when they receive 100s of orders.

I have searched for plugins that may do this but couldn't find any. Just wondering if I missed something in Store or if there is a plugin available?

They are using Store version 2.4.1

# Answer
There is nothing built in to Store, nor is there an extension that would allow something like this.

While being a bit more work for you, you could use something like PDF Press and the `{exp:store:orders}` tags inside of a template that requires you to be an admin to access. With something like this you could view hundreds of orders at a time.

Alternatively you could use Store's email templates and an email rule for orders. Basically you would set up an email template in Store for admins, then send it to a specific email address, then the client could easily set up an email rule on their computer to print any email with a specific subject. I have a client that has this exact setup on a site and it has worked out well for them.

Finally your other option would be to build an extension to add the functionality to Store. You would probably be best to go with the store\_order\_complete\_end hook if you wanted to do something automatically after each order. Or use the Store Reporting hook if you wanted to modify how you access reports in the CP.
> 2 votes

---
Tags: expresso-store
---


# Question
Title: Multiple forms on one page display required field errors when only one form is submitted
I've got a page on my site with two freeform forms, each have different purposes. If I fill out either of the forms entirely (required fields) I am taken to the correct landing page and the correct notification is being sent out so all is functioning correctly there.

If do not enter all required fields the inline errors appear but for both forms rather than for the form I submitted.

Does anyone know of any way to make it so that the errors appear only on the submitted form?

I'm happy to create an extension using either the `freeform_module_validate_begin` or `freeform_module_validate_end` hooks but I'm just not sure where to start.

Any help would be greatly appreciated.

```
{exp:freeform:form form_name="product_demo_form" form:id="demo-form" required="name|email" return="{path='demo-enquiry-success'}" inline_errors="yes" inline_error_return="products/{url_title}/#demo-form"}
    <input type="hidden" name="XID" value="{XID_HASH}" />
    <input type="hidden" name="product_name" value="{title}" />
    <div class="row">
        <div class="col-md-4">
            {if freeform:error:name}<span class="required">{form_error_name}</span>{/if}
            {freeform:field:name attr:placeholder="Name *"}
        </div>
        <div class="col-md-4">
            {if freeform:error:email}<span class="required">{form_error_email}</span>{/if}
            {freeform:field:email attr:placeholder="Email *"}
        </div>
        <div class="col-md-4">
            {freeform:field:phone attr:placeholder="Phone"}
        </div>
     </div>
    {freeform:submit}
{/exp:freeform:form}

{exp:freeform:form form_name="product_pdf_download" form:id="download-form" required="name|email" return="{path='download-request-successful'}" inline_errors="yes" inline_error_return="products/{url_title}/#download-form"}
    <input type="hidden" name="XID" value="{XID_HASH}" />
    <input type="hidden" name="product_id" value="{entry_id}" />
    <input type="hidden" name="product_name" value="{title}" />
    <div class="row">
        <div class="col-md-6">
            {if freeform:error:name}<span class="required">{form_error_name}</span>{/if}
            {freeform:field:name attr:placeholder="Name *"}
        </div>
        <div class="col-md-6">
            {if freeform:error:email}<span class="required">{form_error_email}</span>{/if}
            {freeform:field:email attr:placeholder="Email *"}
        </div>
    </div>
    {freeform:submit}
{/exp:freeform:form}

```

# Answer
I believe you can do some PHP jiggery-pokery here, what you'll want to do is on the template page use PHP to detect which form was submitted (you could set a hidden POST value here, or check the posted collection parameter maybe). Then do `unset($_POST['field_id']);` for each of the fields on the other (not to display validation messages) form.

If there's no value in the $\_POST it might not throw a validation message, but I'd have to double check this.

I'll try to spin a test up later this week for you, otherwise I'd definatly inspect the `$_POST` array on this template after submitting an invalid form

Scrap that...

I have spun an example up, and have found your answer...

The problem is you are using the same field's on both forms. A quick fix would be to recreate the fields for form 2 with different ID's, this will seperate your values and validation messages...

Example template :

```
<h3>Form 1</h3>
{exp:freeform:form
    form_name="form1"
    required="test_text_1"
    inline_errors="yes"
}
        {if freeform:error:test_text_1}
            <span class="error">
                {freeform:error:test_text_1}
            </span>
        {/if}
<p><label>{freeform:label:test_text_1}</label> {freeform:field:test_text_1}</p>
<p>{freeform:submit}</p>
{/exp:freeform:form}

<hr />
<h3>Form 2</h3>
{exp:freeform:form
    form_name="form2"
    required="test_text2"
    inline_errors="yes"
}
        {if freeform:error:test_text2}
            <span class="error">
                {freeform:error:test_text2}
            </span>
        {/if}
<p><label>{freeform:label:test_text2}</label> {freeform:field:test_text2}</p>
<p>{freeform:submit}</p>
{/exp:freeform:form}

```

This one works a treat, seperated error messages. If you absolutely **MUST** have the same fields...

**2 Forms, 1 Field**

We have to do some foolery here, first things first, we need to create a field in freeform, lets call it `fid`. This field is required so we can pass the forms ID through Freeform (it cleans fields that arn't part of the form collection).

So as per the example above each form collection has a `fid` field and a `test_text_1` field. Dont worry, we're never going to display or use this field, its just so we can track through...

Then edit your template to be this (PHP on **Input**) :

```
<?php
//this variable holds the passed form ID, if submitted
$submittedFid = NULL;

//get the freeform params ID (needed for later)
$paramsId = ee()->session->flashdata('freeform_errors');

//was there a params ID set (if not there's no submission, continue)
if ( !empty( $paramsId ) ) {

    //get the freeform params info from the db
    $res = ee()->db->where('params_id', $paramsId)->get('freeform_params');

        //if we have a result, gravy! lets sniff for the submitted form ID
    if ( $res !== FALSE ) {

                //extract the data/info
        $res = array_shift($res->result_array());
        $paramInfo = json_decode($res['data'], TRUE);

                //did we have a form ID passed through??
        if ( !empty( $paramInfo['inputs']['fid'] ) ) {

                        //set the form ID that was submitted
            $submittedFid = $paramInfo['inputs']['fid'];
        }
    }
}
?>

{!-- Here we display form 1 --}
<h3>Form 1</h3>
{exp:freeform:form
    form_name="form1"
    required="test_text_1"
    inline_errors="yes"
}
    {!-- here we pass our super secret FID! for this one its '1st_form' --}
    <input type="hidden" name="fid" value="1st_form" />

    {!-- Display the field --}
    <p><label>{freeform:label:test_text_1}</label> {freeform:field:test_text_1}</p>

    {!-- Display Error messages if any. First use PHP to see if this is the right form --}
    <?php if( !empty($submittedFid) && $submittedFid == "1st_form" ) { ?>
                {!-- Standard Fredform error syntax --}
            {if freeform:error:test_text_1}
                <span class="error">{freeform:error:test_text_1}</span>
            {/if}
    <?php } ?>

    {!-- submit button --}
    <p>{freeform:submit}</p>

{/exp:freeform:form}

<hr />
{!-- Here we display form 2 --}
<h3>Form 2</h3>
{exp:freeform:form
    form_name="form2"
    required="test_text_1"
    inline_errors="yes"
}
    {!-- here we pass our super secret FID! for this one its '2nd_form' --}
    <input type="hidden" name="fid" value="2nd_form" />

    {!-- Display the field --}
    <p><label>{freeform:label:test_text_1}</label> {freeform:field:test_text_1}</p>

    {!-- Display Error messages if any. First use PHP to see if this is the right form --}
    <?php if( !empty($submittedFid) && $submittedFid == "2nd_form" ) { ?>
                {!-- Standard Fredform error syntax --}
            {if freeform:error:test_text_1}
                <span class="error">{freeform:error:test_text_1}</span>
            {/if}
    <?php } ?>

    {!-- submit button --}
    <p>{freeform:submit}</p>

{/exp:freeform:form}

```

There you have it! tested and works a treat (EE 2.9.2 + Freeform 4.2.2).

As always if this gets you there, help the site and please mark as the answer.
> 1 votes

---
Tags: solspace-freeform
---


# Question
Title: How can I get the Freeform (free v.) Recipient Name value into a notification template?
My question is very similar to this one:

Getting Recipient Names/email address in Notification

However I need to use a select field rather than checkboxes.

I've tried this but it doesn't work (I used `.change` instead of `.click` and `:selected` instead of `:checked`):

```
$(function($){
    var $chosenRecipients   = $('[name="freeform_product"]');
    var $recipientChecks    = $('[name^="the_product"]');

    $recipientChecks.change(function(){
        setTimeout(function(){
            $chosenRecipients.val('');
            var newVal = [];
            $('input[name^="the_product"] option').each(function(){
                if ($(this).is(':selected'))
                {
                    newVal.push($(this).val());
                }
            });
            $chosenRecipients.val(newVal.join(', '));
        },0);
    });
});

```

The relevant HTML/EE code:

```
{exp:freeform:form
    collection="Contact Us"
    form:id="contact_us"

    recipients="yes"
    recipient_template="contact_us_page"

    recipient1="name|email1@address.com"
    recipient2="name|email1@address.com"
    recipient3="name|email1@address.com"
    recipient4="name|email1@address.com"
    recipient5="name|email1@address.com"
}

<input type="text" value="" id="freeform_product" name="freeform_product">
<label for="the_product" class="span6">Product<br>
<select name="the_product" id="the_product">
    <option value="">------Select------</option>
    {freeform:recipients}
    <option value="{freeform:recipient_name}">{freeform:recipient_name}</option>
    {/freeform:recipients}
</select>
</label>

```

Any ideas on what I'm missing?

Thanks!

**UPDATE:** I've added a fiddle here: http://jsfiddle.net/yL432nvc/

# Answer
Using your fiddle, use this as your JS :

```
    var newVal = [];
    $('select[name="the_product"]').change(function(e){
        $('input#freeform_product').val('');
        $('select[name="the_product"] option').each(function(){
            if ($(this).is(':selected')) {
                newVal.push($(this).attr('value'));
            }
        });
        $('input#freeform_product').val(newVal.join(', '));
    });

```

Very much simplified, you had a scope issue around newVal...

PS\> JUST this, no other JS...
> 2 votes

# Answer
Is your JS at issue here or getting the value in the notification template itself?

If it's the JS, you have the `each()` iteration wrong. you're targetting the `<select>` element on the each, but what you want is the child `<options>`.

Try this, replace :

```
[...]
        $recipientChecks.each(function(){
            if ($(this).is(':selected'))
            {
                newVal.push( $('label[for="' + $(this).attr('id') + '"]').text());
            }
        });
[...]

```

With :

```
[...]
        $('input[name^="the_product"] option').each(function(){
            if ($(this).is(':selected'))
            {
                newVal.push($(this).val());
            }
        });
[...]

```

Edit : I also notice you're getting the id's not the values of the option's, ammended example..

You can also make your hidden input a text input for debugging so you can see if its working without inspection...
> 0 votes

---
Tags: solspace-freeform, jquery, notification
---


title: Question regarding Freeform Pro Fields

text:
# Question
Title: Question regarding Freeform Pro Fields
I want to make a new field "untick box if you do not want to receive the e-newsletter' I am using Freeform Pro

Is this possible?

Thank you

# Answer
> 0 votes
Wouldn't you just use a checkbox??

http://www.solspace.com/docs/freeform/default\_fieldtypes/#checkbox

Of course you'll want to work your caption carefully (untick to ...) and you probably want to render the checkbox yourself instead of letting freeform do it, so you can set it to checked to start with

```
<input type="checkbox" id="freeform_field_id" name="freeform_field_id" value="Y" {if '{freeform:value:optin}' == 'Y'}checked=checked{/if} />

```

Also, see here : FreeForm PRO checkbox requied field its not got an answer ticked but is relivent.

And here : Any way to pass a checkbox value in Freeform (not Pro version)?

---
Tags: solspace-freeform
---


# Question
Title: How can I display entries from the past 2 weeks, and have it refresh every two weeks?
```
{exp:channel:entries site="nxtsports" channel="blog" dynamic="no" limit="5" status="open|Preview" {global:disable_basic} orderby="view_count_one" {!--display_by="week" start_day="Monday"--}}
                {snp_global_blog_article_listed}
                This has been seen {view_count_one} times!

            {/exp:channel:entries}

```

Anyone know how to use the display\_by parameters I commented out to display the top 5 entries with the most views from the past 2 weeks?

# Answer
> 2 votes
There's a sample of this code on user guide. You need to use the `start-on` parameter and to enable PHP to run at input on the template:

```
<?php
        $start_time = ee()->localize->format_date('%Y-%m-%d %H:%i', ee()->localize->now - (60*60*24*14));
?>

{exp:channel:entries start_on="<?php echo $start_time; ?>" site="nxtsports" channel="blog" dynamic="no" limit="5" status="open|Preview" {global:disable_basic} orderby="view_count_one"}
    {snp_global_blog_article_listed}
    This has been seen {view_count_one} times!
{/exp:channel:entries}

```

---
Tags: parameters
---


# Question
Title: Filter channel entries tag by category url title
Articles on my site are structured as /\[category\_url\_title\]/article/\[article\_url\_title\].

Now, I want to have at the bottom of my articles a section that says "related articles", and then list a few more articles from the same category. I have the same template for all articles.

This works perfectly fine:

```
{exp:channel:entries category="100" limit="3" dynamic="off" url_title="not {segment_3}"}
{title}<br>
{/exp:channel:entries}

```

But I need the category parameter to be set dynamically from {segment\_1} which is the category's url title. However, the channel:entries tag will only accept category id, not category url title as a parameter.

I have cat2 installed, but this doesn't work:

```
{exp:channel:entries category="{exp:cat2:id category_url_title='{segment_1}'}" limit="3" dynamic="off" url_title="not {segment_3}"}
{title}<br>
{/exp:channel:entries}

```

I've also tried saving the value of the cat2 tag output as a php variable, but that doesn't work either.

I assume my above efforts don't work because of mixed parse order of EE. So how can I make this work?

# Answer
> 1 votes
If you want to parse a plugin as a parameter, you need to set the parameter `parse` as `inward`.

```
{exp:channel:entries parse="inward" category="{exp:cat2:id category_url_title='{segment_1}'}" limit="3" dynamic="off" url_title="not {segment_3}"}
  {title}<br>
{/exp:channel:entries}

```

Since different categories on different groups can share the same name, is a good idea to specify the `category_group` parameter on the cat2 add-on.

One more thing. The values of the parameter `dynamic` should be `yes` or `no`.

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


title: Issues Upgrading from 2.5.3 to 2.9.3

text:
# Question
Title: Issues Upgrading from 2.5.3 to 2.9.3
Hi there I am having issues upgrading from v2.5.3 to v2.9.3 the wizard starts fine and goes from 2.5.3 to 2.6.0, then moves onto the next step 2.7.0, but at this point I the server times out and I get the following message:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, \[no address given\] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

I have upgraded EE many times before, but not across the relationship change (from \<2.6.0 to \>2.7.0)... is this the issue? Surely it must be possible.

My install runs MSM and has Assets, Matrix and Playa installed along with some other add-ons. (all upgraded to the latest version) before running the wizard.

Hope you can help.

Edd

# Answer
> 1 votes
Sometimes when EE does this, I enable PHP error reporting at the top of my index.php file and set $debug = 1.

```
ini_set('display_startup_errors',1);
ini_set('display_errors',1);
error_reporting(-1);

```

If you continue to get Internal Server Errors, try disabling your htaccess file (if using Apache).

If none of that helped, I strongly suggest you refer to your Apache or nginx error logs (if you're using either one of those). Report your findings and we'll be happy to help

---
Tags: upgrade
---


# Question
Title: Solspace Importer - JSON to Matrix data getting mixed up
I'm importing a JSON feed into entries in my EE site (v2.9.2) using Solspace Importer (v2.2.5). Everything seemed to work fine - we've been using it in dev for weeks and have run many imports to update entries. Unfortunately, we just noticed that the data that is being imported into Matrix fields isn't keeping it's organization.

Here is an example node from the feed (I can't share the actual feed because it's sensitive data):

```
"Scott-Stephanie-2015-03-18-20:48:17": {
        "id": "2242e4a8-b2b2-3ada-adf9",
        "region": "Southwest",
        "text": "Lorem ipsum dolor sit amet, consectetur adipisicing elit.",
        "link": "",
        "video": "",
        "first_name1": "Scott",
        "first_name2": "Stephanie",
        "title": "Our Family Profile",
        "status": "open",
        "paragraphs": [{
            "title": "Paragraph 1",
            "text": "Lorem ipsum dolor sit amet, consectetur adipisicing elit.",
            "link": "https://www.example-image.com/image1.jpg"
        }, {
            "title": "Paragraph 2",
            "text": "Lorem ipsum dolor sit amet, consectetur adipisicing elit.",
            "link": "https://www.example-image.com/image2.jpg"
        }, {
            "title": "Paragraph 3",
            "text": "Lorem ipsum dolor sit amet, consectetur adipisicing elit.",
            "link": ""
        }, {
            "title": "Paragraph 4",
            "text": "Lorem ipsum dolor sit amet, consectetur adipisicing elit.",
            "link": ""
        }, {
            "title": "Paragraph 5",
            "text": "Lorem ipsum dolor sit amet, consectetur adipisicing elit.",
            "link": "https://www.example-image.com/image5.jpg"
        }, {
            "title": "Paragraph 6",
            "text": "Lorem ipsum dolor sit amet, consectetur adipisicing elit.",
            "link": "https://www.example-image.com/image6.jpg"
        }]
    }

```

You'll see there is a node called "paragraphs" that has values for "title", "text" and "link", the "link" being an image to go along with the paragraph. Unfortunately, there isn't always an image, so it may be empty.

The problem I'm having is that Importer is ignoring the empty values and grabbing the next available node. So, in the case of the example above, "image5.jpg" is getting placed in the Matrix row with "Paragraph 3" and "image6.jpg" is getting placed in the Matrix row with "Paragraph 4". The Matrix rows for paragraphs 5 & 6 will have empty "link" values in EE.

Here is a screenshot of my Importer setup for the "paragraphs" node:

Here is a screenshot of my Matrix settings:

I've tried to keep it as simple as possible. Any ideas what the issue is?

# Answer
This is a known issue in Importer. Cells with empty data get filled with other data similar to an "inverted Tetris game". The workaround is indeed to have empty cells contain anything but an empty string (can be `-` or `no_image` or anything that is not "nothing"). In the meantime, we have noted the bug.
> 0 votes

---
Tags: solspace-importer
---


# Question
Title: How to create a button on the Entry Edit page?
Basically, what i'm attempting to do is create a \[button\] right next to the entry save/submit button that will grab the current entries entry\_id and pass it to a page we control.

I'm staring at the channel\_entry api, but that's not really what i need at the moment. https://ellislab.com/expressionengine/user-guide/development/api/api\_channel\_entries.html am i looking at the wrong api?

Google search for "add button to entry edit page in expression engine" doesn't really give me any valuable results either.

Anyone know where i should start? or what files i should make changes to?

# Answer
There is no API for adding anything other than fieldtypes or tabs to the entry screen. I'd suggest one of two options:

1. Build a fieldtype which displays your button and adds the javascript you need, then place a field which uses this fieldtype as the last field on the screen.
2. Build an accessory which simply injects some javascript into the edit entry screen in order to add your button and behaviours under the appropriate circumstances.
> 2 votes

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


# Question
Title: Expresso Store connect guest orders to member
In Expresso Store, is it possible to connect orders placed by a guest to a member account with the same email address? The scenario is that a guest places an order, then later wants to create a member account on the site. It would be great to be able to then connect all their previous guest orders to that new member account.

# Answer
> 2 votes
Hi directly in the built in system - however, the only thing that relates an order to a member is a single column representing member\_id. You could write a small extension to simply iterate through all orders with member\_id=0 and query the members table to update them.

Shouldn't take more than an hours work.

Just to flesh this out a little - you should be able to do it with a query pretty close to this:

`update exp_store_orders o set o.member_id = (select member_id from exp_members where email = o.order_email) where o.member_id = 0;`

That's untested SQL BTW, but should give you a headstart.

---
Tags: expresso-store
---


# Question
Title: Moved website to another server, now the File Uploader (assets plugin) doesn't work.
I'm new to ExpressionEngine. I just moved a ExpressionEngine website to another server, got everything to work except for the images uploaded with assets (file uploader manager)... I checked the HTML and the images doesn't actually gets put into the website. It's just empty. I've tried to make all permission to 777 but nothing works. I can see the images if I go to the direct URL but the images never gets insertet into the website...

Anyone has a idea?

# Answer
Can you check your file upload prefences? Specifically the physical path setting for each upload location?

```
Content -> Files -> File Upload Preferences

```

Choose File Upload location and specificlly check :

```
* Server Path to Upload Directory
* URL of Upload Directory

```

A common relocation issue (fyi Reelocate can save you lots of time here) so I appologise if you've checked this setting too.

From your OP it looks like your URL is righ, but is your physical path 100%?

Also, can you diable Assets and try uploading via the native file manager? This will identify if the problem is in native EE file manager or the assets plugin specifically.
> 0 votes

---
Tags: assets
---


# Question
Title: How do I get the reverse entries of a relationship field?
I have a multi-site with two different channels:

1. Guides
2. Rivers

I need to associate specific guides with each river. Each river can have multiple guides associated with them.

Currently, I have it setup so the Rivers have a relationship field that allows selecting of entries from guides channel. That's working perfectly, but I'm running into an issue trying to list all of the Rivers a Guide is associated with.

For example: I have the river Salmon with a relationship of Guide A, Guide B and Guide C. On the Salmon River's page, it displays Guide A, Guide B and Guide C.

When I click on Guide A, I want that page to display all of the Rivers that have Guide A selected in the River's relationship field, i.e. Salmon River, Main Payette, etc.

# Answer
> 0 votes
You need to use a reverse relationship tag `{parents}`, it's well documented (with a Pizza Shop example) here on the EE docs site : https://ellislab.com/expressionengine/user-guide/add-ons/channel/relationships.html#parent-entries-which-stores-have-which-pizza

For example :

```
{!-- assuming here the guide being displayed is entry ID of 1 --}
{exp:channel:entries channel="guides" entry_id="1"}

    <h2>Guide : {title}</h2>

    <p>Rivers this guide applies to:</p>
    <ul>

    {!-- Here, the field parameter needs to be the field id of the relationship field on the rivers channel --}
    {parents field="river_guides"}
        <li>{parents:title}</li>
    {/parents}
{/exp:channel:entries}

```

And yes this is a duplicate. Let us know how you get on though please.

Also, you don't actually mention if your relationship fields are in a grid or matrix, are they? If so this answer might be of use to you : Parent relationship in grid field type

---
Tags: relationships, multi-site-manager
---