# Question
Title: Wygwam - automatically wrap media embed with custom html
I'm using Wygwam on a site, and I'm allowing content administrators to embed media (specifically, videos) within the main, body copy/content area.

Is there a way to automatically wrap the embedded content in some kind of custom HTML? It seems that the embeds are already automatically wrapped in a classless `<div>`, and I'd like to, at the very least, give that `<div>` some kind of class or ID, so that it'd be something like `<div class="inline-media">`.

# Answer
> 8 votes
You can do this without editing the Wygwam source. First you need to create a custom config file for CKEditor. Create a JavaScript file called something like 'ckeditor\_config.js' and then set Wygwam to use it. You can do this by adding an advanced setting to your Wygwam editor configuration. Add the 'customConfig' setting and enter the path to the JavaScript file you just created. It will look like:

```
/javascripts/ckeditor_config.js

```

Then enter the following code into the file. It sets up a htmlFilter that adds the 'inline-media' class name to all div elements that contain an iframe.

```
CKEDITOR.on( 'instanceReady', function( ev ) {
    ev.editor.dataProcessor.htmlFilter.addRules({
        elements: {
            $: function (element) {
                // Add inline-media class name to embedded media
                if (element.name == 'div' && element.children[0].name == 'iframe') {
                    element.attributes.class = 'inline-media';
                    return element;
                }
            }
        }
    });
});

```

Later versions of Wygwam will strip out the div when you save the field. In your Wywam settings, add an advanced setting for 'extraAllowedContent' and set it to `div(inline-media)`

# Answer
> 3 votes
I believe to do so, you would need to create a Custom Style Set for Wygwam. See the Wygwam Docs over a Pixel & Tonic. Though, I recommend creating a class instead of an id. Since someone will most likely add more than one media embed sometime in the future.

Additionally, this StackExchange post deals with editing the Wygwam .js for custom sets.

# Answer
> 2 votes
***EDIT**: Please see the accepted answer above from Dylan as an approach for handling this type of functionality.*

---

nonprofit\_tech's suggestion to try using a custom style set *does* work, but it involves a two-step process: the content administrator must first add the custom wrapper from the style set dropdown, and then embed the media via the toolbar's media embed button. Again, this works, but places more of a burden on the administrator who may or may not be very tech savvy, and if you accidentally navigate outside of the empty wrapper element, you might not embed the media in the right place. Not an ideal solution, but here's a sample of the code that I wrote to test out that theory:

```
CKEDITOR.stylesSet.add('custom-styleset',[{
  name: 'Embed Wrapper',
  element: 'div',
  attributes: {'class': 'inline-media'}
}]);

```

Another solution to this is to edit the minified `ckeditor.js`, but this is **not** recommended by the folks at Pixel & Tonic, as this file would likely be overwritten by updating the plugin in the future.

However, if you really want to do this, you can add a line to that file to add a class to the element that wraps the embedded media. In the current build of the plugin, the code looks like this:

```
div=b.document.createElement("div");
div.setHtml(this.getContentElement("iframe","embedArea").getValue());

```

To which I added:

```
div.setAttribute("class","inline-media");

```

And the final code looked like:

```
div=b.document.createElement("div");
div.setAttribute("class","inline-media");
div.setHtml(this.getContentElement("iframe","embedArea").getValue());

```

Again, this is **not** recommended, as changes to this file will likely be overwritten if the plugin is updated in the future.

I think that a better solution to this issue will be to create my own embed button that replicates the functionality of the default embed button, but also wraps the embedded content in the markup that I need to have.

---
Tags: pixelandtonic, wygwam, embeds, video
---


# Question
Title: Filtering Child Categories in Solspace Super Search
I've a working Super Search form, need to filter a category search result page {site\_url}/event/results/search&category=sport/

where sport is a parent category. working form is...

{!----------- SUPER SEARCH FORM -------------------------------------------}

```
<form method="post" action="{path='event/results'}" accept-charset="UTF-8" class="search-box" data-abide>
{exp:super_search:search channel="main_event" status="open|featured"}
{if super_search_category}<input type="hidden" name="category" value="{super_search_category}" />{/if}

<div class="row">
<div class="large-6 columns">
<label for="sort">Location:</label>
<small class="error">Please Choose Event</small>
<select name="category[]" id="event" data-placeholder="All Events" style="width:100%" required>
<option></option>
{exp:channel:categories category_group="1" show_empty="no" parent_only="yes" style="linear"}
<option value="{category_url_title}">{category_name}</option>
{/exp:channel:categories}
</select>
</div>
{/exp:super_search:search}
</form>

```

{!----------- /SUPER SEARCH FORM -------------------------------------------}

The parent category **sport** have some child categories, i need to dynamically filter the results page via a select drop-down the child categories of the searched parent category.

With GWcode Categories plugin, was able to come up with this

```
<select name="category" onchange="if(this.options[this.selectedIndex].value != ''){window.top.location.href=this.options[this.selectedIndex].value}" id="multi" data-placeholder="Select" style="width:100%" />
<option></option>
{exp:gwcode_categories channel="main_event" group_id="1" excl_group_id="3|4" show_empty="no" cat_id="{segment_3_category_id}" depth="2" style="linear"}
<option value="{site_url}event/results/search&category={super_search_category}&&{cat_url_title}" {if super_search_category_{cat_url_title}}selected="selected"{/if}>{cat_name}</option>
{/exp:gwcode_categories}
</select>

```

I think i'm very close but the GWcode tags code isn't perfect and stable because after a first successful filtering.. {site\_url}event/results/search&category=sport&&soccer

trying to filter again, i got this {site\_url}event/results/search&category=sport&&soccer&&tennis

instead of

{site\_url}event/results/search&category=sport&&tennis

Thanks

# Answer
> 1 votes
The problem with your second block of code is that the option values for the `category` select field is a URL, when it should be category data, such as a category\_id, category\_url\_title or category\_name.

Let's say your first search with the first dropdown sends you to http://mysite.com/event/results/search&category=sports

On this result page, you can create another search form, and pass the previous search's values. In this case, you could pass "sports" in a hidden field, for example:

```
{if super_search_category != ""}
<input type="hidden" name="category[]" value="{super_search_category}&&" />
{/if}

```

**Please note the brackets in `category[]`**. This is needed to be able to submit an *array* of category data. If you forget this, you are sending a single *string* of data, i.e. only the last filled field with name="category". The `&&` is to enable an AND search with other categories. (The alternative is to use `inclusive_categories="yes"` in {exp:super\_search:results})

In addition to the above in your search form on your result page, just create a dropdown with your child categories. Use whatever you need for this, GWcode or other. The important is to

* use `name="category[]"` here again
* pass category data in the option's value="" attribute (not a URL). Add `&&` at the end to specify that categories are to be searched inclusively.

In other words, try getting something like this:

```
<select name="category[]">
   <option value="soccer&&">Soccer</option>
   <option value="tennis&&">Tennis</option>
   ...
</select>

```

If you select "Tennis", for example, in this second search submission, you should be sent to http://mysite.com/event/results/search&category=sports&&tennis

No messy javascript to mess with either! :)

---
Tags: solspace, search, filter, supersearch, gwcode-categories
---


# Question
Title: Duplicate screen names with Profile:Edit
During registration the {exp:profile:register} tag checks for duplicate screen names, however when editing an existing profile with the {exp:profile:edit} tag it does not appear to check for duplicates therefore letting me create duplicate screen names. Does anyone know if this is a bug or working as expected. I have tested this with the default Profile:Edit templates.

# Answer
> 1 votes
I've noticed this too: Profile:Edit does prevent duplicate member email addresses and usernames, which is needs too. But, not screen names.

Note that Rob from Mighty Big Robot commented on this issue, before, on this site:

How to keep Screen Name in sync with Profile channel fields using Profile:Edit

# Answer
> 0 votes
ExpressionEngine's own registration process checks for duplicate screen names. So, Profile:Edit should be doing so as well. It's possibly a bug or oversight that it doesn't do so upon editing.

---
Tags: profile-edit
---


# Question
Title: giving each item in a EE loop a unique class without javascript?
I'm trying to create an Expression Engine loop (channel entries) that outputs an unordered list with each list item being an individual entry. Easy enough. But I'd also like each list item it outputs to have a unique class. For example, li class="column\_one", li class="column\_two", etc.

Can the channel entries tag do this? or do I have to add the classes with javascript?

# Answer
Surely you just output somehting like:

```
<li class="unique_{entry_id}">What ever you are outputting here?</li>

```

Or perhaps use {count} or similar?
> 9 votes

# Answer
Really common to use `{count}` for this, as suggested:

```
<li class="column_{count}">I'm item {count}</li>.

```

I often combine `{count}` with `{switch}` and a truly unique identifier like `{entry_id}` like this:

```
<li class="list_{count} {switch='col1|col2'}" id="thing_{entry_id}">
  I'm Thing {entry_id) at List position {count} in Column {switch='col1|col2'}
</li>

```
> 4 votes

---
Tags: html
---


# Question
Title: Is it possible to disable XSS filtering on Cartthrob?
I'm looking for some hidden configuration settings that will allow me to disable XSS filtering when using Cartthrob. The global EE config item is ignored.

Is this possible?

# Answer
> 1 votes
It absolutely is.

You can find information on how to disable XSS filtering on this thread Are PDFs still an XSS problem with EE uploads?

---
Tags: cartthrob, config, xss
---


# Question
Title: Expresso Store Inventory Control Panel Layout
I'm sure this is some obvious setting that I cannot find, but I've had no luck after consulting the documentation and settings so here goes.

In the Control Panel for Expresso Store 2.0.6, I do not have any options available to edit the products in 'bulk' via the Inventory tab. Several hundred products are listed and paged correctly, but the table doesn't look like this screenshot from the documentation \- it's missing the 'plus', sale price and sale price enabled columns, and my price column is a fixed value not a form field.

Any ideas why this might be occurring? I'm using Store 2.0.6 as upgraded from 1.X.

# Answer
It looks like that screenshot is out of date - will get that updated shortly.

In Store 2.0 it is not possible to bulk update prices and quantities like that. In 2.0 we are using EE's built in table libraries to display the order/inventory pages (which is considerably faster), but unfortunately it was not possible to retain the inline row expanders.

The recommended alternative is to update the prices and stock levels on the publish page.
> 1 votes

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


title: Email Contact Form {member_email}

text:
# Question
Title: Email Contact Form {member_email}
I'm setting up an email contact form for a page, it's working fine for logged in users, but for non logged users, they get the message:

A valid sender email is required

I'm sure it's the {member\_email} field that's causing it, it's obviously not picking up the field if your not logged in. Does anybody know a way to use this form without the {member\_email} field, or a way to fill this field for someone whos not logged in?

```
  {exp:email:contact_form user_recipients="no" replyto="yes" recipients="mark@emagine.ie" charset="utf-8"}
    <h2>Register</h2>
    <p>
            <label for="name">Your Name:</label><br />
            <input type="text" name="required[]" size="40" />
    </p>
    <p>
            <label for="institution">Institution/Organisation</label><br />
            <input type="text" id="Institution" name="required[]" size="40" placeholder="institution/organisation" />
    </p>
    <p>
            <label for="number">Contact Number</label><br />
            <input type="text" id="number" name="required[]" size="40" placeholder="contact number" />
    </p>
    <p>
        <label for="email">Email Address</label><br />
        <input {if logged_in} value="{member_email}"{/if} {if logged_out} type="text" value=""{/if} id="from" name="from" size="40" />
    </p>

      <p>
            <input type="text" id="subject" name="subject" size="40" value="Contact Form" style="display:none;"/>
            <textarea type="hidden" id="message" name="message" rows="18" cols="40" placeholder="Register" style="display:none;">
                    Sent on:  {current_time format="%l %mF %Y"}
            </textarea>
    </p>

    <p>
            <input name="submit" type='submit' value='Register' />
    </p>

```

{/exp:email:contact\_form}

# Answer
> 3 votes
You just need to ask user to entered his email.

```
<p>
            <input {if logged_in}type="hidden" value="{member_email}"{/if} {if logged_out} type="text" value=""{/if} id="from" name="from"  />
</p>

```

or you can replace FROM email for quest with your own (in all case you have email field)

```
<p>
<input type="hidden" id="from" name="from" {if logged_in}value="{member_email}"{/if}{if logged_out value="youemail@domain.com"{/if} />
</p>

```

# Answer
> 3 votes
You'd have to have them fill out that field themselves. Currently, you have it hidden with `display:none`. Also, your input related to the Email Address label has a placeholder of "contact number."

Try adding a logged\_in conditional around the `display:none` inline style.

```
<p>
        <label for="email">Email Address</label><br />
        <input type="text" id="email" name="required[]" size="40" placeholder="email address" />
</p>
<p>
        <input type="text" name="from" size="40" value="{member_email}" {if logged_in} style="display:none;"{/if}/>
</p>

```

I'm not sure what you're trying with the required\[\] field and why someone would input their email address twice, but I'll trust you have that figured out since you didn't ask about it.

---
Tags: email, forms
---


# Question
Title: How to test P&T's field pack checkbox, unchecked
I want to test for a single unchecked checkbox using P&T's field pack checkbox. Anyone know the syntax for this?

# Answer
> 3 votes
Looks like you need **:selected** tag

> For use in conditionals; returns whether or not a particular option is selected.

```
{if '{my_checkboxes_field:selected option="kittens"}' == '0'}
  <p>No Kittens :'(</p>
{/if}

```

---
Tags: pixelandtonic, conditionals, field-pack
---


# Question
Title: Site Error: Unable to Load Site Preferences
I'm getting this issue with a new MT GS Server and have yet to resolve the problem despite reading he various recommendations on EESE. My database.php file is set to point to my config.php file where I've placed all my DB settings in a DRY setup. Both have been tested with 755 and 777 with no change in results. I can log into the db with PHPMyAdmin and Sequel Pro but when I try EE and a simple test script I get the above error. Any ideas why I can connect with PHPMyAdmin and Sequel Pro but not through PHP? Any other suggestions to try to resolve a db connection? Anything to keep in mind when talking to tech support at MT?

# Answer
Turns out it was a password issue. MT didn't like the original password I entered for some reason. Changing it fixed everything.
> 2 votes

---
Tags: error, database, site-preferences
---


title: Solspace user registration via ajax

text:
# Question
Title: Solspace user registration via ajax
Is this possible? I've been searching and have not been successful in finding any solid answers. I've tried submitting the user registration form with ajax and it just returns the expected html page. I hope I'm not just missing some parameter.

\** edit \**
figured out that you can submit, if successful you will get the expected response. If their are errors you will get undesirable response back. It a normal Expression Engine error page

# Answer
This works for logging into ExpressionEngine with ajax and showing the appropriate error, you would just modify the code where it checks for the error messages it returns to display to the user. You will need more conditions for the required fields.

```
function displayAjaxMessage(message, response_id)
{
    if(typeof(response_id)==="undefined") response_id = "#form-message";
    $(response_id).html(message);
    $(response_id).show();
}

// using the jquery validate library
$("#register-form").validate({
    rules: {
        username: {
            required: true,
            email: true
        },
        password: {
            required: true,
            minlength: 5
        },
        password_confirm: {
            required: true,
            minlength: 5,
            equalTo: "#register_confirm_password"
        },
    },

    submitHandler: function() {
        $.ajax({
            url: $("#register-form").attr("action"),
            data: $("#register-form").serialize(),
            dataType: "html",
            type: 'POST',

            error: function (jxhr, msg, err)
            {
                $('#register-form').append('<li style="color:red">' + msg + '</li>');
            },

            success: function(html, textStatus, jqXHR)
            {
                if (html.match(/<title>Error<\/title>/))
                {
                    var error = $(html).find('ul li:first').text();

                    if(error == "The username you chose is not available")
                    {
                        displayAjaxMessage("This email address is already registered",  "#register-form-message");
                    } else {
                        displayAjaxMessage(error,  "#register-form-message");
                    }
                } else {
                    $("#register-form").hide();
                    displayAjaxMessage("Thanks! You can now login!",  "#register-form-message");
                }
            }
        });
    }
});

```
> 4 votes

---
Tags: ajax, solspace-user, solspace, registration
---


# Question
Title: Solspace Super Search - Relevance not working
**Sorry - I can't figure out how to answer my own question, but this came down to me not using a Keyword Search. Relevance scoring only works on keyword searches.**

EE 2.7.2 Super Search 2.1.3

Hi

We are trying to implement Relevance within our search results, but having no luck at all. We output {relevance\_count} but it always returns 0. Eventually we also want to add relevance\_proximity="yes" but we will come back to that.

Here is the code we are using and it still returns a {relevance\_count} of 0 even when the title and/or tags is an exact match:

```
{exp:super_search:results
channel="photos"
relevance="title=5+tags=1"}

<h2>{title} - {relevance_count}</h2>
<p>{tags}</p>

{/exp:super_search:results}

```

Any help would be much appreciated.

Thanks, Jonathan

# Answer
Copied from above...

"This came down to me not using a Keyword Search. Relevance scoring only works on keyword searches."
> 1 votes

---
Tags: solspace
---


# Question
Title: CartThrob - Getting started with inventory
I'm setting up a shop with CartThrob, with one product with multiple options. This is set up using Price modifiers. But now the customer has requested inventory to be updated through the shop. I've looked around, and tried to see how it's done, but to no luck.

I've tried setting up a text field called inventory, and set the Product Inventory Field Name to this field, but it won't change. I also tried to do it with a Matrix, but that didn't work either.

I have the "Update Product Inventory When Editing Order" set to Yes as well.

I've tried installing the "CartThrob Price Modifiers Configurator", but there is no column for inventory here.

Is there any Getting started guides for inventory in CartThrob? Because the docs are getting me nowhere.

**Edit:** I've even tried adding `{inventory:reduce entry_id="6" quantity="4"}` pointing to the product id, but still nothing.

**Edit2:** Okay, so setting the Price Modifiers Configurator field to the inventory-field gave me the inventory column, as I wanted, but it's still not updating the field after purchase.

# Answer
> 1 votes
This is in the docs under **Using Price Modifiers and Product Options**.

> *inventory (Optional)* Your field will need to be mapped in CartThrob's product channel settings as the inventory field to use the inventory feature.

---
Tags: cartthrob
---


# Question
Title: How to lock the field height and bring back the scrollbar?
It looks like in Wygwam 3.2.2, the field height grows with the content. It used to have a static height and a scrollbar would appear in the field if content was too tall for it.

My client prefers the scrollbar way because the formatting toolbar would remain in once place. Any way to get that back?

# Answer
> 7 votes
In the Wygwam editor config, in advanced settings, add the 'autoGrow\_maxHeight' setting and make it equal to the 'height' setting.

# Answer
> 1 votes
Uncheck the "Resizable" box in the module configs:

---
Tags: wygwam
---


title: Populate Meta Tag Dynamically

text:
# Question
Title: Populate Meta Tag Dynamically
I want to be able to populate my meta tags with the information for the specific page that the user is visiting. I obviously can't just plug a variable in there without it being in some kind of a channel entries loop, but I don't want to have to specify the channel because that defeats the purpose of having it dynamically populated. Is there a way to grab the channel based on the page the user is on? I'd basically want to have something like this:

```
{exp:channel:entries channel="{channel}"}
<meta property="og:title" content="{title}" />
...etc.
{/exp:channel:entries}

```

# Answer
Personally I'd use SEO Lite - then only this is needed in the header:

```
{exp:seo_lite use_last_segment="y"}

```

And then this in the config file / SEO Lite template:

**EE2 example** (with focuslab llc master config): https://gist.github.com/bjornbjorn/4039233

**EE3 example** can be found here: http://wedoaddons.com/seo-lite/extra-tags

http://devot-ee.com/add-ons/seolite

.. but then again I might be biased as I'm the dev behind the addon ;-)
> 9 votes

# Answer
I usually embed the "header" portion of each page, since most of that content is universal. So in this case, you can just use embed parameters to pass any meta tags dynamically.

```
{exp:channel:entries channel="foo"}
    {embed="_global/_header" title="{title}" description="{page_summary}" thumbnail="{page_thumbnail}"}
    <h1>{title}</h1>
    // etc
{/exp:channel:entries}

```

Then in your **\_header** template:

```
// opening html tag, etc
<meta name="og:title" content="{embed:title}" />
<meta name="og:description" content="{embed:description}" />
<meta name="og:image" content="{embed:thumbnail}" />
<meta name="description" content="{embed:description}" />
<meta name="thumbnail" content="{embed: thumbnail}" />
<title>{if embed:title}{embed:title} - {/if}My Great Site</title>

```
> 3 votes

---
Tags: channel-entries
---


# Question
Title: Anyone know how to capitalize a page title?
I'm using the {segment\_2} variable to complete various bits of info on a page. The segment is all lowercase, but that's fine as I'm using CSS to capitalize those elements.

The problem comes when I'd like to use that {segment\_2} in the page title. It's appearing all in lowercase and I can't figure out how to make it appear in sentence case.

Any ideas would be appreciated!

Thanks in advance,

Tom

# Answer
> 7 votes
Install the **Streeng plugin**.

> Perform common operations on strings. Change case, truncate, find/replace, repeat, encode/decode, generate slugs and more.

One of the parameter options is `capitalize="yes"` which lets you capitalize the first character of the string.

# Answer
> 6 votes
**CE String** is another great option.

> CE String is a string manipulation tool for use in your ExpressionEngine templates. It is feature-packed, and allows you to manipulate strings (text) with very simple syntax.

You would just do:

```
{exp:ce_str:ing strtoupper}{segment_2}{/exp:ce_str:ing}

```

CE String has *tons* of other useful methods. And the chaining feature that lets you use more than one method can come in handy.

---
Tags: segments, css, title
---


# Question
Title: How can i make the Screen Name element required?
I need to make the screen\_name input field on my CP Register Member form required.

Here is what I currently have:

```
// Screen Name
$this->table->add_row(array(
    form_label(required().lang('Client Name'), 'screen_name').NBS.form_error('screen_name'),
    form_input(array(
        'id'    => 'screen_name',
        'name'  => 'screen_name',
        'class' => 'field',
        'maxlength' => 50,
        'value' => set_value('screen_name')
        )
    )
)
);

```

I am not sure what else I need to do to make this a required field. Thanks!

# Answer
Assuming this is a custom add-on you are building, you need to use the ExpressionEngine form validation class to truly make it required.

There is even a method specifically for screen name.

```
ee()->form_validation->set_rules('screen_name', 'Screen Name', 'required|valid_screen_name');

```

See valid\_screen\_name

There are other rules you can use, too. Check the form validation class Rule Reference in the CodeIgniter docs.

**UPDATE**

Since you're referring to the Control Panel's Members \> Register Member form...

Unless you find or build an extension to do this for you, you actually have to make a tiny modification to the core to make this happen.

The following is based on EE 2.7.2, but should be similar for older versions.

Make the modification in /system/expressionengine/controllers/cp/members.php. Around line 2170 inside the new\_member\_form() method you just need to add a "required" rule to the validation on the "screen\_name" field.

So the rules for screen\_name should look like this:

```
'rules' => 'required|trim|valid_screen_name[new]'

```
> 2 votes

---
Tags: member-management
---


# Question
Title: Testing add-on with Mockery without rewriting all $this->EE->db calls?
I'm attempting to write unit tests for my EE module using Mockery. Throughout my module code I have lines like:

```
$this->EE->db->select('channel_title, channel_id');
$this->EE->db->from('exp_channels');
$query = $this->EE->db->get();

```

Of course when I am attempting to test my functions I don't want to actually load the EE framework, I rather want this db object to be a mock. But I can't set variables on mocks, so Mockery can't tell the function under test that when it looks at `EE->db` it should actually use my mock. Based on this answer it seems like in order to use Mockery I'll have to rewrite the above code to:

```
function db() { return $this->EE->db}

db()->select('channel_title, channel_id');
db()->from('exp_channels');
$query = db()->get();

```

Is this my only option? Have I missed some trick for how to get Mockery to mock variables too?

# Answer
> 2 votes
Yeah, that's one of your options. It's almost pointless testing code that way though, it would be very brittle. However, to get Mockery to access the global EE object, you simply need to set it up in your class's constructor:

```
public function __construct($ee = null)
{
    $this->EE = $ee ?: get_instance();
}

```

That way, in your unit tests, you can inject the dependency like so:

```
$mock_ee = m::mock('ee');
$mock_ee->db = m::mock('ee_db');

$module = new My_module($mock_ee);
// tests here

```

The other alternative is you will need to spin up most of the EE core inside your unit tests, and tie it to a real database. Ideally reset the test database at the start of each test run, and run each test inside a transaction so that it doesn't affect your data. I'd definitely recommend this method rather than trying to mock the entire database object, because then you are testing the outcome of the function rather than just the contents of the function.

I haven't yet figured out the easiest way to do this (bootstrap EE from the console without rendering a page), but I'm sure it would be possible without too much work.

In Store 2, I solved this problem by using the Eloquent ORM to handle the database layer. In the unit tests, I simply load Eloquent and connect it to a test database, without loading the rest of EE. Then I stub out any other calls to EE libraries using Mockery.

---
Tags: php, module
---


# Question
Title: Cannot use Publish Layouts because "Title field cannot be hidden"
I would like to customize a Publish Layout on a channel that uses MX Title Control but it won't let me save my layout because it errors out with "Title field cannot be hidden"

Any workarounds available?

Thanks!

# Answer
Solutions is MX Title Control 2.8.7. Now Title field will be visible when toolbar is open.

If you will have any errors with this version - send me email.
> 5 votes

# Answer
I got around this by using Chrome's Inspector and making the field visible just by adding some CSS to it. This let me save the new layout. Then when the page is reloaded it's hidden again.
> 0 votes

---
Tags: mx-title-control
---


title: System Offline problems

text:
# Question
Title: System Offline problems
I turned off the site in the config panel, General Configuration , Is system on? = no. Inside the config file, it’s set to no too. But even if it’s set to no, the site still online. I can still view the site when logged out.

On a fresh EE install System Offline not working works, so i guess it would be caused by a Plugin conflict.

Does someone had already had this issue ??

i’m using EE 2.7.2

Thanks,

Stéphane

# Answer
I was almost certain that Custom System Messages was causing this problem.

The template offline message could be set in the preferences, but it was not. As Custom System Message has a greater priority over EE offline template, and no template was set, it was not working.

The template was set inside Custom System Message

The problem is solved.
> 5 votes

# Answer
is not possible that some add-on can be affected on this. You need to be sure, that you are not login as SuperAdmin. Because Super Admin can see site even in offline.
> 4 votes

# Answer
You shouldn't see the site in online mode if you have set `$config['is_system_on'] = 'n';` in your config.php file.

If you are seeing the site, I'd guess one of the following is true:

1. You are editing the wrong config.php file
2. You are still logged into the control panel as a SuperAdmin. Clear browser cookies to be sure and confirm that you see the login screen when loading `domain.com/admin.php`
3. You have something other than `$config['is_system_on'] = 'n';` set in your config file, perhaps a misspelling?
4. You have multiple instances `of $config['is_system_on']` set in your config file... one near the top turning it off and one later turning it off.
5. The EE cache needs to be manually cleared via FTP
> 4 votes

# Answer
After put your site offline, clean up the system cache. Open another browser and check the site.

You also can copy `system/expressionengine/utilities/offline.html` to your web root directory and rename it to `index.html`. If your server is configured to look first for html files, the site goes offline.

Make sure your server isn't sending a long cache time of html or files without extension to the browsers. On Nginx, look up for the `expires` setting. On Apache, look up for `ExpiresByType text/html`.
> 1 votes

# Answer
Thanks a lot for the replies!!

I set my `$config['is_system_on'] = 'n';` in my config.php file.

The cache is off, it could not cause this problem. And I cleaned the cache of all the browsers.

The problem is caused by a addon, extension, module, but i don't know wich one. So I found a solution, disabe all the extensions:

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

```

With `$config['is_system_on'] = 'n';` and `$config['allow_extensions'] = "n";` the offline template is displayed.

Now i have to find which is the extension that prevent the system to be turned off.
> 1 votes

# Answer
Recently I spent an hour trying to sort out a similar problem and had forgotten I had Dev Demons Smart Switch installed (which I was using for the first time).

Great add-on by the way.

http://www.devdemon.com/smart\_switch/
> 0 votes

---
Tags: plugin, config, system, offline
---


title: Login Password Does Not Save

text:
# Question
Title: Login Password Does Not Save
The login password does not save when I login in ether Chrome or Safari (on Mac). I am running 2.7. This is a pain in the ass when I am developing, I need to login 25 times a day with my password.

On an older site I built last year it remembers my login both user name and password. This site is 2.52.

It there a security setting that has changed between 2.5 and 2.7, and if so can I change it, especially durning the development stage while I am in development mode. I would most likely change it back when I turn it over to the client. I have looked but to no avail.

Thanks, making me crazy.

# Answer
> 2 votes
Change the Control Panel Session type to Cookies Only: http://ellislab.com/expressionengine/user-guide/cp/admin/security\_settings.html

This will get a Remember Me checkbox showing on the login screen.

---
Tags: login, security
---


# Question
Title: Freeform recipients not sending to recipient
Hi I am new to EE and found the FreeForm Module for Contact Forms. It is pretty Helpful and i love how fast you can create forms with it. One thing is not working though and as i read other posts about this topic i can not find reasons why it is not working. Here is the Code

```
{exp:freeform:form
            form_id="1"
            required="first_name|last_name|email|user_message"
            return="{segment_1}"
            recipient1="Topic1|t1@domain.de"
            recipient2="Topic2|t2@domain.de"
            recipient3="Topic3|t3@domain.de"
            recipient4="Topic4|t4@domain.de"
            recipient5="Topic5|t5@domain.de"
            recipient6="Topic6|t6@domain.de"
            recipient_template="user-request"
            notify_user="yes"
            recipients="yes"
            user_email_field="email"
            recipient_limit="8"
            }
                <label for="first_name">First Name *</label>
                <input name="first_name" id="first_name" type="text"/><br/>
                <label for="last_name">Last Name *</label>
                <input name="last_name" id="last_name" type="text"/><br/>
                <label for="email">E-Mail Address *</label>
                <input name="email" id="email" type="text"/><br/>
                <label for="recipient_email">Subject *</label>
                   <select name="recipient_email">
                {freeform:recipients}
                 <option value="{freeform:recipient_value}" {if freeform:recipient_selected}selected="selected"{/if}>
                    {freeform:recipient_name}
                 </option>
                {/freeform:recipients}
                </select>  <br/>

                <label for="user_message">Your Message *</label>
                <textarea name="user_message" id="user_message"></textarea> <br/>
                <label for="submitForm"></label>
                <input id="submitForm" type="submit" value="Send Form"/>
            {/exp:freeform:form}

```

So it does find errors, and it does send an e-Mail to the admin but it does not send an email to the selected recipient nor the user.

What did i miss to set up correctly? ( i changed the e-mail adresses in case of spamming :) )

# Answer
Double check this parameter to make sure the template is named "user-request":

```
recipient_template="user-request"

```

Also, try recoding your select like this:

```
<select name="recipient_email" id="recipient_email">
    <option value="{freeform:recipient_value1}">Option</option>
    <option value="{freeform:recipient_value2}">Option</option>
</select>

```
> 2 votes

# Answer
If the communicate module isn't delivering emails either then try setting up the SMTP option under admin\>email.

Also make sure you have set a default email address within EE (can't recall where that's set)

Finally, are the email addresses from the same domain... me@mysite.com & www.mysite.com.

Failing all those, reach out to your host to see if they allow or have available the php mail module. Also check your sites error logs, long shot but you never know.
> 1 votes

---
Tags: templates, forms
---


# Question
Title: Solspace Calendar - Issues with surrounding beginning of cal loops with conditionals
We need to tell whether the user has chosen a specific date or has just defaulted to our calendar:

* example.com/calendar
* example.com/calendar/11/31/2013

We're trying the following:

```
{if segment_2 == ""}
  {exp:calendar:cal date_range_start="today" date_range_end="today" show_days="1" pad_short_weeks="n"}
{if:else}
  {exp:calendar:cal date_range_start="{segment_4}-{segment_2}-{segment_3}" date_range_end="{segment_4}-{segment_2}-{segment_3}" show_days="1" pad_short_weeks="n"}
{/if}
  ... do stuff with the events for the given day here.
{/exp:calendar:cal}

```

When we go to the `/calendar` page all of the data returned is fine, however, when we go to a specific date page, the data returned is for the current day (ie the data that's returned on the `/calendar` page).

Does anybody know as to why this is happening?

# Answer
Just simple conditionals are parsed before the modules and plugins. Simple ones are the conditionals using just `if` and just early parsed variables. `segment_N` are early parsed variables, but your conditionals have an `if:else`.

So, try this:

```
{if segment_2 == ""}
  {exp:calendar:cal date_range_start="today" date_range_end="today" show_days="1" pad_short_weeks="n"}
{/if}
{if segment_2}
  {exp:calendar:cal date_range_start="{segment_4}-{segment_2}-{segment_3}" date_range_end="{segment_4}-{segment_2}-{segment_3}" show_days="1" pad_short_weeks="n"}
{/if}
  ... do stuff with the events for the given day here.
{/exp:calendar:cal}

```

Or this:

```
{exp:calendar:cal
    {if segment_2 == ""}
        date_range_start="today" date_range_end="today"
    {/if}
    {if segment_2}
        date_range_start="{segment_4}-{segment_2}-{segment_3}" date_range_end="{segment_4}-{segment_2}-{segment_3}"
    {/if}
    show_days="1"
    pad_short_weeks="n"
}
  ... do stuff with the events for the given day here.
{/exp:calendar:cal}

```

This article about this subject is really good.
> 5 votes

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


title: Conditional not working as expected

text:
# Question
Title: Conditional not working as expected
I have this code

```
{exp:low_replace find="\r|\n|\t" replace="" regex="yes"}
    {if '{member_group}' == 7}
        aaa
    {if:else}
        zzz
    {/if}
    {if '{logged_in_member_group}' != 7}
        bb
    {if:else}
        yyy
    {/if}
    {if {logged_in_member_group} == '7'}
        ccc
    {if:else}
        xxx
    {/if}
    {if {logged_in_member_group} != '7'}
        dddd
    {if:else}
        www
    {/if}
    {member_group}
{/exp:low_replace}

```

The output is

`zzz yyy xxx www 7`

This is weird because the output of `{member_group}` is 7.

Why are the conditionals not matching?

# Answer
Member defined variables like `{member_group}` are **parsed last** by default, so your advanced (not simple) conditionals will never properly read the member data. View parse order pdf by Low.

You need to install an add-on to move the parsing of the member defined variables earlier. Try Low Variables, Mo' Variables, or any other add-on that has this feature.
> 6 votes

# Answer
First off, you can't have any "else" statements in your conditional or it will be considered "advanced".

But more importantly in relation to how you're writing these: Simple Conditionals aren't just about the operators, control structures & variables, but the *format* is actually critical.

The actual format must be:

```
{if early_parsed_variable == "string"}
...
{/if}

```

Basically the left-hand side **must NOT** have curly brackets or quotes; and the right-hand side **MUST** have quotes. This is the exact and only pattern that EE looks for when trying to hunt down a Simple Conditional - along with the other requirements.

It's bewildering I know - it promted me to write a post about all the times you might think you've written a Simple Condition, but haven't:

http://johndwells.com/blog/when-a-simple-conditional-isnt
> 6 votes

---
Tags: conditionals
---


# Question
Title: getting data into ExpressionEngine via Channel Entries API
So I'm building a site just now that isn't EE, however, I thought this would be a good time to learn how to get data into EE using the Channel Entries API when I'm under no pressure to get the job done.

In this scenario, I'm looking to sync data from the SoundCloud API into Channel Entries.

Can anyone point me in the direction of resources to pour over that could help give me a starter for 10?

I'm looking to sync playlists from SoundCloud that contains:

* Title
* ID
* Secret URL
* Enabled (boolean)
* Private (boolean)
* Tracks (Grid/Matrix)
    + Track ID
    + Track title
    + Track duration
    + Secret token
    + Stream URL
    + Image URL
    + Private track (boolean)
    + More info URL
    + iTunes URL
    + Amazon URL

Any guidance gratefully received.

# Answer
I'm not sure there are any resources specific to this use case, but I've built quite a few add-ons which import channel entries.

It's fairly straightforward with just a couple caveats:

* Inserting data for more advanced fieldtypes can be a bit tricky. Your best bet is to look at what fields are actually being submitted via the publish form in the control panel and replicate those data structures programatically. You can easily find some examples for specific add-ons like Playa and Matrix with a little Googling.
* You always want to make sure your data array is complete, especially if you're editing an existing entry. If fields are left out of the array when editing, they will get blanked out in the database.

Sample Code:

```
$this->EE->load->library('api');
$this->EE->api->instantiate('channel_entries');
$this->EE->api->instantiate('channel_fields');

$data = array(
    'title' => $entry->title,
    'field_id_4' => '',
    'field_ft_4' => 'none',
    'field_id_5' => $field_id_5_data,
    'field_ft_5' => 'none',
    'field_id_6' => $field_id_6_data,
    'field_ft_6' => 'none',
    'field_id_7' => $field_id_7_data,
    'field_ft_7' => 'none',
    'entry_date' => time(),
    'edit_date' => time()
  );

// This is how we'd set a Playa field
$data['field_id_4']['selections'] = array(1, 5, 7, 9);

$this->EE->api_channel_fields->setup_entry_settings(2, $data);
$this->EE->api_channel_entries->submit_new_entry(2, $data);

```

Note, this code was written before some recent API changes, so you will need to adjust the methods a bit to replace the deprecated ones with current ones.

Hopefully this helps you get going.

**EDIT** It should be noted, as discussed in the comments that a session is required for the channel entries API to work. *grumble* You'll need to fake it like this if you're going to do this from a CRON job or some other way that wouldn't already have a logged in member.

```
$this->EE->session->create_new_session($member_id);
$this->EE->session->fetch_session_data();
$this->EE->session->fetch_member_data();

```
> 6 votes

# Answer
I was originally going to post this as a comment, but it's too long, so have opted for an 'answer'.

You should be aware of the security implications of doing this as advised above.

I've just created an add-on to do just this which will be executed via CRON - however, it needs to be pointed out that running:

```
$this->EE->session->create_new_session($member_id);
$this->EE->session->fetch_session_data();
$this->EE->session->fetch_member_data();

```

instantiates itself as a user and creates a valid session, therefore if a user were to find and HTTP to the URL you've created for the CRON, it would effectively log them in to the site without any authentication credentials which would persist throughout the site posing a serious security risk.

Use with caution.
> 1 votes

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


# Question
Title: How to show Transcribe language links only if it has entries?
The Transcribe documentation about the language\_link tag:

> Using the entry\_id parameter in conjunction with the has\_entry parameter will only output links for languages that have entries related to the entry\_id passed in

I can't get it to work, and no example to be found. The documentation mixes variables and tag parameters, it's not clear.

**Anybody here that knows how to only show a language link when the current viewed entry has an entry for that language?**

# Answer
Tom from EE Harbor helped me out, here's his answer:

```
{exp:channel:entries channel="name" ....}

    {exp:transcribe:language_links has_entry="yes" entry_id="{entry_id}" parse="inward"}
            <select name="lang">
                {languages}
                    <option value="{abbreviation}"{if current} selected="selected"{/if}>{name}</option>
                {/languages}
            </select>
    {/exp:transcribe:language_links}

{/exp:channel:entries}

```

> Please note, you will need to place the language\_links tags inside the channel:entries tags.

This fixed it for me, I didn't place the code inside the channel:entries tag.
> 3 votes

---
Tags: transcribe
---


# Question
Title: Migrating the EE1.x aMember plug-in to EE2.x
We're migrating a EE1.x site that uses aMember and the old 1.x aMember plug-in. New registrations are created in the EE2.x DB but log-in 'via' aMember no longer seems to work.

Did log-in change significantly between EE1.x and EE2.x? I'm guessing so but I wondered if anyone knew roughly what the differences are or happened to have updated the old EE1.x aMember ExpressionEngine plug-in to work with ExpressionEngine 2.x.

# Answer
The answer is 'yes', log-in did change significantly between EE 1.x and EE2.x. For anyone running into the same issue there is an updated aMember plug-in available for EE2.x from http://www.amember.com/ (you'll need to submit a support ticket and ask for a copy).
> 2 votes

---
Tags: integration
---


# Question
Title: Category Tag Pair Vars not Parsing when Stashed into a Nested List
Coming across a parsing problem when trying to get related Playa entries categories in a nested list with Stash. The setup involves Playa pulling related entries (videos) from a parent entry (feed) as a Stash list, and then a nested list for each video to include the categories of each video.

**Example Code that stashes the data:**

```
{exp:channel:entries channel="feed" dynamic="no" url_title="{segment_2}" limit="1"}

    {!-- The Feed --}
    {exp:stash:set name="feed_title"}{title}{/exp:stash:set}

    {!-- The Feed's Videos : Playa Field (Parent List) --}
    {exp:stash:set_list name="videos" parse_tags="yes" parse_depth="2"}

        {cf_feed_videos}

            {stash:entry_id}{entry_id}{/stash:entry_id}
            {stash:title}{title}{/stash:title}
            {stash:file}{cf_video_file}{/stash:file}

            {!-- Video Categories : EE Categories (Nested List) --}
            {exp:stash:set_list:nested_cats name="categories_{entry_id}" context="{entry_id}" parse_tags="yes"}
                {categories}
                    {stash:category_url}{category_url_title}{/stash:category_url}
                    {stash:category_title}{category_name}{/stash:category_title}
                {/categories}
            {/exp:stash:set_list:nested_cats}

            {!-- Video Links : Matrix Field (Nested List) --}
            {exp:stash:set_list:nested_links name="links_{entry_id}" context="{entry_id}" parse_tags="yes"}
                {cf_video_links}
                    {stash:link_url}{mx_url}{/stash:link_url}
                    {stash:link_title}{mx_title}{/stash:link_title}
                {/cf_video_links}
            {/exp:stash:set_list:nested_links}

        {/cf_feed_videos}

    {/exp:stash:set_list}

{/exp:channel:entries}

```

**Example Code that outputs the data:**

```
{exp:stash:get_list name="videos" limit="1" sort="desc"}

    ...

    <h1>{title}</h1>
    <ul class="categories">
        {exp:stash:get_list:nested_cats name="categories_{entry_id}" context="{entry_id}"}
            <li><a href="{category_url}">{category_title}</a></li>
        {/exp:stash:get_list:nested_cats}
    </ul>

    ...

{/exp:stash:get_list}

```

So everything parses correctly except for the variables within the nested categories loop.

The {category\_title} for example renders as "{category\_name}" as if it's not being parsed when it's stashed in the nested set\_list.

I have tried setting a higher parse\_depth on the parent set\_list, or setting a parse\_depth on the nested categories list, however these do not seem to work either. Also in the example code, there is a second nested list (video links) which is pulled from a matrix field at the same level of the categories nested list, and this renders just fine.

Is this a question of the EE {categories} tag pair parsing later in the process than custom fields like a matrix field?

# Answer
Turns out the problem wasn't a parse issue after all. Playa disables categories by default so by placing a blank disable="" parameter on the {cf\_feed\_videos} tag it overrides this and re-enables categories for the related entries.
> 3 votes

---
Tags: playa, categories, stash, parse-order
---


# Question
Title: Unknown column 't.dst_enabled' in 'field list' after EE 2.7.2 Upgrade
Okay this one is totally nuts, I've spent all day trying to nail this one.

I've attempting to go from EE 2.5.5 to 2.7.2, but after the upgrade, I'm getting the following error on some pages:

```
    Error Number: 1054

Unknown column 't.dst_enabled' in 'field list'

SELECT t.entry_id, t.channel_id, t.forum_topic_id, t.author_id, t.ip_address, t.title, t.url_title, t.status, t.dst_enabled, t.view_count_one, t.view_count_two, t.view_count_three, t.view_count_four, t.allow_comments, t.comment_expiration_date, t.sticky, t.entry_date, t.year, t.month, t.day, t.edit_date, t.expiration_date, t.recent_comment_date, t.comment_total, t.site_id as entry_site_id, w.channel_title, w.channel_name, w.channel_url, w.comment_url, w.comment_moderate, w.channel_html_formatting, w.channel_allow_img_urls, w.channel_auto_link_urls, w.comment_system_enabled, m.username, m.email, m.url, m.screen_name, m.location, m.occupation, m.interests, m.aol_im, m.yahoo_im, m.msn_im, m.icq, m.signature, m.sig_img_filename, m.sig_img_width, m.sig_img_height, m.avatar_filename, m.avatar_width, m.avatar_height, m.photo_filename, m.photo_width, m.photo_height, m.group_id, m.member_id, m.bday_d, m.bday_m, m.bday_y, m.bio, md.*, wd.* FROM exp_channel_titles  AS t LEFT JOIN exp_channels AS w ON t.channel_id = w.channel_id LEFT JOIN exp_channel_data AS wd ON t.entry_id = wd.entry_id LEFT JOIN exp_members  AS m ON m.member_id = t.author_id LEFT JOIN exp_member_data    AS md ON md.member_id = m.member_id WHERE t.entry_id IN (27) ORDER BY t.sticky desc, t.entry_date desc, t.entry_id desc

Filename: modules/channel/mod.channel.php

Line Number: 297

```

I thought it was a simple issue of an addon not being updated as dst\_enabled has been removed since 2.6.

Now it get's weird.

I only get this error if I access the pages with a channel tag over SSL.

I've cut everything back to absolute bare bones, all addons, extensions, plugins and field types have been uninstalled and physically removed from the site. I've created a very basic template to reproduce the error:

```
{exp:channel:entries channel="pages" entry_id="27" limit="1" disable="categories|pagination|member_data|custom_fields|category_fields"}

    <h1>{title}</h1>

{/exp:channel:entries}

```

I've also replaced all EE files with a fresh download in case a file was not replaced during the upgrade.

I've disabled htaccess, and reverted to stock EE config.

Running on PHP 5.4.19 and can reproduce it on different servers with entirely different configurations.

The really annoying thing is I've run into this issue before, took days to track it down but I didn't document the fix! Paying the price now :(

# Answer
Okay pinned this one down, it made no sense for good reason.

We were running the staging site out of the same hosting account as the live site, which should have been fine. But due to a misconfiguration, any SSL pages were being loaded from the live site but as we load the DB based on the hostname, it was still pulling the stage DB.

As only some pages enforced SSL that's why the problems were intermittent, and only when we access the pages over SSL did it pull the 2.5.5 files instead.
> 1 votes

---
Tags: ee2, entries, ee2-upgrades, ssl
---


title: Google Maps Mod pre-purchase question

text:
# Question
Title: Google Maps Mod pre-purchase question
I am creating a business directory and want to have a map that shows locations of member businesses.

Can I use the fieldtype to allow members to show location of their business, then display a map that show all locations from ALL entries in the member channel?

Can I restrict the fieldtype so that a member can only place one marker?

I also need to assign categories to each entry and then have either a drop menu or check boxes that allow for filtering. So the user can display only locations that match a certain category.

Also, can you get the entry\_url to be a link in the info box?

# Answer
Google Maps can do all of this, yes (and makes it really easy). It's a very flexible add-on. Sorry for the short answer, but it really just is "yes" to each of your questions. :-)

By the way, this isn't an official response since obviously I'm just a user, not the developer of this add-on. But my guess is that Justin would agree. ;-)
> 1 votes

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


# Question
Title: Best method to split module mcp file into multiple files
We are developing a module and the controller mcp file has become quite large. I wondered if there is a best practice for splitting this into multiple files. It's a collection of methods in the class our module\_mcp class, so can these be split out into other files somehow? Multiple controllers instead of one? We could use the include() method in PHP but doesn't seem it would be the best practice to do this.

# Answer
> 4 votes
I would suggest a couple things to help separate our your code.

1. As Derek mentioned in a comment above, make sure you're abstracting your data model work to a model class.
2. You can also create a libraries directory within your add-on package and begin to create your own set of libraries. Since they are local to your package, you'll be able to easily load them like `$this->EE->load->library('your_module_class_name');` Then, within the control panel file you can simply pass off processing to your library. As the code gets more complex, you can abstract into multiple libraries as needed.

Of course all of this is really a matter of your own personal taste and need for organization. You want to be careful not to abstract too much, making it incredibly difficult to trace through later.

---
Tags: add-on-development, module
---


title: Save revision on channel entry error

text:
# Question
Title: Save revision on channel entry error
We've setup a site for a client to populate with their content and they are having a recurring issue when they go to 'save revision' or 'submit' the entry.

If they've spent a bit of time adding the entry content, when they click either save or submit, they're getting dumped out to the control panel home.

I wondered whether the session could have been expiring (or changing somehow) so changed the security to cookies only, but they're still having the issue.

Anyone else come across this or have any thoughts as to why it might be happening?

Cheers!

# Answer
ExpressionEngine natively processes forms in secure mode which means each for submission is tied to an automatically generated XID / Hash which is passed as a hidden field in all CP and most front-end forms.

The XID is a hash containing a reference to a database entry which gives EE a bunch of info about the user (their user agent, timestamp created, ip address and some other identifying 'stuff').

The XID is validated on submission (to ensure the same user visiting the form is the same user submitting the form) so if the XID fails to validate, or expires - EE will block the submission and in the case of a user being in the CP, it simply redirects them to the home page which isn't very helpful.

To prevent your issue, you can disable secure form processing globally via:

Admin -\> Security and Session Preferences -\> Process form data in Secure Mode? -\> No

I'm always quite wary of disabling this though, if you do - proceed with caution. You're opening a few holes and it's up to you to determine if the risk is worth it.

EDIT: I should also mention that a common cause of what you are describing is a user submitting a form and using their browser's back button to submit again. Because the XID has been used, it is no longer 'valid' and EE will reject it.
> 4 votes

# Answer
Oddly enough, the only known solution to this that I've been able to use is to use the back button, and save again. It works more often than it doesn't.

This is what made me think that the issue was not the XID at all.

Also, none of the content being submitted differs greatly from a successful submit to a failed one. New entries v edits, paragraphs v images, everything appears to be fair game for this random occurrence.

On the front end, an invalid XID results in "You are not authorized to perform this action." This results in no obvious error. Anyone who did not expect a View Entry screen would think that their entry had saved just fine.

As someone still experiencing this issue, my client cannot turn off Secure Mode because the site relies heavily on user-generated content.

This is a bug, and it needs to be handled as such.
> 0 votes

# Answer
I've experienced these same symptoms with clients running a site on multiple servers behind a load balancer. When this is the case, you may need to whitelist the proxy IPs.

You can do this in /system/expressionengine/config/config.php in the Reverse Proxy IPs section.

```
/*
|--------------------------------------------------------------------------
| Reverse Proxy IPs
|--------------------------------------------------------------------------
|
| If your server is behind a reverse proxy, you must whitelist the proxy IP
| addresses from which CodeIgniter should trust the HTTP_X_FORWARDED_FOR
| header in order to properly identify the visitor's IP address.
| Comma-delimited, e.g. '10.0.1.200,10.0.1.201'
|
*/
$config['proxy_ips'] = "";

```
> 0 votes

---
Tags: channel, entries, sessions
---


# Question
Title: Creating Custom CP Links to Other Site Channels in MSM with Zoo Flexible Admin
I've got an MSM installation with 2 sites (Site 1, Site 2). I'm building out a custom control panel menu using Zoo Flexible Admin. I would like my admin to be able to click a custom link in the CP which will:

1. switch the MSM site from Site 2 to Site 1
2. take them to a specific channel edit page on Site 1

I can't seem to figure out how to combine these two into a single link, as the CP url for switching sites seems to include a query string of "C=sites" and the link to a specific channel edit page also uses the query string "C=content\_edit".

The reason for the season is that Site 1 holds a Member Profile channel (using Profile:Edit). I'd like my admin (who administers both Site 1 and Site 2) to be able to quickly go to this Member Profile channel from Site 2 (avoiding the extra step of having to switch sites first, and avoiding the confusing conversation where I try to explain why the admin must go to Site 1 to change settings for a Site 2 member).

# Answer
> 0 votes
MSM switcher is encoded the current pages in base64 as

```
&page=Qz1jb250ZW50X3B1Ymxpc2h8TT1lbnRyeV9mb3JtfGNoYW5uZWxfaWQ9Mw__

```

if to decode it, we will get

```
C=content_publish|M=entry_form|channel_id=3

```

So you can coded your pages the same way, or the most simple way - go to a specific channel edit page on Site 1, click on MSM menu and just copy the link for current site.

**update**

no, this is not working because this function is commented in *system/expressionengine/controllers/cp/site.php line 139 - 161*

> *"// Commenting this out for the time being, as I'm not pleased with how it's working // Depending on the page you're on, you can be hit with PHP errors. So rather than // keeping this as is, we'll redirect to the CP homepage of the site switched to. // We should examine this in the future to see if a better experience for the end users // can be had."*

```
     if ($this->input->get_post('page') !== FALSE &&
            preg_match('/^[a-z0-9\_]+$/iD', $this->input->get_post('page')))
     {
        $parts = explode('|', base64_decode(str_replace('_', '=', $this->input->get_post('page'))));

        $page = BASE;

        foreach($parts as $part)
        {
            if ($part == '' OR ! preg_match('/^[a-z0-9\_\=]+$/iD', $part))
            {
                continue;
            }

            $page .= AMP.$part;
        }
     }
     else
     {
        $page = BASE;
     }

```

so I don't see way do this w/o uncommend this lines or write ext. which will do the same.

---
Tags: control-panel, multi-site-manager, profile-edit
---


title: Nothing rendering on Windows server

text:
# Question
Title: Nothing rendering on Windows server
Not sure what happens but a site I'm running on a windows server displays nothing now. I can't get it into debug mode. Also, works perfectly fine locally on MAMP and on a linux set up with 1and1... any help would be amazing!

# Answer
According to Gearhost docs, you can set a PHP.INI file per site. Using these docs, you can override the default PHP.INI settings. Create a file which shows the output of the phpinfo function to see what your current settings are. It's possible that PHP is set to output errors to a log file and not to display them on screen. This makes sense for a production site.
> 1 votes

---
Tags: templates, windows
---


# Question
Title: Error message when upgrading from 2.4.0 to 2.7.2
I am about to update a site online and I wanted to make sure that everything when smoothly. So, I downloaded the site and tried to update the site locally. I followed all the steps on the docs for upgrading expressionengine 2. But, after the installer runs and I delete my installer folder and try to login I get this error message:

Has anyone ran into this? Also, what do I need to do to get this working locally? I know what to look for when I make this update to the live site.

# Answer
> 1 votes
This appears to be a duplicate question.

Channel Fields Error After Updating to 2.7

As per the response to the first question, remove this add-on and use the standard file field-type.

It's probably a good idea to update everything or at least look into updates for everything in your third\_party directory before you upgrade EE.

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


# Question
Title: Templates aren't working properly after update
I just updated this site for a client from ExpressionEngine 1.6.3 to 2.7.2 Now the blog works fine but the individual blog entries aren't displaying.

Any ideas on where I should start to troubleshoot this?

Edit: Sorry, now I realize that the question was way too vague. The page listing the blog entries displays fine but when I visit an individual entry, the url is wrong.

Link to the site: http://professor-murmann.info/

Pastie of the template code: http://pastie.org/private/6x367wh2yilbulceotf5g

# Answer
> 2 votes
It appears the template you should be using is fullarticle\_all\_weblogs as opposed to fullarticle\_all\_channels.

For example.

http://professor-murmann.info/index.php/weblog/fullarticle\_all\_weblogs/1161

vs

http://professor-murmann.info/index.php/weblog/fullarticle\_all\_channels/1161

# Answer
> 1 votes
I'm not sure what you mean when you say the "blog works fine" if the entries aren't showing up. But did you change "exp:weblog" in your templates to "exp:channel"?

---
Tags: ee1, ee2-upgrades
---


# Question
Title: "Low Reorder for Structure" plugin - links to the wrong reorder list
Do any of you use the Low Reorder for Structure plugin?

Assuming you're using Structure & Low Reorder, it adds a link next to a page which has listings, and changes the "Add or Edit" link to be "Add, Edit or Reorder."

I'm having a problem where the "Reorder" link is going to the wrong reorder list. And the unfortunate part is that it matches up reorder lists to listings automatically, so I can't manually select one or the other (as far as I know).

I've got two reorder lists that pull from the same channel. The channel is called "projects" and the lists are called "projects" and "area" - Projects is all of the listings, while area is a particular subset.

According to the docs, it should pick up the reorder list with the same name, but it's picking up the other one instead.

Is there a way to override the selection that the plugin is making? Or change my data to get the plugin to select the right list?

EDIT: After some testing, it looks like it uses the last reorder list that uses the same channel. I deleted my first 'projects' list and recreated it, and then it was working. Delete the 'area' one and recreate it, and then it links to that. It's not a fix, but it does work.

# Answer
> 0 votes
I think your issue is caused by both sets using the same listing.

The copy on the Low Reorder for Structure plugin page suggests that the listings need to be unique for this to work correctly. That's how I'm reading it.

> This accessory will **look for structure listings that are using Low Reorder sets**. If it finds a match it will add a "Reorder" link next to the "Add or Edit" links.

To change the default functionality, you'd need to hack the addon.

---
Tags: structure, low-reorder
---


title: Update entry with XML post

text:
# Question
Title: Update entry with XML post
First, thanks in advance for any input or direction.

Does anyone have an idea how I might be able to receive entry updates by XML? Specifically, I'm looking to integrate ShipStation with CartThrob, particularly receiving shipping updates. More about the process can be found here, in the "Receiving Shipping Notifications" section:

http://app.shipstation.com/content/integration/ShipStationCustomStoreDevGuide.pdf

I've been digging into accomplishing this with EE's Channel Forms (aka Safecracker), but not sure if I'm on the right path. I also reached out to the developers of Data Grab, but it's not quite the right fit.

If anyone could point me in the direction of a possible solution, I'd greatly appreciate getting moving down the right path.

Cheers,

Chris

# Answer
DataGrab is the gold standard and was built for this. You can import XML at regularly scheduled intervals using Cron or via HTTP. Otherwise you'll have to build a custom add-on.
> 2 votes

---
Tags: safecracker, cartthrob, xml
---


# Question
Title: Replacing Controller and function name with attribute in Codeigniter?
in htaccess or route.php where from you want you can give answer for this issue.

I Need some thing like this.if i have url :

```
http://tageto.pnf-sites.info/developer/headcategory_controller/head_category/Agriculture

```

than it must be replaced into

```
http://tageto.pnf-sites.info/developer/Agriculture

```

and if i have url like this

```
http://tageto.pnf-sites.info/developer/headcategory_controller/sub_category/Rice

```

than it must be replaced into

```
http://tageto.pnf-sites.info/developer/Rice

```

and if i have url like this

```
http://tageto.pnf-sites.info/developer/products/view_product/nokia-internet-stick-cs-17-hsdpa-144mbps-logo-nokia-black-1

```

than it must be replaced into

```
http://tageto.pnf-sites.info/developer/nokia-internet-stick-cs-17-hsdpa-144mbps-logo-nokia-black-1

```

Can anybody solve my this issue? Please reply rapidly.

.htaccess

```
 <IfModule mod_rewrite.c>

```

RewriteEngine On

```
    # Removes index.php from ExpressionEngine URLs
    RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
  #  RewriteRule ^(.*)$ /index.php/$1 [L]

```

RewriteRule ^(.\*)$ index.php/$1 \[L\] To remove index.php i need all i mentioned above for url so that url becomes canonical.

# Answer
> 2 votes
Template Routes

> Control your URLs by remapping URI routes to a specific template, using CodeIgniter-style routing rules.

```
$config['template_routes'] = array(
    'blog/:category' => 'site/blog-category',
    'blog/:year/:pagination' => 'site/blog-yearly-archive',
    'blog/:any' => 'site/blog-single',
);

```

---
Tags: php, url-title, codeigniter, .htaccess, routing
---


# Question
Title: Is it possible to populate a select list field from another grid field?
I'm working on a project where the client wants to be able to upload new page background images and then select one for each page/section of the site.

A solution I thought might solve this would be to have a grid field allowing for the uploading of the images, say up to 10 rows. Then add in another select list field that is populated from the previous grid field. I could then take that selected value and change the background image via css.

As the grid field is quite new I'm not sure if this is possible?

Also, if there is a better way of solving this please advise too.

Thanks.

# Answer
Can you not just use the standard file field and set up a folder for backgrounds? Your client can then either select an already-uploaded image from the list of files, or upload a new one. You can restrict this field to one folder so there's no room for confusion and have it as a field in your pages channel.

This way you don't have two separate strands to the workflow (upload in one place, then select somewhere else).

Or am I misunderstanding your needs?
> 2 votes

# Answer
Yes, you can do this using any FT which can retrieve data by query (for example SELECT+). But will be needed to save entry first after upload images to get it in select field.

Other way is to create this field (simple select + little bit JS coding).

But take attention on **Penzizzle** advice - way which you choose is looks little bit unusual.
> 1 votes

---
Tags: channel, fieldtype, fields, grid
---


title: Make a member which cannot login

text:
# Question
Title: Make a member which cannot login
Is there a way to make a member which cannot be logged in?

I am using it as some sort of a member placeholder for entries of members I want to delete.

I don't want anyone be able to log-in as that member.

Does this feature exist?

# Answer
> 4 votes
You can disable the access to the Control Panel to a Member Group if you want to: Members \> members groups.

The **Banned Member Group**, for example, can't access the Control Panel.

# Answer
> 1 votes
It sort of goes against the philosophy of having members to actually have 1 that cannot login. If your posts are member restricted then you'll need to have a member that you can assign them to with the same level of permissions.

If security is an issue:

Create a new member, assign them whatever group is required then set a monster 64 char password, don't record the password and move on.

---
Tags: members
---


title: Components based globally

text:
# Question
Title: Components based globally
Just a quick post to find out if something is possible or not within EE.

We have been looking at the easiest way of trying to make certain blocks of code within our sites global. What we are doing is setting up the right column to show all the components that would be available across the site i.e. Twitter, Social Media, Relationships etc so the user can choose what they want in each page. Sort of similar way as Drupal works if you see where I am coming from.

I can set up checkboxes for Twitter and Social Media as they are not connected to channel fields but with Relationships you have to set up a channel field (generic-events or news-events etc) in each channel.

Is there anyway of not having to set up a channel field in every channel or maybe there is a module that is out there?

Hope this is clear enough.

Thanks in advance

Dave

# Answer
Low Variables is what you want. A lot of us use it on every project as it allows for global variables with a user-friendly (ie, client-friendly) interface.
> 1 votes

---
Tags: ee2, channel, multiple-channels
---


title: Get value of a specific modifier?

text:
# Question
Title: Get value of a specific modifier?
I am building a gift certificate item and am using gift voucher options as modifiers.

It all works great. However, I need to output those modifier values into a template in a particular design – as such, I want to get values of particular modifiers.

For example, I have a modifier, system called this ‘modifiers\_6’ - I can only get its value when I use the modifiers loop – but I also get all other modifiers.

Was hoping is could be like {modifiers\_6:modifier\_value} - I wrapped the modifiers and items loop tags around this but no luck.

Any ideas? How do I target specific modifiers without using the whole loop?

# Answer
You should be able to run a conditional check on the modifier names along the lines of:

```
{modifier_options}

// Only output a particular modifier by name
{if option_name == 'my_name'}
    {option_name} {if price_mod_val} ({price_mod}) {/if}
{/if}

{/modifier_options}

```

Then you limit the output to a particular modifier. You still need to wrap it in the `{modifier_options}` loop but you can just wrap the whole section in this if you need to.
> 2 votes

---
Tags: expresso-store
---


title: Relationships EE 2.7.1

text:
# Question
Title: Relationships EE 2.7.1
I seem to be getting an error when putting relationships in EE version 2.7.1

Error is:

> Error Number: 1054
>
> Unknown column 'L0.grid\_field\_id' in 'field list'

The relationships looks like this:

```
{generic-call-to-action}
    {generic-call-to-action:cta-image}
    {generic-call-to-action:cta-main-content}
{/generic-call-to-action}

```

and is sitting in a channel entries tag for the generic channel which is where the generic-call-to-action channel field has been set up.

Is this a new bug in 2.7.1 as this has always worked in previous versions.

Thanks Dave

# Answer
> 1 votes
If you have read this question that I posted I thought I would let you know the issue was the install script we have to set up EE.

---
Tags: relationships, 2.7.1
---


# Question
Title: Trouble with Low Events / Low Nice Date / Mo' Variables
I'm trying to make a URL that will (eventually) print out JSON for jquery FullCalendar to use. I'm using Low Events to do this, but I'm having some trouble with getting the start and end dates from the url..

The url itself is formatted like this `/ajax/events?start=1384869883&end=1385042714`

The code I have on that template is this:

```
{exp:low_events:entries channel="events" date_from="{exp:low_nice_date date="{get:start}" format="%Y-%m-%d"}" date_to="{exp:low_nice_date date="{get:end}" format="%Y-%m-%d"}" unit="custom"}
    {entry_id}
{/exp:low_events:entries}

```

When turning on debugging, I'm getting this error:

```
Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string ({exp:low_nice_date date=) at position 0 ({): Unexpected character' in /home/user/public_html/example.com/system/expressionengine/third_party/low_events/libraries/Low_date.php on line 448 Exception: DateTime::__construct(): Failed to parse time string ({exp:low_nice_date date=) at position 0 ({): Unexpected character in /home/user/public_html/example.com/system/expressionengine/third_party/low_events/libraries/Low_date.php on line 448 Call Stack: 0.0003 693672 1. {main}() /home/user/public_html/example.com/index.php:0 0.0008 777272 2. require_once('/home/user/public_html/example.com/system/codeigniter/system/core/CodeIgniter.php') /home/user/public_html/example.com/index.php:188 0.2111 16059624 3. call_user_func_array() /home/user/public_html/example.com/system/codeigniter/system/core/CodeIgniter.php:319 0.2111 16059760 4. EE->index() /home/user/public_html/example.com/system/codeigniter/system/core/CodeIgniter.php:0 0.2111 16059840 5. EE_Core->generate_page() /home/user/public_html/example.com/system/expressionengine/controllers/ee.php:68 0.2201 17906008 6. EE_Template->run_template_engine() /home/user/public_html/example.com/system/expressionengine/libraries/Core.php:693 0.2209 17999968 7. EE_Template->fetch_and_parse() /home/user/public_html/example.com/system/expressionengine/libraries/Template.php:184 0.2608 19299776 8. EE_Template->parse() /home/user/public_html/example.com/system/expressionengine/libraries/Template.php:236 0.2627 19306040 9. EE_Template->tags() /home/user/public_html/example.com/system/expressionengine/libraries/Template.php:462 0.3258 19327744 10. EE_Template->process_tags() /home/user/public_html/example.com/system/expressionengine/libraries/Template.php:928 0.3605 25814976 11. Low_events->entries() /home/user/public_html/example.com/system/expressionengine/libraries/Template.php:1308 0.3605 25815056 12. Low_events->_init_date() /home/user/public_html/example.com/system/expressionengine/third_party/low_events/mod.low_events.php:174 0.3606 25815320 13. Low_date->init() /home/user/public_html/example.com/system/expressionengine/third_party/low_events/mod.low_events.php:1487 0.3606 25815712 14. Low_date->_from_string() /home/user/public_html/example.com/system/expressionengine/third_party/low_events/libraries/Low_date.php:114 0.3606 25816192 15. DateTime->__construct() /home/user/public_html/example.com/system/expressionengine/third_party/low_events/libraries/Low_date.php:448

```

When doing a `var_dump($date_from)` inside of the `Low_events::_init_date()` method, it prints out `string(24) "{exp:low_nice_date date="`.

Any suggestions on how to fix this?

# Answer
Try adding parse="inward" to the exp:low\_events:entries tag. That should allow you to use a plugin as a parameter.
> 1 votes

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


title: Parent Relationship Broken in EE 2.7.2

text:
# Question
Title: Parent Relationship Broken in EE 2.7.2
I just updated to 2.7.2 and I'm trying to rework all of the relationship tags (the updater failed to convert them automatically as promised).

So I've got three channels: Author, Publisher, and Book. A book has two relationship fields, one for author (writer) and one for publisher that link to the other two channels respectively. When I display the the author listing, I need to display all related books. This is doing exactly what I want.

```
        {parents field="writer_rel"}

        <ul id="books">
            <li><h4><a href="{parents:url_title_path='book'}">{parents:title}</a></h4>
                <ul>

                    {if parents:publication_date}<li><strong>Publish Date: </strong>{parents:publication_date}</li>{/if}
                    {if parents:format}<li><strong>Type: </strong>{parents:format}</li>{/if}
                    {if parents:isbn_hardback}<li><strong>Hardback ISBN: </strong>{parents:isbn_hardback}</li>{/if}
                    {if parents:hb_pages}<li><strong>Pages:</strong>{parents:hb_pages}</li>{/if}
                    {if parents:isbn_paperback}<li><strong>Paperback ISBN: </strong>{parents:isbn_paperback}</li>{/if}
                    {if parents:pb_pages}<li><strong>Pages:</strong>{parents:pb_pages}</li>{/if}
                    {if parents:leo_call_number}<li><strong>Leo Call Number: </strong>{parents:leo_call_number}</li>{/if}

                </ul>

            </li>
        </ul>

        {/parents}

```

So far, so good, but when I add the Publisher to the list, which is the second relationship field, things stop working. If I treat it just like any other field and add

```
{if parents:publisher_rel}<li><strong>Publisher: </strong>{parents:publisher_rel}</li>{/if}

```

It actually prevents the entire parents tag from being parsed. So I get this rendered on the page.

If I try to treat it like it's own independent parent tag like so:

```
                        {parents field="publisher_rel"}
                        {parents:title}
                    {/parents}

```

It just doesn't render. Weirdly, when nested inside the original parents tag it also prevents any further looping, so it doesn't display anything after the first entry.

So, yeah. I'm stuck. Any advice? Thanks very much.

# Answer
You are actually trying to access the child ("Publisher") of a parent ("Book") - because you're currently viewing another child of the "Book" ("Author"). So that's why `{parents field="publisher_rel"}` won't work.

This code you posted *should* work, with one tweak - you need to add the field you want to display (in this case, `:title`):

```
{parents field="writer_rel"}
    {if parents:publisher_rel}<li><strong>Publisher: </strong>{parents:publisher_rel:title}</li>{/if}
{/parents}

```

This should also work (using a tag pair):

```
{parents field="writer_rel"}
    {parents:publisher_rel}<li><strong>Publisher: </strong>{parents:publisher_rel:title}</li>{/parents:publisher_rel}
{/parents}

```
> 2 votes

# Answer
What I ended up using was a siblings tag, which I somehow missed when I initially posted this.

```
{siblings field="publisher_rel"}
    {if siblings:title}<li><strong>Publisher: </strong>{siblings:title}{/if}
{/siblings}

```
> 2 votes

---
Tags: relationships, 2.7.1, parent
---


title: Deploying Add Ons to Clients?

text:
# Question
Title: Deploying Add Ons to Clients?
Is there a good way to handle giving your clients easy access to an Add-On? For example, I'm using Low Variable to allow a client to edit their homepage content. But as far as I can tell in order for them to do that I have to give them access to Add-Ons and Modules, which they have to click through to get to Low Variables. I wish I could just give them single-click access directly to Low Variables.

In the past, I've added a custom tab to the CP for this kind of thing (which even lets me give it a better name like "Edit Homepage"), but that really doesn't scale well since it requires logging in as each member one at a time, and you have to remember to do it every time you add a new member. I'd probably just keep doing this anyway if it didn't require also making the Add-Ons tab visible anyway.

Any suggestions? How does everyone else handle this? Any way to hide the Add-Ons tab?

# Answer
> 4 votes
Adding a custom CP navigation tab is the best way to do it. But as you said it is tedious to log in as each individual user and manually create the link. There are two add-ons that will enable you to do it on a per-member-group basis.

1) **Member Group Tabs**

> This extension allows you to create navigation tabs for entire member groups in the ExpressionEngine control panel.

OR

2) **Zoo Flexible Admin**

> Zoo Flexible Admin lets you fully customize the control panel menu per membergroup. Insert custom links, rename, re-order and remove menu items in order to create a more intuitive menu.

Zoo Flexible Admin is *really* powerful, giving you complete control of the CP navigation per member group. So if you did want to hide the Add-Ons tab as you described, this would be the way to go.

# Answer
> 1 votes
Zoo Flexible Admin is stellar, as the others have said; if you're using Structure, the "Encaf Where is the LV?" add-on is also a good alternative.

---
Tags: add-on, low-variables
---


title: Freeform field staus option?

text:
# Question
Title: Freeform field staus option?
I have a checkbox field in my form where the values are from another channels title field.

What I would like is to have only entries with status="open" to appear in the checkbox group. My code below however, is not working. Is this possible?

```
{freeform:field:assigned_editor
                attr:id="238"
                attr:class="radio"
                status="open"}

```

Thanks!

Peter T

# Answer
> 1 votes
I would suggest embedding your freeform code and then passing a variable with for status something like this.

```
{exp:channel:entries channel="my_channel"}

some code here

{embed="template_group/freeform_form" entries_status="{status}"}

{/exp:channel:entries}

```

Then in the freeform embed code you would do this:

```
{freeform:field:assigned_editor
                attr:id="238"
                attr:class="radio"
                status="{embed:entries_status}"}

```

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


# Question
Title: Submitting Entry Edits Routes to a Non-Existent Page
Encountering a some odd issues attempting to submit changes on in the CP of an ExpressionEngine 2.7.2 site. Instead of saving the changes and displaying the success message, I'm bounced to a non-existent URL and the landing page of my site is displayed instead.

**URL FOR ENTRY:**

`/system/index.php?S=b6fd020cbb7cc1f54675bce25372a17b&D=cp&C=content_publish&M=entry_form&channel_id=1&entry_id=1&&filter=YToxOntzOjEwOiJjaGFubmVsX2lkIjtzOjE6IjEiO30=`

**URL FOR NON-EXISTENT PAGE**

`/system/index.php?S=b6fd020cbb7cc1f54675bce25372a17b&D=cp&C=content_publish&M=entry_form&channel_id=1&entry_id=1&filter=YToxOntzOjEwOiJjaGFubmVsX2lkIjtzOjE6IjEiO30%3D`

Notice how the first URL has double ampersands right before the filter (entry\_id=1&&filter=) and the URL of the second domain ends not with an = sign but with %3D.

I've see this error in two separate instances:

1) In a particular textarea field (in a field group which only contains five fields), entering more than 327 characters will trigger the error — even if all of the other fields are empty.

2) Adding new fields to a channel field group, regardless of whether it's a brand-new field group or simply adding a field to an existing group.

Disabling extensions (via the config.php file) is having no impact and the logs are not giving any meaningful data.

# Answer
> 1 votes
Bounced this issue up to EllisLab's private support. The answer might be unique to my host but the issue appears to be with their security measures.

The content in question happened to contain a phrase which spambots might use. The speculation is the host is using mod\_security rules to prevent that phrase on index.php pages.

The recommended workaround is to use admin.php to log into the CP as that page is likely not blacklisted.

Again, your mileage may vary, but if future developers run into a similar issue... try admin.php.

# Answer
> 1 votes
I think this is related to a weird URL or some other piece of content in the entry. I've seen similar issues a couple times. Start removing copy a chunk at a time till you find it.

---
Tags: channel
---


# Question
Title: Using Solspace User to only allow editors to edit/view articles the've been assigned to?
By using Channel Form, I've created a Wiki that currently allows a logged in member to edit content of articles on the front end.

I now need to set up access permissions on those articles, so access would only be granted if you've been invited to contribute to a specific article. Any articles you've not been invited to would be invisible.

1. Am i using the correct third party module for this?
2. Is this easy and if so, how?

# Answer
User has a **related members (authors)** feature that lets you link multiple users to an entry. **However, it does not give the same permissions as the "real" entry author**. In a way, it is somewhat like a "Playa for users" where you can related members to an entry.

The **`{exp:user:authors}`** tag is the tag to use to list these related members. You could use this to display content only when the currently logged in member is a related member.

For example, let's assume you know the entry\_id from the URL's {segment\_3}:

```
{exp:user:authors
  entry_id="{segment_3}"
}
    {if logged_in_member_id == member_id}
       // Display your entry data
    {/if}
{/exp:user:authors}

```

Of course, you could start with {exp:channel:entries}, and have {exp:user:authors} inside to do something similar:

```
{exp:channel:entries /* your parameters */}
   {exp:user:authors entry_id="{entry_id}" dynamic="no"}
       {if logged_in_member_id == member_id}
         // Display your entry data
       {/if}
   {/exp:user:authors}
{/exp:channel:entries}

```

However, if you have parsing issues, you might need to use an embed for {exp:user:authors}.
> 1 votes

# Answer
I've done something similar before using Profile:Edit. I know it would work with Zoo Visitor too. I haven't used User, but as long as you can connect a member to a profile entry you should be able to pull this off.

The basic idea is that each member gets a channel entry in a members channel. Within that entry, there will be a Playa field, allowing entries from your articles channel to be selected.

Then on the edit template, you'd load the profile, and then find the entry you want to edit within the Playa field. If it's not found, then you show a permissions error or redirect or something.

You would also use the Playa field to output the list of entries the member can edit in whatever form of navigation you're using.
> 1 votes

---
Tags: ee2, solspace-user, channel-form
---


# Question
Title: Get Matrix {field_row_count} when using the search parameter.
I have a Matrix field that I'm using the search parameter on. Within the output I need to grab the actual `{row_count}` associated with each row based on the order the row appears within the CP-based entry and not the order associated with the filtered results. It seems like the `{field_row_count}` variable should give me exactly what I need, but it's not working as expected.

Here's a simplified sample of the code:

```
{cf_project_images search:categories="{segment_category_ids_piped}" }
    <h2><a href="/portfolio/detail/{url_title}/{field_row_count}">{title}</a></h2>
{/cf_project_images}

```

As an example: The sample I'm testing has 4 rows within the Matrix field. Using the search parameter I'm only returning 1 of those 4 rows. If the row that is returned is the 4th row I would expect the value of `{field_row_count}` to be 4, but it's returning as 1.

Am I misinterpreting the way the `{field_row_count}` variable works?

# Answer
For anyone else that might stumble on this question, it turns out there was a bug in Matrix 2.5.10 that was impacting my specific issue. They've got a patch in place and it sounds like they'll be releasing an update soon.

Turns out `{field_row_count}` works exactly as I was expecting it to. Yip!
> 1 votes

# Answer
Can you use {row\_id} instead? I think the count you're getting is based on the way the search aspect works with the returned results.
> 0 votes

---
Tags: matrix, pixelandtonic
---


title: Filter Playa List by Custom Field

text:
# Question
Title: Filter Playa List by Custom Field
I was able to successfully show a custom field in the Playa list by adding this snippet to the `views/entry.php`:

```
<?=$this->db->select('field_id_XX')->where('entry_id', $entry->entry_id)->get('channel_data')->row('field_id_XX')?>

```

All works well to show and list the custom field, but the filter breaks? Anyone know where I can update the filter to show the correct items when filtering?

**UPDATE:**

Did a little bit of digging after Alex mentioned the `droppanes.js` and `filter_entries()` method and it seems the filtering is done with AJAX as it queries the DB with the playa helper class: `system/expressionengine/third_party/playa/helper.php`.

# Answer
Obviously, modifying these files is not ideal and without some kind of conditionals you won't be able to reuse playa field types for anything else, but if you must here is what I did.

The 3 files that I needed to modify:

1. system/expressionengine/third\_party/playa/ft.playa.php
2. system/expressionengine/third\_party/playa/helper.php
3. system/expressionengine/third\_party/playa/views/entry.php

First, in `ft.playa.php` in the `display_field` method you need to change the query:

```
$query = $this->EE->db->query(
                'SELECT * FROM exp_channel_titles
                WHERE entry_id '.$this->helper->param2sql($vars['selected_entry_ids']));

```

to join on the `exp_channel_data` table and select your custom field. This is for your saved selected item(s).

Next, in `helper.php` in the `entries_query` method you need to change the query being built in a few places to join on the `exp_channel_data` table and select your field. This is for the available unselected options. Also, in the same method under

```
if (isset($params['keywords']) && $params['keywords'])

```

you have to add a search for your custom field. This code is executed when a user is typing in the multi-select playa field via ajax to filter out entries. The filter for the single select playa field is just a javascript regex so, in that case, you need not worry about this.

Finally, you need to print your custom field in the `entry.php` file.
> 1 votes

---
Tags: playa
---


title: Templates and URL Structure

text:
# Question
Title: Templates and URL Structure
EE doesn't allow you to make template groups within groups.

So if you're looking to have "books/chapters/" or "book/chapters/summary" and this didn't happen coincide with channel entries, would the best bet be to use url\_segments to simply control with a single template what's actually displayed?

# Answer
> 6 votes
Conditionals based on URL Segments is how I would handle this. For your example, I would have in my books/chapters a conditional like

```
{if segment_2 == "summary"}
  {embed="embeds/summary_code"}
{/if}

```

I'd use an embed just to keep the template cleaner — instances where I do this do tend to be on more complex site where I like keeping things as clean as possible. It's largely optional and depends on your own coding style.

In that embed, I would then have whatever {exp:channel:entries} code (or whatnot) to output the content I need.

---
Tags: templates, channel, url
---


# Question
Title: Using Relationships or Grid to structure content of books
I'm looking to organize and display a library of books.

Within each book are chapters and my plan was to use the new Relationship features within EE to relate the entries made in a separate "chapters" channel to a particular "book".

I'm wondering if the Grid is possibly a better way of entering the chapter listing for each book without creating separate channels or relationships.

I also want to include a link to a file with each chapter.

Any suggestion as to how to best structure this and take advantage of some of the newer EE features in 2.7.2 would be much appreciated.

# Answer
> 1 votes
If there aren't going to be any instances where a chapter will be connected to a multiple books (and if their are, it's an important data point), I would go with a single book channel where the entry title is the title of the book.

I would then have a two-column (minimum) Grid. The first column would be the title of the chapter, the second would then be a link to the file with that chapter.

If there will be only a few instances where one chapter / chapter file might be associated with a different book, consider just manually adding the same chapter row in each entry rather than going the whole relationship route.

So, short answer is, you're on the right track but if there will be multiple books containing the same chapters (more than you want to manually update each and every entry in case you need to revise something) then relationships are probably the way to go.

---
Tags: channel-entries, relationships, channel, grid, 2.7.0
---


# Question
Title: Tagging content in one channel for other channels
We have a channel of article content (called 'Articles'), and each of those entries is categorized as either a 'standard, case study or bulletin.'

I have 3 other channels, and I want to select when an entry in the 'Articles' channel is posted, which other channel it's also relevant to.

So for example, I post a "Latest Study" entry to the 'Articles' channel, and want to indicate that it's also relevant to channel 2 and 3. This way it can auto-populate the other channels. If categories were not already used, I would likely have done it that way.

Can I do this with relationships? I haven't used the new relationships from 2.6 very much. I tried setting it up but it was going the wrong way (pulling content from the other channels into the 'articles' channel, rather than the other way around).

Basically what I am saying, I want to dictate from the pool of articles in one channel, what's relevant to other channels... other than using categories.

Any help would be appreciated. I have a feeling it's something obvious I am not considering.

Thanks!

# Answer
If you're reason for not wanting to use categories is because they're already used, you can have multiple category group in a channel group. So, Category Group 1 could be whatever is being used now and then Category Group 2 could be used to associate it with some other channel. I'm doing something similar on a recent project.

Shift-clicking, I believe, is the keyboard combo to select mulitple category groups in the Channel \> Category Group list.
> 3 votes

---
Tags: relationships, multiselect
---