title: Manipulating the Style menu in WYGWAM?

text:
# Question
Title: Manipulating the Style menu in WYGWAM?
This thing drives me nuts. There is no reason this thing should be so small. I'd love to:

1. Make it larger, both vertically and horizontally; and
2. Style the text inside. I don't necessarily want it to adopt the style of the element it creates, either.

Are these options I have any control over?

# Answer
Go to Add-ons -\> Fieldtypes and select Wygwam.

Edit the relevant Editor configuration.

Enter a CSS file you want to use in the "CSS File" field I use a template so enter: `/css-javascript/css-wygwam` (template group/template name format), but you can use any frontend URL. This controls the styling inside the Wygwam Text field.

Next add an advanced setting called `stylesSet` and enter the style reference and url to your JS file:

```
mystyles:/themes/site_themes/mysite/js/js-wygwam.js

```

You used to be able to reference a template in this URL, but I think that stopped working with a newer version (could be wrong!). Note the style reference "mystyles".

Here's an example JS file:

```
CKEDITOR.addStylesSet('mystyles',[
    {name:'Content text', element:'p'},
    {name:'Leadin text', element:'p', attributes: { 'class': 'leadin' }},
    {name:'Head2', element:'h2'},
    {name:'Head2+border', element:'h2', attributes: { 'class': 'line' }},
    {name:'Head3', element:'h3'},
    {name:'Read More', element:'a', attributes: { 'class': 'showtext' }},
    {name:'More Text', element:'div', attributes: { 'class': 'moretext' }}
]);

```

Note the same style reference "mystyles". This builds the dropdown menu in Wygwam.

Your styles will be reflected in the menu as well as the text area.

Your CSS file is loaded in the head of the CKEditor iframe, so you can manipulate the dropdown separately:

```
.cke_panel_list li a

```

But it's difficult to target each individual style as they're referenced as #cke\_xxx, although once you've built the dropdown and the styles you want, you can specify these unique references in the CSS file.
> 1 votes

---
Tags: wygwam, config
---


title: Replacement for multitext

text:
# Question
Title: Replacement for multitext
I am upgrading a 1.7 site that used Mark Huot's MultiText field extensively. I'm trying to identify a similar solution for 2.6.1. (The multitext fields were used to provide captions for images in the 1.7 version of the site.)

It appears that the Matrix plug in is the best option. However, the data format of these two plugins is different. I have a lot of data formatted as MultiText. Is there any way to convert the data to Matrix data format?

# Answer
Matrix is perfect for your needs, and was available for EE1 too.
> 1 votes

---
Tags: plugin, upgrade, ee2-upgrades, field-conversion
---


# Question
Title: Output entry info for multiple channels in category loop
How can I output the entry\_ids for multiple channels within a category loop organized by channel?

I have 3 channels that share a category group so I need to loop through the categories and list out all entry ids but organized by their channel.

The info needs to be like so:

```
category 1 title
  - channel 1 (entry id 1, entry id 2, etc)
  - channel 2 (entry id 1, entry id 2, etc)
  - channel 3 (entry id 1, entry id 2, etc)

category 2 title
  - channel 1 (entry id 1, entry id 2, etc)
  - channel 2 (entry id 1, entry id 2, etc)
  - channel 3 (entry id 1, entry id 2, etc)

```

Hope that makes sense.

Any help is appreciated.

# Answer
```
{exp:channel:categories}
   {category_name}
   {exp:channel:entries category="{category_id}" channel="channel1"}
      {if count == 1}{channel}{/if}
      {title}
   {/exp:channel:entries}
   {exp:channel:entries category="{category_id}" channel="channel2"}
      {if count == 1}{channel}{/if}
      {title}
   {/exp:channel:entries}
   {exp:channel:entries category="{category_id}" channel="channel3"}
      {if count == 1}{channel}{/if}
      {title}
   {/exp:channel:entries}
{/exp:channel:categories}

```

Beware performance issues if you have many categories and many entries!

Other ways just for the sake of it...

```
{exp:channel:categories}
   {category_name}
   {exp:channel:entries category="{category_id}" channel="channel1|channel2|channel3"}
      {channel}
      {title}
   {/exp:channel:entries}
{/exp:channel:categories}

```

Or reverse it:

```
{exp:channel:entries category="1|2|3" dynamic="no"}
    {categories}category_name{/categories}
    {channel}
    {title}
{/exp:channel:entries}

```
> 1 votes

---
Tags: categories
---


# Question
Title: Getting a file directory tag {filedir_1} out of a query module result
I'm using a query module to get the results of a channel entry. I've retrieved the correct url: {filedir\_1}/newimages/img1.png

but it does not replace the {filedir\_1} with the necessary prefix like it normally does. Will the query module parse tags from its results?

this field happens to be an assets field but i would think it would parse like a regular image url would.

thanks in advance for any help.

# Answer
All results of queries created by the `exp:channel:entries` module are parsed by the function parse\_images on $this-\>EE-\>typography.

When you use the `exp:query` module, you need to do this by your own; but, luckily, Rob Sanchez coded an addon for this.

```
{exp:query sql="SELECT field_id_1 AS file FROM exp_channel_data" parse="inward"}
  {exp:parse_file_paths}
    {file}
  {/exp:parse_file_paths}
{/exp:query}

```
> 3 votes

---
Tags: assets, query
---


title: WYGWAM Cyrillic

text:
# Question
Title: WYGWAM Cyrillic
I'm trying to create a post on russian and after typing anything and clicking source I see this stuff:

```
<p>Стадион был полный, не просто полный, а переполненный, люди смотрели стоя, на входе, выше сидячих мест, я был приятно удивлен, что пришло столько людей поддержать свой клуб!</p>

```

I see the same while viewing source code on the website :(

# Answer
> 1 votes
Yep, that's normal and correct, relating to how CKEditor (used as the backbone for Wygwam) handles the content and seems to store it in its character encoding, but items like text fields store it in the native (as is) format.

Why is it an issue if the visual result is correct?

These solutions may help:

https://stackoverflow.com/questions/4510434/data-in-db-is-in-wrong-encoding-using-ckeditor-and-greek

http://forum.pivotx.net/viewtopic.php?f=17&t=3267

# Answer
> 2 votes
You can adjust that behavior by going to Add-Ons \> Modules \> Wygwam \> \[your config name\], and adding the ‘entities’ and maybe ‘entities\_greek’ + ‘entities\_latin’ advanced config settings, and setting them to ‘No’.

---
Tags: wygwam
---


title: How can I return UTC time?

text:
# Question
Title: How can I return UTC time?
Using, for instance, {current\_time} you get the time according to your server timezone setting. I see I can format it with {current\_time format="{DATE\_COOKIE}"} to get a result in UTC, but I need it in another format than cookie.

I know I can write a plugin or some direct PHP to pull it out, but is there anything within what EE gives us to return the UTC time?

# Answer
> 0 votes
You can apply your own custom format if you need something specific.

You can find details on how to do it in the docs here:

Date Variable Formatting

If you need to do something more specialised you could maybe try Low Nice Date that allow you to localise the date.

---
Tags: datetime, timezone
---


title: Passing Variables

text:
# Question
Title: Passing Variables
I hardly know any OOP PHP so I don't know how to properly pass variables, especially in EE.

I am working in a Module, and I have a function that passes my modules results to a .php file that has the table to show the results in the modules panel. I want to pass a variable "$config" to that file so I make a if/else statement.

Here is the function that passes my results to the file, that I need to pass the "$config" variable to create my if/else.

```
public function outputBrowser($results)
{
    // $rows = array();
    // print_r($results);
    // die();

    $this->EE->load->add_package_path($this->report_path);
    return $this->EE->load->view('output_browser', array("results" => $results), TRUE);

}

```

# Answer
> 2 votes
Alas you don't mention where you get $config from. I've assumed it's a global class variable below.

```
public function outputBrowser($results) {
    $data = array(
        "results" => $results,
        "config"  => $this->config
    );

    $this->EE->load->add_package_path($this->report_path);
    return $this->EE->load->view('output_browser', $data, TRUE);
}

```

The idea of a view file is that it contains minimal PHP code and ideally just view output. So it's good practice to prep anything before you send it to the view, for example, let's say you want to check if the config has been set:

```
    $data = array(
        "results"    => $results,
        "config"     => $this->config,
        "config_set" => (empty($this->config) ? false : true
    );

```

Then in the view template you can just do:

```
<?php if (config_set) : ?>
    do stuff <?php echo config; ?>
<?php endif; ?>

```

---
Tags: module, variable
---


# Question
Title: Accessing libraries in modules and extensions
I'm developing a module and an extension and I'm having trouble accessing the custom libraries that I placed inside the "libraries" folder of my module directory.

I've been trying to link to them inside public functions like this:

```
    $this->EE=& get_instance();
    //  Instantiate class to access Litmus
    $this->EE->load->library('litmus');

```

In the case above the filename is "litmus.php" and the class name used is "Litmus".

I've also tried putting the same code in the constructor function to no avail.

Thanks in advance for any help on this.

EDIT: ANSWER

All of the comments were helpful and this is what wound up working:

```
function Litmusee()
{
    // Make a local reference to the ExpressionEngine super object
    $this->EE =& get_instance();
    $this->EE->load->add_package_path(PATH_THIRD.'litmusee/');
    $this->EE->load->library('litmus_lib');
    $this->lib = $this->EE->litmus_lib;
}

```

When calling a function:

```
        // Create a new Litmus test
       $clients = $this->lib->get_litmus_email_clients();

```

With this setup I don't believe the library name matters.

# Answer
> 3 votes
The code you have should work fine. I've just run a test on a module and it loads fine in EE v2.5.3 (either in a method or in the class constructor). I've just had a quick read of the EE changelog and can't see any reference to changes there, so don't think it's version related.

Are you sure it's not calling the Class and then doing something unexpected?

I notice the Structure module has a capital letter for the filename (matching the library class name), but Store module doesn't, but does have the class name in front of it. But neither of these I think is relevant.

Have you tried dropping a `var_dump("TEST");` in your litmus construct?

Are you targeting the library methods correctly after loading?

```
$this->EE = & get_instance();
$this->EE->load->library('import');
$this->EE->import->process();

```

Not sure if it's relevant, but ensure you repeat the EE instance declaration in the library also `$this->EE = & get_instance();`.

In your module do you have:

```
error_reporting(E_ALL ^ E_NOTICE);
ini_set('display_errors', true);

```

Set to display errors?

One final thing to check - do you have any other conflicts of class names using "litmus"?

I've had problems in the past with libraries being used by both Extension and module (hence my comment to your question) and got conflicts, possibly that's what is occurring. To avoid it I loaded it in the normal way:

```
//###   Loaded using this method due to multiple classes and extension classes also loading it   ###
if (!class_exists('Settings'))
    require_once(PATH_THIRD.'cart/libraries/settings.php');
//$this->EE->load->library('settings'); <- not working :(
$this->settings = new settings();

```

Note: this was only because of conflicts in class already declared, as in the same class I load other libraries using the EE method.

# Answer
> 1 votes
Not, positive, but I believe the library needs to have the module name in front of it. i.e. Mymodulename\_litmus.php then call

```
$this->EE->load->library->('mymodulename_litmus');

```

This will tell EE to look in your addon's libraries folder and not EE's stock library folder. (I think).

# Answer
> 1 votes
In some instances you have to add the addon's path as a package path to the loader:

```
$this->EE =& get_instance();
$this->EE->load->add_package_path(PATH_THIRD.'your_addon_name/');
$this->EE->load->library('litmus');

```

---
Tags: add-on, module, extension, codeigniter
---


# Question
Title: WYGWAM font and size menus after upgrade to 3.0.2
Just upgraded to Wygwam 3.0.2 (EE 2.6.1)

The font and size menus are no longer available in the main toolbar, and though I see options for them in the advanced configuration options, they aren't appearing for me even when I've chosen them either. (I've set fontSize\_sizes, fontSize\_defaultLabel, font\_names and font\_defaultLabel)

I'd like to know how to get them to appear again.

# Answer
> 0 votes
Direct from the blog post announcing WYGWAM 3

> We’ve made some executive decisions on that last point: in Wygwam 3 you no longer have the option to customize font styles directly from the editor or add emoticons. If you have an issue with that, you’re probably using the wrong CMS to begin with.

---
Tags: pixelandtonic, wygwam, size, toolbar
---


title: language error on an EE 1 upgrade

text:
# Question
Title: language error on an EE 1 upgrade
I've tried to do an upgrade on a 1.7.3 site and never seen this error before:

```
The language files needed for your current language selection () are unavailable. Please put the language pack in this folder: expressionengine/language/

```

I've tried upgrading to 2.6.1 and 2.5.5 and both give the same error.

Language files are definitely in place.

Can't find any refs online.

# Answer
> 0 votes
seems the language files got borked on a previous unsuccessful upgrade. Restored from a backup and it ran fine.

---
Tags: error, ee2-upgrades, language
---


# Question
Title: Using Simple Search to look in an entry's selected categories?
I have a simple search form set to look in entries. When I search for the category name that I have selected in some entries, the entry does not show in the results. Should I be able to use Simple Search to look in an entries selected categories?

# Answer
> 2 votes
eeDelve,

The EE search module searches the content of entries - it will not look for names of categories. You may need to look at some of the third-party options for that.

Here's a quick list of add-ons that that may help out. Look to Low Search and Solspace Super Search first, would be my suggestions. See this search for 'search' on Devot-ee

# Answer
> 0 votes
You can use an add-on called Categories to Text which will save all an entry's categories into a channel field automatically.

---
Tags: categories, simple-search
---


# Question
Title: How can I find out the file extension of a Safecracker file within matrix?
I would like to attach different CSS classes for different types of file within a Matrix field. I have tried:

`{group_files}{group_files_title}{/group_files}`

But this always defaults to txt. Any ideas where I'm going wrong?

Thanks in advance

# Answer
Have you tried using either Switchee or Ifelse instead of the native if/else? It could be an issue of parse order which is messing this up for you.

Low has a very good explanation of ExpressionEngine Parse Order.
> 0 votes

# Answer
Does removing the forced parse help? Change `"{extension}"` to just `extension`.

```
{group_files}
{if extension == "docx"}
    doc
{if:elseif extension == "doc"}
    doc
{if:elseif extension == "pdf"}
    pdf
{if:else}
    txt
{/if}
{/group_files}

```

Or with **IfElse** add-on just add wrapping tag pair:

```
{exp:ifelse parse="inward"}
  {group_files}
    {if extension == "docx"}
      docx
    {if:elseif extension == "doc"}
      doc
    {if:elseif extension == "pdf"}
      pdf
    {if:else}
      txt
    {/if}
  {/group_files}
{/exp:ifelse}

```
> 0 votes

---
Tags: matrix, safecracker, extension, safecracker-file
---


# Question
Title: Advanced conditional & Low Variable parse order
I need to use an advanced conditional with Low Variables and am having trouble getting it to work. I believe it's a parse order thing but am not sure how to get around it.

I am checking the current date/time against 2 Low Variables to see if the current date/time is in between 2 variables.

```
{if '{current_time format="%F %d - %g:%i %a"}' >= '{date_start}' AND '{current_time format="%F %d - %g:%i %a"}' <= '{date_end}'}
Show some content
{/if}

```

date\_start & date\_end are the Low Variables & I have both of them set to parse early.

Any help is appreciated.

# Answer
> 0 votes
This conditional will never work because the format you chose. "%F %d - %g:%i %a" isn't a number and just numbers can use `>`, `>=`, `<` and `<=`.

You need to format all variables used in this conditionals as seconds since Epoch.

```
{if {current_time format="%U"} >= {date_start} AND {current_time format="%U"} <= {date_end} }
  Show some content
{/if}

```

Remember that your Low Variables need to be formated this way too! If you can't, there are some addons which can change the format of a date. Low has one.

```
{exp:low_nice_date date="{date_start}" format="%U"}

```

So:

```
{if {current_time format="%U"} >= {exp:low_nice_date date="{date_start}" format="%U"} AND {current_time format="%U"} <= {exp:low_nice_date date="{date_end}" format="%U"} }
  Show some content
{/if}

```

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


# Question
Title: Run extension after file upload? Need to extract IPTC data
I have a bit of a tricky one.

A client of mine wants the IPTC keywords data within files to be searchable through the default EE simple search (or at least via a db query).

I have searched around and can't find anything that offers this, with channel images coming the closest, but it doesn't appear its possible to search the IPTC data, only display it in templates.

Is there a way I could run an extension after each file upload is complete? I could then build an extension which uses PHPs IPTC extraction and enter it in a database table.

If anyone has any ideas on this, I would be greatful to know, as I am slightly surprised this doesn't come up more often.

Thank you.

# Answer
> 1 votes
The problem is that File Manager isn't associated with search which only relates to entries, so when you add an image to an entry, only the URL is stored with the entry, therefore only the URL is included in the searching.

The simplest solution would be to use a matrix field for your file uploads and include a column for the IPTC keywords to be added manually.

For example, in the below grab I use matrix to store information relevant to an image (alt text, title, etc) and ensure that "Is field searchable?" and "Is col searchable?" are ticked...

**UPDATE**

The alternative is a big task! Search is performed by looking at the field\_id\_x columns in the channel\_data table. So if you simply place the IPTC reference in there, it will conflict with the fieldtype or entry data (e.g. a wysiwyg field).

So you'd need an extension that fired when an entry was saved and used: entry\_submission\_absolute\_end and publish\_form\_entry\_data to capture the save. You'd then need to parse this data for the relevant image paths, read the image data extracting the IPTC information.

That's the easy bit.

Then you'd need a custom lookup table in the database to store this information and reference the entry ID and URL.

But all this is still not going to associate with the search process in EE - and that's a problem as there's only the ability to change the search results (channel\_entries\_query\_result hook), not change the SQL used to search on. So you then have to rebuild the exp:channel:entries tag pair to customise the SQL, run the search and then tap into the channel class and manually trigger the entries method to parse the parameters and output.

If you were to do your own sql query to do the search output, you'd still need to have saved the IPTC data and need to parse the data on output and process any parameters associated with the normal channel:entries tag pair. Although your custom SQL could output a list of entry\_id's that you could then pass to the channel:entries tag to let it parse the output for you.

It's no small effort, so paying a junior for data entry would look far more appealing :)

# Answer
> 0 votes
I'm not sure this needs to be this complex - but you might be better served with a better image storage mechanism. I believe you can achieve what you're after using the metadata capabilities of either Assets, from Pixel & Tonic, or Channel Images from DevDemon. If you can pull your IPTC keywords into a Channel entry field, you should be able to access them via search, or perhaps more easily using the excellent Low Search.

See also this great blog post from Low on EE searching, as well as this recent question that may help.

http://gotolow.com/blog/a-low-search-primer

Search on Assets (pixel & tonic) Meta Data

---
Tags: file-uploads, file-manager, channel-images
---


title: Category links to stay on the same page

text:
# Question
Title: Category links to stay on the same page
Is it possible to use Category links that don't link to a different URL, but instead to a different part of a page. So for example, I want the Category link that is generated to produce:

```
<a href="#section1">Section 1</a>

```

instead of:

```
<a href="section1">Section 1</a>

```

The "#" sign disappears when I try to change the "Category URL Title" field.

# Answer
> 2 votes
Of course!

The `path` variable can be put aside and you can create the links by your own. Just code the href attribute as you need.

Some samples:

```
<a href="{path='channel/index'}">{category_name}</a>
<a href="#{category_url_title}">{category_name}</a>

```

---
Tags: categories, links
---


title: Store - Show Total Amount Sold

text:
# Question
Title: Store - Show Total Amount Sold
We need to be able to show the total amount of items sold for a specific item. How would we go about doing this? So basically the amount that have sold in the past, this is more so for our own reporting reasons.

# Answer
> 1 votes
If this is just for your own reporting then you can make use of the Reports section by navigating to Store \> Reports and going to the Products Sold section. Enter in your custom date range (which can go back to the first purchase) and the items can be ordered by SKU. You can then view this report online or export it as a CSV or PDF which will contain the total number of products sold per SKU for a specified date range.

---
Tags: expresso-store
---


# Question
Title: Specify Order Status in Exp:resso Store Checkout Process
The Exp:resso Store plugin by default assigns all new orders to the New status. This in turn triggers the New status email confirmation to be sent out.

The problem I'm dealing with is that I have a few orders that need to completely bypass the New status. Those orders are submitted using a separate form from the rest of the orders, and as such, I'd like to be able to give them a separate Status so that the default New order email confirmation never gets sent out for them.

Any ideas on how I might accomplish this? Thanks for any help you can offer!

# Answer
> 5 votes
You will need to write an extension that would change or skip the default status based upon what items are in the cart. You can take a look at the available extension hooks. Your best bet would probably be the store\_order\_complete\_end hook.

# Answer
> 2 votes
In Store \> Settings \> Orders Statuses click on the *Add New Status* button. Give this status a name and then check the *Make Default* checkbox. If you don't want an email to be sent out on this status assignment then in the Email Template field below ensure that no email template is selected (leave blank).

---
Tags: expresso-store
---


# Question
Title: How do I send item descriptions from Store to PayPal Express?
Please can anyone help, my EE Store is working fine and is sending the correct details to PayPal Express, however, is there any way I can send item descriptions too? At the moment, the PayPal descriptions area remains blank.

Thanks in advance,

Mike

# Answer
> 0 votes
You will need to modify the PayPal Express gateway files. There is another thread already that shows the steps involved.

After you have made the changes you should see the items being passed along to PayPal.

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


title: Assets - Showing a specific folder

text:
# Question
Title: Assets - Showing a specific folder
If I had a folder with a series of subfolders that matched the username, could I show those files to that specific user? Looking to try making a download portal, but the files are not small enough to be uploaded through PHP. Example:

File Manager Settings:

**/home/www/files/**

Assets Folder tag: **parent\_folder="{filedir\_x}"**

But I wanted to show a single folder in the files directory:

**/home/www/files/{username}**

Assets Folder tag: **parent\_folder="{filedir\_x}{username}"**

The entire tag would look like this:

```
{exp:assets:folders parent_folder="{filedir_20}admin" recursive="yes"}
    <h3>{folder_name}</h3>
    <ul>
        {exp:assets:files folder_id="{folder_id}"}
            <li><a href="{url:huge}" target="_blank">{if title != ""}{title}{if:else}{filename}{/if}</a></li>
        {/exp:assets:files}
    </ul>
{/exp:assets:folders}

```

Using just {filedir\_x} worked, but adding {filedir\_x}{username} did not. Is it possible without using entries and just the two Assets tags? And I would assume from previous posts that if it could, it would show all files as a flat list, and not nested within subfolders?

# Answer
> 3 votes
Blair,

when Expression Engine calls Assets module tags, {username} is still just a string saying "{username}" (see Low's excellent overview for parse order - http://bit.ly/UwfZE2). You'll have to get the username using a different approach - probably by using PHP on Input.

# Answer
> 1 votes
(To answer a request on what I did) I used a list of folder that .load a template of files like so:

URL: site.com/downloads/me/blair Username is required in the URL so the segment variable can be used to parse early enough. logged\_in\_username won't work alone. There are addons to get around this, might do that in the future, but I couldn't find a native EE way.

File Directory: home

```
- blair
- - Folder 1
- - - file1
- - - file2
- - - file3
- - Folder 2
- - - file4

```

Folders:

```
<ul>
  {exp:assets:folders parent_folder="{filedir_29}{segment_3}" recursive="no"}
  <li>
    <a href="{path='downloads/_assets'}/{folder_id}/{username}">{folder_name}</a>
    {if total_subfolders}
      <ul>
      {subfolders}
      </ul>
    {/if}
  </li>
  {/exp:assets:folders}
</ul>

```

Files: URL: site.com/downloads/me/1234 (folder id)

```
{exp:assets:files folder_id="{segment_3}"}
    {exp:link_vault:download_link file_path='{server_path}' text="{filename}"}
      {!-- File display stuff --}
      {!-- Ex: --}
      {server_path} - {filename}...etc.
    {/exp:link_vault:download_link}
{/exp:assets:files}

```

I also have some protection, such as wrapping it in a {if segment\_3 !=""} so it won't show every single folder (kaboom!) and {if segment\_3 != logged\_in\_username}. We've also added member\_group=="1" to that last conditional so we can check other users list of files quickly, and we don't run a public system to worry about security, all campus internal stuff. Link vault to track downloads and there's another template to post files publicly that does need link limitations & hiding.

---
Tags: assets
---


# Question
Title: How to remove 30 second interval restriction when sending mail?
I noticed that when I try send an email to another person, in quick sucession, I get a an error message that says that I should wait for 30 seconds before I can send next email.

How do I remove this restriction?

I have seen in the documentation that there are some settings to edit re-submission time interval, but only for comments.

This is the contents of the body when I tried to submit

```
<div id="content">
<h1>The form you submitted contained the following errors</h1>
<ul><li>You are only allowed to send a Private Message every 30 seconds</li>
</ul>
<p><a href='JavaScript:history.go(-1)'>Return to Previous Page</a></p>
</div>

```

# Answer
> 4 votes
Can you try by making change into the file "system/expressionengine/modules/email/mod.email.php". In this module file, around line number 28, you can see the variable `$email_time_interval`. Set its value as 1.

**======================EDITED===================**

I found it. There is a hidden config variable `prv_msg_throttling_period` for it. so you need to set this config variable within config file system/expressionengine/config/config.php like: `$config['prv_msg_throttling_period'] = '1';`

See here: http://ellislab.com/expressionengine/user-guide/general/hidden\_configuration\_variables.html#prv-msg-throttling-period

I hope, it would work for you.

---
Tags: messages
---


title: Member Temporary Password

text:
# Question
Title: Member Temporary Password
Is it possible in EE 2.6.1 to have a super-admin create a member of another group, and have the system send a temporary password, and then have the user login to the front-end with that temporary password. These members will never have access to the control panel. Are there any good 3rd party modules that would accomplish this?

# Answer
> 1 votes
You should try MX Auto Password and MX Notify Control

---
Tags: members, registration
---


# Question
Title: SQL SELECT using custom field name (not ID) in WHERE
Forgive me if I missing something obvious, but I have a need to select channel entries from the EE database, but I want to select those entries based on a value assigned to one of my channels custom fields. In the `exp_channel_data` table though I have no guaranteed way of knowing which column that data might be in due to how EE adds columns to the table. It could be `field_id_27` or `field_id_123`. I could look in the admin, get the ID and then infer the column name, but that's clunky. Also, I'm trying to use this in a custom plug-in and I can't assume the ID will always be the same as I move the code from EE install to EE install. So what I want to know, and can't find, is what is the recommend method to build a SQL query in EE to be able to use a particular custom field in your WHERE clause?

To put it another way, if my custom field is named `my_cutom_field` what I want to do is be able to say:

`WHERE my_custom_field = 'some value'`

I hope this question makes sense.

# Answer
> 2 votes
Yes, you can prepare an array which would contain the custom field name and id like:

```
$fields = array();

$query = $ee()->db->query("SELECT exp_channel_fields.field_id, exp_channel_fields.field_name FROM exp_channel_fields
LEFT JOIN exp_channels ON exp_channel_fields.group_id=exp_channels.field_group
WHERE exp_channels.channel_name='[CHANNEL NAME]'");

foreach($query->result_array() as $row){
    $fields[$row['field_name']] = 'field_id_'.$row['field_id'];
}

```

Now within the `WHERE` condition you can put like: `WHERE $fields['my_custom_field '] = 'some value'`

# Answer
> 1 votes
How about using a `JOIN` on `exp_channel_fields` which contains the field metadata?

---
Tags: custom-fields, query, mysql
---


title: Switchee not working

text:
# Question
Title: Switchee not working
i simply cant make a simple switchee condition works...just to load template snippet, with different sizes/css. Help, please? (My first time with Switchee)

```
<!-- switchee via simple text field -->
{exp:switchee variable = "{portfolio_size}" parse="inward"}

{case value="small"}
<!-- start small portfolio -->
        <section id="content">
        <div class="container">
                <div class="row">
                        <div class="span8">
                                <article>
                                <div class="top-wrapper">
                                        <!-- start flexslider -->
                                        <div class="flexslider port">
                                                <ul class="slides">
                                                {exp:channel:entries channel="portfolio" orderby="date" sort="desc" limt="1"}
                                                <!-- matrix field -->
                                                        {portfolio_images}
                                                        <li>
                                                        {exp:ce_img:single src="{portfolio_image}" width="612" height="408" crop="yes" alt="{portfolio_image_title}}
                                                        </li>
                                                        {/portfolio_images}
                                                {/exp:channel:entries}
                                                </ul>
                                        </div>
                                        <!-- end flexslider -->
                                </div>
                                </article>
                        </div>

                        <div class="span4">
                                <aside class="right-sidebar">

                                <div class="widget">
                                        <div class="widget-title"><h5 class="widgetheading">Project informations:</h5></div>
                                        <ul class="folio-detail">
                                        {exp:channel:entries channel="portfolio" orderby="date" sort="desc" limt="1"}
                                                <li><label>Category:</label>  {categories}{category_name}{/categories}</li>
                                                <li><label>Client:</label>  {portfolio_client}</li>
                                                <li><label>Project Date:</label>  {portfolio_date}</li>
                                                {if portfolio_url}
                                                <li><label>Project link:</label><a href="{portfolio_url}" target="_blank">  {portfolio_url}</a></li>
                                                {/if}
                                        {/exp:channel:entries}
                                        </ul>
                                </div>
                                <div class="widget">
                                        <div class="widget-title"><h5 class="widgetheading">About this project</h5></div>
                                        {exp:channel:entries channel="portfolio" orderby="date" sort="desc" limt="1"}
                                        <p>{portfolio_texto}</p>
                                        {/exp:channel:entries}
                                </div>

                                </aside>
                        </div>
                </div>
        </div>
        </section>
        <!-- end small portfolio -->
        {/case}

    {case value="bigger"}

        <!-- start portfolio bigger -->
        <section id="content">
        <div class="container">
                <div class="row">
                        <div class="span12">
                                <article>
                                <div class="top-wrapper">

                                        <!-- início do  flexslider -->
                                        <div class="flexslider port" style="margin-bottom: 0px">
                                                <ul class="slides">
                                                <!-- matrix field -->
                                                {exp:channel:entries channel="portfolio" orderby="date" sort="desc" limt="1"}
                                                        {portfolio_images}
                                                        <li>
                                                        {exp:ce_img:single src="{portfolio_image}" width="932" height="621" crop="yes" alt="{portfolio_image_title}}
                                                        </li>
                                                        {/portfolio_images}
                                                {/exp:channel:entries}
                                                </ul>
                                        </div>
                                        <!-- end flexslider -->
                                </div>

                                </article>
                        </div>

                        <div class="span4">
                                <aside class="right-sidebar">
                                <div class="widget">
                                        <div class="widget-title"><h5 class="thin">Project informations:</h5></div>
                                        <ul class="folio-detail">
                                        {exp:channel:entries channel="portfolio" orderby="date" sort="desc" limt="1"}
                                                <li><label>Category:</label>  {categories}{category_name}{/categories}</li>
                                                <li><label>Client:</label>  {portfolio_client}</li>
                                                <li><label>Project Date:</label>  {portfolio_date}</li>
                                                {if portfolio_url}
                                                <li><label>Project link:</label><a href="{portfolio_url}" target="_blank">  {portfolio_url}</a></li>
                                                {/if}
                                        {/exp:channel:entries}
                                        </ul>
                                </div>
                                </aside>
                        </div>

                        <div class="span8">
                    <aside class="right-sidebar">
                        <div class="widget">
                                        <div class="widget-title"><h5 class="thin"><strong>About this project</strong></h5></div>
                                        {exp:channel:entries channel="portfolio" orderby="date" sort="desc" limt="1"}
                                        <p>{portfolio_texto}</p>
                                        {/exp:channel:entries}
                        </div>
                        </div>
                        </aside>

                </div>
        </div>
        </section>
        <!-- end portfolio bigger -->
        {/case}

        {/exp:switchee}

```

# Answer
> 2 votes
Fabio!

Your snippets will load any way. They are loaded before the parse of all modules. But this code should word as you're planing. The content of the unmatched snippets will be removed of your template.

Buuuuuuuuuuuuuuuut, from where are you calling the `portfolio_size`? Are you using a `exp:channel:entries` variable pair around the switchee? Because, the value of this variable needs to come from somewhere.

By the way, you have a missing quotation mark on your ce\_img variables:

```
{exp:ce_img:single src="{portfolio_image}" width="932" height="621" crop="yes" alt="{portfolio_image_title}}

```

It should be:

```
{exp:ce_img:single src="{portfolio_image}" width="932" height="621" crop="yes" alt="{portfolio_image_title}"}

```

# Answer
> 3 votes
I suspect the variable portfolio\_size is actually a custom field in your portfolio channel. So you just need to simplify a little, wrapping your entries loop around the switchee tag pair. So something like this is what you need:

```
{exp:channel:entries channel="portfolio" orderby="date" sort="desc" limt="1"}
    {exp:switchee parse="inward" variable="portfolio_size"}
        {case value="small"}
            <!-- start small portfolio -->
    <section id="content">
    <div class="container">
            <div class="row">
                    <div class="span8">
                            <article>
                            <div class="top-wrapper">
                                    <!-- start flexslider -->
                                    <div class="flexslider port">
                                            <ul class="slides">
                                            <!-- matrix field -->
                                                    {portfolio_images}
                                                    <li>
                                                    {exp:ce_img:single src="{portfolio_image}" width="612" height="408" crop="yes" alt="{portfolio_image_title}}
                                                    </li>
                                                    {/portfolio_images}
                                            </ul>
                                    </div>
                                    <!-- end flexslider -->
                            </div>
                            </article>
                    </div>

                    <div class="span4">
                            <aside class="right-sidebar">

                            <div class="widget">
                                    <div class="widget-title"><h5 class="widgetheading">Project informations:</h5></div>
                                    <ul class="folio-detail">
                                            <li><label>Category:</label>  {categories}{category_name}{/categories}</li>
                                            <li><label>Client:</label>  {portfolio_client}</li>
                                            <li><label>Project Date:</label>  {portfolio_date}</li>
                                            {if portfolio_url}
                                            <li><label>Project link:</label><a href="{portfolio_url}" target="_blank">  {portfolio_url}</a></li>
                                            {/if}
                                    </ul>
                            </div>
                            <div class="widget">
                                    <div class="widget-title"><h5 class="widgetheading">About this project</h5></div>
                                    <p>{portfolio_texto}</p>
                            </div>

                            </aside>
                    </div>
            </div>
        </div>
        </section>
        <!-- end small portfolio -->
        {/case}
        {case value="bigger"}
            SAME IDEA AS SMALL - JUST PUT ALL YOUR BIGGER CASE MARKUP HERE
        {/case}
    {/exp:switchee}
{/exp:channel:entries}

```

---
Tags: switchee
---


# Question
Title: entry submission error logged in as client user - "You are not authorized to perform this action"
Anyone seen this issue?

I'm logged in as the client who is under the member's group (I believe I have set all the required permissions, can't see anything obvious that would restrict this).

When I try and re-submit an entry in the client's account where the Author is the Super Admin, I get this error:

https://i.stack.imgur.com/zXwYC.jpg

# Answer
> 3 votes
Check this permission for their member group: *Can change the author name when posting channel entries*. (Under Members → Member Groups → Edit Member Group.)

---
Tags: members, error, entry, permissions
---


# Question
Title: Expresso Store: Promo Code with no user restrictions
I've set up a Promo code on my site with the setting for 'Restrict to Member Group' set to 'all'.

However the promo code only works if you are a logged in user, not if you are a guest. Even setting 'Restrict to Member Group' to 'guest' doesn't allow the promo code to be used by non-members.

Is seems to be a bug, has any one else any experience of this or even promo codes in general. This is the first time I have used one!?

Cheers

Tom

# Answer
> 2 votes
My issue was that I had set a usage 'Limit per user'. This requires a user to be logged in. Removing that value from the settings made it work.

Thanks to: Promotion Code Errors on Expresso Store

---
Tags: expresso-store
---


title: Building photo-sites with EE

text:
# Question
Title: Building photo-sites with EE
What are the experiences in building a photo oriented site in EE?

There are some really nice plugins out there, like Channel Images or Assets, but they are all oriented around "uploading as you go" and not for serving images from some kind of back-end (like slideshowpro director or similar). For myself and fellow photographers the input would be extremly useful around how others might have solved this.

# Answer
All ended up with me using a totally separate application for images, Koken, with added styling similar to the main site.
> 0 votes

# Answer
I'm a huge fan of SlideShow Pro Director!

I'm not sure there is anything out there off the shelf right now, like an add-on for example though, I hope I'm wrong.

With that said, have you considered using SSP Director along with it's DirectorPHP classes?

You could build your own add-on (recommended) or use PHP templates and build out your own gallery using their classes/methods etc and just use Director for the image handeling uploading/editing side of things.

If I remember right they are using Cake PHP for their API.

You can get more familiar with it here in their docs:

http://wiki.slideshowpro.net/SSPdir/API-DirPHP-Getting-Started

They have some examples here of how to use it:

http://wiki.slideshowpro.net/SSPdir/API-DirPHP-Recent-Images-Example

And you can download DirectorPHP from your account center once you've logged in. Not positive if you need to purchase Director first or not, however, I'm pretty sure to connect to Diretor from DirectorPHP you will need a key from Director settings itself and add it to the DirectorPHP.php file like so:

```
# Fill in your API key here. It can be found on your Director preferences pane,
# under the "About your install" section.
public $api_key = 'your-api-key-goes-here';

# Path to your Director install
# This can also be found on your preferences pane, below the API key
public $path = 'your-api-path-key';

```

Note: the above code is from DirectorPHP 1.5 beta and may differ from the non-beta version.
> 5 votes

# Answer
If you like SSP Director (as do I, very slick interface, I'd love to see something like that come to the EE control panel), then maybe keep an eye on Koken: http://koken.me/

Something new developed by the same developer as SSP with a public beta coming soon.
> 5 votes

# Answer
Can you start by quantifying some numbers, I've built a few image/gallery'esque sites over time and it all comes down to the numbers.

The most used method is similar to a designers portfolio, one channel entry per shoot/location/project, 1 - 20 images per entry - matrix + assets - Add all the jquery/plugin magic you want because your dealing with specific entries.

If you're talking 100's of images per "entry" then mega-upload and channel images could be a worthy alternative.

In the end, it all comes down to how you want to present and how many images are in each presentation.

So, let us know how you plan to present the info with some objective numbers and a solution will become more obvious :)
> 4 votes

# Answer
We typically just use either Channel Images, Assets, or in the past a Matrix field with File fields inside of it, coupled with one of the jQuery plugins that works based on a set of markup. You then read the selected module's data for the current entry out, and insert a bunch of `<li>`s in a `<ul>` or `<div>`s or whatever the given jQuery plugin expects, then style as needed.

I don't feel that there is really a one size fits all approach for this kind of thing, you need to find a jQuery plugin that has the behavior that you want, then work to couple it with your chosen backend module that stores the imagedata.
> 2 votes

# Answer
EE doesn't have a real document/asset management addon, although one could certainly be built out of existing bits. I would start with Channel Images, because its directory structure really lends itself toward reuse of assets (it gives every asset a separate subdirectory).

Alternatively you could start with a separate DMS/AMS, and build some sort of integration bridge, as Natetronn suggested above with SSP Director.
> 1 votes

---
Tags: image-galleries
---


# Question
Title: Playa only returning children in same channel
EE 2.3.1 Playa 4.4.5 I'm just looking to return the children for a given entry. Playa is only returning the children that are in the same channel as the parent. This works as expected on my testing server (EE2.6.1). This is all that is in the template.

```
{exp:channel:entries channel="slider"}
<h3>{title}-{entry_id}</h3>
 <ul>
{slider_articles}
<li>{title}</li>
{/slider_articles}
 </ul>
{exp:playa:total_children}
{/exp:channel:entries}

```

yet specifying {exp:playa:child\_ids entry\_id="1234"} returns all the correct related id's. All the data looks correct in the exp\_playa\_relationships table.

# Answer
Doh! I didn't realize the client had a custom status on those entries.

This fixed it:

{slider\_articles status="open|Published"}

It's been one of those weeks.....................
> 1 votes

---
Tags: playa
---


# Question
Title: Running EE from two locations: A Dev and Live environment
Due to tight security restrictions we can't host the admin.php file on our live server. As a result I need to be able to run EE from two locations: One from a dev server (where we include the admin.php file for access to the EE panel) and another from our live server, where we will *not* include the admin.php file. We only need to serve content there, not manipulate it.

Both the live and dev servers have access to the same DB.

Has anyone done something like this before? Is it possible? If so, what are the details for making this work?

# Answer
Yes it will work, just use the same database config (you'll need to use the full name of the database server rather than 'localhost').

When you have the dev site installed and working just copy the files over to your live server.

You will then need to update a number of paths in various parts of the system. For this I would suggest using Focus Labs Config to set up different config files for each environment in which the site will run.

You might want to look at using a Git repo to keep files in sync.

However, for the record, simply removing admin.php won't stop access to the site's CP. Just hit the system directory and it will load up. I'm curious as to why your host is saying you can't have the admin.php file.
> 4 votes

# Answer
I cannot say I've done this before, but what I would attempt to do is the following:

1. Make a duplicate install of your live ExpressionEngine code on a separate location of your dev server, separate from your dev environment.
2. Ensure the config point your database to the live server. Then use this install uniquely for the Control Panel.
3. You'll want to make sure there is nothing preventing a database connection from your dev environment. You may need to change your database host from '127.0.0.1' to specify the live host.
4. If you have issues with links, set a rewrite rule on your live site to redirect anything pointing to admin.php or /system to the dev server; assuming your dev server has protection from the outside world it should not pose a problem.

You'll also want to make sure you keep both versions of the code in sync going forward, especially any updates to EE or add-ons.
> 1 votes

---
Tags: admin
---


# Question
Title: Sharing live file upload folders with dev
I have a scenario where I would like to share the live file upload folders for a site with the dev environment. Both environments are on the same server so I've created a symbolic link in the dev environment pointing at each of the corresponding folders in the live environment. This works perfectly well over SFTP, I can click into one of these folders in dev and I see the contents of the folder on live.

However I'm unable to access files in these folders via HTTP requests. Is there something I'm missing? It seems like an obvious approach to the problem but maybe it's not that simple?

This is a pretty old site so we're stuck with 1.x (1.7.1 at present) else I would use the lovely new file upload location config vars to resolve the situation. :)

# Answer
This is more a question about servers, than about EECMS.

If you're using Apache, add this to the .htaccess file of your dev website:

```
Options FollowSymlinks

```

You can read more about this at the documentation of Apache.
> 1 votes

---
Tags: files
---


# Question
Title: Freeform Pro - Email Recipient from Channel
I'm trying to have a Freeform Pro on my site that not only emails the site owner when it's submitted but an external email contact as well.

The external email is a field from a channel called company. I was hoping something like this could work:

```
{exp:channel:entries channel="companies" limit="1" site="default_site"}
{exp:freeform:form form_name="el_list_form" required="name|email|phone|company" return="/search" recipient1="{company_email}"}
...
{/exp:freeform:form}
{/exp:channel:entries}

```

At the moment it emails the `admin_notify` in the freeform settings just fine but will not email the `company_email` contact. I tried just sticking in my own email manually and it doesn't seem to like that either.

I tried to see if it was my mail in general that was the issue by sending out a site communication message but that sent just fine.

Any ideas?

# Answer
> 1 votes
This looks like a parsing order issue.

By default the Template Engine will start to parse by innermost module variable. So, in your case, `exp:freeform:form` is parsed before `exp:channel:entries`.

You need to make the `exp:channel:entries` be parsed first to make the `{company_email}` available to `exp:freeform:form`. For this, set the value of its `parse` parameter to inward:

```
{exp:channel:entries channel="companies" limit="1" site="default_site" parse="inward"}
  {exp:freeform:form form_name="el_list_form" required="name|email|phone|company" return="/search" recipient1="{company_email}"}
    [...]
  {/exp:freeform:form}
{/exp:channel:entries}

```

It's just this.

# Answer
> 1 votes
If you aren't using different notification templates for each recipient then you can use a pipe delimited list of email addresses for the admin\_notify parameter (or specify them in the form tag parameters)

If you still encounter a parse order problem you might want to try adding a freeform field for the second address and including a hidden field in the form into which you put the second email address.

Then you could try using the name of that hidden field in your form tag.

Something like

```
<input type="hidden" name="second_email" value="{company_email}">

```

Then in your form tag pair use

```
{exp:freeform:form form_name="el_list_form" required="name|email|phone|company" return="/search" recipient1="{second_email}"}

```

Not tried it but it might work.

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


# Question
Title: Redirect - Even though redirect code is absolute its handled as relative
On my search results page I am testing to see if there is only one result and if so redirecting the user to that result page using the redirect tag.

However, even though the path I am redirecting to is absolute it seems to be handled as relative.

For example - the path I am redirecting to:

```
http://myurl.com/path/to/page

```

Once the redirect is complete the address bar shows:

```
http://myurl.com/http://myurl.com/path/to/page

```

This does still show the right page content, but clearly isn't the right URL.

The code i am using is:

```
{redirect="{url_title_path='store/product'}"}.

```

When placed into a template alone {url\_title\_path='store/product'} writes out myurl.com/path/to/page and indeed this very same tag works perfectly when applied to an anchor (a) tag.

Any advise on how to resolve this much appreciated.

# Answer
> 1 votes
Well, you shouldn't add the domain on redirect global variable.

```
{redirect='template_group/template_or_segment_2'}

```

So, your option is to try:

```
{redirect='store/product/{url_title}'}

```

I have to confess that I never tried to use three segments on redirect global variable.

# Answer
> 1 votes
Consider using the RedirectURL plug-in from Rodrigo Passos. It allows you to specify an entire absolute URL.

This would allow you to provide a URL in something like this: `{exp:redirecturl url=“http://myurl.com/{channel_short_name}/{url_title}”}`

Or if you're using page URIs: `{exp:redirecturl url=“http://myurl.com{page_uri}”}`

Find more information about RedirectURL on Devot-ee.

Doing this though, you may want to wrap your conditional in a `{exp:ifelse}` tag using Croxton's IfElse plug-in. That way you can be sure your condition isn't parsed after the plugin has already run.

---
Tags: redirects, tags, redirection
---


title: Pagination - Base URL duplicate

text:
# Question
Title: Pagination - Base URL duplicate
I have the following problem:
\- Let's say I'm on **domain.com/en/support/manuals**
\- Using pagination I get the following URL on Page 2: **domain.com/en/support/manuals/domain.com/en/support/manuals/P10**
Once I manually remove the duplicate part, it works just fine. Whats wrong here?
Thanks in advance!

EDIT: Here's the template code:

```
{exp:channel:entries channel="manual" limit="10" paginate_base="support/manuals"}

  <div class="row">
    <div class="span4">
      <a href="{manual_download}">
      {manual_relationship}
        {manual_relationship:title}
      {/manual_relationship}
      </a>
    </div>

    <div class="span2">
      {categories}{category_name} {/categories}
    </div>

    <div class="span2">
      {manual_size}
    </div>
  </div>

  <hr>

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

  {/exp:channel:entries}

```

# Answer
Looks like you forgot about the protocol on the URL to the root of your site. Probably, you wrote `domain.com` instead of `http://domain.com`.

The duplicated part is added by the browser that is treating the URL as relative because of the absence of protocol.
> 3 votes

# Answer
I've found a work-around. It appears that I need to use 'http://' in front of the pagination\_url. The following version now works perfectly:

```
{paginate}
{pagination_links}
<ul>
       {first_page}
       <li><a href="http://{pagination_url}" class="page-first">First Page</a></li>
       {/first_page}

       {previous_page}
       <li><a href="http://{pagination_url}" class="page-previous">Previous Page</a></li>
       {/previous_page}

       {page}
       <li><a href="http://{pagination_url}" class="page-{pagination_page_number} {if current_page}active{/if}">{pagination_page_number}</a></li>
       {/page}

       {next_page}
       <li><a href="http://{pagination_url}" class="page-next">Next Page</a></li>
       {/next_page}

       {last_page}
       <li><a href="http://{pagination_url}" class="page-last">Last Page</a></li>
       {/last_page}

</ul>
{/pagination_links}
</div>
{/paginate}

```
> 1 votes

---
Tags: pagination
---


# Question
Title: safecracker + ajax = readyState: 4 on home page
I have a super simple safecracker form in my header (embedded template). It's literally 1 field. I'm using the ajax example in the ee docs (http://ellislab.com/expressionengine/user-guide/modules/safecracker/examples.html#ajax-driven-entry-form).

The form works everywhere except the home page. I get readyState: 4 which I read (https://stackoverflow.com/questions/5852257/jquery-s-ajax-error-handler-being-executed-if-readystate-4-and-status-200) means the returned json is malformed. It's true because the responseText is the code for the home page.

I've changed "Make the index template in this group your site's home page?" to a different template group and then the original home page works and this new temp home page fails.

My safecracker opening:

```
{exp:safecracker json="yes"
channel="email_submission" id="email-subscribe" logged_out_member_id="2"
datepicker="no" include_jquery="no" safecracker_head="no"}

```

And my js:

```
$('#email-subscribe').ajaxForm({
    dataType: 'json',
    success: function(data) {
        if (data.success) {
            alert('You successfully added a new entry with entry_id '+data.entry_id)
        } else {
            alert('Failed with the following errors: '+ JSON.stringify(data.errors));
        }
    },
    error: function(data) {
        // this is what's coming up
        alert('Failed with the following errors: '+ JSON.stringify(data));
    }
});

```

Has anyone encountered anything like this before? Any suggestions? I feel like I'm taking crazy pills.

Thanks Amanda

# Answer
> 1 votes
Thanks to @RobSanchez asking about the form's action attribute (which was always the url of the current page) I decided to cheat and give the ajaxForm a url that wasn't the home page.

No, it doesn't really explain anything but now it works.

Thanks!

# Answer
> 1 votes
Amanda, I started to set this up, and maybe have an idea for you from that, which may fix this.

When I set up the original example from the EE doc as a fresh template group's index page, it works, basically, when you call it as siteurl/group. However, if you call it as siteurl/group/index, it fails.

In the EE doc example, this is clearly because a segment is being used to pass an entry\_id, and if you specify index, that string is passed which will be invalid.

Now, what I am thinking is that you aren't really using the example in your code above. You haven't specified an entry\_id, and you are putting the code in an embed. My guess is that Safecracker may be checking segments or some EE variable on its own when you specify nothing; and that this doesn't work when the code is in an embed as the variable is not present, at least when you are on the home page in the normal fashion, and thus not using segments.

This idea might fit if I understand your observation from setting a different home page, because then you'll have to call the original with at least one segment.

Hence (with this handwaving) what I might suggest is to put your header with Safecracker code not in an embed, but in a Snippet, and call the snippet where you have been using the embed. This might allow Safecracker to find what it needs, as it will be parsed on the first level; and thus not fail when there are no declared segments as on an automatic home page.

Hope this works - in any case this has the scent of being close to identifying the problem, and if not, may bring out \_rsan who wrote Safecracer I think, to give a better hint ;)

---
Tags: safecracker, ajax
---


title: Wygwam 3.0.2 PHP Error in EE 2.5.5

text:
# Question
Title: Wygwam 3.0.2 PHP Error in EE 2.5.5
On a number of EE 2.5.5 sites with Wygwam 3.0.2, I'm getting this PHP error:

```
A PHP Error was encountered
Severity: Notice
Message: Undefined index: defer
Filename: wygwam/ft.wygwam.php
Line Number: 443

```

The error does not seem to happen on EE 2.6. PHP version is 5.3.2

# Answer
Having recently upgraded an EE v1.6.8 site to v2.6.1, I had to re-save each of the Wygwam fields to fix the "defer" PHP notice.

http://website.com/manage.php?D=cp&C=admin\_content&M=field\_group\_management
> 5 votes

---
Tags: pixelandtonic, wygwam
---


# Question
Title: Freemember Login No Errors or login - Solved
I'm lost, this should be easy but for some reason it's not.

If I use the default EE login tags it's fine, replace with Freemember Tags and BAM the whole shebang fails to work, no errors, no nothing :(

I could've sworn it worked originally, I styled the error tags and everything. 64 Char encryption key…

Running EE2.4

Freemember 2.2.2

Structure 3.2.3

```
{exp:freemember:login return="members-area"
          form_class="login"
          error_handling="inline"
          error_delimiters='<span class="error">|</span>'}

        <div class="wrapper">
        <label for="username">Username</label>
            {field:username}
            {error:username}
        </div>
         <div class="wrapper">
        <label for="password">Password</label>
            {field:password}
            {error:password}
        </div>
        <div class="wrapper">
            <input type="submit" name="submit" value="Submit" class="btn">
        </div>
     {/exp:freemember:login}

```

This page is controlled by Structure which shouldnt matter as it works for the native EE login tag :(

Any pointers ?

# Answer
> 1 votes
Found the culprit, a rougue htaccess rule: RewriteEngine On was commented out, uncomment and we're golden, apologies :)

# Answer
> 2 votes
If you remove this parameter -

```
error_handling="inline"

```

you should see what default errors are causing the login to fail in the default EE error page - should help you fix the error.

---
Tags: structure, login, freemember
---


# Question
Title: Problems with CE Image, MX Jumper and parse order (I believe)
I'm experiencing two possible issues in the code below:

1. The if/else I have always sets `standard_image_width` and `retina_image_width` to the value in the last `{if:else}`, regardless of whether or not it's correct; and
2. Whatever that value turns out to be set to, it doesn't make it through to the `width="{exp:mx_jumper:out name='standard_image_width'}"` attribute on the `{exp:ce_img:pair}` tag.

What I'm trying to do: Determine the size the image should be resized to, then create a standard and 2x retina versions using CE Image. `{blog_images}` is a Matrix field.

Anyone see what might be causing these issues? Appreciate any help I can get…

```
{blog_images}
    {!-- Get Image Size --}
    {if '{placement}' == 'sidebar'}
        {exp:mx_jumper:put name="standard_image_width"}226{/exp:mx_jumper:put}
        {exp:mx_jumper:put name="retina_image_width"}452{/exp:mx_jumper:put}
    {if:elseif '{size}' == 'full-width'}
        {exp:mx_jumper:put name="standard_image_width"}750{/exp:mx_jumper:put}
        {exp:mx_jumper:put name="retina_image_width"}1500{/exp:mx_jumper:put}
    {if:elseif '{size}' == 'text-width'}
        {exp:mx_jumper:put name="standard_image_width"}500{/exp:mx_jumper:put}
        {exp:mx_jumper:put name="retina_image_width"}1000{/exp:mx_jumper:put}
    {if:else}
        {exp:mx_jumper:put name="standard_image_width"}500{/exp:mx_jumper:put}
        {exp:mx_jumper:put name="retina_image_width"}1000{/exp:mx_jumper:put}
    {/if}
    {exp:mx_jumper:put name="image_{row_count}"}
        <figure class="{placement} {size}">
            {!-- Retina --}
            {exp:stash:set name="retina_content_image"}{exp:ce_img:pair src="{image}" hide_relative_path="yes" cache_dir="images/blog/retina" filename_suffix="@2x" width="{exp:mx_jumper:out name='retina_image_width'}"}{aws_url}{/exp:ce_img:pair}{/exp:stash:set}
            {!-- Regula --}
            Size: {size}<br>
            Standard Image Width: {exp:mx_jumper:out name='standard_image_width'}
            {exp:ce_img:pair src="{image}" width="{exp:mx_jumper:out name='standard_image_width'}" allow_scale_larger="yes" cache_dir="images/blog" hide_relative_path="yes" parse="inward"}
                <img src="/assets/images/css/holder.png" width="{width}" height="{height}" data-src="{made}" data-src-retina="{exp:stash:get name='retina_content_image'}" alt="{alt_text}">
            {/exp:ce_img:pair}
            {if caption}
                <figcaption>
                    {caption}
                </figcaption>
            {/if}
        </figure>
    {/exp:mx_jumper:put}
{/blog_images}

```

# Answer
> 3 votes
You didn't say which version of EECMS you're using. Some versions have parsing issues on conditionals with single quotation marks. Or, maybe, your version of Matrix have one of this issues.

So, first of all, try to replace them.

```
{if "{placement}" == "sidebar"}
    {exp:mx_jumper:put name="standard_image_width"}226{/exp:mx_jumper:put}
    {exp:mx_jumper:put name="retina_image_width"}452{/exp:mx_jumper:put}
{if:elseif "{size}" == "full-width"}
    {exp:mx_jumper:put name="standard_image_width"}750{/exp:mx_jumper:put}
    {exp:mx_jumper:put name="retina_image_width"}1500{/exp:mx_jumper:put}
{if:elseif "{size}" == "text-width"}
    {exp:mx_jumper:put name="standard_image_width"}500{/exp:mx_jumper:put}
    {exp:mx_jumper:put name="retina_image_width"}1000{/exp:mx_jumper:put}
{if:else}
    {exp:mx_jumper:put name="standard_image_width"}500{/exp:mx_jumper:put}
    {exp:mx_jumper:put name="retina_image_width"}1000{/exp:mx_jumper:put}
{/if}

```

On the first `exp:ce_img:pair` you forgot about the `parse` parameter. You put it on the second one, but forgot on this.

```
{!-- Retina --}
{exp:stash:set name="retina_content_image"}{exp:ce_img:pair src="{image}" hide_relative_path="yes" cache_dir="images/blog/retina" filename_suffix="@2x" width="{exp:mx_jumper:out name='retina_image_width'}" parse="inward"}{aws_url}{/exp:ce_img:pair}{/exp:stash:set}

```

I hope it helps.

---
Tags: parse-order, ce-image, mx-jumper
---


# Question
Title: Replacement for reverse_related_entries in 2.x
This code comes from 1.6 days.

```
{exp:weblog:entries weblog="static" sort="asc" offset="1" dynamic="off"}
     {if static_parent_page=="0"}
      <li>
       <a class="active"href="{url_title_path=static/three_tier_d}">{title}</a>
       {reverse_related_entries weblog="static"}
        {if count==1}<ul>{/if}
        <li><a  class="active" href="{url_title_path=static/three_tier_d}">{title}</a></li>
        {if count==total_results}</ul>{/if}
       {/reverse_related_entries}
      </li>
     {/if}
    {/exp:weblog:entries}

```

Since relationships was overhauled in 2.x, the **reverse\_related\_entries tag** in the above doesn't work. I need help to re-code it for EE 2.6

Full page code is at: http://www.train-ee.com/images/weblog/static\_content\_approach\_d\_activeclass.txt The result of the code is this page: http://www.train-ee.com/courseware/static/three\_tier\_d/

In a nutshell, the snippet does the following... Each entry has a special field called **static\_parent\_page**. If it isn't set, then the field is 0 and thus a top level navigation link. If the field is set to another entry, then we assume it is a child entry. So the code will display every child entry of a parent entry.

A 1000 thanks for helping with this!

# Answer
You'll need the name of the relationship field on your parent entries.

Instead of using `static_parent_page == 0`, try a namespaced `no_results`.

```
{exp:channel:entries channel="static" sort="asc" offset="1" dynamic="off"}
  {static_parent_page}
    {if static_parent_page:no_results}
      <li>
       <a class="active" href="{url_title_path=static/three_tier_d}">{title}</a>
       {parents field="static_parent_page"}
        {if count == 1}<ul>{/if}
        <li><a class="active" href="{parents:url_title_path=static/three_tier_d}">{title}</a></li>
        {if count == total_results}</ul>{/if}
       {/parents}
      </li>
    {/if}
  {/static_parent_page}
{/exp:channel:entries}

```

The documentation about relationships is really good.
> 3 votes

---
Tags: relationships, navigation, reverse-related-entries, parent
---


title: Front-end user cannot logout

text:
# Question
Title: Front-end user cannot logout
This is my first time using ExpressionEngine to allow users to log into the front end interface and see different content. The login aspect is working fine... but I can't seem to be able to log out!

Some details:

* EE 2.6
* CE Cache (using database caching, with the salient parts escaped, and turned off in the config file anyway as I'm not yet in production, so this should not be causing a conflict)
* Objective HTML's Authenticate plugin
* Security setting "User Session Type" set to "Cookies only". When setting it to "Session only" I cannot seem to log in at all!

I've tried using both `{exp:authenticate:logout}` and `{path='logout'}` (both rendering ?ACT=8, which I've confirmed in the database calls `Member` class method `member_logout`) but using either link does not seem to actually log the user out.

I've tried disabling the Authenticate extension and running the same ACT?ID=8, and though I get EE's "You are now logged out." screen, when I return I am stilled logged in and can still see logged in material.

Clearing local cache has no effect.

The only action that seems to get the user out is to go into my cookies and delete the `exp_sessionid` cookie.

Any suggestions/pointers/leads to follow are welcome.

# Answer
> 3 votes
This may be related to bug #19338 which was fixed in EE 2.6.1. There was also a manual fix that could be applied. See 19338 on the changelog.

# Answer
> 1 votes
Try changing the user session type under Admin-\>Security and Privacy-\>Security and Sessions. I'm not sure which would be the best option so give all three a try!

---
Tags: ee2, members, logout
---


# Question
Title: Getting address detail from marker using Google Maps for ExpressionEngine
I have a Google Map generated from multiple entries and using Google Maps for ExpressionEngine.

Each entry can have multiple markers. Basically, each entry is an business with multiple locations. For logistical regions it is not practical to create a separate entry for each location.

My question is how can I get the address info from each marker to output on my template. I can do it if there is only a single marker per entry by using the built in function to copy the formatted address to another field but since I have many markers in an entry this won't work.

# Answer
> 3 votes
You could always try the `parse` parameter. This will allow you to loop through the JSON data of each marker and output the formatted address as needed.

Let me know if this doesn't solve your issue and I will look a little deeper.

https://objectivehtml.com/google-maps/fieldtype#parse

---
Tags: add-on, google-maps-for-ee
---


title: Freemember field helpers textarea

text:
# Question
Title: Freemember field helpers textarea
I Have a freemember form. I originally had a comments text area coded manually:

```
<textarea name="register_comments"></textarea>

```

But this meant that the field emptied if you submitted the form with a required field empty. To get round this I'm trying to generate the field using a field tag:

```
{field:register_comments}

```

But this outputs a text input rather than a text area. I've made sure that the field is set to 'Text Area' in the EE admin.

Is there any way round this?

Thanks

# Answer
You will want to use something along the lines of

```
<textarea name="register_comments">
  {register_comments}
</textarea>

```

To get the previously entered contents of the field.
> 2 votes

---
Tags: freemember
---


title: CartThrob, Postmaster and Notifications

text:
# Question
Title: CartThrob, Postmaster and Notifications
Justin at ObjectiveHTML has been helping me out here but I think it might be time to see if anyone else has had some experience with this.

My client is selling two items. Item A requires an email be sent to the customer when the purchase is authorized with copies of the email sent to a set of additional recipients, let’s call them Set A. I’ve been using the standard CartThrob Notifications and EE mail and it is working.

Now, Item B is to be sold but, when purchase is authorized, an email is to be sent to the customer and to a different set of additional recipients, Set B. (Note: both Items can not be purchased in the same order.)

There didn't seem to be anyway to do this in CartThrob so I installed Postmaster. Postmaster has a "cartthrob\_on\_authorize" hook that will send out an email when a purchase is authorized. I was able to make that work equally well on Item A. (I figured out how to "turn off" the CartThrob Notifications, I'll put that in a note at the bottom.)

Postmaster also has a "Extra Conditionals" feature to do things like not send the email if the customer hasn't entered a full name. Justin thought that it would work to put this in to keep an email from being sent out when the product purchased was not, say, Item A. (Note: each item in the CT orders channel has an order\_items CT field which is a matrix that includes an entry\_id field which uniquely identifies a product. Item A's entry\_id is 213.)

{if hook:entry\_id != “213”}FALSE{/if}

Unfortunately, no email got sent out when I tried this. I tried various iterations of it including:

```
{if hook:item_options:entry_id != "213"}FALSE{/if}

```

and

```
{if hook:item_options:item:entry_id != "213"}FALSE{/if}

```

neither of which worked.

I'd certainly appreciate hearing from anyone who has successfully used the "Extra Conditionals" feature with the "cartthrob\_on\_authorize" hook.

I'm using the latest Postmaster version and 2.3.5 version of CT.

Thanks,

Jeanne

P.S. I tried setting "Log Email" to "No" in CT Notifications but that did not stop the emails. Justin gave me the hint to set up a "dummy" email which just means just leaving the email section as blank as possible.

# Answer
If there's only ever one item being purchased in a single checkout, maybe try `{hook:items}{if '{entry_id}' != '213'}FALSE{/if}{/hook:items}`.

For debugging, it's useful to get to a point where an email is definitely being sent (ie, remove all the extra conditionals), then print out the variable names in the body of the email so you can see what they should be called. Also handy if you don't mind getting your hands dirty is throwing a quick `var_dump` into the postmaster/hooks/cartthrob\_on\_authorize.php file to see what variable names are available.
> 1 votes

# Answer
I'm not sure this will help your particular case but I'm doing a very similar thing at the moment and this may help you.

You can use the custom\_data array in {exp:cartthrob:submitted\_order\_info} to do some conditional logic. Add a specific value to your checkout form and test that value later in the checkout process.

For instance, I have a checkout form that can be used to pay a previous invoice. For the checkout form in this case I have added a hidden field.

```
<input type="hidden" name="custom_data[type]" value="invoice">

```

I can then check for that value in a notification template and the order-info screen that the customer sees after a transaction. In my case the notification template shows some different information.

```
{exp:cartthrob:submitted_order_info}
    {if custom_data:type=="invoice"}
        Show this message and other stuff
    {if:else}
        Show a different message, receipt and purchase details
    {/if}
{/exp:cartthrob:submitted_order_info}

```

I don't know Postmaster but I wonder if you could check the custom\_data value and have Postmaster do its stuff based on that?
> 0 votes

---
Tags: cartthrob, postmaster
---


# Question
Title: Add-ons are linking incorrectly in control panel
I've taken over a site created in EE and transferred it to my host. Since doing so, the addon tabs are linking incorrectly. What I mean is that on click it sends the admin to:

```
index.php?S=b84310dd48d074edf67c8d6c44848df407c64147&D=cp&C=addons_modules&M=show_module_cp&module=structure

```

Rather than sending the admin to

```
admin.php?S=b84310dd48d074edf67c8d6c44848df407c64147&D=cp&C=addons_modules&M=show_module_cp&module=structure

```

All default admin area links work fine, it is just Structure and rEEservation that have this problem.

How can I insure they link to the correct url?

# Answer
> 2 votes
The two comments below are worthy answers, however the fault was all mine.

I normally work with a boilerplate which has the control panel at {site\_url}/admin.php . I forgot that some people don't have it set up that way.

The weird thing was that logging at {site\_url}/admin.php worked until I tried to access add-ons, however logging in at {site\_url}/system fixed the issue.

# Answer
> 1 votes
Check the value of `$config['cp_url']`, under **Admin → System Administration → Config File Editor**. My guess would be that you have `index.php` as the script name in there.

# Answer
> 1 votes
Reset the shortcut tabs and it'll be fine.

---
Tags: add-on, control-panel, url, addons
---


# Question
Title: Playa field within a matrix field - duplicate results
There is a probably a very simple fix to this issue, however, I can't wrap my head around it. So I have a playa field (embedded) within a matrix field like so:

```
{call_out_section}
      {embed="projects/related_projects" row_count="{row_count}" xpos="{xpos}" ypos="{ypos}"}
{/call_out_section}

```

embed:

```
  {exp:playa:children field="select_project" status="not closed"}
<a href="#" class="call_{embed:row_count}">{title} {embed:xpos}, {embed:ypos} </a><br />
{/exp:playa:children}

```

The result of this is:

```
Window Boxes 100, 100

Dining Room Table 100, 100

Window Boxes 200, 200

Dining Room Table 200, 200

```

I've tried adding a limit="1" on {call\_out\_section} and on the playa:children. The former will only return a single title and the latter returns a single pair of x/y coordinates. Any thoughts here?

# Answer
The result tells me that this entry has 2 children (Window Boxes and Dining Room) and that its field `call_out_section` has 2 rows (100 and 200). So, everything is right. 2 × 2 = 4!

But, as you said on chat, `selected_project` is also a column of `call_out_section`. So, you can use the Field tags of Playa, instead of exp:playa:children, that is another module with another parse, etc, etc...

So, try this:

```
{call_out_section}
  {select_project status="not closed" var_prefix="project"}<a href="#" class="call_{row_count}">{project:title} {xpos}, {ypos}</a><br />{/select_project}
{/call_out_section}

```

The strange part is that the parameter `var_prefix` isn't currently on docs of Field Tags.
> 2 votes

---
Tags: matrix, playa, loop
---


# Question
Title: Anything after segment_1 in URL causes CSS not to load
CSS is not loading if there is anything after segment\_1. This includes a trailing slash or an entry id. This happens on ANY template on this site but not other sites on the same server with the same .htaccess.

EG: "...//example.com/projects/" or "...//example.com/projects/4" will not render CSS in browser

The template will still parse the EE tags but seems to not be sending the CSS to the broswer despite the code showing in the rendered HTML.

Live example: "http://getyourtips.in/projects/"

Setup --

Template Group: projects

Template: index.html

Version: EE 2.6.1

CSS Theme: Unify (Bootstrap Based)

# Answer
> 4 votes
You need to add a forward slash to your assets.

Change this `<link rel="stylesheet" href="assets/css/style.css">`

to this `<link rel="stylesheet" href="/assets/css/style.css">`

# Answer
> 2 votes
It doesn't work because if you omit the initial slash then the path is relative to the current page.

The first slash basically says, "start from the site root". So no matter where you are within the filesystem the link "/assets/css/style.css" will always resolve to the correct place.

If you are at "/mypage/something" and you call "assets/css/style.css" you are effectively looking for "/mypage/something/assets/css/style.css" which is going to be incorrect.

It's not an ExpressionEngine issue, it's a basic principle of how URLs and filesystems work.

---
Tags: ee2, templates, url, css
---


# Question
Title: czowOiIiOw== being added to empty fields in exp_channel_data
A client's MSM powered EE 2.6.1 site including Matrix 2.5.5 has just gone live and new entries with empty Matrix fields are ending up with 'czowOiIiOw==' in them – this I understand is a PHP base 64 encoded empty string.

This of course causes template logic that hinges on empty fields to break!

Any suggestions for a fix? I can go into the database and clear 'czowOiIiOw==' but I'd like to do better than that ;)

# Answer
P&T recommended an update to Matrix 2.5.6 as a fix for this issue, which is apparently to do with "a small bug with support for EE Revisions".

I confirm that the 2.5.6 update fixes this issue for me.
> 1 votes

---
Tags: matrix, php-errors
---


# Question
Title: Upload a File using a URL instead of direct upload
Is there a way to upload a file to a "File" field using either a direct upload ("Browse" button) or a URL input? I noticed that the built-in file field only support direct upload.

Thanks!

# Answer
Yes, the built-in file field only support direct upload. For a URL input upload, you will need to develop a custom field type. It's possible with the cURL of PHP. Here I can share PHP code example how a remote file can be saved within a directory.

Example code:

```
$upload_dir_path = '/UPLOAD/DIRECTORY/PATH/';
$file_url = 'URL OF THE FILE';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $file_url);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
$upload_file = curl_exec($ch);

file_put_contents($upload_dir_path, $upload_file);

```

I hope, you would be aware to develop an EE field type and above code example would be helpful for you.
> 1 votes

---
Tags: custom-fields, file-uploads, fieldtype
---


# Question
Title: Specifying url paths for Tag related entries
I have an entries page where I want to show related entries from other channels using Solspace Tag's {exp:tag:related\_entries} tag pair. Since they are from different channels I need to have the correct path to lead to the correct template. At the moment I have split this in to two related\_entries tags, but I was wondering if there was a way of combining them in to one?

{exp:tag:related\_entries url\_title="{segment\_3}" channel="channel\_A" orderby="date" sort="desc" limit="5" paginate="bottom"} {title}{/exp:tag:related\_entries}

{exp:tag:related\_entries url\_title="{segment\_3}" channel="channel\_B" orderby="date" sort="desc" limit="5" paginate="bottom"} {title}{/exp:tag:related\_entries}

# Answer
> 3 votes
You said that your problem is to make the URL's point to the right template. If you don't mind about to have 10 entries from both channels, instead of 5 of every one, you can merge the variable pair and use a conditional.

```
{exp:tag:related_entries url_title="{segment_3}" channel="channel_A|channel_B" orderby="date" sort="desc" limit="10" paginate="bottom"}
  {if channel_short_name == "channel_A"}
    <a href="{url_title_path='channel_A_template_group/template'}">{title}</a>
  {/if}
  {if channel_short_name == "channel_B"}
    <a href="{url_title_path='channel_B_template_group/template'}">{title}</a>
  {/if}
{/exp:tag:related_entries}

```

# Answer
> 2 votes
If your template group names match the short name of your channels then simply use {channel\_short\_name}

So you could do:

```
{exp:tag:related_entries url_title="{segment_3}" channel="channel_A|channel_B"  orderby="date" sort="desc" limit="10" paginate="bottom"}
   <a href="{channel_short_name}/template'}">{title}</a>
{/exp:tag:related_entries}

```

# Answer
> 1 votes
In your channel settings you have the ability to enter a channel url and a channel comment page url - and when it is filled in, it is available to you as a variable in your entries loop (normally - whether it is within the tag module I couldn't say, but it very well may be). It has the same effect as url\_title\_path, for example. But instead of something like:

```
{your_loop}
    <a href="{url_title_path='template_group/single_entry_template'}">{title}</a>
{/your_loop}

```

You instead then have the ability to use:

```
{your_loop}
    <a href="{comment_url_title_auto_path}">{title}</a>
{/your_loop}

```

Which then allows your single entry view path to be automatically assigned based on what you have entered into the channel's preferences, therein pointing them to the right template for viewing on a channel by channel basis.

Another approach would be to use the channel short name, and then use an add-on like switchee to early parse a conditional that allows you to define the template path for the single entry view. Same idea as Robson's suggestion, just parsing the conditional with an add-on for performance, particularly if there are any other conditionals within the parent conditional needed.

```
{your_loop}
    {exp:switchee variable="{channel_short_name}" parse="inward"}
        {case value="channel_short_name_A"}
            <a href="{url_title_path='channel_A_template_group/channel_A_single_entry_template}">{title}</a>
        {/case}
        {case value="channel_short_name_B"}
            <a href="{url_title_path='channel_B_template_group/channel_B_single_entry_template}">{title}</a>
        {/case}
        {case value="channel_short_name_C"}
            <a href="{url_title_path='channel_C_template_group/channel_C_single_entry_template}">{title}</a>
        {/case}
    {/exp:switchee}
{/your_loop}

```

If you have to do this in a bunch of different places though, it may be a bit cleaner to use the channel settings option rather than do it in template like this, since you risk repeating yourself a bit. And in particular, if the comment\_url\_title\_auto\_path is not available within the tag module's loop, then this switch case method will be a way around that.

---
Tags: solspace-tag
---


# Question
Title: 0 displayed after saving entry on View Entry Page
I have a channel with about 12 custom fields. Nothing complicated, mostly text input, a few text areas, two files and one relationship field.

I noticed after I create an entry and click save, the next screen which is called 'View Entry' displays all the data I entered BUT also shows a zero.

I thought it odd, so re-installed EE Core. Remade my channel and its custom fields but once again, I keep getting shown a 0. It seems that one of the fields is defaulting to the 0. I recheck all of them 100s of time, they all look fine.

I seem to recall that back in the 1.4 EE days, I encountered this problem as well.

Anyone have a reason as to why?

Thanks

# Answer
> 1 votes
One thing that would do that is if you have one of your text fields with the "Field Content" option set to something other than "all" - number, integer or decimal - I can't remember which it is - it may be more than one of them - that defaults to zero when the field is left blank.

---
Tags: custom-fields
---


# Question
Title: Wygwam - Form & script tags being removed
I’m struggling with `<form>` and `<script>` tags being removed in WYGWAM.

When these tags are added via source in WYGWAM and saved they show up on the page but when you go back into edit the entry they do not show up in Source area.

I tried adding this suggested regex to the config file but it didn’t work: https://getsatisfaction.com/pixelandtonic/topics/wygwam\_deleting\_javascript\_tags\_in\_content.

Other Regex examples found on Google didn't work either.

How can I allow `<form>` and `<script>` tags in a WYGWAM field?

# Answer
These tags are stripped out of the editor view because the "Restrict Allowed HTML" setting is set to YES for that field's WYGWAM configuration. Changing this setting to NO fixes the issue.

Go to Add-Ons -\> Modules -\> Wygwam -\>(your toolbar config) and set the "Restrict Allowed HTML" setting to 'no'.
> 6 votes

---
Tags: wygwam
---


# Question
Title: Using Postmaster to Auto Send total amount sold of an item
So we're looking to use Postmaster to auto send emails to specified emails of the amount of an item total sold. Does anyone have any idea what code we should use for this? I've tried a few different things and haven't been able to figure it out.

I have the channel set to the correct channel that stores our products. What would be the code to show the total sold for the selected Parse Entry?

# Answer
> 1 votes
You may want to email me at support@objectivehtml.com so I can get you in the right direction. Sounds like you are trying do something a little outside the scope of the Parcels API and more in line with notifications or hooks. Without knowing more information and specific details, I can't help much more. I think though that emailing my support channel will be a better place to converse than here until we can figure out a formal solution.

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


# Question
Title: Stashing images from a Matrix field grabs only the image from the last entry on the page
Inside of my entries loop I have a Matrix field called `{blog_images}` where the user can store up to 10 images. The user then determines where these images should appear in the content area (`{blog_post_content}`) using shortcodes like this:

```
<p>First paragraph is here.</p>
{image_1}
<p>Second paragraph is here.</p>
{image_2}
<p>…</p>

```

Currently I'm using Stash to loop through the Matrix images and store them for insertion into `{blog_post_content}`. Strange thing is if I have 10 entries appear on the page, every entry is showing only the image from the LAST entry instead of its own image.

Here is my existing code:

```
{blog_images}
    {exp:stash:set type="snippet" parse_tags="yes" parse_conditionals="yes"}
        {stash:image_{row_count}}
            <figure class="{placement} {size}">
                {exp:ce_img:pair src="{image}" width="{size}" allow_scale_larger="no" cache_dir="images/blog" hide_relative_path="yes" parse="inward"}
                    <img src="/assets/images/css/holder.png" width="{width}" height="{height}" data-src="{made}" alt="{alt_text}">
                {/exp:ce_img:pair}
                {if caption}
                    <figcaption>
                        {caption}
                    </figcaption>
                {/if}
            </figure>
        {/stash:image_{row_count}}
    {/exp:stash:set}
{/blog_images}
{exp:stash:parse process="end"}
    {blog_post_content}
{/exp:stash:parse}

```

Any idea what I'm doing wrong?

# Answer
Are you using the latest version of Stash (as of writing 2.3.9)? Your code should work but a few versions back there was a bug in `{exp:stash:parse}` which meant that `parse_vars` didn't get run under certain circumstances.

https://github.com/croxton/Stash

EDIT: just realised you've left off the wrapping channel entries tag which would have made it clear why your code can't possibly work unless limit='1'. You are overwriting the value of {image\_x} with each iteration of the channel entries tag. The solution is to use a list with the entry id as a context. I will update this answer with sample code shortly.

EDIT2: use context and the @ pointer to point to the static context:

```
{exp:channel:entries}
{blog_images}
    {exp:stash:set type="snippet" context="{entry_id}" parse_tags="yes" parse_conditionals="yes"}
        {stash:image_{row_count}}
            <figure class="{placement} {size}">
                {exp:ce_img:pair src="{image}" width="{size}" allow_scale_larger="no" cache_dir="images/blog" hide_relative_path="yes" parse="inward"}
                    <img src="/assets/images/css/holder.png" width="{width}" height="{height}" data-src="{made}" alt="{alt_text}">
                {/exp:ce_img:pair}
                {if caption}
                    <figcaption>
                        {caption}
                    </figcaption>
                {/if}
            </figure>
        {/stash:image_{row_count}}
    {/exp:stash:set}
{/blog_images}
{exp:stash:parse process="end" parse_depth="2"}
    {exp:stash:context name="{entry_id}"}
    {blog_post_content}
{/exp:stash:parse}
{/exp:channel:entries}

```

Only caveat is that you'll need to refer to the images like this in the {blog\_post\_content} field:

`{@:image_1}`, `{@:image_2}`, etc
> 3 votes

# Answer
Your exp:stash:set is inside a channel entries loop? I think you might be better off using stash:set\_list in place of stash:set. stash:set is often used to surround an entries loop, whereas stash:set\_list is used inside the loop, stashing elements within the loop into a list (hence the name). I think set\_list may be more consistent with what you're looking to do.
> 2 votes

---
Tags: channel-entries, matrix, stash
---


# Question
Title: Validate form input with regex (no jquery)
I'm getting a lot of spam om my websites where I have a couple of email/contact forms.

The forms are all validated/submitted inline with jQuery/ajax.

However, spam bots skip javascript so I want to validate the form natively too.

I don't want to use a (hidden) CAPTCHA.

EE/CI can validate emails and numbers etc. But I have a phone number field for example and I don't want to force users to use a specific pattern 000-000-000 etc. I just want to allow only 0-9 spaces and dashes and (). At the moment spam bots put anything there.

Also, I have a name field which spam bots use to put email addresses in. So I would like to **disallow** the @ sign and other symbols that no one uses in their name.

Also I don't want to even accept html tags or common spam strings like "

How would I do this without javascript?

# Answer
> 1 votes
You couldn't have such validations via the freeform tags. You will need to develop an extension with the hook `freeform_module_validate_begin`. Within the hooked function you can validate the user inputs and prepare the $error array.

You can take a reference from here: http://www.solspace.com/docs/freeform/extension\_hooks/#freeform\_module\_validate\_begin

# Answer
> 0 votes
Freeform 4 allows specifying different types of text inputs, including numbers, when creating text fields: http://www.solspace.com/docs/freeform/default\_fieldtypes/#text\_field\_content\_type

Input failing the requirements will be validated negative.

---
Tags: solspace-freeform
---