# Question
Title: Upgraded to EE2.9, CartThrob Pro2.6 now add to cart tag with inventory conditional isn't working
I'm using ExpressionEngine2.9 and CartThrob2.6. I Upgraded versions from EE2.6.1 and CT Pro2.3.5

The store was working previous to updating EE/addon, I updated a dev version of the site. After updating the add to cart tag isn't working correctly, it has a price modifier with a conditional to check the inventory amount. Based on inventory level being 1 or more the add to cart button shows, if less than 1 a message "product out of stock" shows instead of the add to cart button.

This code was working before the update:

```
{exp:cartthrob:add_to_cart_form secure_action="yes" entry_id="{entry_id}" return="shop/view_cart" no_tax="{no_tax}" no_shipping = "{no_shipping}"}

<!-- addtocart-form -->
<div class="addtocart-form">
{exp:cartthrob:item_options entry_id="{entry_id}"}
    {if options_exist}
        <!-- control-group -->
        <div class="control-group">
            <!-- controls -->
            <div class="controls">
                {select class="input-medium"}
                    <option {selected} value="{option_value}" {if {inventory} < 1} disabled="disabled" {/if}>
                        {option_name}
                            {if {inventory} < 1}
                                - Out of Stock!
                            {if:else}
                                {if option_price_numeric != 0} +{option_price}{/if}
                            {/if}
                    </option>
                {/select}
            </div><!-- /.controls -->
            <label class="control-label" for="{option_field}">
                {option_label}:
            </label>
        </div><!-- /.control-group -->
    {/if}

    <!-- control-group -->
    <div class="control-group">
        {if {inventory} ==0}
            <h2>So Sorry!</h2>
            <p>The specific size and style of the item you selected is currently out of stock.
                    Please check back soon for availability.</p>
        {if:else}
            <!-- controls -->
            <div class="controls">
                <input type="text" id="product_quantity" class="input-medium"  placeholder='1' name="quantity" size="8"  />
            </div><!-- /.controls -->
            <label for="product_quantity" class="control-label">
                Quantity:
            </label>
        {/if}
    </div><!-- /.control-group -->

    <!-- add-to-cart-btn -->
    <div class="add-to-cart-btn">
        <!-- control-group -->
        <div class="control-group">
            <!-- form-actions -->
            <div class="form-actions">
                {if {option_value:select:inventory} ==0}
                    <h2>So Sorry! Out of Stock! :(</h2>
                {if:else}
                    <button type="submit" class="btn btn-primary">
                        <img src="{site_url}button.png" />
                    </button>
                {/if}
{/exp:cartthrob:item_options}
            </div<!-- /.form-actions -->
        </div><!-- /.control-group -->
    </div><!-- /.add-to-cart-btn -->

</div><!-- /.addtocart-form -->
{/exp:cartthrob:add_to_cart_form}

```

In the control panel, in the price modifier field the product has suitable inventory levels though conditional acts as if it's "0" - happens on all products. I've tried updating the conditional using a different operator other than the lessthan operator - no success. It's been a while since I built this, but I believe this add to cart price modifier code is based on the template example that came with CT2.3.5.

Based on some other posts I've read (if I'm understanding things correctly) maybe CT isn't getting the inventory amounts correctly because of a change in template parsing, but I'm not sure if I'm incorrect in that. Anyone else have any experience with this? If so, is this a bug? Or due to changes in parser, etc?

Thanks in advance, Reuben

# Answer
I have found with the new conditionals parser you still at times need to experiment with using the {} and "" methods in conditionals. Also you don't really need the nested if do you?

So something like this might work:

```
                           {if {inventory} < 1}
                                - Out of Stock!
                            {if:elseif {option_price_numeric} != "0"}
                                +{option_price}
                            {/if}

or
                          {if {inventory} < 1}
                                - Out of Stock!
                            {if:elseif "{option_price_numeric}" != "0"}
                                +{option_price}
                            {/if}

```
> 0 votes

---
Tags: cartthrob, conditionals, upgrade, ee2-upgrades, 2.9
---


# Question
Title: Can you have multiple e-mail configurations for Carthrob?
I'm running EE 2.5.2 and Cartthrob 2.0506 and need to setup an additional customer e-mail for just a few of our products. To make a long story short we have two different groups of products and the majority are in the first group and once a product is purchased the admin e-mail is sent to me and also to the vendor that fulfills these orders then the vendor actually sends an invoice to the customer. Initially the customer e-mail sent just informs them that the order was received and to expect an invoice from the vendor soon, that all works great. However the secondary group of products does not need to e-mail this vendor but rather just e-mail the invoice directly to the customer. Is there anyway to get Cartthrob setup with a product based condition for the e-mails sent? Maybe a multiple stores setting or something that would give me a fresh set of options under the e-mail button on the settings page. Any tips or suggestions would be greatly appreciated, thanks!

# Answer
You can achieve this sort of thing via Postmaster and Stash. I have found trying to do any complex stuff in CT direct emails is very hard/impossible

Have a look at: How is a postmaster Cart Throb on authorize hook mail formed?
> 2 votes

---
Tags: cartthrob
---


# Question
Title: Solspace Freeform 4+ submission per email address
Possible to submit only one submission per email address?

I am trying to make the form gives an error if someone already has submitted and try submit again.

Thank you

# Answer
If your users are filling in the form while logged in, you could look for Freeform entries authored by the currently logged in user and display the form only when no previous entries were found:

```
{exp:freeform:entries form_id="1" author_id="1"}
    {if freeform:no_results}
        {exp:freeform:form /* your other parameters */}
            // Your form...
        {/exp:freeform:form}
    {/if}

    {if freeform:count == 1}
        <p>You already submitted the form.</p>
    {/if}
{/exp:freeform:entries}

```

(**Note**: You will need to adjust form\_id and author\_id values based on your setup. IDs of "1" above are just an example)

---

Unfortunately, for logged out users, the above won't work since there is no id for logged out users. In the case of logged out users, although a user could submit an email address in a Freeform field. The next time the form is filled out with the same email address, there is no way to stop the user from entering the same email address again. The validation would have to occur *after* submitting the form a second time.

You could build an extension using some of the available hooks for Freeform: http://www.solspace.com/docs/freeform/extension\_hooks/

Alternatively, although you can't prevent entering the same email address in a field, you could give the ***impression*** that submitting the same email address again is not possible. Here's an example of what could be done. Assuming your have a Freeform field called `email`:

1. In {exp:freeform:form}, use `return="template_group/template/%%entry_id%%"` (provide your own template\_group and template name, eg. `form/thank_you`
2. In your template\_group/template template, retrieve the submitted form data using `{exp:freeform:entries entry_id="{segment_3}"}` (segment\_3 will be the latest Freeform entry\_id).
3. Pass the retrieved email in an embed which will check for pre-existing entries with the same email address:

template\_group/template:

```
{exp:freeform:form entry_id="{segment_3}"}
     {embed="check/email" email_field="{freeform:field:email}"}
{/exp:freeform:form}

```

The embed:

```
{exp:freeform:entries search:email="{embed:email_field}"}
    {if freeform:no_results}Thank you for submitting{/if}
    {if count == 1}You already submitted the form with this email address{/if}
{/exp:freeform:entries}

```

Of course, within Freeform you will still see 2+ submissions with the same email (and even be notified more than once if you have email notifications set up), but the front-end user will see the "*You already submitted the form with this email address*" message the second time the form is submitted with the same email address. This is the ***illusion*** of a duplicate I mentioned earlier.

In the end, the better option would be creating an extension using the hooks.

---

**UPDATE**: There is an additional solution, using `prevent_duplicate_on=""`. See: http://www.solspace.com/docs/freeform/form/#prevent\_duplicate\_on

This will allow you to detect duplicates based on email address (used with an `email` field). Perhaps the best approach.
> 0 votes

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


# Question
Title: Solspace freeform: sending pre-generated token to user
I am trying to send an unique code when user submit their form.

Each unique code should send only once in order with each submission.

Any help would be appreciated.

# Answer
The answer is similar to that given here: Solspace Freeform 4+ submission per email address

In summary:

* Create an add-on that uses Freeform hooks to check for Freeform entries matching the token upon form submission
* Give the illusion of a duplicate submission. It doesn't prevent submitting or saving the form again with the same token, but the front-end user would see a message upon duplication.

### Additional solutions

**If you're comfortable with AJAX and javascript/jQuery**, you could have a field which, upon typing the token in it, calls a template in the background which contains `{exp:freeform:entries}`. This tag would check if any previous Freeform entries contain the same token (using the `search:MY_FIELD=""` parameter). If an entry is found, prevent the user from submitting the form through javascript (eg. blocking submission).

**If you're not comfortable with AJAX or javascript/jQuery**, you could do something similar, but with a simple HTML form which asks for the token code **before** the main Freeform form. Eg.

```
<form method="post" action="{path='template_group/template'}">
    <label for="token">Your token code:</label>
    <input id="token" name="token" placeholder="Eg. 123ABC" />
    <input type="submit" />
</form>

```

Then, after submitting the form and moving to template\_group/template, using a plugin such as Mo'Variables, retrieve the token (it's a POST variable) and pass it in `{exp:freeform:entries}` to check for previous Freeform entries containing the same token code. Display the form if there are no previous Freeform entries, or display a message if a previous token is found:

```
{exp:freeform:entries search:token="{post:token}"}
    {if freeform:no_results}
        {exp:freeform:form /* your other parameters */}
            // Your form...
        {/exp:freeform:form}
    {/if}

    {if freeform:count == 1}
        <p>You already submitted the form.</p>
    {/if}
{/exp:freeform:entries}

```

**Note**: The above uses Mo'Variables, but you could do this with PHP instead as well. Turn on PHP in EE (*Input* mode), and use `<?php echo ee()->input->post('token', TRUE); ?>` instead of the above `{post:token}`.
> 0 votes

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


title: Solspace freeform pro and relationships

text:
# Question
Title: Solspace freeform pro and relationships
Is it possible to create relationships in freeform pro similar to how you can create relationships between channels?

I have two channels, a freeform for each, and a need to relate the information from each using a third form. I know I can do a lot of this using channel forms but I really like some of the functionality that freeform gives me.

I guess a third option is to tie in the freeform into the channel as written in the freeform docs.

If anyone has any suggestions I would certainly welcome your input. Thank you.

# Answer
I recommend reading the comments to the opening post for more details about the question. There are no "*Channels*" in this setup, only Freeform forms (forms were simply described as similar to "channels" in the opening post).

## Summary

There are currently 2 Freeform forms:

* **Theatres**: Contains *theatre* information
* **Admin**: Contains other *theatre* and *movie* information

## The Goal

A 3rd form is needed, called **Booking**, which contains data from the first 2 forms.

## A Suggested Solution*

> * As with most things EE, more than one solution is possible. This is only one possible strategy.

You can build this using `{exp:freeform:form}` and `{exp:freeform:entries}`. Let's say you have 3 fields in the **Booking** form set up to store data:

* `movie`
* `theatre`: the field will be populated with entries from the **Theatres** form for the currently logged in user
* `no_of_prints`

You could build the form this way (**this is just an example**):

```
{exp:freeform:form form_name="booking" /* your other parameters here */}

    {!-- The movie --}
    {exp:freeform:entries form_name="admin" search:movie_name="Snowpiercer"}
        <input type="text" name="movie" value="{freeform:field:movie}" />
    {/exp:freeform:entries}

    {!-- The theatre --}
    <select name="theatre">
        <option>-- Select a theatre --</option>
        {exp:freeform:entries form_name="theatres" author_id="CURRENT_USER"}
        <option value="{freeform:field:theatre_name}">{freeform:field:theatre_name}</option>
        {/exp:freeform:entries}
    </select>

    {!-- The Number of Prints/Screens --}
    <input type="text" name="no_of_prints" placeholder="Eg. 50" />

    <input type="submit" />
{/exp:freeform:form}

```

If you have custom fields with the same name across Freeform forms, you might run into issues where tags such as `{freeform:field:movie}` get parsed as a *field*, since it's within `{exp:freeform:form}`, when you really wanted a *value*, since it's also within `{exp:freeform:entries}`. In that case, use embed templates to isolate the `{exp:freeform:entries}` tag code.
> 0 votes

---
Tags: solspace-freeform, relationships, related-entries
---


# Question
Title: CE Img template debugging doesnt display in depth info
Following the directions listed here: http://www.causingeffect.com/software/expressionengine/ce-image/user-guide/troubleshooting

I set up a dummy template with a missing image, so I could see the debug information, but I never got the "*** CE Image debug:". Ive copied my debug text below:

https://gist.github.com/anonymous/cc2c9d014550f52d1e20

Currently CE Img isnt displaying any images at all, but until I see the debug message, I cant get much further!

# Answer
CE Image 2.1.3 was released in June of 2011. There have been numerous updates and releases since that time. Upgrading to the latest version will allow the in-depth debug information to show.
> 1 votes

---
Tags: ce-image
---


# Question
Title: Mulltisite Manager - How to find out which site users come from
I am using multisite (MSM) and i want to show user listing for different site for admin. How can admin see the users list according to site.

For eg: -

I am having 5 sites (named as Site-A, Site-B, Site-C, site-D and Site-E) and i have created new member group for each site from admin CMS (Members-\>Member Groups-\>Create a Member Group) as below:

Member Group Name for Site-A is user-A and

Member Group Name for Site-B is user-B and

Member Group Name for Site-C is user-C and

Member Group Name for Site-D is user-D and

Member Group Name for Site-E is user-E.

i have implemented login/registration functionality for each site.

Now Users can register from the above sites.

But in admin CMS, It is showing all users for all site on a page (Members-\>View Members).

Here how can i know the user comes from which site ?

Please give me a solution.

# Answer
If you have created separate member groups for each site then can you not simply use the filter dropdowns to show each group and see which members are in it?

UPDATE

If you are using different registration forms for each site then you could create a hidden field containing the site name and have that info stored in a custom profile field. Then it won't matter if the user activates the account or not.
> 0 votes

---
Tags: members, member-details, multiple-sites
---


# Question
Title: Validate a freeformpro with Parsley and define required fields
first post here. For what I understand, I need to add 'data-parsley-validate' to the form tag and 'required' and some other options for the fields.

I have been using Composer but even if I can define the special parameters using template approach (where I manually code the fields) the tag will require the Parsley parameter.

Is this something we can add to the FreeForm Pro form tag? Or what about adding parameters for the fields using the Composer option?

Thanks for your time

# Answer
You could try:

```
{exp:freeform:form form:data-parsley-validate="true"}

```

But from memory there is a bit notice on the Parsley docs that says NOT to add the data-parsley-validate attribute manually.

You should create some javascript/jQuery to attach the validation behaviour to your form. Maybe give the Freeform tag an id or class attribute and then get your jQuery to target that.

```
{exp:freeform:form form:class="validate-me"}

```

and then some jQuery (at the bottom of the template

```
$('.validate-me').parsley();

```

You can then provide data attributes on each form input (if you're manually coding the form) or you can set up validation options within the jQuery.
> 0 votes

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


# Question
Title: Categories not editable from channel entry screen
I'm using ee v2.8.1 and when I try and click the red link next to 'edit categories' in the entry screen the link disappears and nothing happens? I can edit the categories if I go through the drop down under admin and then channel administration.

Any thoughts? Thanks

# Answer
> 0 votes
Found out that this is a known bug. Patch and details: https://support.ellislab.com/bugs/detail/20237

---
Tags: categories, control-panel
---


title: Expresso Store no_results

text:
# Question
Title: Expresso Store no_results
I am using expresso store:search tag in a page and I am submitting a price range (min/max) to the tag as follows:

```
{exp:store:search channel="products" search:price:min="{post:min_price}" search:price:max="{post:max_price}" category="{segment_category_ids}" paginate='bottom' dynamic_parameters="orderby|limit|sort"}

```

There is a lot going on in this I know, but it does work - to a point. When I do a search for a combination that doesn't exist (say there is nothing in that price range) I get a blank page because there are no entries associated.

My question is, does store:search have a no\_results tag pair? And if so, how is it implemented? I looked through the documentation and in here, but have found nothing to direct me and it seems like it should be part of a search tag by default.

# Answer
> 0 votes
The Store search tag is basically a wrapper for the channel entries tag pair with the ability to search Store specific functionality.

So you would want to do something along the lines of:

```
{exp:store:search channel="products" search:price:min="{post:min_price}" search:price:max="{post:max_price}"}

{!-- this will show if their are entries --}
 {title} - {price} - {your_custom_fields}

 {if no_results}
  There are no items for this search.
 {/if}

{/exp:store:search}

```

So any tags you would use in the channels entries tag pair should be available in your search tag pair.

---
Tags: expresso-store, search, no-results
---


# Question
Title: Using the query module to get an image path. How do I get to the thumb folder?
First of all. Big thank you to Rob Sanchez. I'm using his plugin inside the query module to get a zoo-visitor member-picture and add it to a public profile page.

This is the query. field\_id\_37 contains something like {filedir\_1}filename.jpg.

```
{exp:query limit="1" sql="
SELECT ct.author_id, ct.entry_id, ct.channel_id, cd.field_id_37
FROM exp_channel_titles ct
INNER JOIN exp_channel_data cd
USING(entry_id)
WHERE author_id = '{embed:lid}' AND ct.channel_id = '6'
"}

{exp:parse_file_paths}
{field_id_37}
{/exp:parse_file_paths}

{/exp:query}

```

This works fine. The output is something like: http://mysite.com/picture/filename.jpg

I do need this information to create a link to the full picture. I'd like to show the thumb as well. And that is what this question is about. How do i change the path from http://mysite.com/picture/filename.jpg to http://mysite.com/picture/\_thumb/filename.jpg?

If I didn't use the Query module, but simply the channel:entries tag the solution would be simple:

```
{field_id_37:thumb}

```

How can i rewrite the default path?

# Answer
> 1 votes
I ended up using the SQL REPLACE functionality:

```
{exp:query limit="1" sql="
SELECT ct.author_id, ct.entry_id, ct.channel_id,
REPLACE (cd.field_id_37, '\{filedir_1\}', '') AS myfile
FROM exp_channel_titles ct
INNER JOIN
exp_channel_data cd
USING(entry_id)
WHERE author_id = '{embed:lid}' AND ct.channel_id = '6'
"}

{if myfile == ""}
    {site_url}/pic/nofile.gif
{if:else}
    {site_url}/picture/_thumb/{myfile}
{/if}

{/exp:query}

```

So, for future reference and for those interested. If you only want the full filename, without a path and you're using the query module... Use the REPLACE functionality.

If there is a better way to solve this, i'd love to hear it. I'll be keeping an eye out for other solutions.

---
Tags: zoo-visitor, query-module
---


title: Stash - merge two lists

text:
# Question
Title: Stash - merge two lists
I need to merge to loops into one stash list.

The first loop is a standard channel entries loop. The second is a twitter time line, using CE Twitter.(http://www.causingeffect.com/software/expressionengine/ce-tweet)

Here is my code thus far, I've removed a lot of the markup and variables et al...

```
{!-- set list --}
{exp:stash:set_list name='journal_list' parse_tags='yes' depth="2" parse="inward"}

    {exp:channel:entries channel="journal" dynamic="no" paginate="bottom" sort="desc" limit="10"}
        {!-- append to the list the channel entries --}
        {exp:stash:append_list name='journal_list' parse_tags='yes' depth="2" parse="inward"}
                {!--type set as post, used to output post markup --}
                {stash:type}post{/stash:type}
                {!-- entry date saved to variable - the idea is to then use this as the order by argument --}
                {stash:entry_date}{entry_date}{/stash:entry_date}
                {!-- All the usual gubbins, titles, images, text et all, all sorted in stash variables --}
        {/exp:stash:append_list}

    {/exp:channel:entries}

    {exp:ce_tweet:user_timeline screen_name="myMegaTwitterAccount" count="5" sort="asc"}
        {!-- append to the same list as above for the twitter time line --}
        {exp:stash:append_list name='journal_list' parse_tags='yes' depth="2" parse="inward"}
                {!--type set as tweet, used to output tweet markup --}
                {stash:type}tweet{/stash:type}
                {!-- entry date saved to variable - the idea is to then use this as the order by argument --}
                {stash:entry_date}{created_at}{/stash:entry_date}
        {/exp:stash:append_list}

    {/exp:ce_tweet:user_timeline}

{/exp:stash:set_list}

{exp:stash:get_list name='journal_list' order_by="{entry_date}" paginate="bottom" limit="5"}
    {if "{type}" == "Post"}
        {!-- all the post markup here --}
  {if:else}
    {!-- all the tweet markup here --}
  {/if}
{/exp:stash:get_list}

```

The code above works, but not quite right.

Currently the two lists are outputted separately, i.e. first all of the channel entries are outputted, then all the tweets.

What I need is for the sort order to be based solely on the {entry\_date}, so the tweets and posts will be mixed up... \[post post tweet post tweet post post\] etc etc

I'm sure this will be possible, I may have approached this incorrectly. Fairly new to stash, although I have to say I'm bloomin' loving it (Thanks Mark!)

I've added a screenshot below which should illustrate the issue I have, notice the dates on the items. eeee! (n.b using masonry for the layout)

Any help, greatly appreciated

# Answer
> 1 votes
You should be able to do this by setting a list with the channel entry output and just appending the tweet module output to that list. A couple of other things, you have depth of 2 which adds processing and shouldn't be necessary in this case. (this is untested):

```
{!-- set list --}
{exp:stash:set_list
    name='journal_list'
    parse_tags='yes'
    parse="inward"
}
    {exp:channel:entries channel="journal" dynamic="no" paginate="bottom" sort="desc" limit="10"}
        {stash:type}post{/stash:type}
        {stash:entry_date}{entry_date}{/stash:entry_date}
    {/exp:channel:entries}
{/exp:stash:set_list}

{exp:ce_tweet:user_timeline screen_name="myMegaTwitterAccount" count="5" sort="asc"}
    {!-- append to the same list as above for the twitter time line --}
    {exp:stash:append_list
        name='journal_list'
        parse_tags='yes'
    }
        {stash:type}tweet{/stash:type}
        {stash:entry_date}{created_at_relative}{/stash:entry_date}
    {/exp:stash:append_list}
{/exp:ce_tweet:user_timeline}

{!--output the list--}
{exp:stash:get_list
    name='journal_list'
    order_by="{entry_date}"
    paginate="bottom"
    limit="5"
    process="end"
}
    {if "{type}" == "Post"}
        {!-- all the post markup here --}
    {if:else}
        {!-- all the tweet markup here --}
    {/if}
{/exp:stash:get_list}

```

I added a process=end to the get\_list, but depending on how you have the templates set up you may not need that. Also, the ce\_tweet module tag may need to be wrapped with stash:parse so that it runs after the initial set\_list. If that's the case, you would use:

```
{exp:stash:parse process="inline" parse_depth="2"}
    {exp:ce_tweet:user_timeline screen_name="myMegaTwitterAccount" count="5" sort="asc"}
        {!-- append to the same list as above for the twitter time line --}
        {exp:stash:append_list
            name='journal_list'
            parse_tags='yes'
        }
            {stash:type}tweet{/stash:type}
            {stash:entry_date}{created_at_relative}{/stash:entry_date}
        {/exp:stash:append_list}
    {/exp:ce_tweet:user_timeline}
{/exp:stash:parse}

```

---
Tags: stash, 2.9
---


# Question
Title: How can I retrieve the site name from a channel entry as a query?
I have a plugin that I am editing at the moment and I am looking to do a query that takes the site\_id from a channel(not a channel entry) and then grabs the id and passes that through a function that then gets the site name from it. So far I have got this in my function which basically populates a sub menu in the main nav in the admin backend. The menu spits out the channel name and then lists that in chronological order. The issue here is that every multisite has the same name for each entry as its based on seasons for example: AW14, AW15,AW16, SS14, SS15 and so on. Here is the code:

```
//Set each channel name and its link
                foreach ($assigned_channels as $key => $channel_id) {

                    //Add the channel to the order sub_nav array
                    $channels['jf_re_order_channel_' . $channel_id] = BASE.AMP.'C=addons_modules'.AMP.'M=show_module_cp'.AMP.'module='.JF_RE_ORDER_PACKAGE.'&channel_to_order='.$channel_id;

                    //Get the cannel name
                    $query = $this->EE->db->get_where('exp_channels', array('channel_id' => $channel_id), 1);
                    $row = $query->row();
                    $channel_name = $row->channel_name;
                    $channel_parent_site = $row->site_id;
                    var_dump($channel_parent_site);

                    //Add a nav_channel_id = channel name to the current lang object
                    $this->EE->lang->language['nav_jf_re_order_channel_' . $channel_id] = $channel_name;

                }

```

I can var\_dump the id and I get the id for each site that channel is located in, what I need to do now is get the site name from that with the id. Is that possible with a query like below or inside this query.

Cheers

# Answer
Here's the query to get the site name and site label for each channel:

```
SELECT
    site_name, site_label, c.site_id, channel_name, channel_id
FROM
    exp_channels c
        LEFT JOIN
    exp_sites s ON s.site_id = c.site_id

```
> 1 votes

---
Tags: channel-entries, multi-site-manager, database, query
---


title: Howto trim incoming URL's

text:
# Question
Title: Howto trim incoming URL's
So I've recently moved a blog from Wordpress to ExpressionEngine. Everything transferred over great (thanks to DataGrab!!).

Now the one problem I'm having is in my attempt to redirect traffic from the old blog to the new one. I've implemented an HTACCESS like so:

```
RewriteEngine On
RewriteBase /
RewriteRule ^([0-9]+)/([0-9]+)/([0-9]+)/(.*)$ http://www.new_ee_site.com/blog/view/$4 [R=301,NC,L]

```

To redirect the old blog posts to their new counterparts on the EE install.

**Here's the problem**: This works for post with short titles just fine, the problem is some post titles are greater than 75 characters (the default EE url\_title limit). So the post with titles name greater than 75 aren't translating over (since, when importing, the blog titles for the EE blog got trimmed to 75 characters).

Is there a way to somehow truncate incoming URLs, if they match the format /blog/view/..blog-title.., to truncate / trim the blog-title portion to 75 characters so these links go to the right place?

# Answer
> 1 votes
Ok, thanks to both @foamcow and @AllInOne I was able to weed out the solution.

So here is what works:

```
RewriteBase /
RewriteRule ^([0-9]+)/([0-9]+)/([0-9]+)/([a-zA-Z0-9\-/_]{0,75})(.*)$ http://www. new_ee_site.com/blog/view/$4 [R=301,NC,L]

```

Basically, I used

> (\[a-zA-Z0-9-/\_\]{0,75})

to match the 75 characters I was after, then I had to add the

> (.\*)

Because otherwise it didn't match any URLs that had a title greater than 75, so i had to take that into account. Now the **$4** variable contains the first 75 characters of the URL, and the other variables aren't used, but 1-3 are the date, and 5 is the part that gets trimmed off.

# Answer
> 2 votes
Using the info from the link provided by AllinOne https://stackoverflow.com/questions/1649435/regular-expression-to-limit-number-of-characters-to-10 you should be able to solve this. The information is relevant to your problem as it lets you match a number of characters in a given string.

Try

```
RewriteEngine On
RewriteBase /
RewriteRule ^([0-9]+)/([0-9]+)/([0-9]+)/(.*){1,75}$ http://www.new_ee_site.com/blog/view/$4 [R=301,NC,L]

```

I'm not sure if you will need to change the (.\*) to something like (\[a-z\]\[A-Z\]\[0-9\]){1,75} but effectively you are saying grab the first 75 characters of the last segment of the url.

I've had a quick play around and this might be better. It depends on what characters are in your WP URLs. This one should match upper and lower case characters, hyphens, and underscores. It also assumes that the first 3 segments of your URLs are digits (are they dates?).

^(\d{1,4}/){3}(\[a-z\]|\[A-Z\]|\[0-9\]|-|\_){1,75}

EDIT

Try this regex instead

```
^([0-9]+\/){3}([a-zA-Z0-9\-\_]{0,75})

```

# Answer
> 1 votes
Thinking on my feet here.

I don't think you can do this via htaccess so what I would do is ensure that these urls end up at a special template (you might do it on a 404 page but I'm not sure of the SEO implications there).

Then on that special template I would look for the presence of 'blog' in segment\_1 then grab segment\_3, truncate it (with PHP or a plugin) and then feed the result into either a redirect or directly into a channel:entries tag.

You should also respond with a 301 http code so the referring URL can make any changes needed (Google etc will like this!)

I've used this technique with 404 pages before when moving a site from one platform to another or after a big change in url structure and it's been quite successful.

This feels really clumsy and there may well be a more elegant way to do it. Like I said, thinking on my feet over morning coffee!

---
Tags: htaccess, core-hacks
---


title: Understanding nested Loopee tag output

text:
# Question
Title: Understanding nested Loopee tag output
I decided to undertake cleaning up some crazy repetitive code using the plugin Loopee, which we are already using. I briefly looked at Loop Plus, but that seems to only handle numbers, so I didn’t try testing nesting that one.

Anyway, I tried nesting Loopee tags, and the order the tags are looped is from the inside, opposite of how it would work if these were PHP loops. **I’d like to know if anyone has experience nesting Loopee tags, why this works like this, and how I might resolve this issue.** I’m not averse to patching the plugin if I can get some guidance on what I’d need to do.

An example:

```
{exp:loopee parse="inward" foreach="A|B" as="a"}
  {exp:loopee parse="inward" foreach="1|2" as="b"}
    {exp:loopee parse="inward" foreach="a|b" as="c"}
      {a}{b}{c}
    {/exp:loopee}
  {/exp:loopee}
{/exp:loopee}

```

Output: `A1a B1a A2a B2a A1b B1b A2b B2b`

As you can see, the outer Loopee tag’s `A` and `B` are alternating, while the innermost Loopee tag’s `a` and `b` are not alternating. To solve this simple example, I could swap the innermost and outermost Loopee tags, but that is both wonky and breaks code if I make use of the variables between the first Loopee start tag and the second.

For example, this is what I might like to do:

```
{exp:loopee parse="inward" foreach="amy|betty" as="name"}
  <h1>{name}</h1>
  {exp:loopee parse="inward" foreach="income|expenses" as="category"}
    <h2>{category}</h2>
    {exp:loopee parse="inward" foreach="1|2|3|4" as="quarter"}
      <p>
        <strong>{quarter}:</strong> {custom_field_here}
      </p>
    {/exp:loopee}
  {/exp:loopee}
{/exp:loopee}

```

But if I run that, I get the messed up looking output of (blank lines removed):

```
<h1>amy</h1>
  <h2>income</h2>
    <p><strong>1:</strong> {custom_field_here}</p>
<h1>betty</h1>
  <h2>income</h2>
    <p><strong>1:</strong> {custom_field_here}</p>
  <h2>expenses</h2>
    <p><strong>1:</strong> {custom_field_here}</p>
<h1>betty</h1>
  <h2>expenses</h2>
    <p><strong>1:</strong> {custom_field_here}</p>
    <p><strong>2:</strong> {custom_field_here}</p>
<h1>betty</h1>
  <h2>income</h2>
    <p><strong>2:</strong> {custom_field_here}</p>
  <h2>expenses</h2>
    <p><strong>2:</strong> {custom_field_here}</p>
<h1>betty</h1>
  <h2>expenses</h2>
    <p><strong>2:</strong> {custom_field_here}</p>
    <p><strong>3:</strong> {custom_field_here}</p>
<h1>betty</h1>
  <h2>income</h2>
    <p><strong>3:</strong> {custom_field_here}</p>
  <h2>expenses</h2>
    <p><strong>3:</strong> {custom_field_here}</p>
<h1>betty</h1>
  <h2>expenses</h2>
    <p><strong>3:</strong> {custom_field_here}</p>
    <p><strong>4:</strong> {custom_field_here}</p>
<h1>betty</h1>
  <h2>income</h2>
    <p><strong>4:</strong> {custom_field_here}</p>
  <h2>expenses</h2>
    <p><strong>4:</strong> {custom_field_here}</p>
<h1>betty</h1>
  <h2>expenses</h2>
    <p><strong>4:</strong> {custom_field_here}</p>

```

When what I want is output like this:

```
<h1>amy</h1>
  <h2>income</h2>
    <p><strong>1:</strong> {custom_field_here}</p>
    <p><strong>2:</strong> {custom_field_here}</p>
    <p><strong>3:</strong> {custom_field_here}</p>
    <p><strong>4:</strong> {custom_field_here}</p>
  <h2>expenses</h2>
    <p><strong>1:</strong> {custom_field_here}</p>
    <p><strong>2:</strong> {custom_field_here}</p>
    <p><strong>3:</strong> {custom_field_here}</p>
    <p><strong>4:</strong> {custom_field_here}</p>
<h1>betty</h1>
  <h2>income</h2>
    <p><strong>1:</strong> {custom_field_here}</p>
    <p><strong>2:</strong> {custom_field_here}</p>
    <p><strong>3:</strong> {custom_field_here}</p>
    <p><strong>4:</strong> {custom_field_here}</p>
  <h2>expenses</h2>
    <p><strong>1:</strong> {custom_field_here}</p>
    <p><strong>2:</strong> {custom_field_here}</p>
    <p><strong>3:</strong> {custom_field_here}</p>
    <p><strong>4:</strong> {custom_field_here}</p>

```

I am using EE 2.7.2

Thank you for your time!

# Answer
I hope someone has a better solution than this, but for the time being, I found I can make copies of the Loopee plugin for each level of nesting I need. For example, I would duplicate the `loopee` directory and name it `loopee2`, and then rename the contained file `pi.loopee2.php`. Then I edit that file, changing these lines:

```
'pi_name'         =>  'Loopee2',
class Loopee2 {
function Loopee2()

```

That allows me to use a second level of nesting by calling the tag `{exp:loopee2}`.

(I also submitted an issue to the Github repo in case the plugin author has time and desire to tackle the issue.)
> 0 votes

---
Tags: plugin, loop
---


# Question
Title: DevDemon Updater - can't find "EllisLab" folder
Updating an older site, and I'm getting an error using the DevDemon Updater (v3.2.15), while trying to bring a site from 2.5.5 to 2.8.1

It stops during the update process on an error. And that message says: `Unexpected server response, probably a php error. Show Error` \- which I click through, it says this:

```
A PHP Error was encountered
Severity: Warning
Message: copy(/var/www/vhosts/mysite.com/sitehomedir/blog/system/expressionengine/cache/updater/1407520245_589541/system/EllisLab): failed to open stream: No such file or directory
Filename: libraries/updater_transfer.php
Line Number: 827
{"success":"yes","body":""}

```

Not sure why it's looking for an Ellislab folder in /system/ - Is this a bug in the updater? Or something with my code?

Caveat: my site is in a subfolder (i.e. mysite.com/blog/ ) All the other functions work fine, but I just can't get EE to update.

# Answer
I went poking in the code for the plugin and found the reference to EllisLab - I removed the updater and installed an earlier version (v3.2.11). And that version was able to update my site to 2.8.1 without any issues appearing.
> 0 votes

---
Tags: ee2-upgrades, devdemon, devdemon-updater
---


# Question
Title: MySQL strict mode: disable on a session basis?
I'm getting mysql errors suggesting that my host's use of strict mode is a problem (with an addon). The host wants mysql strict mode on their DB server. Can I override strict mode for my EE sessions? And if so, how?

I see that codeigniter has a database config setting

> $db\['default'\]\['stricton'\] = FALSE;

but I'm unfamiliar with how to use it. Simply putting

> $db\['Expressionengine'\]\['stricton'\] = FALSE;

into system/expressionengine/config/database.php has no effect. The mode still stays "STRICT\_TRANS\_TABLES,NO\_ENGINE\_SUBSTITUTION"

The EE codebase includes a conditional with 'stricton' = TRUE within system/codeigniter/system/database/DB.php But its not clear how to invoke that either (or hack an analogous FALSE conditional)

Any ideas appreciated. Thanks.

# Answer
> 1 votes
The `stricton` setting controls whether or not strict mode is **forced on**, not whether it is on or off. If the server already has it on (as they should), this will not override it.

You want to run in strict mode, honestly, and it's been the default in MySQL for quite some time. Your efforts would be better spent on bringing the add-on up to date. It should be a fairly trivial thing to do, unless there are hundreds of manually written queries that are assembled in a confusing manner.

---
Tags: mysql
---


# Question
Title: How to disallow characters in URL titles
We recently ran into an issue with some of our auto-generated URL title on channel entries. It seems that EE will happily allow characters like periods in URL titles. For example if I had a tile like `U.S. Tops in EE Installs` then the generated URL title is `u.s.-tops-in-ee-installs`. The periods can become an issue in some cases. Specifically they seem to throw off the EE Session Tracker Array, causing it to be NULL which is what caused our problem. So my questions are:

1. Why does EE even allow these kinds of characters in URL titles?
2. Is there a setting or way to define a list of disallowed characters to be stripped from URL titles?

# Answer
> 1 votes
Pop open your config file: /system/expressionengine/config/config.php

Look for a config option for 'permitted\_uri\_characters' - if you don't have it, you can add the line:

```
$config['permitted_uri_chars'] = "a-z 0-9~%.:_\-";

```

This is what I use (and I think it's the default). But you should be able to just remove the period.

If you use Structure (or similar), there's probably additional steps you'll want to take. So make sure you do proper testing, and so on.

---
Tags: url, url-title, sessions
---


title: Issues with EE On IIS with Directories

text:
# Question
Title: Issues with EE On IIS with Directories
I moved my IIS site from a hosted server (Apache) to IIS. In doing so I

* Made the normal IIS install, installed PHp and mysql
* Copied all the files to wwwroot
* Added the database.

Now what happens is that i can get to the root mynewserver.com but if i click any links or type a link that has the subdirectory such as mynewserver.com/mypath i get 404 errors.

But mynewserver.com/system does work.

Another hint is that mynewserver.com/index.php/mypath totally works...

I'm guessing this has something to do with IIS looking for directories over the PHP paths? Or what config am i missing?

Any suggestions?

# Answer
What do you have in your web.config file? You'll find this in the site's root. Are you using web.config to redirect all requests to your index.php file? If not, this might help: http://www.climbingturn.co.uk/resources/expressionengine-tips-and-tricks/how-to-remove-index.php-on-iis
> 1 votes

---
Tags: 404, iis
---


# Question
Title: Is it possible to have "closed" as the default channel entry status
This seems to be an easy thing, but I cannot find a way in EE where you can select which of the statuses in the status group should be the default status. Am I missing something?

What I want to do is have new channel entries default to status of "closed" and only be "open" once the administrator explicitly sets it to "open". I know that if you do not set a specific status group to a channel, entries will default to closed for non-superadmins, but this is not an option, because we are using a custom status group with more statuses than just "open" and "closed". Does anyone know whether it is possible to set the default status to "closed"?

# Answer
In Admin-\>Channels, click "Edit preferences" on the channel you want to change. There's an option in there for the default entry status.
> 1 votes

---
Tags: status
---


title: Possible Expresso IE8 JS bug?

text:
# Question
Title: Possible Expresso IE8 JS bug?
I'm building my first Expresso store, and have hit an issue with IE8. Any page that contains "add to cart" buttons renders everything up to the buttons but the rest of the page is blank.

IE shows this error:

Message: HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917)

I presume it's Expresso's inline JS that's causing this, and that IE doesn't like it manipulating the page before it's fully loaded? Has anyone else come across this or found a solution?

EDIT:

I've now narrowed it down to a very simple template that still shows this error:

```
<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
    <div class="container">
        BEFORE
        {exp:channel:entries channel="discography" limit="1" disable="categories|category_fields|member_data|trackbacks|pagination"}
            {exp:store:product entry_id="{entry_id}" return="cart"}
                <input type="text" name="item_qty" size="3" value="1" />
                <input type="submit" name="submit" value="Buy now" class="submit" />
            {/exp:store:product}
        {/exp:channel:entries}
        AFTER
    </div>
    </body>
</html>

```

When I view that in IE8 or lower I don't see the "AFTER" text, and I get the same parsing error as before. If I remove the .container div, it renders as expected. So I assume that Expresso is trying to manipulate the page before IE has finished rendering the container div. Any ideas?

# Answer
> 1 votes
Admittedly it's a few months late but I too was having this issue. It's caused by Store loading it's JS into the body tag before the page has finished loading.

The fix is to wrap it in a document.ready function. This is on line 159 of AbstractTag.php which can be found in `third_party/store/src/Store/Tag`

So replace

```
return '
(function() {
    ExpressoStore.config = '.$this->ee->store->config->config_json().';
    if (!ExpressoStore.scriptElement) {
        var script = ExpressoStore.scriptElement = document.createElement("script");
        script.type = "text/javascript"; script.async = true;
        script.src = "'.$theme_url.'";
        document.getElementsByTagName("body")[0].appendChild(script);
    }
})();';

```

with

```
return '
$(document).ready(function() {
    (function() {
        ExpressoStore.config = '.$this->ee->store->config->config_json().';
        if (!ExpressoStore.scriptElement) {
            var script = ExpressoStore.scriptElement = document.createElement("script");
            script.type = "text/javascript"; script.async = true;
            script.src = "'.$theme_url.'";
            document.getElementsByTagName("body")[0].appendChild(script);
        }
    })();
});';

```

And it should fix the issue.

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


title: Trouble upgrading

text:
# Question
Title: Trouble upgrading
I have a client site on EE 2.5.3 platform and Solspace Calendar 1.7.0. Obviously this should be upgraded, but when I try to upgrade to EE 2.9.0 the whole thing stops around version 2.6-2.7 with this error message:

A Database Error Occurred Error Number: 1054 Unknown column 'protect\_javascript' in 'field list' UPDATE `exp_templates` SET `template_id` = '33', `site_id` = '1', `group_id` = '4', `template_name` = 'edit', `save_template_file` = 'n', `template_type` = 'webpage', `template_data` = '{embed=\\"calendar\_inc/index\\" page\_title=\\"Edit Event\\"}\n\n\n{exp:calendar:datepicker\_js}\n{exp:calendar:datepicker\_css}\n\n\n{embed=\\"calendar\_inc/header\\"}\n\n

I'm unable to log on after this error, and have to restore both site and database from backup.

My question is: what is the recommended approach to upgrade both EE and Calendar here? The latest version of Calendar (1.8.9) requires EE 2.6, but upgrading of EE from v. 2.5.3 stops and breaks on the old Calendar module (1.7.0).

I hope I have been clear – and that someone can point me in the right direction.

# Answer
> 0 votes
I think this is going to be difficult.

Perhaps the best way to approach it would be to update EE from 1.7.0 to an early version of 2. Then upgrade calendar and ensure it's working. Only then try to upgrade to the more recent version of EE.

---
Tags: ee2, solspace-calendar, ee2-upgrades
---


# Question
Title: Playa link with matrix field is not working
I am using playa with in matrix field type and want to get the url of playa link.

For eg:-

I have created Channel (named as XYZ) and following fields as below :

```
a) gallery_name : text

b) gallery : matrix

   i) link  : Playa
   ii) link_text : text

```

Now i want to show gallery link and link\_text.

I am using code below :

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

    {gallery_name} <br/>

    {gallery}
        <a href="{link}{page_uri}{/link}">{link_text}</a>
    {/gallery}

{/exp:channel:entries}

```

But the code `<a href="{link}{page_uri}{/link}">` is not working.

```
{link}{page_uri}{/link}

```

this code is not showing playa link that is selected before for respective text.

So what is missing/wrong here. Please give me a solution.

# Answer
For making work playa link:

1) Double check you have selected a published entry.
OR
2) Open your playa field to edit (from Admin-\>Channel-\>Channel fields-\>select gallery to edit) and recheck settings and save field.
> 1 votes

---
Tags: channel-entries, matrix, playa, channel
---


# Question
Title: Grid field type with 'row_id' variables is not working properly in channel tag
I am using grid type field for express engine channel and i want to show result based to row\_id and it was working when i have entered row\_ids but it is not working when row\_id are not there.

for eg. I have created a channel named as 'XYZ' and having following channel fields there :

```
1) user_type : text

2) profile : grid

       a) first_name : text

       b) last_name :  text

       c) user_name : text

       d) age : text

```

Now i want to show user listing for a entry and i am getting row\_id for grid from custom query in code. i have used following code :

```
.............

//here we are getting row_ids from custom query as

// if condition here
<?php  $rowsId="10|11|12"; ?>

// else condition  (set $rowsId value as -1  in case when we are not getting row_id from custom query)

<?php $rowsId = "-1" ; ?>

..............

{exp:channel:entries channel="xyz" entry_id=1}
    {profile row_id="<?php echo $rowsId; ?>"}
        {profile:first_name}<br/>
        {profile:last_name}<br/>
        {profile:user_name}<br/>
        {profile:age}<hr>
    {/profile}
{/exp:channel:entries}

```

But the code

```
{profile row_id="<?php echo $rowsId; ?>"}

```

it is working in case of `<?php $rowsId="10|11|12"; ?>`

but it is not working in case of `<?php $rowsId = "-1"; ?>`

It should not give us result set in that case (should be empty) but It shows one row in result set and i have also tried '$rowsId' value as 0 instead of -1 but it is also not working.

Please help me what is missing/wrong here or give me a solution for the same.

# Answer
Unfortunately this is bug in EE grid field. If you are passing invalid parameter for row\_id="ABC@#4" it will still show first row from grid.
You can check $rowsId variable and set condition accordingly.

```
<?php
If ($rowsId == '-1') {
    echo "No result to show";
} else{ ?>
    {profile row_id="<?php echo $rowsId; ?>"}
        {profile:first_name}<br/>
        {profile:last_name}<br/>
        {profile:user_name}<br/>
        {profile:age}<hr>
   {/profile}
<?php } ?>

```
> 1 votes

# Answer
If you are using php in this way, you could just not show the output if it is set to -1

```
{exp:channel:entries channel="xyz" entry_id=1}
  <?php if ($rowsId != -1) {?>
    {profile row_id="<?php echo $rowsId; ?>"}
        {profile:first_name}<br/>
        {profile:last_name}<br/>
        {profile:user_name}<br/>
        {profile:age}<hr>
    {/profile}
   <?php } ?>
{/exp:channel:entries}

```
> 2 votes

---
Tags: channel-entries, channel, grid
---


# Question
Title: Search tag for grid - 'or' condition on two fields/columns
I have created a channel named as 'XYZ' and having following channel fields there :

```
1) user_type : text

2) profile : grid

    a) first_name : text

    b) last_name :  text

    c) user_name : text

    d) age : text

```

Now i want to show user listing for a entry and i am having a text box in form and i want to search users from first\_name or last name. i have used following code :

```
{exp:channel:entries channel="xyz" entry_id=1}
    {profile search:first_name="amit" search:last_name="amit"}
        {profile:first_name}<br/>
        {profile:last_name}<br/>
        {profile:user_name}<br/>
        {profile:age}<hr>
    {/profile}
{/exp:channel:entries}

```

But the code

{profile search:first\_name="amit" search:last\_name="amit"}

it is using 'and' condition but i want to use 'or' condition.

# Answer
> 1 votes
You need to create custom query and it is ee bug and did not work such for OR conditions. Use custom query or query module and need to use join with channel and channel field and channel field data etc,

---
Tags: channel-entries, search, grid
---


title: Assets 2 select file on upload

text:
# Question
Title: Assets 2 select file on upload
When I upgraded to Assets 2, I noticed that when uploading a file from the modal window in a channel entry form that once the file is uploaded, Assets doesn't automatically select it for me anymore. I have to do a search for the filename. Is that the normal behavior for Assets 2? Or am I the only one experiencing this? And, if it's just me, is there any way to solve it.

Here is a step-by-step list of the process:

1. Open either a new or existing channel entry form
2. In the Assets field, click **Add file**
3. In the Assets modal window, click **Upload files**
4. Locate file to upload from file system, then click **OK**
5. The file uploads
6. **this is what's not happening:** Assets automatically selects the just-uploaded file(s)
7. Double-click on the newly-uploaded file to add it to the Assets field

**Here's a new/interesting discovery:** step 6 above **does** happen when I use a computer that is not on my organization's official network. I'm wondering if it's blocking a Javascript or something like that??

Currently running Assets 2.1, was running Assets 2.0.5, on EE 2.5.2 issue happens in both versions for me.

---

April 11, 2013

Screenshot of Javascript console errors

The Uncaught TypeError: Object... happened on page load, the Double-instantiating a select... happened (and I'm not really sure if it's an error or just logging) when Assets completes the file upload and selects the document.

Thanks! \- B

# Answer
> 2 votes
We were seeing this same issue running Assets in our EE 2.5.2 environment. After we updated to Assets 2.2.2 it began working as expected.

# Answer
> 0 votes
I am having this same issue and have talked to P&T support about it. We isolated it down to a scenario in which the upload directory has a large number of images and the uploaded file falls somewhere below (out of range of) the images that are already displayed / loaded in the modal.

For example, if I upload an image with a name that starts with 0 or A, the image is highlighted as you would expect and the add button is available because it falls in the range of the displayed files. Conversely, if the file name starts with Z or some letter / number that is not already displayed in the modal then the image is not selected and the add button is not available so you have to manually search for the file or click on "Recently Uploaded."

This may not be the case for you but I thought I'd share it for anyone else that may be experiencing this issue.

Update: I have found that if I use List View in Assets, and then sort by newest first, the problem is solved. To help with this, I set List View as the default in the Channel Field settings.

---
Tags: assets
---


title: Using CE Image on a php generated image

text:
# Question
Title: Using CE Image on a php generated image
I have a php file that generates an image based on some parameters. But it doesn't seem like CE Image knows how to handle that.

The URL looks something like this: `myimg.php?id=165`

It's being served as an image: `header('Content-Type: image/jpeg');`

When viewing it in the browser it shows the image like it's supposed to. It also works with the `<img>`-tag, so there's nothing wrong with the image.

# Answer
Since the source that is being passed into CE Image is not an actual image on the file system, you'll want CE Image to treat it as a remote image. You can accomplish that by using the parameter force\_remote="y".

Here's an example:

```
{exp:ce_img:singe src="http://example.com/myimg.php?id=165" width="100" force_remote="y"}

```
> 1 votes

---
Tags: ce-image
---


title: How to overwrite price

text:
# Question
Title: How to overwrite price
is there a way to force or overwrite the price of an item?

I tried this: `<input type="hidden" name="items[playa{count}][price]" value="0" />`

Thanks

# Answer
You need to make sure that the Store Product Detail field for your channel has "allow user price" enabled in its settings, then you simply need to pass a field named `price` in your `store:product` form.

```
<input type="hidden" name="price" value="XX" />

```
> 1 votes

---
Tags: expresso-store
---


# Question
Title: How To Manipulate Database In Custom Expresso Store Payment Gateway
Is it possible to use EE-standard database queries in a custom payment gateway written using Omnipay format to manipulate data in the database?

I.E. use `$query = ee()->db->select('title, url_title, field_id_14')` within the PurchaseRequest class?

# Answer
> 2 votes
I assume you are using Store \> 2. If that is the case you would be making your own extension. Store has a default layout for these extensions available on github here.

If you notice in the ext.store\_check.php file, there are these lines.

```
    // tell PHP where to find the gateway classes
    // Store will automatically include your files when they are needed
    $composer = require(PATH_THIRD.'store/autoload.php');
    $composer->add('Omnipay', __DIR__);

```

This would get all the files in your omipay folder and include them into this source. Working off of that assumption, you should (in theory) be able to call any ExpressionEngine api functions that are regularly available in an extension in your omnipay files.

One precautionary note I'm going to mention is be careful of namespaces (if you are using any). Because those could throw off the function calls.

---
Tags: expresso-store, database, payment-gateway, omnipay
---


title: Passing custom data to a user tag?

text:
# Question
Title: Passing custom data to a user tag?
Attempting to customize the list of users displayed based upon a custom field in a channel entry.

```
{exp:channel:entries channel="messages"}
  {exp:user:users group_id="{member_groups backspace="1"}{option_name}|{/member_groups}"}
    {email} - {group_id}
  {/exp:user:users}
{/exp:channel:entries}

```

The 'member\_groups' custom field will output the chosen groups in this format...

```
group_id="7|8|9"
```

No matter what, I always get the logged in super admin account as a result. Is this possible with User or do I need to use a query here?

Would really prefer to not have to use an embed since I also need to this to work for sending email notifications when a new entry is posted to the messages channel.

Thanks!

# Answer
Pretty sure this will not work unless you use an embed. That said, I am not sure why using an embed would stop email notifications from working (though I do not know how and what you intend on setting that up with). I am also assuming {member\_groups} is a custom channel field?

Main template:

```
{exp:channel:entries channel="messages"}
  {embed="path_to/embed" member_groups="{member_groups backspace="1"}{option_name}|{/member_groups}"}
{/exp:channel:entries}

```

Embedded template:

```
  {exp:user:users group_id="{embed:member_groups}"}
    {email} - {group_id}
  {/exp:user:users}

```
> 0 votes

---
Tags: members, solspace-user, member-management
---


# Question
Title: Is there a way to use Low Search to return results by author?
We would like to be able to perform a free text search using an author name and return all posts credited to that author, is this possible with Low Search?

# Answer
The method Jamie mentioned will indeed work. You can also try and use Low Author, which saves the author screen name as a searchable read-only field. Add that field to your entries, and you'll be able to use keywords to search by author.

**Edit:** If you're using Low Search 4+, you can now also use the Members filter. Once installed, use the parameters `members:screen_name` (exact matches) or `members:search:screen_name` (partial matches) with the same result.
> 1 votes

# Answer
I don't know if anything has changed in more recent versions, but Low himself suggested using Solspace's Preparse addon for cases like this:

http://gotolow.com/blog/searching-non-field-data-with-low-search
> 1 votes

---
Tags: search, low-search, author
---


# Question
Title: Call Controller from Folder and remove index.php from url
I am creating an application in which I want administrator functionality runs from different controller and it is in controller(backend.php) in administrator folder in controller folder. But when I run url(http://mysite.com/administrator/backend/method-name) is not open but url(http://mysite.com/index.php/administrator/backend/method-name) is working I want to remove index.php from url when I run adminstrator url But currently I have problem.

Thanks.

# Answer
> 0 votes
**1)**. EE is a CodeIgniter application and overrides the routing to the ee controller. To merge/use a custom application, you have to enable routing again. For to be able to update EE with less hassle, it is probably better to not merge a large app with libraries, helpers and controllers inside the ExpressionEngine directory. You can install/create your app in its own sub-directory, and set APPPATH accordingly.
\- The manual is a good start: Further https://ellislab.com/codeigniter/user-guide/
\- See also this answer on StackOverflow *Expression Engine Controllers*

**2)**. If you also want to make use of EE functionality (members, backend-layout, etc.), and have a more tight integration in the backend control panel, you can develop an add-on. Extensions are class-methods that are called from certain points in other libraries, to alter data or do their own stuff, Modules are more or less standalone mini-apps inside EE. See the development manual
https://ellislab.com/expressionengine/user-guide/development/index.html

---
Tags: codeigniter, routing
---


# Question
Title: problem with publish_form_entry_data expressionengine hook
I'm trying to develop an expressionengine extension which uses "publish\_form\_entry\_data" hook to change some default features such as customized datepicker , etc. problem is it works perfectly in the publish new entry form , but when I tried to edit my existing entries it redirect me to the publish new entry page , and won't get me to edit entry page with the entry values for editing! is there any other hooks for this purpose? or should I pass some info for editing existing entries?

here is the code for activating the extension :

```
function activate_extension() {
    $hooks = array(
        'publish_form_entry_data'   =>  'main',
        'update_multi_entries_start' =>  'main',
        'entry_submission_start'    =>  'dataProcess'
    );
    foreach($hooks as $hook => $method){
        $data = array(
            'class'    => __CLASS__,
            'method'   => $method,
            'hook'     => $hook,
            'priority' => 10,
            'version'  => $this->version,
            'enabled'  => 'y'
        );
        $this->EE->db->insert('extensions', $data);
    }

}

```

and here is the method for the publish\_form\_entry\_data hook :

```
function main(){
    $this->persianDatePicker();
}

```

# Answer
> 0 votes
Thanks a lot my friend "Derek Hogue" , I got the result by returning the data like this :

```
if(!empty($entry_id)){
            //$result = $this->EE->db->get_where('exp_channel_titles',array('entry_id' => $entry_id));
            $this->EE->db->select('*');
            $this->EE->db->from('exp_channel_titles');
            $this->EE->db->where('exp_channel_titles.entry_id',$entry_id);
            $this->EE->db->join('exp_channel_data','exp_channel_titles.entry_id = exp_channel_data.entry_id');
            $result = $this->EE->db->get();
            $result_array = $result->result_array();
            $data = array();
            foreach($result_array[0] as $key => $value){
                $data[$key] = $value;
            }
}
return $data;

```

---
Tags: hook
---


# Question
Title: MSM multisite Front End login Site B members not access SITE A any section
We have Facing Problem While MSM two Different primary & secondary Front End Login .

Problem: We have Created member group for secondary site (site B) members Register SITE B member in that group but When We have same user logged in primary site front end login (Site A) then its logged in successfully and site B member access all SITE A section.

above our Problem , We need to both Site front end login different , it means SITE B member group not access SITE A login after login any section.

let me know if you have any idea for this.

Thanks, ZW PD

# Answer
> 0 votes
In ExpressionEngine MSM member groups are installation wide. For restricting SITE B members to access content of SITE A follow steps:

```
1) Create a template/snippet/header
2) Include this template/snippet/header in every template of SITE A
3) Check current logged in user member group.
4) If member group from SITE B then destroy the user session and redirect to home page with message "You are not authorized to access SITE A"

```

---
Tags: multi-site-manager, freemember
---


# Question
Title: Contains operator not working for channel field that uses checkboxes
I am using a checkbox channel field named "destinations" that allows an entry to have multiple values checked off. I then want other fields from that entry to be displayed if the destinations field contains, rather then == (is equal to). So, an entry that has both Hawaii and New Zealand checked off for the field destination, will show up in either, rather then having to equal both.

So, this works:

```
{if destination == "Hawaii"}
                <p><strong>{term}</strong> <br /><a href="{site_url}voyages/{program_page_url}">{title}</a></p>
 {/if}

```

For a destination that only has Hawaii checked off, in the destination field. But, for an entry that has both Hawaii and New Zealand checked off, it won't show.

I tried using the Contains Operator, https://ellislab.com/expressionengine/user-guide/templates/conditionals.html#contains-operator

```
{if destination *= Hawaii} xyz {/if}

```

But it causes the page not to load.

I also tried using the http://devot-ee.com/add-ons/pvl-check-if plugin, but that didn't work either.

Any advice greatly appreciated. The page is here:http://www.sea.edu/destinations/destinations\_testing

Note for the destinations that don't have any Upcoming Voyages, its because the Voyages go to multiple destinations, so have more than one item checked off for the destinations field.

Thanks.

# Answer
> 0 votes
I actually ended up using Field Pack http://devot-ee.com/add-ons/field-pack, just installed the Checkboxes field and it offered much more flexibility, achieved what I needed. Here is the updated code:

```
{if '{destinations:selected option="hawaii"}'}
            <p><strong>{term}</strong> <br /><a href="{site_url}voyages/{program_page_url}">{title}</a></p>
            {/if}

```

# Answer
> 0 votes
I never used a checkbox field, but I believe they can should be used as variable pair in case of more than one possible option.

So:

```
{destination}
  {item}
{/destination}

```

Will return every item checked. In case of two destinations:

```
Hawaii
New Zealand

```

You can try to change your template to these data be inside the variable pair or use an embed to pass all data as one single string and keep your previous logic:

```
{embed="destination/data" destinations="{destination}{item},{/destination}"}

```

On the embed:

```
{if embed:destinations *= "Hawaii"}
  <p><strong>{term}</strong> <br /><a href="{site_url}voyages/{program_page_url}">{title}</a></p>
{/if}

```

I hope it helps. Bye!

---
Tags: templates, conditionals, channel-fields
---


# Question
Title: Importer module for uploading CSV in channel entries is not working for grid
I am using grid in channel fields and using importer module for uploading CSV file to add/update channel data.

But importer module dose not support for grid, then is there a way how can i use importer with grid ? Also i am having 5 grid in the channel so i can not use matrix instead of grid now.

# Answer
Importer module doesn't support GRID fields.
> 1 votes

# Answer
Looks like you'll either have to switch to Matrix or purchase Datagrab:

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

I personally prefer DG or Import. Solspace does offer a 30 Day Money Back Guarantee so I'd return it and purchase DG instead.
> 0 votes

---
Tags: channel-entries, channel, grid, solspace-importer
---


# Question
Title: MSM and EE question (subdomain using main domain's templates)
I have recently installed MSM on my EE build. Both are the very latest. I followed the tutorial all the way through: http://ellislab.com/expressionengine/user-guide/cp/sites/install.html

When i visit the subdomain on my local host it shows up fine in terms of the styles being there however when I make an edit to a template via the control panel/or text editor it does not show up on the subdomain. I have all my templates saved out as files. If i edit the index page for the main site, it shows up on both the main and subdomain.

my main site is located in a public\_html folder on my computer and at the same level is the subdomain folder named appropriately. I am sorry my question is so high level. I bet I am just missing something obvious.

PS I have added an htaccess file to my subdomain folder with no success. This is all on apache on my local computer.

# Answer
Make sure that the path to your template files is correct in your control panel. Look under Design \> Templates \> Global Preferences and check "Server path to site's templates"
> 0 votes

# Answer
I have approached this by embedding a template to another site as documented here:

https://ellislab.com/expressionengine/user-guide/cp/sites/code.html

```
{embed="site_short_name:template_group/template"}

```

I have actually done this for embedding entire templates.

Have you tried this approach? How did you copy all of your templates over when you setup the new Site?
> 0 votes

---
Tags: multi-site-manager, subdomain
---


title: Can you set a channel as unsearchable?

text:
# Question
Title: Can you set a channel as unsearchable?
I have a channel that I don't want searchable, however suggestive search results containing entry titles for this channel still appear. I'm using Super Search 2.04 and EE 2.5.2. I know that you can easily disable searching on custom channel fields but I need to disable searching for the entry titles of this channel. Further I thought that changing all entries to status closed might resolve it but it does not. Any tips or suggestions would be greatly appreciated!

# Answer
My apologies as it turns out this issue wasn't completely related to Super Search. There was also suggestive search results being powered by the following code:

```
<?php $term = $_GET['term']; ?>

{exp:ifelse parse="inward"}
    {if group_id == '20' OR member_id == '79' OR member_id == '9' OR member_id == '113' OR member_id == '129'}
        [{exp:query sql="SELECT title, channel_id FROM exp_channel_titles WHERE title LIKE '%<?php echo $term; ?>%' AND channel_id NOT IN (82,80,61,63,51,54,9,39,40,46,56,37,60,66,67,68,69,37,78,93) GROUP BY title ORDER BY title ASC" backspace="1"}"{title}",{if no_results}"No Results"{/if}{/exp:query}]
    {if:else}
        [{exp:query sql="SELECT title, channel_id, entry_id FROM exp_channel_titles WHERE title LIKE '%<?php echo $term; ?>%' AND channel_id NOT IN (82,80,61,63,51,54,9,39,40,46,56,37,60,66,67,68,69,37,78,93) AND entry_id NOT IN (2589,2590,2591,2592,3575,3577,4154) GROUP BY title ORDER BY title ASC" backspace="1"}"{title}",{if no_results}"No Results"{/if}{/exp:query}]
    {/if}
{/exp:ifelse}

```

In order to remove the channels I wanted from these suggestive search phrases I just had to edit the MySQL query adding the channel ID's of the ones I didn't want searched into the NOT IN part of the query. Thanks to Justin and Roman for your tips and to remove channels from the search results (not the suggestive search) they worked perfectly. My apologies for not clarifying my question a little better in regards to the suggested search results.
> 1 votes

# Answer
You can set specific channels to limit results on your exp:super\_search:results tag like:

```
{exp:super_search:results
    channel="news|another_channel"
    limit="20"
    hightlight_keywords="strong"
}

```

(see solspace docs here, and under "why does it work that way" heading). Setting the channel parameter here should prevent results from showing up from the channel you want hidden.
> 1 votes

# Answer
If you only have a single channel that you are trying to exclude I often find it easier to use the not parameter to your template tags. The following would not show any entries from a channel with a short name of "excluded\_channel" or any entries that have a status that is set to closed.

```
{exp:super_search:results
    channel="not excluded_channel"
    status="not closed"
    limit="10"
}

```

You can add a pipe delimiter between multiple channels or status to exclude multiple. i.e. `status="not closed|preview"` or `channel="not excluded_channel|home"`
> 1 votes

---
Tags: search, supersearch
---


title: GIF not showing up

text:
# Question
Title: GIF not showing up
When I create the blog post, it looks like an image is showing up, but when I publish it, the image doesn't show up. There are other GIFs in the same post that do show up. This is the post https://www.wibidata.com/blog/wibi-interns-2014-our-summer-in-gifs

# Answer
> 1 votes
If the images that do not show up are coming from tumblr, then it's because you are linking to them with http protocol (see your DevTools). Your site seems to enforce SSL, but links to images on tumblr are coming from non-SSL (http protocol).

Try using them with secure protocol (`https`) or without (instead of `http://example/url/file.gif` use `//example/url/file.gif`);

---
Tags: channel-images
---


# Question
Title: Bug? When selecting a date range within product report, an order report is generated instead
Within the CartThrob Order Manager, on the product report tab, under the the initial report, there is an option to choose a date range. When I select a date range and generated the report, an order report is generated instead.

Is this a bug?

# Answer
> 0 votes
I have been in contact with MightyBigRobot, and they confirmed that this is a bug and they are working on it.

As a temporary workaround I built a SQL query and embedded it into a custom report template. that looks like this:

```
<h1>Product Totals for the Past 7 Days</h1>

<table class="mainTable padTable">
<tr>
    <td></td>
<td>Product</td>
<td>Total Sold</td>
<td>Current Inventory</td>
<td>Unit</td>
<td>Need</td>
</tr>

{exp:query sql="
SELECT SUM(`exp_cartthrob_order_items`.`quantity`) AS total_quantity, `exp_cartthrob_order_items`.*,  exp_channel_titles.entry_date, FROM_UNIXTIME(exp_channel_titles.entry_date) AS MYDATE, exp_channel_titles.status,
exp_channel_data.entry_id as product_id, exp_channel_data.field_id_72 AS unit, exp_channel_data.field_id_78 AS unit_numerical, exp_channel_data.field_id_7 AS inventory,
(SUM(`exp_cartthrob_order_items`.`quantity`)* exp_channel_data.field_id_78) as need
FROM (`exp_cartthrob_order_items`, `exp_channel_titles` AS ct, `exp_channel_data`)
JOIN `exp_channel_titles` ON `exp_channel_titles`.`entry_id` = `exp_cartthrob_order_items`.`order_id`
WHERE ct.entry_id = exp_cartthrob_order_items.entry_id
AND exp_channel_titles.entry_date >= UNIX_TIMESTAMP(CURRENT_DATE - INTERVAL 7 DAY)
AND exp_channel_titles.entry_date  < UNIX_TIMESTAMP(CURRENT_DATE + INTERVAL 1 DAY)
AND `exp_channel_titles`.`status` =  'open'
AND exp_channel_data.entry_id = exp_cartthrob_order_items.`entry_id`
GROUP BY `exp_cartthrob_order_items`.`entry_id`, `exp_cartthrob_order_items`.`price`
ORDER BY `total_quantity` DESC
"}

<tr>
<td>{count}</td>
<td>{title}   {exp:basee64:decode}{extra}{/exp:basee64:decode}   </td>
<td>{total_quantity} </td>
<td>{inventory}</td>
<td>{if unit=="kg"}{unit_numerical}/{/if}{unit}</td>
<td>{need} {if unit=="kg"}kg{/if}</td>
</tr>
{/exp:query}

```

---
Tags: cartthrob
---


# Question
Title: Stop EE from obfuscating email address in template
How do I get EE to actually print out the email {apply\_email} instead of making a javascript obfuscated email address in the templates? Is there an option I can put on the tag to do this?

# Answer
There is a Channel preference setting to automatically turn URLs and email addresses into links than when enabled does some auto-typography to create links. Disabled, it will leave your naked email addresses and URLs in content fields alone.
> 1 votes

---
Tags: templates, email, encode
---


title: Expresso Store: User input Price

text:
# Question
Title: Expresso Store: User input Price
My client would like to sell gift certificates, in addition to having set prices they want the user to be able to input their own price. Is it possible to have a store item without a price?

# Answer
> 2 votes
As Ian has mentioned Store does not currently have the ability for users to enter their own price in. On exp-resso.com there is a channel for the donations (tip jar) that has a single product with a value of $1. When a user enters the price that they want to donate they are actually just adding X amount of items to the cart at $1 a piece so a $25 donation is actually registered as 25 donation items of $1 for a total value of $25.

I wrote a blog post a while back that deals with a similar situation.

# Answer
> 1 votes
As far as I know it's not possible to enter a product without a price as price, along with SKU, are required fields. One option would be to make use of *modifiers* to make any number of variations possible (£5, £10, £15, £20, ...).

There is also provision in Store to accept *donations*. This does allow for a custom amount to be entered and an example can be seen at the bottom of the Exp-resso website. I've not setup a donations form before however so I'm not sure on the specifics of setup or how it is recorded in the sytem (if it's in with the orders or stored elsewhere). I'm sure one of the Store guys can help to clarify though.

# Answer
> 0 votes
There is now a Enable Dynamic Prices option for the field that should work.

See see this post for some help.

---
Tags: expresso-store
---


# Question
Title: Show only (Low Search) shortcuts from logged in user
I am new to Low search, and happy I got shortcuts working. My site is a member site, with memberdata in a channel (Profile-edit) I want to show only shortcuts to the user that creates them (when they were logged in). Is there a way to filter shortcuts so that users only see their own shortcuts?

(And my apologies if I missed this in the docs) (edit: I mean shortcuts created in the frontend, not collections)

# Answer
> 0 votes
Thanks a lot Low, for you reaction.

In the meantime I found a 'dirty' solution:

I created a channel (called shortcut), and a form on the result page. URL as hidden field, the title of the entree in the channel 'shortcut'.

Now I can call these entrees made by AUTHOR and link them to the result page. For the ones interested, this my (simple) code.

On result page:

```
<!-- formfields shortcut           -->
{exp:channel:form channel="shortcut" return="zoek/opdrachten" entry_id="{segment_5}"}
    {if segment_4 == ""}
    <div class="forms" id="myform">
    <input type="hidden" name="url_title" id="url_title" value="{url_title}">
    <input type="hidden" name="entry_date" id="entry_date" value="{entry_date}">
    <input type="hidden" name="title" id="title" value="{segment_3}" onkeyup="liveUrlTitle();">

        <fieldset>
            <legend>CV</legend>
            <label>Bewaar deze selectie<span class="forms-desc">Geef een beschrijving van deze zoekopdracht</span>
                <div class="controls">
                {field:shortcut_beschrijving}
                </div><!-- end control -->
            </label>
        <div class="controls" >
            <input type="submit" value="Voeg toe">
            </div>
        </fieldset><br>
        </div>
    {/if}
{/exp:channel:form}
<!-- /formfields shortcut           -->

```

On the shortcut list page

```
{exp:channel:entries channel="shortcut"
    author_id="CURRENT_USER"
    disable="categories|category-fields|member-data"
    dynamic="no"
}

    {if no_results}Je hebt geen zoekopdrachten opgeslagen{/if}
    <p>
    <a href="{site_url}index.php/zoek/resultaat/{title}/{count}">{count}</a>
    {shortcut_beschrijving}
    </p>
{/exp:channel:entries}

```

# Answer
> 0 votes
Sorry, per-member shortcuts aren't possible with Low Search at the moment. They are global.

---
Tags: low-search
---


# Question
Title: Expressionengine Email Contact Form Tags and Success Messages
Does anyone know of a way to create a custom success message and post to the expression engine processing controller manually?

I'm using jQuery validator, and usually what I would do is something like this:

```
   submitHandler: function(form) {
    var data = $(form).serialize();
        $.post(
            '/system/expressionengine/templates/default_site/global.group/form.php',
            data),
        function(data){
                $('#contact-form').html('<div id="success">We’ll get back to you.</div>');

            }
        );
    }
 });

```

Unfortunately with the expression engine {exp:email:contact\_form} tags it posts straight to a page and always redirects the user.

Does anyone know of a way to post or properly format the data so that handler will accept the post data and allow a seamless form submission experience?

# Answer
> 0 votes
Answering my own question, what you have to do is post to the site url, you cannot use a custom php handler without a lot of work. I found this out by looking where the {exp:email:contact\_form} posts to. You also have to disable CSRF protection, or find a way to snag the XID from the return data. (I just disabled it because we're not doing anything that is data sensitive)

```
    submitHandler: function(form) {
            $.ajax({
                url: "/",
                type: "post",
                dataType: "html",
                data: $('#contact_form').serialize(),
                error: function(jqXHR, textStatus, errorThrown)
                {

                },
                success: function(html, textStatus, jqXHR)
                {

                }

            });

        }

```

---
Tags: javascript, php, jquery, forms
---


# Question
Title: Discussion Forum 3.1.15 - This form has expired
I'm on EE 2.8.1 and Discussion Forum 3.1.15 and when I try unsubscribe from forum threads I get this error message: *This form has expired. Please refresh and try again.*

I tried to updated the config.php file with the info on this thread without success: Error After Install

Is this an EE bug that can be fixed?

Thanks

# Answer
> 2 votes
Add $config\['disable\_csrf\_protection'\] = "y";

to your config file, you need to add the XID to the form in a hidden field to get rid of the error the other way.

---
Tags: ee2, ee2-upgrades, forum
---


# Question
Title: How to show recent entries restricted to one per author?
I would like to show a list of recent entries, restricting the list to one per author. Essentially the logic I'm looking for is "show 10 recent articles, but if the author of the next article already has an article on the list, skip it."

I'm thinking I'll have to use PHP to add a second level of logic, but I'm hoping someone else has an idea.

A possible kink: I'm using Solspace's User.

# Answer
> 4 votes
You might could do something like this (php must be enabled on input)

```
<?php
$entries = array();
$sql = "SELECT author_id as author,
        max(entry_id) as entry_id
        FROM exp_channel_titles
        WHERE channel_id = '4'
            AND status = 'open'
        GROUP BY author
        ORDER BY entry_id DESC
        LIMIT 10";
$authorEntriesQuery = ee()->db->query($sql);
foreach($authorEntriesQuery->result_array() as $row)
{
    $entries[] = $row['entry_id'];
}
$entriesString = implode('|',$entries);
?>
{exp:channel:entries channel="blog" entry_id="<?echo $entriesString?>"}
{title}<br>
{/exp:channel:entries}

```

You would have to change the channel number obviously and if you have any custom statuses you need to account for, then change that section.

I tested this and got the most recent posts from individual authors.

---
Tags: entries, solspace-user, author, logic
---


# Question
Title: How can I setup a dev copy of EE before license purchase?
I have built over 70 EE sites in thej last few years. I noticed now in EE 2.8+ that it is now required to enter a license number even on a local copy. Is there a new method to allow us to build and test before getting the license? Maybe like using a .dev or .local domain extension or something? I have many client licneses I can use if needed, but I do not like that option. The reason we like to build a bit of the CMS in advance is that we typically we demo it with a client to see if the like the way it works for basic editing. What do you all do now for your local dev copies of EE? Is it possible to get a dev license?

# Answer
> 1 votes
We start building before our licenses are purchased. We just put in a random number until we actually get the real license. EE doesn't currently do an authorization call on install to validate your license. We use stuff like: 1234-1234-1234-1234.

---
Tags: development, license
---


title: Low Variables — Batch Creation

text:
# Question
Title: Low Variables — Batch Creation
On the overview it mentions you can batch create low variables:

> You can clone variables, **batch-create** them and duplicate whole groups

How is this done exactly? I'm having trouble finding any documentation.

Many thanks!

# Answer
Check out the Variable creation options bit. Batch creation of multiple identical vars happens when using multiple suffixes when creating a variable.
> 2 votes

---
Tags: low-variables
---


title: Exp-resso store Amazon S3

text:
# Question
Title: Exp-resso store Amazon S3
I'm looking for a way to sell mp3 files.

Will digital product downloads work if they are hosted on amazon S3 hosting service?

# Answer
> 1 votes
You should be able to.

When you create a product download you pass the custom field name of your file field to the `exp:store:downloads` tag which then will allow the user to download the item.

I have not tested this with a hosted service like S3 but I don't see why it wouldn't work. If for some chance it does not work you could use the `exp:store:orders` tag pair and something like Link Vault to allow only users that have purchased an item to download the mp3 files.

---
Tags: expresso-store
---


# Question
Title: Matrix Total Rows Column Search Conditional
So I have this conditional that works properly for entries with matrix rows:

```
{if {tech_documents:total_rows search:doc_thumb="IS_EMPTY"} > 0}
    ...
{if:else}
    ...
{/if}

```

However, entries that have no rows for this matrix field throw a template error:

> ### Error
>
> You have an invalid conditional in your template. Please review your conditionals for an unclosed string, invalid operators, a missing }, or a missing {/if}.
>
> **Parser State**: Invalid Condition: Not enough operands for operator ” \> “.

Running: EE 2.9, Matrix 2.6, Assets 2.4

# Answer
EE simply removes any tags corresponding to custom fields that have no data. So by the time EE is ready to parse the outer `{if}` conditional, it will look like this:

```
{if  > 0}

```

Try wrapping the field tag in quotes:

```
{if '{tech_documents:total_rows search:doc_thumb="IS_EMPTY"}' > 0}

```
> 5 votes

# Answer
try with below code:

```
{if tech_documents:total_rows > 0 && search:doc_thumb="IS_EMPTY"}
    ...
{if:else}
    ...
{/if}

```
> 0 votes

---
Tags: matrix, assets, conditionals
---


# Question
Title: Zoo Visitor: confirm delete user account
In the 'member area' I have the ability for a user to delete their own user account, with a confirm password field. Still, I would like to add an 'Are you sure?' Checkbox that is required. Even better would be to have the user redirected to a confirmation page with an 'Are you sure?' button. How would I accomplish this.

If I add rules:name\_of\_checkbox="required" to {exp:zoo\_visitor:delete\_form} it does not work.

# Answer
I have created the following template that works perfectly using the stash plugin.

```
<!-- Delete -->
{if segment_3 == 'delete' AND !segment_4 AND "{exp:stash:get name='password' dynamic='yes'}" == '' AND "{exp:stash:get name='confirm_delete' dynamic='yes'}" == ''}

    <form action="" method="post" class="form-horizontal">
        <input type="hidden" name="csrf_token" value="{csrf_token}">
        <input type="password" class="form-control" id="password" name="password" placeholder="Password">
        <input type='checkbox' name='confirm_delete' value='yes'>Are you shure?
    </form>

{if:elseif segment_3 == 'delete' AND !segment_4 AND "{exp:stash:get name='password' dynamic='yes'}" AND "{exp:stash:get name='confirm_delete' dynamic='yes'}" == 'yes'}

    {exp:zoo_visitor:delete_form
        return='/'
        role="form"
        include_jquery='no'
        datepicker='no'
        include_assets='no'
        secure_action='yes'
        secure_return='yes'
        require_password='yes'
    }
    <input type="hidden" name="password" value="{exp:stash:get name='password' scope='user'}">
    <button type="submit" class="btn btn-default" data-loading-text="Deleting Account...">Yes</button>
    {/exp:zoo_visitor:delete_form}

{if:else}

    {redirect='/account/edit/delete'}

{/if}
<!-- ./Delete -->

```
> 0 votes

---
Tags: zoo-visitor
---


# Question
Title: Requiring User to Select from Dropdown Menu
I'm trying to create a field that requires the user to select from a dropdown field (Select field). I inputted the selection options and the first option shows by default. Instead of that, however, I'm trying to get it to show some default "Select option" or something of that sort and then requires the user to select from the dropdown selection options. I know I can just input "Select Option" as the first option, but I need to make this a required field that ensures the user makes a real selection—that is to say, an option that isn't just the "Select Option" option if I were to put that in as the first option. Any idea on how to do this?

# Answer
> 2 votes
If you specify your first option as:

```
<option value="">Select Option</option>

```

i think that should be treated as empty and will not be accepted if the field is required in your form.

---
Tags: solspace-freeform
---


# Question
Title: File manager images not displaying, linking back to the main article
First off I apologise if this is the wrong SE community to post this on, however since it is the software package I use I hoped you guys could help me out.

I have set up a couple of image upload directories for me to use, one being for static images used over the site and another for images relating to articles posted on the site. I currently have a custom directory set up for static images at `<root>/img/<imagename>` which works perfectly fine when directly linked to in the template. However, this is not an ideal solution since I would need to manually manage images.

The problem effects both upload directories and new ones, but I will refer to the directory used for the static images for convenience unless noted. The logo which is used in the custom directory was also uploaded to the new ExpressionEngine upload directory, however when it is accessed nothing will appear. Any links to the image will show up as the broken image icon, and opening the image link directly will just produce a blank screen.

News article images are stored at `<root>/news/images/<newsimage>`. At the same time news articles themselves are stored/displayed at `<root>/news/article/<channelcontent>`. This suffers the same issue as the static image directory, however opening a direct link to one of the images will load up the news overview section of the site, the homepage of the /news/ section. In short, it effectively ignores the image and displays the news homepage instead, as the image below demonstrates.

(the second black box at the bottom happens all the time, not just in this particular scenario).

You can see that while hotlinking to the image, I get redirected instead of showing an image. Below, you can also see that the images hotlinked alongside the articles do not display, instead showing a broken image icon.

The same issue does not occur just in the articles, but also in the editor!

I instantly assumed it was a server permissions error, but following the guide I set the image and folder permissions to 755 and even 777, but the bug remains present.

The following is the setup for the news image directory.

```
Descriptive name: News Images
Server path of upload directory: /home/<hidden>/public_html/beta/img/news/
URL of upload directory: http://beta.bowl-of-soup.co.uk/news/images/
Images only

```

And this is how it is used in the broken images above.

```
{exp:channel:entries channel="news" limit="10"}
<hr />
<h4><img class="left" src="{news_headimg:thumb}"/><a href="{url_title_path='news/article'}">{title}</a></h4>
<p><i>A wonderful testing article by your adoring {author}</i></p>
<p>{news_headline}</p>
{/exp:channel:entries}

```

(Removing :thumb makes no difference).

Please can anyone help with this issue? I can provide more details happily as this issue is a blocker in the site development. I tried searching multiple solutions but none seemed to work.

ExpressionEngine covers the whole site at , so please check it out to see the bug first-hand (advertising not intended - I'll switch off adverts until the issue is resolved).

# Answer
> 0 votes
I think your problem is that your server path and URL are pointing to different places. The end of these paths should match. Try the following:

```
Server path of upload directory: /home/<hidden>/public_html/beta/img/news/
URL of upload directory: /img/news/

```

Accessing http://beta.bowl-of-soup.co.uk/img/news/blank.jpg works fine, so I think the problem is just that the image URLs are being output as at the moment because the URL of the upload directory does not match the true location on the server.

# Answer
> 0 votes
There is a setting in expressionengine to change the url path of images. This sounds like it may be your problem. If you go under Content -\> Files -\> File upload preferences, and you edit the file url path "URL of Upload Directory". This is what is ExpressionEngine uses for the path of your images in your templates. If this is incorrect, then you get a broken image even if the files are in the incorrect path on your server.

So in your case, it looks like you need to change the URL of Upload Directory for that particular upload path to "/news/images/" without quotes.

---
Tags: image, channel-images
---


# Question
Title: Getting NSM Live Look PHP errors, even after uninstalling
I've had issues and PHP errors with NSM Live Look. It's been uninstalled and I thought it was fine, but the client has just informed me that when they try to post or edit an item from just one specific Channel, they are getting errors.

To confirm, if they try posting or editing an item from any other Channel this error does not appear.

These errors look like:

> A PHP Error was encountered Severity: Notice Message: Undefined index: nsm\_live\_look\__preview Filename: content/publish.php Line Number: 145 " id="hold\_field\_
>
> A PHP Error was encountered Severity: Notice Message: Undefined index: nsm\_live\_look\__preview Filename: content/publish.php Line Number: 145 " style="width: 100%; display: none;"\>
>
> A PHP Error was encountered Severity: Notice Message: Undefined index: nsm\_live\_look\__preview Filename: content/publish.php Line Number: 151
>
> A PHP Error was encountered Severity: Notice Message: Undefined index: nsm\_live\_look\__preview Filename: content/publish.php Line Number: 152

As I said, I've already uninstalled the this plugin, plus I've checked the database and cannot even see an entry for *nsm\_live\_look*.

Any ideas?

# Answer
I've never used NSM Live Look, but the nature of the error seems to indicate the channel's live look template is not set in the configuration.

That said, the severity of the errors above are mere 'Notices' and should probably be turned off on live production environments. You can disable error output display from:

Admin → System Administration → Output & Debugging → Debug Preference → **None**
> 0 votes

---
Tags: error, php, plugin
---


title: Cartthrob, stripe and double payment

text:
# Question
Title: Cartthrob, stripe and double payment
I've just inherited a site from a previous developer that is using CartThrob to power the eCommerce and strip/offline payments for the payment gateway.

Recently some customers have not been seeing the success notification template on submitting payment via stripe resulting in double payment submissions. One customer did not see the second payment go through and sent an email saying they would submit payment via check. However all payments are successfully received via stripe.

Is there a setting/template code that I need to work on to fix this issue? Any advice is appreciated.

EE 2.7.2 CT Pro 2.5

# Answer
> 1 votes
You may want to ensure the return template for order\_complete is defined (and also exists). In the example below, the order\_complete template should contain the {exp:cartthrob:submitted\_order\_info} tag.

```
{exp:cartthrob:checkout_form
        return="{template_group}/order_complete"
        required="first_name|last_name|address|city|zip"
        gateway="stripe"
}

```

Stripe works differently than other CT gateways and some JavaScript implementation for error handling is required - so be sure to watch your console when testing.

---
Tags: cartthrob, ecommerce, stripe
---


title: WYGWAM in comments form

text:
# Question
Title: WYGWAM in comments form
I need to use WYGWAM in comment form. Now I use {exp:comment:form} as it is shown in EE documentation. But it is necessary for me that users could format the text with power of WYGWAM! How can I embed it to comment form?

# Answer
This is not currently possible with any of the wysiswyg editors for EE. Have you considered making a feature request?
> 2 votes

# Answer
My current project requested this, and after trying to build out a custom solution, I came across SCEditor, a jQuery plugin that's worked perfectly. It's lightweight and easy to customize (both the JS and the CSS).

Link: http://www.sceditor.com/
> 0 votes

---
Tags: wygwam, comments
---