# Question
Title: Solspace Freeform custom fieldtype and notifcation templates
So I'm attempting to create a custom FieldType for Freeform for a custom one-off application. Basically I have multiple hidden fields to populate data associated with a regular user input field.

I've been struggling with this for a while and don't know of a better way, so if someone knows I'd be happy to hear it!!

Basically here's my setup: Within the `freeform:form` I'm listing channel entries to populate the inputs

```
<input id="product_{count}" type="hidden" name="product[]" value="{sku}/" />
<input id="product_{count}" type="hidden" name="product[]" value="{title}/" />
<input id="product_{count}" type="hidden" name="product[]" value="{price}/" />
<input id="product_{count}" type="number" name="product[]" value="" />
<input id="product_{count}" type="hidden" name="product[]" value="," />

```

As stated, I don't know that this is the best approach, but it's the best I could figure out for now.

When a member views the page all they see is the input for the quantity, which is the line `<input id="product_{count}" type="number" name="product[]" value="" />`

When the form is submitted the `product` array comes in looking like:

```
[0] => 1011/
[1] => Product A/
[2] => 9.95/
[3] => 50
[4] => ,
[5] => 1011/
[6] => Product B/
[7] => 24.95/
[8] =>
[9] => ,
[10] => 1011/
[11] => Product C/
[12] => 11.95/
[13] => 12
[14] => ,

```

As you can see, element 8 is empty, this means that products was **not** ordered. So I need a way to skip that one.

So I've copied the `text` field type as a base to start off of from the Freeform pre-installed FieldTypes.

In the `pre_process()` method here is what I have created:

```
public function pre_process($data)
{
    if(is_array($data)){
        $data_string = implode($data);
        // print_r($data_string);
        // First get all the products into single lines we can work with
        $process_product = explode(",", $data_string);
        // String to hold our return value
        $return_str = "";
        // Loop through and process the extracted strings
        foreach($process_product as $value) {
            // Testing
            //echo($value . "<br/>");
            try{
                // Split the string by the "/" delimiter
                $explode = explode("/", $value);
                // Count should always be 4, even if no QTY entered, it will contain " "
                if(count($explode) == 4){
                    list($sku, $descr, $price, $qty) = explode("/", $value);
                    // Checking if there really is a QTY
                    if (trim($qty) !== "") {
                        // echo(" SKU: " . $sku . " Description: " . $descr . " Price: $" . $price . " Qty: " . $qty . "<br/>");
                        $ordered_product = (" SKU: " . $sku . "<br>" . " Description: " . $descr . "<br>" . " Price: $" . $price . "<br>" . " Qty: " . $qty . "<br>");
                        //echo($ordered_product);
                        $return_str .= $ordered_product . "<br>";
                    }
                }
            }
            catch (Exception $e){
                log_message('error', $e->getMessage());
                return;
            } // end try/catch
        }// end for

        // Final check to see if return_str is what we expect
        //echo($return_str);
        return $return_str;
    }

    return $data;
}

```

Basically I'm imploding the returned array so I can then delimit the string as needed. The string will now be in the format:

```
"1011/Product A/9.95/50,1011/Product B/24.95/,1011/Product C/11.95/12,"

```

This is working for both the front-end within the `{exp:freeform:entries}` tag pair, and also within the control panel. I get what I would expect. Basically it looks like this in the CP and on the front-end of the website:

```
SKU: 1011
Description: Product A
Price: $ 9.95
Qty: 50

```

But notifications are still receiving the original array in its entirety? This is my problem. I don't understand where the notifications are pulling the data from, and which function to use to process that data so I only get the data I need.

# Answer
In response to the reponse from Solspace, here's what I came up with:

```
{!--
    Basic usage:
    {embed="includes/process_notification" data="{myData}"}
    {embed:data} is now the data we're working with
--}

<?php

function processOutput($data)
{
    // First get all the products into single lines we can work with
    $process_product = explode(",", $data);
    // String to hold our return value
    $return_str = "";
    // Loop through and process the extracted strings
    foreach($process_product as $product) {
        try{
            // Split the string by the "/" delimiter
            $explode = explode("/", $product);
            // Count should always be 4, even if no QTY entered, it will contain " "
            if(count($explode) == 4){
                list($sku, $descr, $price, $qty) = explode("/", $product);
                // Checking if there really is a QTY
                if (trim($qty) !== "") {
                    // echo(" SKU: " . $sku . " Description: " . $descr . " Price: $" . $price . " Qty: " . $qty . "<br/>");
                    $ordered_product = ("<tr><td>" . $sku . "</td>" . "<td>" . $descr . "</td>" . "<td>(size)</td>" . "<td>" . $qty . "</td>" . "<td>" . $price . "</td></tr>");
                    //echo($ordered_product);
                    $return_str .= $ordered_product . "<br>";
                }
            }
        }
        catch (Exception $e){
            log_message('error', $e->getMessage());
            return;
        } // end try/catch
    }// end for

    return $return_str;

} // end output

$string = strip_tags("{embed:data}");
echo processOutput($string);

?>

```

The problem now is that nothing is output at all?? If I simply do a `echo("{embed:data}");` I get the same thing as if I didn't use the embed at all, which is what I would expect. After testing the code on a string just like the one passed in as `{embed:data}` I get the output I'm after.

However, the code used as seen above returns nothing? I don't understand why it works on a raw string but not on `"{embed:data}"` ? I have php enabled on the template, and parse order is output.

**EDIT**: Problem was string passed in was html encoded (littered with `<br>` tags, so I needed to strip\_tags first. Updated code shown above.
> 0 votes

# Answer
You can create custom notification templates from the **Notifications** section in the Freeform module in the CP, and assign this notification template to your form, either from the CP in the **Forms** section, or through parameters in your template.

In the CP when editing/creating a notification template, **the notification email body can accept EE tags and variables**, including embeds. You could use your PHP logic above and put this in a template, followed by loading the template in the notification body as an embed. Possibly, you could instead put this PHP logic directly in the notification body, although there is no setting for a PHP input/output setting there.
> 0 votes

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


# Question
Title: Channel entry detail on the same page with {exp:channel:entries} list
I want to achieve similar result like this page: http://www.zillow.com/homes/for\_sale/Newark-NJ/12970\_rid/40.749598,-74.169281,40.7296,-74.200952\_rect/14\_zm/1\_fr/

Simply without the bells and whistles, let's say I wanna list the entries on the page using {exp:channel:entries channel="news" limit="10"} and then when visitor clicks on an entry on the list, I want to show the details of the selected entry on a slide panel on the same page using jquery. How can I achieve this? Any idea?

# Answer
Hi you can do something similar to this:

```
   <div>
       <ul>
          {exp:channel:entries channel="foo" limit="10" dynamic="no"}
            <li class="select-entry"><a class="entry{count}" href="#">{title}</a></li>
          {/exp:channel:entries}
       </ul>
    </div>

    <div class="entry-data">
       {exp:channel:entries channel="foo" limit="10" dynamic="no"}
         <div class="entry-data entry{count}" style="display:none;">
             {data}
         </div>
       {/exp:channel:entries}
    </div>

```

Then in your js do something like this:

```
$(document).ready(function (){
   $('.select-entry a').on('click', function(e) {
      e.preventDefault;
      var class = $(this).find('a').attr('class');
      $('.entry-data').hide();
      $('.entry-data .' + class).show();
   });
});

```

So you create two instances of your channel entries. One is for the listing the other is for the data. We give them unique classes using the "count" variable. Then in jquery, we prevent the a click, hide all any other selected data, get the clicked "a" tags class and shows the appropriate div based on that class.
> 1 votes

---
Tags: channel-entries, jquery
---


# Question
Title: Channel Form : Passing data into a Playa or Relationship field
I need to allow users the ability to create an entry via the front end hence I'm using Channel Form.

In the CP I have set up several custom fields in this channel to be either a Playa field or a Relationship field.

In the Channel form page I am building SELECT statements by looping through a channel:entries tag building the value to be the entry\_id and the text to be the title.

When I save the form the value of these fields are not being saved to either of the playa or relationship fields.

Is it possible to do this? Should I be passing in some other value other than the entry\_id? I have the SELECT names set to the name of the custom field.

Oh and as an added complication the user is also selecting one of the site members. Currently I'm just saving the member\_id to a text field so it's just showing up as a number. Is there any plugins I could use that would allow the editor in the CP to see the members name rather than their ID?

# Answer
Updating the field name to name="custom\_field\_name\[data\]\[\]" was the solution:

```
<select class="" name="log_skill[data][]" id="log_skill">

```
> 1 votes

---
Tags: channel-entries, playa, members, channel-form
---


title: playa in a matrix inside a playa

text:
# Question
Title: playa in a matrix inside a playa
so I am trying to call a Playa (m\_p\_discipline) inside a Matrix (discipline\_3rd\_order) inside Playa (thirdorder) inside of channel:entry. I am using var=prefix to get this far. The results of my code is it lists all available playa list entries not just the ones I am trying to get. I must be close but something is off.

Thanks for looking hope you can help!

```
        <li>
            {thirdorder:discipline_3rd_order}
                {thirdorder:exp:playa:children field="m_p_discipline" var_prefix="matrix_disipline"}
                   {matrix_disipline:title}
                {/thirdorder:exp:playa:children}
            {/thirdorder:discipline_3rd_order}
        </li>

```

# Answer
> 0 votes
The answer according to Brandon at Pixal tonic:

You don't actually need to use {exp:playa:children} if you already have an entry or Matrix row, and you want to just loop through the Playa field's related entries. In that case you can just reference your actual Playa field's short name.

Also, Matrix supports the var\_prefix= parameter as well, which is helpful when looping through Playa-within-Matrix-within-Playa.

```
{3rd_order_under var_prefix="thirdorder_playa"}
        {thirdorder_playa:discipline_3rd_order var_prefix="discipline_matrix"}
            {discipline_matrix:m_p_discipline var_prefix="mx_disipline_playa"}
                {mx_disipline_playa:title}
            {/discipline_matrix:m_p_discipline}
        {/thirdorder_playa:discipline_3rd_order}
{/3rd_order_under}

```

Make sense?

-Brandon

---
Tags: matrix, templates, playa
---


title: CKEditor Integration

text:
# Question
Title: CKEditor Integration
i was searching for a while, but my Google-fu probably isn't strong enough to find out, how to create a CKEditor Fieldtype, or find any plugin, that will do that for me. So what am i asking for? **Does anybody know any EE2 compatible plugin, that will give me a CKEditor Fieldtype (Preferably free one)?**

And additional question, is there any possibility to create new content and edit it using frontend forms (so moderators don't need to go to CP)?

# Answer
> 1 votes
There are three commercial EE add-ons which use CKEditor - all very affordable:

And yes, you can add/edit entries via a front-end form, using the included Channel Form module.

# Answer
> 0 votes
Solved! The free alternative to CKEditor plugin is making a front-end, more user friendly administration using the Channel Form Module and just using the CKEditor as you would normally!

---
Tags: ee2, wysiwyg, ckeditor
---


# Question
Title: Migrating between Development, Staging and Production for a pre-existing ExpressionEngine site
This is a topic which is a major headache for us and I'd like to see how other folks tackle it.

We manage some pretty big sites which run on ExpressionEngine. Our clients sometimes ask for changes and enhancements which take a long time to develop, and so we naturally do that development work on a separate copy of their live website. However, when we come to bring those changes back to the production site it's a nightmare, for the following reasons

1. Software version changes (i.e. modules added/replace, EE upgrades performed, module upgrades performed)
2. EE 'Structural' changes (channels/fields/templates/snippets which have been added/removed/changed)
3. Content changes

1 isn't too painful, 2 is a pain but we've developed some tooling to help us with that (and I believe Christopher Imrie's Site Manager can help with that too). It's number 3 which is a major problem. It's not just the fact that new content has been added, it's the inter-dependencies between all the various tables (and add-on tables) which make it almost impossible to handle.

How are you handling this?

# Answer
> 59 votes
A long time ago I came across a graphic which presented it like this:

**Code** should flow in this direction:

Development \>\> Staging \>\> Production

**Content**, on the other hand, should flow in the opposite direction:

Development \<\< Staging \<\< Production

That is, you should populate your development and staging environments with live content (to test your latest changes), then move your template code to staging and production. In this case code refers to your ExpressionEngine template code.

This is obviously easier said than done in ExpressionEngine since content and structure is stored together in the database, and there is no migration system to speak of. However, I believe it's still important to try and follow this as closely as possible.

Therefore, the way I do things is to document any changes you make to your content structure during development (channels, custom fields etc). Then, if possible, make those structural changes on a staging site, before bringing your template code onto staging. If that works, make the structural changes on production, before updating your template code.

Ideally, any structural changes you make won't break your existing template code (e.g. try to avoid renaming custom fields just for the sake of it). This is why it's important to test things on a staging site first, so you know your live site will not go down as you update your content structure.

Make sense?

# Answer
> 25 votes
In short, we handle these issues on a case-by-case basis. Adrian described it well. Here are two slides from a presentation I did on the topic: schema flow & content flow

The thing that makes the described process easy for us is that we rarely work on multiple large features at a time. We build one, deploy. Build another, deploy. So we don't have to pick and choose which features get deployed at certain times (which would be a huge pain).

# Answer
> 9 votes
I outlined some of the methodologies I have encountered for handling migrations in my EECI talk where I demoed Site Manager. You can find my slide deck here:

https://speakerdeck.com/chrisimrie/eeci-2012-us-ee-and-web-agency

Thanks for the kind words about Site Manager. Early days, but it is definitely our solution to migrating content between local/dev/production sites.

# Answer
> 3 votes
I follow pretty much just what Adrian Macneil explained. I use git and Beanstalk for deployments. It makes it easy to deploy one branch (dev for example) to the staging server online. Once that code is all ready, I merge it with the production branch, and deploy that to the live/production server.

For future reference, there's an add-on being developed for syncing fields, channels, etc. between servers. It's still in alpha, but it looks very promising.

https://github.com/ckimrie/Site-Manager

# Answer
> 2 votes
I would recommend looking at the database migration features of HeidiSQL and Navicat. They both provide robust migration mechanisms that can synchronize the MySQL database underlying your EE instances.

# Answer
> 2 votes
Just published an addon on github to trace db changes into files that can be deployed to your staging server. On the staging server you can re-execute the db changes made on your local development environment (manual or use a hook).

The basics work, but lots of room for improvement.

https://github.com/fccotech/ee-db-trace

Feel free to use/extend/branch etc.. (or create issues if you have trouble making it work)

I also created a forum thread in the EllisLab forums because this might be to META for SE:

http://ellislab.com/forums/viewthread/242709/

# Answer
> 1 votes
I documented our workflow for this in response to "Move ExpressionEngine from development to live", including a link to a video of our git/MySQL steps.

# Answer
> 0 votes
I am doing this all day now. I have 3 installs of EE running the same website. One is a personally hosted version of the website, the other is the client provided preview site and lastly we have the live site.

As Adrian answered I think he totally nailed the flow, but as others have said freezing content is sometimes not an option. You have to then figure out a way to make edits in your development environment and get those edits to fit as closely as possible to the live site.

To echo what Erik said by only deploying one feature at time, that is also helpful too. It keeps overlapping edits to minimum. Even still sometimes that is not an option either. Some clients request a batch of changes at once and then want to preview them before they go live.

What I've done is I track everything!

1. First thing I do is make a full backup of all site files and database from the live site.
2. I'll load these files into my development site. This gets me to the latest version and I'll current at least temporarily. If content is added to the live site I'm not going to get those changes. You'll have to be aware of this and make changes to your code if needed when you move to the live site.
3. Track Everything: I track every template I edit. I track by line number and code added so its easy to push to the live site.
4. Breaking up the updates you make into babysteps is useful. By babysteps I mean i create an outline of the steps I'm taking and I've very detailed about it too. (This does add time to the project, but I would prefer to add time in this way than adding time trying to figure out something I've already done).
5. If i add modules, I track which modules I've installed and the steps to get it working including all of the settings.
6. If i update js or css I also track by line number and code added.

So once my edits are done I end up with a lengthy document that contains every step I took from start to finish. Once approved I begin migrating my changes to the client hosted preview site and hopefully in this stage we nail any issues before going to the live site. Of course i adjust my notes as needed. That step is like a second chance to run through my steps in my document. I test my notes against the process.

I repeat all of these steps once again when i migrate to the live site if all goes well on the preview site.

I'm in the middle of this now. At the very end, once all of my changes are on the live site I'm going to export from the live site and update both of my staging websites. That way all of the sites will be on the most current version.

I have some specific issues in regards to Entry ID numbers not matching in the development, staging, and production sites. I want to get my databases in sync at the end of this procoess so that all of my templates will sync up as well. Right now I have to make a few changes to some templates so they load the correct entry by the ID.

Excellent documentation is the key to success here.

---
Tags: migration
---


# Question
Title: changing permissions on certain categories
I have a page that hides some amount of page content for free viewers. We have a certain category of 'sample' articles which should be available for everyone. Is there an if clause which basically reads if category = x show all content regardless of membership member?

# Answer
Not exactly, but you could put your Channel Entries tag into an embedded template, and use a member group ID conditional to send it the parameters you want based on the visitors membership status.

```
{if logged_in_group_id == 7}
    {embed="template_group/_template_name" categories="1|2|3|4"}
{if:else}
    {embed="template_group/_template_name" categories="1"}
{/if}

```

And on the `template_group/_template_name` embedded template:

```
{exp:channel:entries channel="news" category="{embed:categories}"}

```
> 3 votes

---
Tags: members, ifelse, permissions
---


# Question
Title: how to stop null submission of search in expressionengine
I wants to stop the search field submission, if my search field is empty or null. can anyone help me that how to do this, or is it possible. because when i am clicking on search button when my search field is empty, EE redirects to me on default error template where showing "You did not submit a search term" , i wants to stop the redirection on this page, can i send it to my any other template when my search field will be empty.

Thanks in advance

# Answer
> 4 votes
You have this tagged as PHP, but this sounds more like a job for JavaScript. The Search module is already preventing empty searches, which is why you get that error page. Lots of ways to accomplish this, here is one way if you are using jQuery:

```
$(document).ready(function() {
    $('#search').submit(function() {
        if ($('#keywords').val() == '') {
            return false;
        }
    });
});

```

---
Tags: javascript, simple-search
---


title: Cookies failing with EE

text:
# Question
Title: Cookies failing with EE
I've got the following code working on a static page, but it does not work with EE. Could anyone tell me why?

CSS

```
.contentB {display: none;}

```

HTML

```
<div class="contentA">
   <h1>Sign up to download (set cookie)</h1>
   <button class="clickme">ClickMe</button>
</div>

<div class="contentB">
   <h1>Download (cookie set)</h1>
</div>

```

JS

```
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.cookie.js"></script>
<script type="text/javascript">
$(document).ready(function () {
        $(".clickme").on('click',function() {
            $.cookie('showContent', 'true', { expires: 7, path: '/' });
          });

 });

$ (function (){
    if ($.cookie('showContent') == 'true') {
        $( ".contentB" ).show();
        $( ".contentA" ).hide();
    }
});
 </script>

```

Basically I want to show contentB and hide contentA if the cookie is present.

# Answer
> 2 votes
```
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.cookie.js"></script>

```

This is likely your problem - you're calling your scripts in a relative fashion, but your URL likely has multiple segments, so the browser is looking for the scripts in the wrong place. Change these to absolute references:

```
<script type="text/javascript" src="/jquery.js"></script>
<script type="text/javascript" src="/jquery.cookie.js"></script>

```

---
Tags: cookies
---


# Question
Title: Restrict file browsing in Wygwam / CKEditor
Is there a way to show only files belonging to the current EE user in CKEDitor file browser?

Failing that, can I remove the delete option from the context menu in the CKEDitor file browser to prevent different users from deleting each others files?

Failing both of those - is there an alternative that is better suited to multi-user use (i.e. one that fulfills my first option).

Thanks in advance.

# Answer
> 1 votes
Yes, try this plugin: **https://github.com/pixelandtonic/wygwam\_upload\_tags**

You'll have to change the path in your file settings to include {member\_id}

---
Tags: wygwam, channel-form
---


# Question
Title: Is there a Realex Payments module for Expresso Store 2?
As per this post (from October last)

https://expressionengine.stackexchange.com/questions/14325/expresso-store-realex-payments#*=*

Is there any support for Realex Payments provider? I have commissioned the Realex payment module for the previous version of Store, but we have moved on the upgrades and now need to offer the same thing for what is a much better store version.

# Answer
Unfortunately we've not had time to implement it for Store v2 as of yet. There are a few complications with that gateway that we found out about when building integration with Store v1. For that reason it took a bit more work than the others and as of yet we haven't had a chance to build a gateway extension for it.

A few people have mentioned they'd be interesting in sponsoring development of it but as of yet we've not had any follow-ups. The option is always there for split cost sponsorship. If enough people are interested then it wouldn't work out that much at all when divided.
> 1 votes

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


# Question
Title: Member Activation email are not received from Bluehost accounts
I'm using "Self-activation by email" for new members, and FreeMember for the front end form. However new members are not being sent the activation email.

I have done more testing and found this is true for all my EE sites on Bluehost. I have tried this on a 1.7, 2.7, and 2.8 EE site. I have also tried it with email accounts hosted on Bluehost and those not on Bluehost. None have worked for me.

What I've tested:

* I can email members (pending or activated members) via the communicate section.
* I have tried all three options (PHP, SMTP, and SendMail)
* my local build (MAMP) works fine
* email debugging doesn't produce any errors
* using the 're-send activation' link does not work either
* I disabled email activation, tried a test registration that worked, then enabled activation and it still didn't work.
* I get the admin notification emails instantly when a new member registers (i.e. the "A new member has registered..." email)
* I can send email via the "communicate" feature in the CP
* Password reset emails are working and are sent to the member
* The same is true for other installs of EE (v1.7, 2.7, 2.8) on three separate Bluehost accounts. All of these are the basic shared hosting plan.

Bluehost support says that logs show the emails are being sent.

Is there anything different about how the Member Activation email messages are sent? It sounds like it could be a global filter that Bluehost has applied that is blocking all of these.

Anyone else have EE on a Bluehost shared server and can test? Can you confirm that new member activation emails are or are not received?

# Answer
> 4 votes
Bluehost (and maybe other hosting companies) filters these activation messages. What I was told by the level III tech:

> This was difficult to track down, but I was able to find that the message was getting caught in a spam filter because of the subject of the message subject="Enclosed+is+your+activation+code". This looks to be a common subject that unsolicited messages use, do you know if you are able to customize the subject of your registration notices to prevent the messages being categorized with unsolicited messages?

To fix the issue you need to change the email subject. That can be done by logging into the control panel and then going to:

Design \> Message Pages \> Email Notifications

Click on "Member Account Activation Instructions". You can change the email subject and body here. I used "Welcome to \[sitename\]!" as the subject and also changed the body to be a bit more friendly and less spammy.

I then tested with an email address that had failed every time and voila, it worked.

# Answer
> 2 votes
This could be down to security on your mail server rejecting a non-existant "from" address. Does the email address set up for EE return emails actually exist?

You might also want to try putting the mail through a transactional service such as Mandrill at least to debug what's going on. That will tell you whether or not the mail is being sent and just not received or never even being sent.

# Answer
> 2 votes
I recommend bypassing BlueHost altogether and getting set up with a 3rd party email service like Mandrill. Install the Escort add-on, enter your API key, and you're done!

The nice thing about the 3rd party services is they track incoming and outgoing messages and provide analytics for each one, so you can do really fine-grained troubleshooting instead of the guesswork of SMTP on your host.

---
Tags: email, activation, bluehost
---


# Question
Title: Trouble Upgrading from 2.5.5 to 2.8.1 - white screen
I have been trying to upgrade a site from EE 2.5.5 to EE 2.8.1, but I get a white screen on the admin.php page after the upgrade is complete. The only way to get rid of the white screen is to disable extensions in the config.php file. I also get the login window that usually appears after the usual non-use timeout, except it is not a popup. This happens, when I am logged in. It appears at the bottom of the control panel - see screebshot below.

I have tried upgrading all plugins, but so far I cannot enable extensions without getting the white screen.

I have upgraded numerous sites to EE 2.8.1 but none have been this problematic. Any sage advice is welcome.

Thanks.

# Answer
Have you checked all of your installed add-ons for updated versions? White screens are also typically a sign of hidden errors, so make sure that `display_errors` is enabled in your PHP environment, and set the `$debug` value in the `admin.php` file to `1`. That may reveal a PHP error that identifies the problem.

If that doesn't help, and you think you have the latest versions of each add-on but it's still not working, as a last measure of debugging you could flip the `enabled` field for each entry in the `exp_extensions` table to `n` (after noting which are already y/n so that you can restore those values after testing). Then re-enable them one at a time by updating each row to `y`. When you run into the problem again, you've at least identified the offending add-on.
> 5 votes

---
Tags: upgrade, extension, 2.8
---


# Question
Title: set the order to a Select menu loaded from channel fields
I have a select menu where the values are loaded from a channel field. Is it possible to set the sort order using Freeform Pro? The code below does not work and I have not found any documentation. Surely though there must be a way to sort the contents of a select menu loaded from a channel by something other than entry\_id.

```
           {freeform:field:field_001
            attr:id="493"
            attr:class="form-control"
            attr:orderby="title"
            attr:sort="asc"}

```

I also tried this code below but obviously the data would not submit.

```
        <p><label for="field_001">First Choice</label><span class="required">* </span><br />
            <select name="field_001" class="form-control" id="dd_biology_reu_faculty_001">
                <option value="">Select</option>
                {exp:channel:entries channel="channel_name" orderby="title" sort="asc" dynamic="no"}
                    <option value="{entry_id}|~|{title}">{title}</option>
                {/exp:channel:entries}
            </select> </p>

```

Thanks in advance.

# Answer
> 1 votes
Chalk this one up to "Operator Error!"

This code worked:

```
    <p><label for="field_001">First Choice:</label><span class="required">* </span><br />
    <select name="field_001" class="form-control" id="field_001">
        <option value="">Select</option>
                {exp:channel:entries channel="channel_field" orderby="title" sort="asc" dynamic="no"}
                    <option value="{title}">{title}</option>
                {/exp:channel:entries}
            </select> </p>

```

---
Tags: solspace-freeform
---


title: Non existing content redirection

text:
# Question
Title: Non existing content redirection
my google-fu failed again, and i have a serious problem. I have a channel and template for it called html, when i go to page.com/html/(existing article name), it works just fine, but when i go to page.com/html/(non-existing article), it shows the article with lowest ID instead. So what am i asking for? **How to redirect user to 404 page, when he opens page.com/html/(non-existing article name)?**

# Answer
You need to use the `require_entry` parameter:

```
{exp:channel:entries limit="1" require_entry="yes" [...]}
  {if no_results}
    {redirect="404"}
  {/if}
  [...]
{/exp:channel:entries}

```

This parameter make the `{if no_results}` conditional available.
> 4 votes

---
Tags: ee2, channel, 404
---


# Question
Title: EE and Structure - View Page links don't work
EE 2.7.3 (recently upgraded from v2.5.2 to v2.7.3) Structure 3.3.14.5 PHP 5.3.3 MySQL

I recently updated from v2.5.2 to v2.7.3. I'm now seeing in Structure that the View Page links dont work anymore. What I mean by that is when I click the View Page button in the EE CMS, Structure page, I see the browser start to load the page (i see the loading icon in Chrome appear) but then it stops before taking me to the page.

We run the entire site under https://

Below is what one of the urls from a View Page link looks like...What do you think could be causing this issue? Do you have any suggestions for me to try to fix it?

```
https://ourwebsite.com/system/index.php?S=aa6cefbdfb8a27770b11082fc7bd71cb&D=cp&C=addons_modules&M=show_module_cp&module=structure&method=link&entry_id=322

```

# Answer
> 0 votes
I'd start by reuploading your /themes directory. When there is oddness in the CP, it's often related to missing or corrupted /themes files.

---
Tags: structure
---


# Question
Title: Anyone know of a replacement for simplepagination?
On our site we've been using simplepagination (http://www.vayadesign.net/software/simple-pagination/release-notes) which lets us specify a page break by merely inserting {pagebreak} into the body of a post.

However this plug-in seems to have stopped working in the EE 2.7.x and the developer is no longer working on it.

Has anyone found an alertnative?

# Answer
I look into this and couldn't find any replacement. I suggest you to go with the default solution. It doesn't do everything you want to, but is better than keep all your system outdated.

I'm sorry.
> 2 votes

---
Tags: pagination
---


title: Check if member password is blank

text:
# Question
Title: Check if member password is blank
Is it possible to conditionally show a form field if the member password field is blank. Something along the lines of

```
{if password == ""}SHOW THESE FIELDS{/if}

```

I have a Cartthrob shopping cart that auto registers member on purchase and I want to give them the opportunity of setting a password on the cart summary page. I don't want to show the set password form if they are a returning customer/member (ie password field is not blank)

Running EE 2.7.2 CT 2.5 PE

# Answer
> 0 votes
Unless I'm missing something if they're a member and logged in you could use the conditional `if logged_in` to show/hide stuff or alternatively the opposite conditional `if logged_out` to show/hide stuff as well.

Also I'm not sure you can create a member without a password.

---
Tags: cartthrob, members, profile-edit, password
---


title: get url_title from title?

text:
# Question
Title: get url_title from title?
I have a code which looks like this:

```
{exp:channel:entries channel="videos" search:category="some_category"}
<span>{some_field}<span>
<a href="www.domain.com/videos/{How to get url_title of this particular {some_field}?}"></a>
{/exp:channel:entries}

```

The problem is i cant go for another exp tag inside an exp tag.I want to redirect the user to a url that has url\_title of the field(this title is being populated by a field from another channel).

**I dont want to redirect the page to some other template.I just want to append a url title to www.something.com/videos/{append url title here...} .**

# Answer
> 1 votes
You would simply use {url\_title} within your entries loop.

```
{exp:channel:entries channel="videos" search:category="some_category"}
<span>{title}<span>
<a href="www.domain.com/videos/{url_title}"></a>
{/exp:channel:entries}

```

In light of new information...

If the field is a relationship or Playa field you can access the URL title by using the field name as a tag pair and then your required tag within that. The precise method may vary depending on how you have things set up but try something like

```
{exp:channel:entries channel="videos" search:category="some_category"}
<span>{title}<span>
<a href="www.domain.com/videos/{mycustomfield}{url_title}{/mycustomfield}"></a>
{/exp:channel:entries}

```

This *may* not work due to namespacing and will return the url title for the parent entry, in which case you could try {mycustomfield:url\_title}

Here are the docs for relationships in EE. Note that the way these work has changed in recent versions so if you are using an older version of EE you may need to do it slightly differently.

If all that fails then you could resort to using an embedded template but that's not particularly efficient.

# Answer
> 0 votes
Try using the **title\_permalink** tag, for example:

```
{exp:channel:entries channel="videos" search:category="some_category"}
 <span>{title}<span>
 <a href="{title_permalink='videos'}"></a>
{/exp:channel:entries}

```

{title\_permalink} - This variable uses the “url title” as the link. It defaults to the site index with the “url title”

In addition, you can specify a specific template group/template and the “url title” will automatically be added:

```
{title_permalink="template/location"}

```

see: http://ellislab.com/expressionengine/user-guide/add-ons/channel/channel\_entries.html#title-permalink

##

## Update

If you simply want to echo out the url title you should be able to use the variable:

```
{url_title}

```

"The human readable title used in the URL as a permalink."

http://ellislab.com/expressionengine/user-guide/add-ons/channel/channel\_entries.html#id8

---
Tags: ee2, url, tags, url-title, title
---


# Question
Title: php class should return JQ library single time when its calling multiple time in single template
i am using a php class that returns jquery library if the class calls multiple times on same page it should include that jquery library single time .

it works if class called single times it works fine but if i call it multiple times it shows js conflict due to multiple times added of jquery library.

how can i make it sigle time include only whenever the class called multiple times....

# Answer
You can use the session cache to know what your plugin already did while loading the page. Unlike the session class, which is new, the session cache is there by a long time. It's intended to avoid unnecessary repeated actions.

You can create a variable called, let's say, `jqueryfied`.

```
if ( ! ee()->session->cache('my_add-on_class', 'jqueryfied'))
{
   // add your code to include the jquery

   ee()->session->set_cache('my_addon_class', 'jqueryfied', true);
}

```

See? Now you add-on knows if it already included the jquery script on the page.
> 0 votes

---
Tags: ee2, php
---


# Question
Title: Can't save templates containing Query tags
I've set up a staging server for an existing EE2 website, when I make changes to templates and save most templates save ok, but when I try to save a template that has an EE query tag, I get the following error and it fails to save: 'You don't have permission to access /system/index.php on this server.'

If I remove the query tag, it saves with no problems.

# Answer
You may want to check if mod\_security is installed on your server and either disable it or change the configuration. My guess is that your issues is that mod\_security is seeing the SQL query in your query tag and blocking the submission.
> 3 votes

---
Tags: templates, query
---


title: Wrong entry_date

text:
# Question
Title: Wrong entry_date
I just make new entries (19 may 2014) and on my site I get for entry\_date 05 may 2014. I use plain EE tag:

```
{entry_date format="%m %F %Y"}

```

Any idea what is going wrong?

Francois

# Answer
In your entry\_date tag you're using (date formatting docs):

```
%m (month)
%F (month, textual, 3 letters)
%Y (year, 4 digits)

```

So it's outputting as you've entered it. If you want 19 may 2014, change %m to %d like:

```
{entry_date format="%d %F %Y"}

```
> 4 votes

---
Tags: entry-date
---


# Question
Title: How to reference snippet variables inside a stylesheet template
EE doesn't seem to be parsing {snippet} tags inside a template of type stylesheet - I'm guessing because the curly braces conflict with CSS's own braces indicating the start of a style declaration. Is there a way to sort of escape these characters or something?

Ex:

```
.style { /* CSS curly brace */
  width: {snippet_width}px; /* EE curly brace */
}

```

# Answer
While use cases for it are rare, CSS templates can parse tags if you need them to, but you must link to them with `{path='template_group/css_template'}` instead of `{stylesheet='template_group/css_template}`.
> 4 votes

# Answer
EE's CSS and JS templates do not parse variables or tags. They're just static templates. Best to avoid EE altogether and just create CSS and JS files on the server. To still be somewhat dynamic, you can always hard-code rules in the `<head>` (for CSS) or above `</body>` (for JS). For example:

```
<style>
   .style {
       width: {snippet_width}px;
   }
</style>

```
> 2 votes

---
Tags: templates, css, snippets, stylesheets
---


# Question
Title: Upgrade failed towards the end and won't continue, CP is blank
I was upgrading my client’s website from a pretty early version (around 2.4 or something) to the latest. I followed all the steps in the upgrade process and when it started I could see it incrementally making upgrades.

However, it came up with this error after a while:

{“error”:” Error Number: 1060\</p\>\n\n Duplicate column name ‘includeseconds’\</p\>\n\n ALTER TABLE exp\_members ADD \n\tinclude\_seconds char(1) DEFAULT ‘n’ NOT NULL AFTER time\_format\</p\>\n\n Filename: /www/eh20217/publichtml/system/codeigniter/system/database/DB\_driver.php\</p\>\n\n Line Number: 382\</p\>”}

I then tried to do the upgrade again but it keeps carrying me to a blank page. I did some googling and decided to delete the safecracker folder from third party but that’s no help

I’ve tried deleting the installer folder but when I do that the control panel appears as blank.

I tried moving the installer folder to the root and then turned off extensions via config:

$config\[‘allow\_extensions’\] = “n”;

And I actually get to the CP login screen but once I submit it goes to a blank page. I’ve deleted switchee from the third party folder because I also saw that someone was getting issues with that plugin when upgrading, but it hasn’t helped.

I also posted this as an urgent ticket since yesterday but I guess as it's weekend response time is slow.

Any help would be appreciated!

# Answer
> 0 votes
There were a few issues, all to do with outdated addons, which EE's support were stellar about investigating and fixing:

After turning on debugging this came up:

```
Fatal error: Call to undefined method Category_model::get_categories()

```

This was caused by the Developer accessory and updating it fixed the issue.

Then we had 2 fieldtypes with the same issue - one was carthrob\_matrix and the other was pt\_switch. This was the basic error:

Fatal error: Call to undefined method EE\_Fieldtype::EE\_Fieldtype() in /www/redacted/public\_html/redacted/expressionengine/third\_party/cartthrob/fieldtypes/ft.cartthrob\_matrix.php on line 40

And we fixed it like this: http://devot-ee.com/add-ons/support/simple-s3-uploader/viewthread/12869

We also had another issue with imgsizer:

Call to undefined method EE\_Functions::remove\_double\_slashes() in /www/redacted/public\_html/redacted/expressionengine/third\_party/imgsizer/pi.imgsizer.php on line 42

It's really old and was calling a deprecated function. Robin switched out reduce\_double\_slashes() from the string helper for remove\_double\_slashes() and that seems to have it working.

The lesson is obviously to upgrade all addons before upgrading and to upgrade your EE installation often, don't wait 2 years ;(

Again, Robin at EllisLab was really great in tracking all this down and helping to fix it.

---
Tags: upgrade, white-screen-of-death
---


# Question
Title: multiple sliders one page - Stash parse order and Playa
Concept is to stash entry\_ids of playa entries to pass to jquery-nivoslider call, so that both the slider div and the call will not have identical slider ID's resulting with conflict.

```
{exp:stash:set_list
name="rehab_list"
parse_tags="yes"
trim="yes"
parse_depth="4"
}

   {exp:channel:entries
   channel="rehab"
   url_title="{segment_3}"
   limit="1"
   require_entry="yes"
    }

    {stash:rehab_entry_id}{entry_id}{/stash:rehab_entry_id}
    {stash:rehab_url_title}{url_title}{/stash:rehab_url_title}
    {stash:rehab_title}{title}{/stash:rehab_title}

{stash:playa_stash_test}test{/stash:playa_stash_test}

   {exp:stash:set_list:nested
name="rehab_update_list"
trim="yes"
parse_tags="yes"
parse_depth="3"
}

    {exp:playa:parents
    channel="rehab_update"

    limit="10"}

          {stash:playa_test}test22{/stash:playa_test}
               0{stash:playa_entry}|{entry_id}{/stash:playa_entry}
                {stash:playa_title|{title}{/stash:playa_title}

                {image_uploads sort="asc"}{photo_images size="thumbnail"}
                {stash:playa_entry_img}{photo:url}{/stash:playa_entry_img}
                {stash:playa_entry_img_label}photo_label}   {/stash:playa_entry_img_label}
        {/photo_images} {/image_uploads}

   {stash:playa_summary_update}{summary_update}{/stash:playa_summary_update}
   {stash:playa_materials_needed}{materials_needed}{/stash:playa_materials_needed}
   {stash:playa_steps_taken}{steps_taken}{/stash:playa_steps_taken}

    {/exp:playa:parents}
     {/exp:stash:set_list:nested}
  {/exp:channel:entries}
  {/exp:stash:set_list}

```

# Answer
Set your var like this, using the trim parameter to remove whitespace and line breaks from the captured variable:

```
{exp:channel:entries channel="rehab" url_title="{segment_3}" limit="1" require_entry="yes"}
    {exp:stash:set name="update_ids" parse_tags="yes" trim="yes"}
        0{exp:playa:parents channel="rehab_updates" status="open" limit="10"}|{entry_id}{/exp:playa:parents}
    {/exp:stash:set}
{/exp:channel:entries}

```

**Using the captured variable**

Use the `process="end"` parameter to delay the parsing of the wrapped code block until the end of template parsing (i.e. after the variable has been set). Inside `{exp:stash:parse}` tag pairs, stash variables can be accessed as placeholders in the form `{stash:my_var}`, which saves you having to use `parse="inward"` when passing a tag as a parameter.

```
{exp:stash:parse process="end"}
    {exp:channel:entries channel="rehab"}
      {exp:playa:parents channel="rehab_updates" status="open" entry_id="{stash:update_ids}"}
        <script type="text/javascript">
          $(window).load(function() {
            $('#slider-{entry-id}').nivoSlider({});
          });
        </script>
      {/exp:playa:parents}
    {/exp:channel:entries}
{/exp:stash:parse}

{exp:stash:parse process="end"}
    {exp:playa:parents channel="rehab_updates" status="open" limits="10" entry_id="{stash:update_ids}"}
{/exp:stash:parse}

```
> 2 votes

# Answer
Snippets parse first, so your Stash tag `{exp:stash:update_ids}` gets read directly as it's written without being parse when that snippet code gets parsed. You can test that by only putting `{exp:stash:update_ids}` in your snippet.

Possible solution: Move that snippet code either into a Stash embed or regular EE embed.

Also, the limit parameter is just `limit="10"` not `limits="10"`.
> 1 votes

# Answer
This is also possible and less complicated if you use sort="entry\_id" orderby="asc" it would in essence accomplish what the idea was
> 0 votes

---
Tags: playa, stash, jquery
---


# Question
Title: URL to search a field for keyword on Low Search
We have a query which searches a specific custom field for a given keyword.

As an example lets assume we have a table of results, one of the columns data is a custom field called 'my\_colour' which contains a colour such as red.

When we click 'red' we want to show all results from a collection where the field 'my\_colour' contains 'red'.

This would give something like the following URL:

`http://example.com//results?search:my_colour=red`

Which works, but our question is, is there is a specific tag to do this for example:

`{exp:low_search:url search:my_colour='red'}`

We DONT want use filter to append the current URL, instead simply display a specific set of results for the field and keyword.

# Answer
> 1 votes
At this moment, using the URL tag *and* GET variables for the query (not encoding it) will always use the existing query and apply the given URL tag's parameters to it. If you switch to encoded queries, you can "reset" the query by not defining a `query` parameter.

You could create the non-encoded query by hand, by composing the query string yourself:

```
http://example.com/results?search:my_colour={the_color_var}

```

---
Tags: custom-fields, url, low-search
---


# Question
Title: Building slider with Low Variables, Matrix and playa
I am not figuring this one out. It's my first time trying to combine Low Variables, Matrix, and playa.

I have a slider on the homepage that is populated with Low Variables. Within LV I used Matrix to create the individual slides.

Within Matrix you can choose a project with playa which pulls in the background image (channel images), the title, and location with a link to the project.

There is another field in Matrix to give a general title to the slide. Below is my code, any help would be great!

```
<div class="flexslider masthead">
<ul class="slides">
{exp:low_variables:pair var="lv_home_slider"}
{lv_home_slider}
<li>
<div class="inside-wrap">
<div class="masthead-txt">
<h1>{hero-tagline}</h1>
{exp:playa:children var="featured_project" limit="1"}
<h2>{title}</h2>
<h4>{project-location}</h4>
<a href="{title_permalink='what-we-do/projects'}" class="btn btn-fill">View Details</a>
</div>
</div>
{exp:channel_images:images entry_id="{entry_id}" field="masthead_image" limit="1"}
<div data-picture data-alt="{title}">
<div data-src="{image:url:small}"></div>
<div data-src="{image:url:medium}" data-media="(min-width: 700px)"></div>
<div data-src="{image:url}" data-media="(min-width: 1000px)"></div>
<!--[if (lt IE 9) & (!IEMobile)]>
<div data-src="{image:url}"></div>
<![endif]-->
<noscript>
<img src="{image:url}" alt="{title}">
</noscript>
</div>
{/exp:channel_images:images}
{/exp:playa:children}
</li>
{/lv_home_slider}
{/exp:low_variables:pair}
</ul>
</div><!--flexslider-->

```

# Answer
From a Low Variables point of view, you don't need to add the Matrix variable pair inside the `low_variables:pair` tags. So instead of this:

```
{exp:low_variables:pair var="my_matrix_var"}
    {my_matrix_var}
         matrix content here
    {/my_matrix_var}
{/exp:low_variables:pair}

```

...you'd need to use this:

```
{exp:low_variables:pair var="my_matrix_var"}
     matrix content here
{/exp:low_variables:pair}

```

As for all the Matrix/Playa/Channel Images bits; can't really help with that, although it would be useful for you to add what it is that's not working for you.
> 0 votes

---
Tags: matrix, playa, low-variables, channel-images
---


title: Cartthrob Checkout PHP Errors

text:
# Question
Title: Cartthrob Checkout PHP Errors
Managed to checkout fine before switching email notifications on. After switching to "Log and send" I now get a number of PHP errors using Cartthrob 2.5 and EE 2.7.2

Has anyone had a similar issue and managed to resolve?

```
A PHP Error was encountered

Severity: 8192

Message: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead

Filename: core/Security.php

Line Number: 483

A PHP Error was encountered

Severity: 8192

Message: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead

Filename: core/Security.php

Line Number: 484

A PHP Error was encountered

Severity: 8192

Message: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead

Filename: core/Security.php

Line Number: 483

A PHP Error was encountered

Severity: 8192

Message: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead

Filename: core/Security.php

Line Number: 484

A PHP Error was encountered

Severity: 8192

Message: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead

Filename: core/Security.php

Line Number: 483

A PHP Error was encountered

Severity: 8192

Message: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead

Filename: core/Security.php

Line Number: 484

A PHP Error was encountered

Severity: 8192

Message: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead

Filename: core/Security.php

Line Number: 483

A PHP Error was encountered

Severity: 8192

Message: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead

Filename: core/Security.php

Line Number: 484

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/damelin/system/codeigniter/system/core/Exceptions.php:170)

Filename: libraries/Functions.php

Line Number: 809

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/damelin/system/codeigniter/system/core/Exceptions.php:170)

Filename: libraries/Functions.php

Line Number: 809

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/damelin/system/codeigniter/system/core/Exceptions.php:170)

Filename: libraries/Functions.php

Line Number: 809

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/damelin/system/codeigniter/system/core/Exceptions.php:170)

Filename: libraries/Functions.php

Line Number: 414
```

# Answer
> 1 votes
It looks like there are some core functions in your EE version that aren't support anymore by your version of PHP.

You could upgrade EE to the latest version and hope this fixes the problem. If this doesn't help you should make a bug report.

If you want to solve the problem yourself, you can open up the files mentioned in the php errors and edit those. What you need to do is remove the `e` at the end of the first parameter of `preg_replace`.

Like so:

```
preg_replace("/\%u([0-9A-F]{4,4})/e","'&#'.base_convert('\\1',16,10).';'", $str);

```

Becomes:

```
preg_replace("/\%u([0-9A-F]{4,4})/","'&#'.base_convert('\\1',16,10).';'", $str);

```

---
Tags: cartthrob, php-errors
---


# Question
Title: EE 2.7.1 - Channel Form for new entry not working
I have completed the editing of entries with Chanel\_Forms, but I can't get channel\_forms to create an entry. I am running MSM and have EE 2.7.1. Below is my code. You can see this is extremely basic. What is going wrong here? When I submit, the page just refreshes and does not enter the new entry in EE CP.

```
            {exp:channel:form
                channel="test_channel"
                site="blogs"
                id="newEntryForm"
                return="{site_url}/inline/URL_TITLE"
            }
                <label for="title">Title</label>
                <input type="text" name="title" id="title" value="{title}" maxlength="100" onkeyup="liveUrlTitle();">
                {label:test}
                {field:test}
                <br/><br />

                <input id="submitMe" type="submit" name="submit" value="Submit">
            {/exp:channel:form}

```

---

Sorry guys... I bounced off of this project completely. I will rebuild this test environment and make the suggested changes to reply with the results.

# Answer
> 1 votes
A few things to check:

1) Are there any required fields that you didn't add to the form?

2) Does the user you're logged into as (or the guest user you are using) have permissions to post in the channel?

3) Have you tried adding in the URL title field? It's not supposed to be required, but I've had that cause issues before.

# Answer
> 0 votes
In addition to Jeremy's suggestions... Triple check these two parameters

```
channel="test_channel"
site="blogs"

```

They must match what is set in EE.

---

If you're using a guest user\_ID to allow users to post to the channel, you must set the **logged\_out\_member\_id** parameter on the form tag and that member group must have permissions set to post to the channel.

# Answer
> 0 votes
I had this same problem, but I discovered that the form worked when it wasn't in the "home page" template group.

Literally just changing a different template group to the "home page" group magically made the channel form start writing to the database correctly.

It's not a permanent solution, but it may be a workaround.

---
Tags: ee2, safecracker, entries, saef
---


# Question
Title: Displaying Count of Large Amount of Entries - Best Practice?
we need a 'counter' which displays the total number of entries for a given channel limited by category and status.

Were originally doing this via the EE Stats module before the Status/Cats requirement was added, the Stats module can't handle those parameters so need another approach - we're talking about possibly 10k entries so we can;t sure 'count' - it's going to have to be a query or a plugin.

Does anyone have any suggestions for that sort of large amount? Thanks!

# Answer
> 7 votes
The query module would do nicely here. Unless the information rapidly changes and 100% accuracy is necessary, I also recommend tag caching if the page itself is not cached.

```
{exp:query sql="SELECT COUNT(*) AS total
    FROM exp_channel_titles t
    WHERE t.channel_id = 1
    AND t.status IN ('open', 'featured')
    AND t.entry_id IN (SELECT entry_id FROM exp_category_posts WHERE cat_id = 265)"
    cache="yes" refresh="43200"}
        There are {total} entries in Channel ID 1 with a Category ID of 265.
{/exp:query}

```

You can of course change the `channel_id` and `cat_id` as necessary.

---
Tags: count, query-module
---


# Question
Title: CartThrob and PayPal Website Payments Pro - Declined: Timeout processing request
I have an EE 2.7.3 site running CartThrob Pro 2.5. The site is running on a Nexcess server and we have SSL installed. We set up the gateway values for Paypal Website Payments Pro, and I have tested against the following:

* sandbox with paypal sandbox testing credit card
* live mode with actual paypal values and two different "real" credit cards

In all instances, we are getting the following error: "Declined: Timeout processing request"

I have verified that cURL is enabled. I also tested with the sample cart templates provided by CartThrob. We always get the same error.

Does anyone have advice on what to check or how to troubleshoot this one?

Thanks! Tim

# Answer
> 1 votes
OK, here is the solution. The form needed an input for the credit card security code. We are not requiring that, but it had to be in there as a hidden input.

---
Tags: cartthrob
---


title: EE solution for image-zooming on hover?

text:
# Question
Title: EE solution for image-zooming on hover?
I'd like to do something like at http://www.jacklmoore.com/zoom, zooming into an image on hover. Is there a preferred/popular way of doing this in EE? Any recommended software?

# Answer
> 4 votes
Image zooming is a front-end/template issue, so you can do whatever you want. Just follow the instructions of the jQuery plugin you want to use.

---
Tags: image, image-galleries
---


# Question
Title: Where do I add the cartThrob License Code?
I may be dense, but I do not see where to add the license number. In the installation instructions it says in the "Global section", I can't find this section. Besides that installation was very simple. a route to the global section or any other hint as to where to add the license key would be helpful. thanks!

# Answer
Assuming nothing has changed with recent versions of Cartthrob, and Cartthrob has been properly installed you should go to Add-Ons-\>Modules-\>Cartthrob, then you should see a place to enter the licence number. (under the Global tab).

You may also have shortcut to go directly to the Cartthrob settings page in your Control Panel menu bar.
> 1 votes

# Answer
It's possible the CartThrob developers removed the field for the license number and have not updated their docs. It is not required that you add the license number and the Module will not stop working if it's not there.
> 1 votes

---
Tags: cartthrob, license
---


# Question
Title: Advanced Settings don't get saved (Wygwam)
I'm using EE 2.8.0 and updated to Wygwam 3.3. I'm adding some advanced settings in the Wygwam configuration (eg.g for the Basic set) in the CP - when saving and going back to the Wygwam configuration page, all the advanced settings are lost.

Anyone else experiencing the same problem?

# Answer
I can confirm that the advanced settings do appear to get saved - they just don't appear again on the Editor Configurations page. This seems to be a bug which prevents the display of the advanced configurations rather than a bug in saving them. The advanced configurations I saved were available for use on the publish page.
> 1 votes

---
Tags: wygwam
---


title: Closed entries show in search results

text:
# Question
Title: Closed entries show in search results
Using the search\_results tags to display results I added a parameter like when displaying channel entries, status="Open" to specifically show only "Open" entries, but it still shows Closed entries.

Any guidance on this would be greatly appreciated.

# Answer
I would try making the Open uncapped to status="open".

Maybe not the fix, but I have had weird issues around that.
> 1 votes

# Answer
You need to ensure you are setting the status on the search form tag itself, rather than on the results tag.
> 1 votes

# Answer
You don't need to set status="Open" anywhere in your templates. ExpressionEngine already assumes you want "open" entries and will return "open" entries by default.
> 0 votes

---
Tags: ee2, channel-entries, search, entries
---


# Question
Title: Is there a different uploader for the Channel Form that can upload images instantly?
I am building a channel form for creating entries outside the control panel and I am having a small problem with uploads.

The form allows the user to upload 6 image files and the way I do it is by having 6 separate file upload fields. If try to create an entry from the control panel, I can upload each file separately. So when I am done completing the form and hit submit everything is posted almost instantly. On the channel form though the problem is that the user selects the files to upload for each one of the 6 file upload fields, but ALL the files are uploaded only once the user hits the submit button. Now imagine having 6 separate 1MB files… it could take ages for the upload to complete.

A potential solution could be to disable the submit button once the user presses it and maybe show a message informing them that this might take a while based on the file sizes. But I believe that it would be better to have a different uploader. Something that would upload the files instantly and let the user move one with the rest of the form. A preview of the uploaded image would be nice too. :-)

Does anyone know something like this for ExpressionEngine? Is there an uploader plugin that can do what I want or any other solution?

# Answer
> 1 votes
Mega Upload (http://www.devdemon.com/mega\_upload) would be a good add-on to look into for this. I use it for my channel forms.

# Answer
> 1 votes
Checkout Photo Frame. It does exactly what you want.

Docs https://objectivehtml.com/photo-frame

Devot:ee http://devot-ee.com/add-ons/photo-frame

---
Tags: file-uploads, channel-form
---


# Question
Title: Simple search - Only works the first time?
My users only get proper search results when using the simple search form the first time. Each subsequent search either returns no results or an error.

"The action you have requested is invalid."

EE 2.7.2

Has anyone seen this or have insight?

# Answer
> 2 votes
I was running into a similar error earlier, and the culprit was the template and/or tag caching on the page where the search form was rendered. Might be the source of the problem here as well; if you have any of the EE-based caching options enabled, try disabling them and see what happens.

# Answer
> 2 votes
Are your users behind a corporate firewall? Sometimes those will include proxies that use their own caching, delivering stale forms to visitors. If that's the case, the network admins should be able to disable network caching for the site.

---
Tags: ee2
---


# Question
Title: Conditionally targeting the 404 template
When I get a 404 page, the URL in the browser remains pointing to the page I was *trying* to reach. ie. the address bar will show domain.com/unreachable-page not domain.com/404. Which is fine and, I believe, correct behaviour. However…

That being the case, is there any way to target the 404 template with a conditional? (In this case, from within an embed or snippet that appears on every template -- I wish to have some different content for the 404 template). It would seem that segments are not going to be much help here, so I wondered if there is another way.

Example:

```
{if is_404_template}
    // Display something
{/if}

```

Thanks.

# Answer
> 1 votes
Since your 404 template is one specific, you can, of course, add a Preload Replace Variable to it.

Let's say you have a snippet which appears on every template called `{snip-html}`:

```
{preload_replace:pre-root_class=""}{!-- setting a default value --}
<html class="{pre-root_class}">

```

On the template set to be your 404, you can override this value:

```
{preload_replace:pre-root_class="404"}
{snip-html}

```

This template will have the snippet parsed:

```
{preload_replace:pre-root_class="404"}
{preload_replace:pre-root_class=""}
<html class="{pre-root_class}">

```

Then, the first preload replace variable:

```
{preload_replace:pre-root_class=""}
<html class="404">

```

Then, the second one will not find where to go and will just disappear:

```
<html class="404">

```

See? You created a variable for this specific template.

I tried to create a simple example adapting something I already used, because I don't know exactly what you need, but you can, of course, use this on a conditional or make adaptations.

---
Tags: conditionals, 404, segments
---


# Question
Title: Entry tags are lost when saving Stash set_list
I'm using the MVVC approach and all works well until I turn on fragment caching. This works, but of course does not offer any performance advantages.

```
`{exp:stash:set_list
        name="tutorials"
        parse_tags="yes"
        parse_conditionals="yes"
        parse_depth="2"
    }

        {exp:channel:entries
            channel="tutorials"
            dynamic="no"
            disable="member_data"
        }
            {stash:item-entry-id}{entry_id}{/stash:item-entry-id}
            {stash:entry-title}{title}{/stash:entry-title}
            {exp:stash:set_list:nested
                name="tags"
                context="{entry_id}"
                parse_tags="yes"
            }
                {exp:tagger:tags entry_id="{entry_id}"}
                    {stash:tag-url-name}{tagger:urlsafe_tagname}{/stash:tag-url-name}
                    {stash:tag-name}{tagger:tag_name}{/stash:tag-name}
                {/exp:tagger:tags}
        {/exp:channel:entries}
    {/exp:stash:set_list}`

```

If I set it to save using the following parameters, the tags are not shown anymore:

```
{exp:stash:set_list
        name="tutorials"
        parse_tags="yes"
        parse_conditionals="yes"
        parse_depth="2"
        save="yes"
        scope="site"
        refresh="5"
        replace="no"
    }

```

My layout template where I get the tags looks like this (other markup and stash data removed for clarity):

```
{exp:stash:get_list name="tutorials" paginate="bottom" limit="10"}
    <p class="custom meta">
    <span class="fa fa-tags">
    {exp:stash:get_list:nested
        name="tags"
        context="{item-entry-id}"
        prefix="nested"
        backspace="2"}
        <a href="/search/tag/{nested:tag-url-name}" rel="tag">{nested:tag-name}</a>,
    {/exp:stash:get_list:nested}
{/exp:stash:get_list}

```

I suspect it is caching the first set\_list data before it actually parses the nested list that gets the tag data. I did try to use:

```
{stash:embed:layouts:listing-text parse_stage="both"}

```

But that didn't work.

Maybe this approach (using a set\_list) isn't the best way to do this. The page is a listing of entries and I want to be able to use pagination and switchee cases to allow for displaying filtered content by category and tag using regex with switchee.

# Answer
Try adding on your get\_list tag `scope=site` I seem to recall this being a thing.
> 1 votes

---
Tags: stash
---


title: SSL and Insecure Content

text:
# Question
Title: SSL and Insecure Content
I finally set up my first EE site with SSL. Everything seems to be working ok, but I discovered that some of the pages are "delivering unencrypted elements". What I've found so far:

* Images added through WYSIWYG are being called via http and not https
* I am using EE\_Twitter, and any images through there are also being delivered via http and not https

If I have a page without either of those, then I get a thumbs-up from the browser.

I am utilizing a master config file, and my .htaccess file looks like this:

```
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [L,R=301]

RewriteCond %{HTTPS} on!
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]

```

Any suggestions would be greatly appreciated!

# Answer
> 1 votes
Great write up by Jesse Knowles - took me 10 minutes to be up-and-running with https. http://www.jesseknowles.com/blog/article/forcing-https-on-an-expressionengine-site/

---
Tags: ssl
---


# Question
Title: Is there a limit on how high the Entry IDs can go?
I've been trying to import thousands upon thousands of entries into a few different channels.

Before I get too far into my current project, I just wanted to clarify that there is no limit as to how high the entry IDs can go in ExpressionEngine.

# Answer
> 5 votes
Entry IDs are stored as an unsigned integer field in MySQL, meaning the maximum value is 4294967295

# Answer
> 3 votes
More a general MySQL tip: if you need to test the import and re-import a couple of times, keep an eye on the auto\_increment value for the entry\_id column of exp\_channel\_titles. Either reset auto\_increment after deleting a test import, or set the entry\_id value as well on import.

---
Tags: channel-entries, entryid
---


title: Fixed amout of page links in pagination

text:
# Question
Title: Fixed amout of page links in pagination
So I have a blog where I am paginating my entries to 6 per page. Generally the standard pagination built into EE is fine, but for this I only ever want 4 page numbers to show in the pagination bar like so

Prev 1 2 3 4 Next *or* Prev 7 8 9 10 Next

I don't think that the `page_padding` parameter will work in this way - do you know if it's possible to have EE's pagination work in this way or will I have to get an add on like AB Pagination?

Thanks in advance!

# Answer
> 1 votes
I got the AB Pagination plugin after all - not only do I think that standard pagination won't work for this, but there are other things we need to do that AB Pagination solves, so there we have it!

---
Tags: ee2, pagination
---


# Question
Title: Trigger to Change Author's Member Group on Channel Status change?
Is it possible? Basically the scenario is this:

1) Member in default Member Group submits Channel form to make entry. 2) Entry automatically set to status 'Under Review' 3) Admin reviews and - if necessary - marks 'approved' 4) Author/Member automatically changes group from 'Members' to 'Approved'

Is there anyway of doing this? I'm thinking perhaps not. Looked at Zoo Visitor but don't think it's the right fit. Any suggestions?

# Answer
> 1 votes
I'm assuming that the status is being changed in the EE control panel? If so, then this will likely require an extension that uses the entry\_submission\_end hook:

http://www.ellislab.com/expressionengine/user-guide/development/extension\_hooks/api/channel\_entries/index.html#entry\_submission\_end

It's a pretty simple script to just check if the status being submitted is 'approved' and then if it is to update the database with the EE database class and change the member group to the desired number.

---
Tags: members, status, groups
---


title: Template Routes and Regular Expressions

text:
# Question
Title: Template Routes and Regular Expressions
I'm trying to use **regular expressions** with the **new template routes** in ExpressionEngine 2.8. I have little experience with either.

Using the Template Route Manager, I'd like to route multiple URLs to a single template:

```
domain.com/workplace-coaching/
domain.com/workplace-coaching/{url-title}
domain.com/personal-coaching/
domain.com/personal-coaching/{url-title}

```

Problem is, I don't know how to specify segment\_1 == 'workplace-coaching' OR segment\_1 == 'personal-coaching' using the Template Route Manager.

I'm assuming I need to call upon the Regular Expressions feature so have tried

```
{variable:regex[(workplace\-coaching|personal\-coaching)]}/{url_title}

```

Whilst this works, for the urls above, it also seems to match other urls. For instance domain.com/blog now routes to same template as the above urls.

I suspect my Regrex is wrong, and is matching too many options including blog, however don't know how to fix it.

Any insights would be appreciated.

Thank you.

# Answer
> 2 votes
The variables need to have a name and that `url_title` is a reserved word.

To avoid conflicts, if you need to keep the *Segments required* set to *no*, keep a static part on the first segment:

```
/{coaching_type:regex[(workplace|personal)]}-coaching/{coaching_title:alpha_dash}

```

By this way, you can't grab the first segment by `{segment:coaching_type}`, but `{segment_1}` still works.

Please, try this.

---
Tags: 2.8, regular-expressions, template-manager
---


title: CartThrob VAT issue

text:
# Question
Title: CartThrob VAT issue
I'm building an order process to order a specific item, separate from the rest of the site's CT Checkout process.

I've turned VAT off for the specific item but VAT is being added to the overall order.

**How do I turn off VAT for a specific order?**

# Answer
> 1 votes
Found the solution to this, added `tax_exempt="yes" shipping_exempt="yes"` to the `{exp:cartthrob:add_to_cart_form}` tag.

---
Tags: cartthrob, tax
---


title: Codeigniter Error on Admin Page

text:
# Question
Title: Codeigniter Error on Admin Page
***Fatal error:*** *ob\_start() \[ref.outcontrol\]: Cannot use output buffering in output buffering display handlers in /home/.../public\_html/system/codeigniter/system/core/Exceptions.php on line 166*

Unfortunately the web server to my site was hacked and an add-on designed for the control panel had code inserted into one of it's files. I have removed the offending file and ensured that my server settings were secure. Unfortunately, in the process aspects of that plugin are not working. I attempted to manually remove the add-on by removing references to it within the database.

This did resolve the original error that I was receiving. However, I am now receiving a new error as noted above. I have checked and even replaced the entire codeigniter directory, so there is no malicious code within it.

At this point the website is rendering correctly, but the admin.php is still displaying the above error. I assume that it has something to do with what i did in the sql database, but I am unsure how to track down and repair this issue. Any assistance would be appreciated.

# Answer
> 3 votes
That's a nasty one to debug. My advice is to let someone with a bit of codeigniter / expressionengine knowhow look at.

If the addon was an extension, check if it is still referenced in the exp\_extensions table. (duplicate table first as backup, then remove row with offending extension from exp\_extensions table).

edit: you might also be able to disable all extension in config (without unstalling them).
See this SE topic. Is there a quick way to disable all plugins?

# Answer
> 2 votes
Try setting this line in config.php to be FALSE:

```
$config['compress_output'] = FALSE;

```

---

When I see an error, I go to the line of code to see what the script is trying to do. Line 166 in the /system/codeigniter/system/core/Exceptions.php file is in the show\_php\_error() function so I'd suggest checking your PHP error logs to see what error is being thrown. If no error is being logged in the error file, go into the CP index.php file and remove the conditional around the error logging to force it to log the error and reload your problem page.

---
Tags: ee2, add-on, codeigniter
---


# Question
Title: Expresso store multiple product modifiers
The main issue I’m having, and this is a general issue, is because the products are part of a range. In essentially the same way as an iPad where you have options of 16gb, 32gb or 64gb memory with wi-fi or wi-fi & mobile options our ranges work in a similar fashion, some with far more complex options.

As with the iPad, it can be said there are 6 different products reflecting the options, our products are similar and instead of showing, for example, 6 products that all look the same from the outside we’re promoting the product range and have an options panel so the end user can select their requirements and a product model is defined for them.

This is part of a complete redesign I am working on but the current site has this functionality working (My boss liked it so much he wanted me to add it before I developed the new site!!) and you can see it in the left hand panel here http://www.picotech.com/picoscope5000-flexibleresolution.html

It’s built on jQuery so is all client side and just passes a catalogue number to the cart. The problem I’m having is I can’t seem to replicate that function. There are some models that are set from 1 option that would work with a product modifier but there are many with more than 1 option and it is not (from what I can gather?!) possible to use multiple product modifiers.

Any solution would be greatly appreciated.

Further more, from what I’m noticing one entry is being rendered in the JavaScript code that’s generated, Is that what is used to send info to the cart??? If I was able to generated an array of all the models in the range then I'm hoping that would work but I'm unsure as to how to do that.

Much appreciated Jon

# Answer
OK, thanks again to Peter for answering my question. My challenge is that no two products are the same and some with many variants. To create the price options modules that can be seen on the current site (http://www.picotech.com/highest-performance-oscilloscopes.html) and are being plugged into exp:resso store I created a load of conditional jQuery scripts that changed the info when requested. My solution was a lot easier than I thought, as opposed to creating product ranges with a modifier creating each product I stuck with what I already had in a full list of products. Then upon discovering the entry\_id in the hidden input field was what store was looking for to update the cart I added the jQuery below to my conditionals and all was saved.

```
$("input[name='entry_id']").val("{store_info}{entry_id}{/store_info}");

```
> 2 votes

# Answer
Yes it is possible to use multiple modifiers as long as there's only a single option **selectable** per modifier - so as per your example, there is 1 product called iPad, that has different modifiers and options to create the variants, but an iPad can't be a 16Gb **and** a 32Gb model - obviously. Here's an example of the EE Entry in the backend:

Then on the frontend:

Even showing availability for the combination selected:

The important part is that your product template is assigning all the modifiers/options with the correct names, so when your product form is submitted, Store knows what variants (modifiers/options) the customer has selected.

```
{exp:store:product entry_id="{entry_id}" return="/checkout/basket"}
    ...
    {modifiers}
        {if "{modifier_name}" != ""}
                <label>
                    <select id="{modifier_name}" name="{modifier_input_name}" class="dropdown required" tabindex="1">
                             <option value="">-- Select {modifier_name} --</option>
                         {modifier_options}
                             <option value="{option_id}" {if "{modifier_name}" == "Colour"} itemprop="color"{/if}>{option_name}</option>
                         {/modifier_options}
                    </select>
                </label>
        {/if}
    {/modifiers}
{/exp:store:product}

```

Specific documentation link: https://exp-resso.com/docs/product\_form\_tag.html#product\_form\_tag\_example
> 5 votes

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


title: Deleting 1,000s of spam comments

text:
# Question
Title: Deleting 1,000s of spam comments
We are using LowNoSpam and it is working well. Very few spam comments get through. However the settings flagged them as spam and kept them closed. The person who was reviewing these didn't do that since November and since then spam bots have been having a blast. It now has 35,984 spam comments.

We have changed some settings (must be logged in to leave a comment) but we do want to purge the ~36,000 spam comments. There may be a few legit comments in there, but they are ok with just letting them get deleted.

My idea is to go into the database and delete all comments with a status of "c" in the table "exp\_comments". I did this on my local db and it seems to work. However I've also tried some database shortcuts that didn't work out so well (creating custom member fields via the db) because there are links to this data elsewhere.

Is there anything else I need to do other than delete the "c" comments in exp\_comments?

# Answer
No, that is all you need to do - `exp_comments` has no other dependencies when it comes to "closed" comments.

If you were deleting "open" comments, you'd want to recount the site's statistics afterwards (as `exp_channel_titles` has a `comment_total` column).
> 5 votes

---
Tags: comments, spam
---


title: Checkbox Fieldtype Conditionals

text:
# Question
Title: Checkbox Fieldtype Conditionals
How would you perform a conditional on a custom checkbox field in which the user can select 0 -4 different options?

In other words, I have a "Checkboxes" fieldtype named "{side\_content\_selectables}".

This fieldtype has the following options:

* Show Search
* Show Feed Subscription
* Show Categories
* Show Recent Posts

Which would just allow them to turn widgets on or off. In my template, I have the following:

```
<aside id="sidebar">
    {exp:channel:entries channel="side_content" limit="1" dynamic="no"}
        {if {side_content_selectables}"{item}" == "Show Search"{/side_content_selectables}}
            <section class="widget">
                <h3>Search</h3>
                {!-- Search Form --}
            </section>
            <!-- /.widget -->
        {/if}

```

OR

```
        {if "Show Feed Subscription"}
            <section class="widget">
                <h3>Subscribe</h3>
                {!-- Feedburner Widget --}
            </section>
            <!-- /.widget -->
        {/if}

```

Neither of these seem to work though. This makes me feel like a big noob, but I am stumped on this one. ;)

It's almost like I would need to write out a PHP script to perform a contains, but that just seems like overkill and I would like to keep PHP from being used in templates.

# Answer
You're best off using the PT Checkboxes, the native ones are just too fragile for real world use.

http://devot-ee.com/add-ons/pt-field-pack

Then:

```
{if {side_content_selectables:selected option="show_feed"}}
  <p>show the feed</p>
{/if}

```
> 6 votes

# Answer
I second the answer posted by @James, PT Checkboxes are more flexible, but if you want to use the native checkboxes the following will work:

```
{checkboxes_field}
    {if item == "Option One"}<p>Option one is checked</p>{/if}
    {if item == "Option Two"}<p>Option two is checked</p>{/if}
    {if item == "Option Three"}<p>Option three is checked</p>{/if}
{/checkboxes_field}

```

Just replace the custom field name and option values to match your situation.
> 2 votes

# Answer
I guess this would be the proper syntax

{if '{side\_content\_selectables}{item}{/side\_content\_selectables}' == 'Show Search'}
> 0 votes

# Answer
If you're stuck with the native field type and can't switch for whatever reason (legacy data etc) then you can always use the phpstringfun plug-in (http://devot-ee.com/add-ons/phpstringfun) and do something along the lines of:

```
{if "{exp:phpstringfun function='substr_count' par1='Foo'}{checkboxes_field}{/exp:phpstringfun}"=="1"}
Foo Found
{/if}

```

Hope that helps. :)
> 0 votes

# Answer
Just joined, so I can't comment on the accepted answer, but...

the correct syntax should be (note the single quotes):

```
{if '{side_content_selectables:selected option="show_feed"}'}
    <p>show the feed</p>
{/if}

```

Maybe there's been a change in the plugin since this was originally posted, but I discovered that without those single quotes, EE will throw a PHP error if none of the checkboxes are checked.
> 0 votes

---
Tags: ee2, custom-fields, conditionals
---


# Question
Title: Can I have a user emailed when Status is changed?
In Channel Preferences, there's a field "Enable recipient list below for channel entry notification?" But AFAIK that's for when a new entry is published. How about for when an existing entry's Status is changed?

# Answer
> 3 votes
Yes. Take a look at the add on MX Notify Control http://devot-ee.com/add-ons/mx-notify-control which should allow you to do this.

Alternatively, for even more flexibility take a look at Postmaster http://devot-ee.com/add-ons/postmaster

# Answer
> 0 votes
Audit Pro also does a pretty good job of letting you set granular notifications.

---
Tags: email, status, notification
---


# Question
Title: Delete thousands of members from an EE2 site
I had over 40 000 spam member accoutns created and need to delete them.

I tries adding &group\_id=5&perpage=1000 to my view all members page which works fine, but as soon as I click a column to sort them by ID or last visit it defaults back to 20 members.

How can I easily display and delete 40000 membrs accounts?

This is NOT using EE1.6 but EE2, so NOT a duplicate question. PLUS

I cannot just delete the entire member group. The spam member accounts are spread out through the group. I will say again if I display 1000 per page and try and edit the order (ie: sort by last visit or join date to help group the spam accounts onto one page for easy deletion, it defaults back to 20 members per page)

# Answer
If you have any visible pattern for spam accounts, you can delete them just with query. My examples:

```
#Delete all pending ExpressionEngine members mysql query
DELETE FROM exp_member_data where member_id in (select member_id FROM exp_members where group_id = 4) LIMIT 1000000
DELETE FROM exp_message_folders where member_id in (select member_id FROM exp_members where group_id = 4) LIMIT 1000000
DELETE FROM exp_member_homepage where member_id in (select member_id FROM exp_members where group_id = 4) LIMIT 1000000
DELETE FROM exp_members where group_id = 4 LIMIT 1000000

#remove all users who have links in bio (be carefully with this!)
DELETE FROM exp_member_data where member_id in (select member_id FROM exp_members where bio REGEXP 'http') LIMIT 1000000
DELETE FROM exp_message_folders where member_id in (select member_id FROM exp_members where bio REGEXP 'http') LIMIT 1000000
DELETE FROM exp_member_homepage where member_id in (select member_id FROM exp_members where bio REGEXP 'http') LIMIT 1000000
DELETE FROM exp_members where bio REGEXP 'http' LIMIT 1000000

#more patterns for select spammers (you will also need do the same for tables exp_member_data, exp_member_homepage and exp_message_folders ) :
SELECT member_id FROM exp_members WHERE email REGEXP '[.].*[.].*[.].*[.].*@'; #select members who have emails with 4 dot's in name

select member_id FROM exp_members where bio REGEXP 'url=www.'
select member_id FROM exp_members where bio REGEXP 'a href="'

#most common spammers emails
select member_id FROM exp_members WHERE email REGEXP '.*@21cn.com' OR email REGEXP '.*@163.com' OR email REGEXP '.*@qq.com' OR  email REGEXP '.*@tom.com' OR email REGEXP '.*@mailnesia.com'

```

Using this method in combination with last check using StopSpammers DB check, it's take for me about 1h to cleanup DB with 120k members to 15'000 accounts which looked more real.
> 3 votes

---
Tags: members, spam
---


title: Test for empty string

text:
# Question
Title: Test for empty string
I have this code to see if `member_order_comments` is blank or not.

```
{if '{member_order_comments}' != ''}

```

It works fine, unless there is a `'` in the middle of `member_order_comments`, in which case I get a php error. I understand why the php error. I don't know the right way to check for an empty string when the string can have any format.

# Answer
I believe if you use:

```
{If your_field} something exists {/if}

```

This should display conditional content if the field contains anything at all.
> 4 votes

---
Tags: conditionals
---


# Question
Title: Solspace Calendar Dates Not Showing Correctly
Running EE 2.7.3 and Solspace Calendar 1.8.5

The mini-calendar here (bottom right) displays all dates that have events using this code:

```
<div id="mc_wrap">
   {exp:calendar:cal
      {if segment_2 == "calendars"}
         date_range_start="year-month-01" date_range_end="year-month-last"
      {/if}
      {if segment_2 == "edit"}
         date_range_start="year-month-01" date_range_end="year-month-last"
      {/if}
      {if segment_2 == "create"}
         date_range_start="year-month-01" date_range_end="year-month-last"
      {/if}
      {if segment_2 == "event"}
         date_range_start="year-month-01" date_range_end="year-month-last"
      {/if}
      {if segment_2 == ""}
         date_range_start="year-month-01" date_range_end="year-month-last"
      {/if}
      {if segment_2 == "month"}
         {if segment_3 == ''}date_range_start="year-month-01" date_range_end="year-month-last"{/if}
         {if segment_3 != ''}date_range_start="{segment_3}-{segment_4}-01" date_range_end="{segment_3}-{segment_4}-last"{/if}
      {/if}
      {if segment_2 == "week"}
         {if segment_3 == ''}date_range_start="year-month-01" date_range_end="year-month-last"{/if}
         {if segment_3 != ''}date_range_start="{segment_3}-{segment_4}-01" date_range_end="{segment_3}-{segment_4}-last"{/if}
      {/if}
      {if segment_2 == "day"}
         {if segment_3 == ''}date_range_start="year-month-01" date_range_end="year-month-last"{/if}
         {if segment_3 != ''}date_range_start="{segment_3}-{segment_4}-01" date_range_end="{segment_3}-{segment_4}-last"{/if}
      {/if}
   dynamic="off"
   }
      <div id="mc_calendar">
         {display_each_month}
         <table id="mini-cal">
            <thead>
                    <tr  id="mc_head">
                  <th colspan="1">{if segment_2 != "calendars"}<a id="mc_prev_month" class="icon left" href="{path=''}mini-cal/month/{prev_month format="%Y/%m"}/">«</a>{/if}</th>

                  <th colspan="5"><a href="{path='calendar'}/{month format="%Y/%m"}/">{month format="%F %Y"}</a></th>

                  <th colspan="1">{if segment_2 != "calendars"}<a id="mc_next_month" class="icon right" href="{path=''}mini-cal/month/{next_month format="%Y/%m"}/"> »</a>{/if}</th>
           </tr>
           <tr id="mc_days">
              {display_each_day_of_week}
              <th class="{if day_of_week_is_weekend}weekend{/if} {if day_of_week_is_current}current{/if}">{day_of_week_one}</th>
              {/display_each_day_of_week}
           </tr>
        </thead>
        <tbody>
           {display_each_week}
           <tr>
              {display_each_day}
              <td class="
                 {if !day_in_current_month == FALSE}mc_pad{/if}
                 {if day_event_total > 0}has_events{/if}
                 {if count == 7}selected{/if}
                 {if day_is_today}today{/if}
              "><div class="mc_date">{if day_in_current_month}
                 {if day_event_total}<a href="{path='calendar/day'}/{day format="%Y/%m/%d"}/">{/if}
                 {day}
                 {if day_event_total}</a>{/if}
                 {if:else}
                    <strong class="middot">·</strong>
                 {/if}</div></td>
              {/display_each_day}
           </tr>
           {/display_each_week}
        </tbody>
     </table>
     {/display_each_month}
  </div>
{/exp:calendar:cal}
</div>

```

Clicking on the day takes you to this page. This works but with problems: the page displays a list of the days events and in most cases lists the day and date at the top using this code:

```
 <div id="main-content">
    {exp:calendar:cal
                date_range_start="{segment_3}-{segment_4}-{segment_5}"
                show_days="1"
                limit="1"
            }

    <h2>Events for {event_start_date format="%D, %M %d, %Y"}</h2>
    {/exp:calendar:cal}

    {exp:calendar:events
                date_range_start="{segment_3}-{segment_4}-{segment_5}"
                date_rande_end="{segment_3}-{segment_4}-{segment_5}"
                orderby="event_start_date"
                sort="asc"
                show_days="1"
            }

            <div class="inner">
                {if calendar_no_results}
                    No Results
                {/if}
            <div class="event-summary">
                <div class="details">
                    <span class="event-title"><a href="{path='calendar/event'}/{event_url_title}/{segment_3}/{segment_4}/{segment_5}">{event_title}</a></span>
                        {event_summary}
                        <p><b>Location</b>: {event_location}</p>
                        <p class="learn-more" ><a href="{path='calendar/event'}/{event_url_title}/{segment_3}/{segment_4}/{segment_5}">Learn more»</a></p>
                </div>
                <div class="clearer"></div>
            </div>
        </div><!-- end .inner -->
        {/exp:calendar:events}
    </div><!-- end #main-content -->

```

For some reason the day/date information is not displaying correctly, even though it is reading from the URL.

For example if I click on May 24, the linked page displays Friday May 23, 2014. If I click on Monday, May 26, the linked page displays Thurs May 29, 2014. Clearly we have a problem.

And then, if I click on June 18, the linked page does not display any Day/Date at all.

I am open to all possible solutions.

Thanks.

# Answer
> 1 votes
**Useful/Important Read**: http://www.solspace.com/docs/calendar/getting\_started/

Next, you have

```
date_range_start="{segment_3}-{segment_4}-{segment_5}"

```

..whereas your URL is

```
/~mac/calendar/day/2014/05/29/

```

Shouldn't that be the following?:

```
date_range_start="{segment_4}-{segment_5}-{segment_6}"

```

Further, in both cases, you need to use **`{exp:calendar:cal}`, which is the only tag that deals with event data on a chronological timeline**. {exp:calendar:events orderby="event\_start\_date"} won't be accurate, `{exp:calendar:cal}` is what would be used instead.

Finally, looks like you want to **zoom in on a particular date**, in that case you need to use:

```
{exp:calendar:cal
    date_range_start="{segment_4}-{segment_5}-{segment_6}"
    date_range_end="{segment_4}-{segment_5}-{segment_6}"
    pad_short_weeks="n"}

```

This will **zoom in** on a specific day, and limit the timeframe to that single day.

You need to have `pad_short_weeks=""` parameter set to `n` in the event you're trying to display anything other than a typical calendar display. When set to `n`, weeks won't be "padded" to the nearest first day of the week and last day of the week, as Calendar does this by default for the sake of properly outputting and formatting a calendar.

So for example, using the `date_range_start=""` and `date_range_end=""` parameters, if your code looks like this:

```
date_range_start="2011-10-19" date_range_end="2011-10-21"

```

...with `pad_short_weeks=""` parameter NOT specified, Calendar will automatically display the entire week range (2011-10-16 - 2011-10-22). With `pad_short_weeks="n"`, Calendar will just display the selected range (2011-10-19 - 2011-10-21).

<sub>(source: solspace.com)</sub>

Finally, you have a separate `{exp:calendar:cal}` tag to display "Events for `{event_start_date format="%D, %M %d, %Y"}`" text. Although there are more than one way to display this data (since you have the date in the URL, you could combine that with {exp:calendar:**date**}, for example), the code as you have it will obviously loop through events, so will display the text more than once. Adding a `{if count == 1} ... {/if}` conditional should fix that and display the text once.

---
Tags: solspace-calendar
---