# Question
Title: Updating status with hook does not trigger email
First, thanks in advance for any insight.

I'm using the following in a simple extension to set the status for new orders with the aim that I can send an email template based on the customer's member group:

```
public function store_order_complete_end($order)
{
  $status = Store\Model\Status::where('name', $status_name)->first();

  if (ee()->session->userdata('group_id') == 10)
  {
    $status->name = "Commercial";
  }
  else
  {
    $status->name = "General";
  }

  $order->updateStatus($status);

  return $order;
}

```

When processing an order, the system correctly sets the status to either Commercial or General. However, no email is sent. If I switch to another status and then back to the desired status, the email does send. In other words, it seems that the emails are only triggered when manually selecting the status.

Note that I have default order status of "Received" that does not trigger any email templates. I've done this because I've found that if no default status is set no email templates ever get sent -- even when manually selected.

Also, when looking at the bottom of the order detail, I do see that both order statuses are logged: Received and Commercial (or General).

Any thoughts?

# Answer
> 4 votes
It mainly goes down to processing order. When the order is successfully placed Store then does a little housekeeping to round off the order completion process. It will look to set a default status **before** checking for any extensions latching on to the `store_order_complete_end` hook. So walking through the process with your specific extension code:

Order is completed:

1) Set the status of the order to the default set via the CP \[Received\]
2) Look for any emails associated with this status & send \[none found so none sent\]
3) Check for extensions using the `store_order_complete_end` hook \[found your extension\]
4) Check session data and set status name to "Commercial" or "General"
5) Update status and send any associated emails

So that is why a default email isn't getting sent. With regards to the status change then not automatically triggering any emails, are you sure you have email templates saved and linked to that status? Check in the database that the status are listed in `exp_store_statuses`:

and associated with corresponding email\_ids in `exp_store_emails`:

Alternatively you could always look to try the `store_order_complete_start` hook which will be triggered **before** the default status is set (if there is one). You shouldn't then need to set a default status if you don't want to.

# Answer
> 3 votes
It looks like there is a problem with the logic in your extension. You don't want to change the name of a particular status when the order is complete - you want to change the status of the order. I would expect it to look something more like this:

```
public function store_order_complete_end($order)
{
    if (ee()->session->userdata('group_id') == 10)
    {
        $status = Store\Model\Status::where('name', 'Commercial')->first();
    }
    else
    {
        $status = Store\Model\Status::where('name', 'General')->first();
    }

    $order->updateStatus($status);
}

```

---
Tags: expresso-store, status, hook
---


title: How build membership site with EE?

text:
# Question
Title: How build membership site with EE?
There are many add-ons available on the market, but their taget is too high for my needs. I have about three hundred members present, and voorei offer payment services through membership.

I was wondering if there is a solution that is less costly and difficult to implement extensions as carthrob.

I was considering the form paypal, and I cheidevo if you can implement this with a mebership.

# Answer
For selling membership through PayPal I think this would be your best option: http://www.membrr.com/

I use it on my site to sell paid premium membership and it works great.
> 1 votes

---
Tags: members
---


# Question
Title: Stored module version number fails to update after upgrade successfully runs
We have a custom module which has successfully used the `update` method in `upd.addon-name.php` to apply database changes. We are attempting to use it again for another version update (from 1.4.0 to 1.5.0). This time however, ExpressionEngine says it successfully runs the module update (no error is thrown), but fails to update the version number in `exp_modules`. It does this whether or not you update via the "run module updates" button or by visiting the settings for the add-on.

This leads to an attempt to run the upgrade again whenever you visit the settings page for the module, which throws mysql errors complaining about duplicate columns (because it already added them).

Has anyone ever encountered this before? Is it safe to update the version in that table ourselves in the update function as a workaround?

I should mention this has occurred on ExpressionEngine version 2.7.3 on two separate installations.

# Answer
What code do you have in your `update()` method? I believe you need to `return true` from the update method for the database table to be updated.

That said, in Store we simply update the `exp_modules` table manually (since from memory you have to do this for extensions anyway), so there's certainly no problem just doing this yourself.
> 1 votes

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


title: Matrix does not save rows above 165

text:
# Question
Title: Matrix does not save rows above 165
My matrix does not save its data anymore.

I use matrix for a table of persons that hold a certain certificate. four textfields and one date field. I want to add 300 people, but I am at row 165 now, and matrix won't save the last name of this person, so right in the middle of a row, on a regular text field, nothing more can be saved. The save seems to go through, but when you click 'edit this entry' the newly entered data is gone.

Another strange thing is the date field now uses another data format to display the date; suddenly the times have an AM/PM notation where before they used the 24h clock. But the issue is not limited to the d

Data entry was handled by the client and they have twice entered all 300 names by hand - only to find them lost them when reopening the entry. The site needs to go live, but I cannot get all the data in the field…

System setup:

* EE 2.7.2
* Matrix 2.5.10
* mysql 4.1.6
* php 5.4.4

# Answer
This is usually caused by the PHP Suhosin patch limiting the number of POST variables which may be submitted on a single page.

See: https://expressionengine.stackexchange.com/a/15290/150
> 1 votes

---
Tags: matrix
---


# Question
Title: How can i do filtration search of channel files extension with low search?
Can i do filtration of channel files extension with low search ?

I want to search filtration of document types with channel files such as: pdf, doc. ppt, jpeg, etc using low search.

Please let me know, if you have solution.

FYI:

EE: 2.7.2

Low Search: 2.4.2

Channel Files: 5.2.8

Thanks.

# Answer
Low Search doesn't have *specific* support for Channel Files (CF), so whether the two play nicely together depends on how CF stores its (searchable) data. **If** CF stores its data in the native channel\_data table, then you can use the Field Search filter to search for substrings like `.pdf` etc. If it does not, then a custom filter/extension would be needed to add support for it.
> 1 votes

---
Tags: search, low-search, filter, channel-files
---


title: Using pattern matching in Low Seg2Cat

text:
# Question
Title: Using pattern matching in Low Seg2Cat
I need to get the IDs of particular segments in the URL, shown in bold (i.e. segments 2, 3 and 4):

> /grid/**strategic/corporate/uk**/jim/tweets

They could also look like this (i.e. no category has been set):

> /grid/**-/-/-**/jim/tweets

I'm assuming I would need a regex pattern match to do this and then use the {segment\_category\_ids} tag to pull them out in a list such as 37&342.

Not entirely sure how I should go about writing that for the settings though. I tried this:

```
^/[a-z-_0-9]*/[a-z-_0-9]*/[a-z-_0-9]*/[a-z-_0-9]*

```

Which works OK in a regexp checker but the I find that the tag {segment\_category\_ids} doesn't get rendered in the template.

How should I be providing this in the settings?

# Answer
The regex option in Low Seg2Cat's settings is meant for something else: when set Low Seg2Cat will *only* set the `{segment_n_category_x}` variables *when the URI matches the given pattern*.

I take it you *want* to have access to those vars in all cases, so you should leave it blank.

If you do want to use the regex option, make sure you also add the delimiters to the pattern. In your case, that would mean the pattern could look something like this:

```
#^(/[\w-]+){4}$#

```
> 0 votes

# Answer
With LowSeg2 Cat could you do...

```
{if segment_2!="-"}{segment_2_category_id}&{/if}
{if segment_3!="-"}{segment_3_category_id}&{/if}
{if segment_4!="-"}{segment_4_category_id}{/if} {!-- No & here because it's the last segment --}

```

That should do the job.
> 0 votes

---
Tags: low-seg2cat, regular-expressions
---


title: The RLS field is required. What?

text:
# Question
Title: The RLS field is required. What?
Brand new to CartThrob - trying to add the add-to-cart form using:

```
{exp:cartthrob:add_to_cart_form entry_id="{entry_id}" return="store/view_cart" quantity="1"}
    ${workshop_price}
    {title}
    <input type="submit" id="addToCart" class="btn-default" value="Add to cart" />
{/exp:cartthrob:add_to_cart_form}

```

And I get the error "**The RLS field is required.**". What's going wrong? I have the latest versions of both CT and EE.

# Answer
Actually turns out I already had a form tag above and below... that was causing the issue. Oops!
> 2 votes

---
Tags: cartthrob
---


title: Conditional Fields in Channel in CP

text:
# Question
Title: Conditional Fields in Channel in CP
So I have 4 countries

Scotland, England, Wales, & N. Ireland

I want my users when they choose Scotland to get the 32 regions in Scotland, similarly in England you would get the counties.

Is this possible?

# Answer
> 1 votes
Have a look at the Entry Type Addon:

http://devot-ee.com/add-ons/entry-type

---
Tags: control-panel, drop-down, ee
---


# Question
Title: Exp:resso Store not sending email order confirmation
Not receiving emails from Exp:resso Store 1.65 when order completed. Nether order conformation to the buyer or the notification to the store manager are generating, you can see the order when I login. It seemed to start when I migrated the site to hosting on nexcess.net. Any ideas, lost.

# Answer
It was the server send mail. Nothing to do with Exp-resso or EE. It was not pointing the the MX record correctly. Just a server setting.
> 2 votes

# Answer
Per Ian's advice in the comments, I highly recommend using Sendgrid or a similar service for sending email. Sending email directly from your own server is highly unreliable, and likely to get caught in a spam filter or even outright blocked in this day and age. Sendgrid is free for up to 200 emails per day, so there is really no reason not to use it.
> 2 votes

---
Tags: expresso-store
---


# Question
Title: MX Notify Control: multiple php errors when saving an entry
I just updated to EE2.7, and I'm getting this error when I try to save an entry:

> A PHP Error was encountered Severity: Notice Message: Undefined index: From Filename: libraries/Email.php Line Number: 1588
>
> A PHP Error was encountered Severity: Notice Message: Undefined index: From Filename: libraries/Email.php Line Number: 1194
>
> A PHP Error was encountered Severity: Notice Message: Undefined index: Return-Path Filename: libraries/Email.php Line Number: 889
>
> A PHP Error was encountered Severity: Notice Message: Undefined index: From Filename: libraries/Email.php Line Number: 1588
>
> A PHP Error was encountered Severity: Notice Message: Undefined index: From Filename: libraries/Email.php Line Number: 1194
>
> A PHP Error was encountered Severity: Notice Message: Undefined index: Return-Path Filename: libraries/Email.php Line Number: 889
>
> A PHP Error was encountered Severity: Notice Message: Undefined index: From Filename: libraries/Email.php Line Number: 1588
>
> A PHP Error was encountered Severity: Notice Message: Undefined index: From Filename: libraries/Email.php Line Number: 1194
>
> A PHP Error was encountered Severity: Notice Message: Undefined index: Return-Path Filename: libraries/Email.php Line Number: 889
>
> A PHP Error was encountered Severity: Notice Message: Undefined index: From Filename: libraries/Email.php Line Number: 1588
>
> A PHP Error was encountered Severity: Notice Message: Undefined index: From Filename: libraries/Email.php Line Number: 1194
>
> A PHP Error was encountered Severity: Notice Message: Undefined index: Return-Path Filename: libraries/Email.php Line Number: 889
>
> A PHP Error was encountered Severity: Notice Message: Undefined index: From Filename: libraries/Email.php Line Number: 1588
>
> A PHP Error was encountered Severity: Notice Message: Undefined index: From Filename: libraries/Email.php Line Number: 1194
>
> A PHP Error was encountered Severity: Notice Message: Undefined index: Return-Path Filename: libraries/Email.php Line Number: 889
>
> A PHP Error was encountered Severity: Warning Message: Cannot modify header information - headers already sent by (output started at /home/content/19/5501119/html/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 /home/content/19/5501119/html/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 /home/content/19/5501119/html/system/codeigniter/system/core/Exceptions.php:170) Filename: libraries/Functions.php Line Number: 414

I'm using MX Notify Control to notify users when an entry they've authored is updated, and it looks like trying to fire off the emails is causing this error. I've updated to the latest version of every add-on I'm using, including MX Notify, and I can't find any info on these errors. Any thoughts?

# Answer
As error messages indicate, its due to FROM value which doesn't get by Email library. Can you check the MX Notify Control setting for that channel entry notification if having "From Name" and "From Name".
> 3 votes

# Answer
I have chance to make test - the reason of this can be wrong tag in **TO** field. For example, for Entry Update/Create trigger needs to use \*author\_email\* instead of \*mbr\_email\*.

I will try soon make better example in docs (and with additional notifications inside the add-on to prevent such situation).
> 3 votes

# Answer
The answer here (as provided by the extension developer) is that the proper "To Email" field syntax is {author\_email}, not {mbr\_email} as it says in the instructions for the extension settings. I am assuming the same goes for the other variables.
> 1 votes

---
Tags: email, php-errors, mx-notify
---


# Question
Title: PHP errors Message: Undefined index: From using MX Notify Control
getting these errors when an entry is updated. It is supposed to send an email to a mailing list using mx notify control:

```
A PHP Error was encountered

Severity: Notice

Message: Undefined index: From

Filename: libraries/Email.php

Line Number: 1584

A PHP Error was encountered

Severity: Notice

Message: Undefined index: From

Filename: libraries/Email.php

Line Number: 1190

A PHP Error was encountered

Severity: Notice

Message: Undefined index: Return-Path

Filename: libraries/Email.php

Line Number: 885

A PHP Error was encountered

Severity: Notice

Message: Undefined index: Return-Path

Filename: libraries/Email.php

Line Number: 1747

A PHP Error was encountered

Severity: Notice

Message: Undefined index: From

Filename: libraries/Email.php

Line Number: 1190

A PHP Error was encountered

Severity: Notice

Message: Undefined index: Return-Path

Filename: libraries/Email.php

Line Number: 885

A PHP Error was encountered

Severity: Notice

Message: Undefined index: Return-Path

Filename: libraries/Email.php

Line Number: 1747

A PHP Error was encountered

Severity: Notice

Message: Undefined index: From

Filename: libraries/Email.php

Line Number: 1190

A PHP Error was encountered

Severity: Notice

Message: Undefined index: Return-Path

Filename: libraries/Email.php

Line Number: 885

A PHP Error was encountered

Severity: Notice

Message: Undefined index: Return-Path

Filename: libraries/Email.php

Line Number: 1747

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /home/tanyacol/admin/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 /home/user/admin/codeigniter/system/core/Exceptions.php:170)

Filename: libraries/Functions.php

Line Number: 414

```

# Answer
(as provided by the extension developer) The proper "To Email" field syntax is {author\_email}, not {mbr\_email} as it says in the instructions for the extension settings. I am assuming the same goes for the other variables.
> 1 votes

---
Tags: extension, notification
---


title: Problems with nested code comments

text:
# Question
Title: Problems with nested code comments
Does anyone else experience issues with their templates when they nest code comments?

I've inherited a project with some code already commented like this

```
code code code
code code code
{!-- ... some code here ... --}
code code code
code code code

```

Then I've come along and commented more code out like this:

```
code code code
{!--
code code code
{!-- ... some code here ... --}
code code code
--}
code code code

```

Only to find that the templates completely break.

So i've ended up doing something similar to this:

```
code code code
{!--
code code code
<!-- ... some code here ... -->
code code code
--}
code code code

```

Which isn't ideal if I ever come back to this code as it has a completely different (undesired) effect.

Is there something I'm missing here?

# Answer
So as has been mentioned in the comments on this post, it's not possible to nest EE's template code comments.

It results in unexpected behaviour. So if like me you suddenly and unexpectedly lose all output from a template, check that you haven't got nested comments.
> 1 votes

# Answer
Yes, ExpressionEngine comments stop at the next `--}` that they find. It's quite irritating.

The rule of thumb I use is to use HTML comments for notes about the frontend code, and ExpressionEngine comments about the EE code. That tends to eliminate the problem most of the time.

Sometimes I just cut + paste blocks of code into other documents while I'm debugging and put them back in later on.
> 4 votes

# Answer
You can't actually nest comment blocks.

In PHP you wouldn't be able to nest a `/* */` within itself, nor would you be able to nest comments in HTML `<!-- <!-- --> -->`, but you could try adding spaces arbitrarily in between for personal notes of where comment blocks used to be. Could be useful if it's a snippet of code you may need to reintroduce later or in a similar template, or just to say something.

E.g.

```
{!--
code code code
{!- - ... some code here ... - -}
code code code
--}

```

If you're going to go an arbitrary route you can really do whatever you want within a comment block. I use Coda 2 as my editor, I can edit multiple lines simultaneously and just prefix single line comments. In PHP it'd be `//`, but since everything is ultimately enclosed in a comment block you could just do whatever, though you'll have to bear in mind... they're not actually comments on their own.
> 4 votes

---
Tags: templates
---


title: Solspace Rating vote up/down using AJAX

text:
# Question
Title: Solspace Rating vote up/down using AJAX
I'm trying to use AJAX to streamline the Rating Vote feature of Solspace Rating so the success or error code from the `{exp:rating:insert_rating_vote}` tag.

In my {rating:entries} template I have this code for the up down voting links:

```
{exp:rating:rating_vote_stats rating_id="{rating_id}"}
{if not_already_voted}<span class="helpful"><strong>Was this review helpful?</strong><span class="voters"><a href="/vendor/rating-vote/{rating_id}/up/" class="yes">Yes</a>  |  <a href="/vendor/rating-vote/{rating_id}/down/" class="no">No</a></span><span class="ajax-response"></span></span>{/if}
{if already_voted}<span class="helpful"><strong>Was this review helpful?</strong><span class="ajax-response">Thanks for your vote</span></span>{/if}
{if total > 0}<span class="light people-like">{up_votes}/{total} people liked this review</span>{/if}
{/exp:rating:rating_vote_stats}

```

And the /vendor/rating-vote template those links point to contains this:

```
{exp:rating:insert_rating_vote
    rating_id="{segment_3}"
    allow_duplicates="no"
    duplicate_check_guest_ip="no"
}
{if failure}Error!{/if}{if success}Thanks for your vote{/if}
{/exp:rating:insert_rating_vote}

```

This setup works as expected. When I click the link I go to that simple template which returns my failure or success message and the up/down vote is recorded and shows in my stats. I see:

> Thanks for your vote

**When I try to load the template via AJAX is doesn't work as expected.**

I'm using this JS code:

```
$(".voters .yes, .voters .no") .click (function() {
    var link = $(this).attr("href")
    var $helpful = $(this).closest(".helpful");
    $helpful.find(".ajax-response").load(link, function() {
        $helpful.find(".voters").hide();
    });
    return false;
});

```

This works except the content loaded into my span is not the same as the ouput I got before. This is what I get in my template where I would expect the simple success message:

> {"success":true,"failure":false,"message":"Your input is appreciated.","already\_reviewed":false,"not\_already\_reviewed":true,"prior\_review\_count":0,"count":1}

**Any advice on how to get this working?**

# Answer
> 0 votes
I had success with a modified version of the generic ajax code linked by Solspace:

```
$(".voters .yes, .voters .no") .click (function(e) {
        e.preventDefault();
        var link = $(this).attr("href")
        var $helpful = $(this).closest(".helpful");
        $.ajax({
            url: link,
            success: function(results){
                    $helpful.find(".voters").hide();
                    $helpful.find(".ajax-response").html("Thanks for your vote");
                },
            error: function(results){
                    $helpful.find(".ajax-response").html("Error - vote not counted");
            }
        });
    });

```

However, in my `{exp:rating:insert_rating_vote}` templates I have messages for success and failure like this:

```
{exp:rating:insert_rating_vote
    rating_id="{segment_3}"
    allow_duplicates="no"
    duplicate_check_guest_ip="no"
}
{if failure}Error!{/if}{if success}Thanks for your vote{/if}
{/exp:rating:insert_rating_vote}

```

But with this ajax method my messages where not being sent (I was seeing the default response) even when using `results` or `results.message` as the HTML output. So I ended up hard coding the response into the JS - not ideal but in my case works fine.

# Answer
> 1 votes
Try:

```
$helpful.find(".ajax-response").load(link, function(response, status, xhr) {
    $helpful.find(".voters").hide();
    $helpful.find(".ajax-response").html(response.message);
});

```

Ajax submissions return a JSON array as a response. You need the correct key (in this case .message) in this array to display only text.

Another method for general-purpose ajax submissions can be found here: http://support.solspace.com/solution/categories/115922/folders/190597/articles/119581-simple-jquery-ajax-script

---
Tags: solspace, ajax, solspace-rating
---


# Question
Title: Changing the Handling Charge in Exp-resso Store
The per-item handling surcharge is based on items in the order. "If the user purchases multiple items, this number will be multiplied by the item quantity, and displayed in the {order\_handling} variable. (from Exp-resso Store docs)"

Is there a way to make this handling charge per order not per Item? Running 1.6x Exp-resso Store.

# Answer
It will depend on your shipping gateway but something along the lines of this will work for the UPS gateway. To add the price to the UPS plugin you will want to open up the shipping plugin system/expressionengine/third\_party/store/libraries/store\_shipping/store\_shipping\_ups.php scroll down towards the bottom you should see something along the lines of

```
return (float)$xml->ShipmentRate->TotalCharges->MonetaryValue;

```

you will want to change that to

```
return (float)$xml->ShipmentRate->TotalCharges->MonetaryValue +4;

```

That should then add $4 to the calculated price of your shipping.
> 1 votes

---
Tags: expresso-store
---


# Question
Title: Live preview using multiple instances of the EE RTE
We need to grab the html/content from multiple instances of the RTE and perform a live preview of the content. It's easy to do with just one instance of the RTE using something like

```
{exp:channel:form channel="channel_name" rte_selector=".ee-rte"}
    <textarea class="ee-rte">{field_tag}</textarea>
{/exp:channel:form}

<div id="preview"></div>

...

var out = $('#preview');
var content = $('.WysiHat-editor');
content.on('keyup', function(){ out.html(content.html()); });

```

However, because you can't assign each auto-inserted RTE an ID, you can't match the input to the output because we're using the `$('.WysiHat-editor')` selector which grabs any and all RTEs.

I've tried using `.each()` but haven't been able to make it work. Our client specifically asked for a live preview, lest we'd be using livelook.

Any tips?

---

Also, as an aside, does anybody know why `exp:channel:form` trucates `<p>` tags when it populates fields (divs, textareas, etc.)?

---

I've been trying it and I've made some progress but it's still buggy and not working they way it should.

```
var count = 0;
$('.WysiHat-editor').each(function(i){
    $(this).attr('id', 'wysi-' + i);
    count += i;
});

$('.out').each(function(i){
    $(this).attr('id', 'out-' + i);
});

for (var k = 0; k < count; k++) {
    $('#wysi-' + k).on('keypress keyup keydown paste change focus blur', function(){
            $('#out-' + k).html($(this).html());
    });
}

```

# Answer
> 0 votes
For posterity:

```
$('.output-div1').html($('#textarea-1').data('wysihat').$editor[0].innerHTML);
$('.output-div2').html($('#textarea-2').data('wysihat').$editor[0].innerHTML);

```

etc. It's tedious with lots of WysiHats, but it works. We moved away from the `keyup` function, but if you were to implement it, it would be something like:

```
$('#textarea-n').data('wysihat').$editor.on('keyup', function(){ console.log('k'); });

```

---
Tags: javascript, jquery, rte
---


# Question
Title: Vague error when updating from EE 1 to EE 2 "The update script failed without returning an error."
When I run the update I get this error that fails as soon as it gets to 2.0.0. The script stops when it gets to updating the exp\_comments table. I tried setting $conf\['allow\_extensions'\] = "n"; before running the update but that didn't do anything.

I successfully updated from EE 1.6 to 1.7.3 first, now the version that I am updating from is EE 1.7.3

# Answer
> 2 votes
There's no need to update 1 before upgrading to 2, that's some Cargo Cult voodoo.

That error is specific to the installer attempting to run third\_party update routines (often). Temporally remove third\_party and try the installer again.

---
Tags: upgrade, ee2-upgrades
---


# Question
Title: Javascript Error in themes/javascript/compressed/jquery/plugins/ee_filebrowser.js
I have an “add file” link in a plain template. When I click it, I get:

`Timestamp: 2/18/14, 11:43:40 PM
Error: TypeError: d is undefined
Source File: https://preview.mycustomsite.com/index.php?S=e6d26fe1e6d862912992a7dfe770a712aa694471&D=cp&C=javascript&M=combo_load&ui=datepicker,resizable,draggable,droppable&plugin=ee_url_title,tmpl,ee_table,scrollable,scrollable.navigator,ee_filebrowser,ee_fileuploader,markitup,toolbox.expose,overlay&file=underscore,files/publish_fields,json2,cp/publish,cp/publish_tabs,cp/publish_admin&v=1392357549
Line: 364`

Short of disabling plugins one at a time until it works, has anyone ever had this issue?

UPDATE: I copied the files and the database to my local environment and it works just fine. It is still broken on the staging server. I diff'ed the javascript and HTML files and the only difference is the v=????? numbers.

UPDATE: its because the EE ajax loader is loading some javascript asynchronously over HTTP, yet the site is loading over HTTPS. Now I need to figure out how to get it to load over HTTPS.

# Answer
> 0 votes
This ended up being a far more complex problem than I expected. The site was running over HTTPS. It had a load balancer in front of 2 web servers. The SSL was being terminated at the load balancer, with non-SSL traffic being sent to the web servers. While the site was configured for SSL use, somewhere a REDIRECT was being generated for the Control Panel's asynchronous javascript loading. The REDIRECT was from HTTPS to HTTP. This was causing load errors in the browser, which was manifesting itself as the error above. When the load balancer was taken out of the loop, it worked fine.

---
Tags: javascript
---


# Question
Title: Possible to globally disable categories|category_fields|member_data|pagination instead of channel entry tag everytime?
Expression Engine's channel entry tag has a parameter called disable for which we can choose to disable various data from being returned and it is supposed to be better for performance to do so. I quote the documentation:

> The disable= parameter allows you to turn off aspects of the tag that you might not be using in order to improve performance.

For example:

```
{exp:channel:entries channel="content" disable="categories|category_fields|member_data|pagination"}

```

Well, we use this disable tag on nearly all of our templates on all of our websites. We of course do not disable them for a news or blog page.

So it has occurred to me, why are they enabled by default? Is it possible to disable these somewhere globally so we do not need to keep using the disable parameter?

It is a waste of space and time for us to add it all the time, and there are likely many developers not using this parameter and not needing the extra data.

It would be better if there was an enable option to add in what you need rather than take away what you dont.

Thanks

# Answer
There isn't a 'disable the disable' config variable.

I imagine come the next major EE release (as in 3.0) they'll swap the behaviour though.

In the meantime, have you considered having a snippet for disable all? `{disable}` which could just include...

```
categories|category_fields|member_data|pagination

```
> 1 votes

# Answer
Further to Andrews answer sometimes you don't want to disable everything so it can be handy to set up several snippets (or global variables) for each disable pattern, eg

```
{disable} - categories|category_fields|member_data|pagination - disable all
{disable-c} - category_fields|member_data|pagination - disable all except categories
{disable-p} - categories|category_fields|member_data - disable all except pagination
{disable-c-p} - category_fields|member_data - disable all except categories and pagination

```

...and so on.
> 1 votes

---
Tags: channel-entries
---


# Question
Title: Does CartThrob support Stripe as a gateway in the UK?
The official Supported Payment Gateways page suggests Stripe can only be used in North America, but not in Europe:

http://cartthrob.com/docs/pages/supported\_payment\_gateways/index.html

I'm wondering if this page simply hasn't been updated since Stripe started supporting markets outside North America.

Can Stripe be successfully set up as a payment gateway with CartThrob for UK stores? And does it work with all the currencies supported by Stripe?

# Answer
> 1 votes
Yes Stripe has a UK version and it works just fine with Cartthrob, see https://stripe.com/gb

---
Tags: cartthrob
---


# Question
Title: How do I use a conditional to display Relationships content?
I am working with three Relationship fields and I would like to be able to display a section only if there are any related articles in that section.

I tried this without success:

```
{if related_tips != ""}
  <h3>Related Tips</h3>
   <ul>
    {related_tips}
      <li><a href="{site_url}in_the_garden/decorating_tip/{related_tips:url_title}">{related_tips:title}</a> </li>
    {/related_tips}
   </ul>
{/if}

```

I would appreciate some guidance on how this should be done.

Thanks.

# Answer
> 4 votes
Try using the count and total results variables, but namespaced with the name of your relationship field:

```
{relationship_field}

    {if relationship_field:count ==1}
        <ol>
    {/if}

    <li>{relationship_field:title}</li>

    {if relationship_field:count == relationship_field:total_results}
        </ol>
    {/if}

{/relationship_field}

```

---
Tags: relationships, conditionals, related-entries
---


# Question
Title: Updated from EE 2.5.2 to 2.7.3 channel:form outputs error tags
I updated EE 2.5.2 to 2.7.3, changed the exp:safecracker tag to exp:channel:form.

Sending a new entry with no content outputs not an error message as expected it shows the tags like

```
{field_errors}
   {error}
{/field_errors}

```

channel:form has this parameter: error\_handling="inline"

I am wondering why that is and how I could fix it?

# Answer
Based on the Docs, you need to use a different syntax for `error_handling="inline"`

```
{error:your_channel_field_name}

```

or if you don't want it inline

```
{if error}
  {error}
{/if}

```
> 1 votes

---
Tags: channel-form
---


title: if last segment equals url title

text:
# Question
Title: if last segment equals url title
I am trying to show an active class if an entry is being viewed but my conditional's are not working:

```
{if last_segment == '{url_title'}  class="active"  {/if}

```

I am using an embed of a list of entries on a product detail page. I want the active entry to have a class of active

This is not working even though last\_segment and url\_title are the same

this is my embeded template:

```
{exp:channel:entries channel="products" category="{segment_3_category_id}"}

    <li {if last_segment == '{url_title}'} class="active"{/if}><a href="{title_permalink='Products/detail/{segment_3}/{segment_4}'}">{title} »</a></li>

    {/exp:channel:entries}

```

# Answer
solved: `{if url_title == "{last_segment}"} class="active"{/if}`
> 2 votes

---
Tags: conditionals, segments, url-title
---


title: using globals in channel entry tag

text:
# Question
Title: using globals in channel entry tag
so I am trying to use a dynamic variable, this works

```
{member_id}
{exp:channel:entries channel="vacancies" author_id="9"}

```

and this does not

```
 {member_id}
    {exp:channel:entries channel="vacancies" author_id="{member_id}"}

```

Any ideas

# Answer
> 1 votes
Install Mo'Variables http://devot-ee.com/add-ons/mo-variables then you could use:

> "Early-parsed Member Variables (for use as tag paramters): {logged\_in\_member\_id}, {logged\_in\_group\_id}, {logged\_in\_username}, {logged\_in\_screen\_name}, {logged\_in\_email}"

Hope it helps

---
Tags: channel-entries, channel, variable
---


# Question
Title: Expression Engine Forum Alternating Classes
Reading the expression engine forum display forum topics There is no count variable. I want to alternate classes for each result so it can have different background colors. There is no other property I can use that would also stand in for it for alternation. Anyone know what I can do for alternating classes for each forum topic result?

I don't know if anyone will see this, I miss the forums.

# Answer
> 1 votes
Use the `{switch}` tag. Separate switches by the `|` pipe character, they will cycle through.

```
{exp:channel:entries channel="news" limit="10" switch="green|blue|red"}
    <h2 class="{switch}">{title}</h2>
{/exp:channel:entries}

```

Will output

```
<h2 class="green">My title</h2>
<h2 class="blue">My title</h2>
<h2 class="red">My title</h2>
<h2 class="green">My title</h2>
<h2 class="blue">My title</h2>
<h2 class="red">My title</h2>
etc...

```

# Answer
> 0 votes
You also can do this is pure CSS using the CSS3 nth-child pseudo selector.

```
#yourtableid tr:nth-child(odd) {
  background-color: #99ff99;
}

```

---
Tags: module, forum
---


# Question
Title: Solspace Calendar: Calendar name not showing in .ics file
In case anyone is not aware of this: if you are using Solspace Calendar and are providing a subscription link, if you use http:// for the link, then the browser sends the .ics to the calendar client as a static file. Calendar changes and new events will not sync.

If you build the link using webcal:// the browser will pass it to the user's calendar client as a 'live link' and then will sync events and changes at intervals the user specifies.

Problem: The generated .ics file does not include the calendar title and thus the calendar name in the user's client ends up being the ulr to the .ics file.

According to http://en.wikipedia.org/wiki/ICalendar#Calendar\_extensions there is a property "X-WR-CALNAME" used to name calendar… How do we make this work with Solspace Calendar?

# Answer
> 1 votes
Currently there is no way to do this but to edit the addon files yourself. You could try around line 4028 of `mod.calendar.php`, close to where you see:

`$E->setProperty('summary', $title);`

adding another line that looks like:

`$E->setProperty('X-WR-CALNAME', $title);`

That should in theory add the line you are looking for.

According to that article anything starting with an 'X-' is a non-standard, and being thus I am hesitant to add this as default as people use Calendar in so many different environments and icalendar file reading implementations are fickle enough as it is.

I have added a feature request to our queue to have some way in icalendar output to add custom attributes via parameters to the tag so in some future version this might be more easily doable.

---
Tags: solspace-calendar
---


# Question
Title: Channel Form - Submit via Ajax with file upload
How do I implement an Ajax implementation on a Channel Form, especially when there is a file needed to be uploaded?

I look at an example, but I don't think I really understand how it works.

# Answer
> 1 votes
I tested this and it works just fine. Be sure to include the `title` input with valid data. If you're still having trouble, be sure to check the console log `data` object. If you dig around you'll probably find the pertinent error.

```
<!DOCTYPE html>
<html>
<head> ... </head>
<body>
{exp:channel:form channel="your_channel" json="yes"}
    <input id="title" name="title" />
    {field:your_file_upload_channel_field}

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

<script src="https://code.jquery.com/jquery.js"></script>
<script src="/path/to/jquery.form.js"></script>
{!-- jquery.form.js can be found at http://malsup.github.io/jquery.form.js --}

<script type="text/javascript">
    $(document).ready(function() {
        $('#publishForm').ajaxForm({
            dataType: 'json',
            success: function(data) {
                if (data.success) {
                    // success!
                } else {
                    console.log(data);
                }
            }
        });
    });
</script>
</body>
</html>

```

Also, because you didn't specify, be sure you're using an instance of EE that supports Channel Form instead of Safecracker. I just checked the docs to 2.7.3 and it looks like files upload in Channel Form were included in 2.7.\*.

> The File fieldtype is now compatible with Channel Form.

So if you have an instance that's older, file upload via channel form might not work.

---
Tags: channel-form, ajax
---


title: Freeform multi-language notifications

text:
# Question
Title: Freeform multi-language notifications
We're trying to work out the best way to get Freeform to send notifications in the user's language. For example, our contact form is on a page where the first segment is the lang code (/en/, /de/, etc.). We've set the config lang to match the lang set in the URL.

Any ideas on how to accomplish this?

Thanks, Paul

# Answer
Let's take the `user_notification_template=""` parameter as an example, and your two languages: `en` and `de`. (This would work for `admin_notification_template=""` and `recipient_user_template=""` as well)

First, create two notification templates in Freeform (*Notifications* tab in the Freeform CP), one in each language. Let's call their short names `user_email_en` and `user_email_de`.

Then in your template, in either `{exp:freeform:form}` or `{exp:freeform:composer}` tags (whatever one you are using), add the `user_notification_template=""` parameter, with an **early-parsed conditional** as its value. Here are a few different ways you would use the parameter:

```
user_notification_template="{if segment_1 == 'en'}user_email_en{/if}{if segment_1 == 'de'}user_email_de{/if}
user_notification_template="{if segment_1}user_email_{segment_1}{/if}"

```

If you registered an early global variable in **index.php** (eg. `{country_code}`), you could do the same as the above, but with that variable. Eg.

```
user_notification_template="{if country_code == 'en'}user_email_en{/if}{if country_code == 'de'}user_email_de{/if}
user_notification_template="{if country_code}user_email_{country_code}{/if}"
user_notification_template="user_email_{country_code}"

```

> **NOTE**: Please make sure to use an **early-parsed conditional** and NOT an **advanced conditional** (eg. containing {if:else} or {if:elseif}, using AND/OR operators, etc). Only early-parsed conditionals can work in parameters. Please refer to the EE documentation about parse order for more details.
> 2 votes

---
Tags: solspace-freeform, solspace, multi-language
---


# Question
Title: Problem: Linking to specific CMS page from external page
I've created an external "admin" page, but added a "Return to CMS" link .When this is clicked it redirects back to the EE admin page BUT it's logged me out and the URL is something like:

http://website.com/admin.php?S=0&D=cp&C=login&return=Qz1hZGRvbnNfbW9kdWxlcyZhbXA7TT1zaG93X21vZHVsZV9jcCZhbXA7bW9kdWxlPWxvd192YXJpYWJsZXM=

Is it possible to link back to the CMS, but still be logged in? Because it seems to be logging me out.

# Answer
Try to change the Control Panel Session Type to **Cookie only**.
> 1 votes

---
Tags: login, redirects, admin, admin.php
---


# Question
Title: Sorting Low Search results across multiple channels
We've got two channel, Images and Videos, that we're combining in search results. Searching by keyword works great. So does sorting by entry\_date and title. But we'd also like to sort by other fields.

To simplify things, imagine a custom field in each channel - video\_score, image\_score - that hold integers received from elsewhere. So, how would it be possible to combine these two for the orderby?

If it's easier we can create fields video\_order and image\_order with unique ordering numbers, but due to the custom fields being in two channels I don't see how to use the same custom field name, which appears to be what we need for orderby.

Do we maybe need to hijack a core field?

Thanks, Paul

# Answer
> 1 votes
One way to do this would be to create a custom extension that uses the low\_search\_post\_search hook. That will give you an array containing all parameters that will be passed through to the native channel:entries tag for parsing the results. That includes the entry\_id or fixed\_order parameter which contains the entry IDs for the search results (as long as a LS filter has been triggered).

With that list of IDs, you can query the DB for the values you want to sort by, and then re-sort the entry IDs based on those values. If you then set the fixed\_order param with the newly sorted list, the search results should appear in the desired order.

Another way would be to create a fieldtype that hijacks a core field (as you suggested) like view\_count\_one to four.

---
Tags: low-search, sort, orderby
---


title: Searching channels

text:
# Question
Title: Searching channels
First time on an EE project, I want to build a search for my channel on the front end. Which is best way to achive this?

```
1 -sql via a form is this an option?

2 - 3rd party module

3. advanced search form?

```

My form is 4 dropdowns which filter the channel (jobs)

```
 -full time/part time
- qualification
- salary
- location

```

# Answer
> 1 votes
I've always used Solspace Super Search for all of my projects and never run into anything it couldn't do search related:

http://www.solspace.com/software/detail/super\_search/

# Answer
> 1 votes
While we're mentioning add-ons here, Low Search will do the job nicely.

http://gotolow.com/addons/low-search

---
Tags: search, forms, sql, ee
---


title: Matrix breaks Field Options on 2.8?

text:
# Question
Title: Matrix breaks Field Options on 2.8?
I'm installing my first 2.8 on a local machine, and noticed that the Field Options aren't showing up.

I retraced the steps and it turns out installing latest version of Matrix (2.5.10) breaks Field Options (i.e., FO stops showing up.)

Only CP related add-on I have is NSM's Override.css.

Has anyone else encountered a similar issue?

# Answer
There’s a Javascript bug in EE 2.8.0 that breaks the field settings page and other areas of the CP when certain add-ons are installed, including Matrix. It’ll be fixed in 2.8.1, and EllisLab has posted a patch file here: https://support.ellislab.com/bugs/detail/20165
> 4 votes

---
Tags: matrix, control-panel, 2.8
---


# Question
Title: Solspace Freeform sent through Postmaster returns multi-part MIME format error
Using Freeform (free version) for two forms on my site. Both forms send a message to admin as well as a confirmation back to the sender.

I have Postmaster setup to send all system emails, so all Freeform notifications are routed through Postmaster to be sent (through Mandrill, not EE).

I get strange results in my email sent emails like this:

> This is a multi-part message in MIME format. Your email application may not support this format. --B\_ALT\_53168daed37f9 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit

Followed by a text only version of the email, and then...

> --B\_ALT\_53168daed37f9 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable = =20

My HTML version of the email is also slightly disfigured and loses its CSS styling.

The issue appears to be that Freeform is sending a multi-part message and headers which is then being embedded inside the Postmaster email template (which is HTML). Even if I make the Postmaster template blank and include all the HTML in the Freeform template, I still get the same problem.

The only way around this issue that I can see is to force Freeform to not send a multi-part message (and no headers) so they don't double-up or conflict with what Postmaster sends out. Is this possible?

If not, how else can I make Freeform compatible with Postmaster? If I can't resolve this there's no way I can use Postmaster to send me system emails.

Just wanted to note that this is specifically a Freeform & Postmaster issue. All other system emails send out fine with this setup so it must be due to the way Postmaster formats the email.

# Answer
It turns out the answer is to turn off "Allow HTML" for all Freeform notification templates. I believe this is because Freeform will then leave the email as plain text allowing Postmaster to encapsulate it as HTML.

Benek, I'm glad it's all sorted for you! :-)
> 3 votes

---
Tags: solspace-freeform, solspace, postmaster, html-email
---


# Question
Title: Channel Form is not inserting <p> tags like Channel Entries does; all <p> tags mysteriously gone from entries
When we enter properly formatted HTML into the RTE via the CP, the `<p>` tags are present. But when we use the `{exp:channel:form ...}` we lose all the `<p>` tags but retain all other tags. We're using `Textarea (Rich Text)` fields because we need the RTE on our custom dashboard.

I tested the `{exp:channel:entries ...}` and the `<p>` tags were properly retained.

So what could be causing this? How can we fix it? We need the channel form to output the proper tags because we have a live preview of what's in the populated `textarea` elements.

---

Update:

When using `{field:my_channel_field}` the `<p>` tags are retained, but the RTE isn't created. It's just a `textarea` with html/text.

---

Update 2:

I did some digging and found that in the SQL tables there are no `<p>` tags, meaning that they're inserted when the data is called.

For instance this is what's actually in the Database

```
<h3>Lorem nascetur </h3> Porttitor. Integer nunc. Hac ultricies velit magnis. Nunc est, tortor proin?

```

And this what is output when using `{exp:channel:entries ...}`:

```
<h3>Lorem nascetur </h3>

<p> Porttitor. Integer nunc. Hac ultricies velit magnis. Nunc est, tortor proin?</p>

```

So at some point the `<p>` tags are being injected into the document, and I want to know how can I force this so they are in the RTE when the user goes to edit them within an `{exp:channel:form ...}` loop?

---

Update 3:

I found these in `/system/expressionengine/modules/rte/libraries/Rte_lib.php` on lines 445 to 446

```
// Strip paragraph tags
$data = preg_replace("#<(/)?pre[^>]*?>#i", "<$1pre>", $data);
$data = preg_replace("#<p>|<p(?!re)[^>]*?".">|</p>#i", "",  preg_replace("#<\/p><p(?!re)[^>]*?".">#i", "\n", $data));

```

and

```
if (stristr($str, '<p') !== FALSE)
{
    $str = preg_replace("#<(/)?pre[^>]*?>#i", "<$1pre>", $str);
    $str = preg_replace("#<p>|<p(?!re)[^>]*?".">|</p>#i", "",  preg_replace("#<\/p><p(?!re)[^>]*?".">#i", "\n", $str));
}

```

in `/system/expressionengine/libraries/EE_Typography.php`.

Commenting them out didn't seem to solve the problem

---

Update 4:

I tested my theory more completely by simply doing a `{exp:channel:entries ...}` and `{exp:channel:form ..}` on a blank template with nothing other than a field.

When output, the `channel:form` actually outputs HTML tags (`<h3>` from update 2 above) that never get rendered, and the `channel:entries` outputs the correct HTML and does get rendered. See picture:

# Answer
After much consternation I tried commenting out the `Strip paragraph tags` section of the `save_field()` function from above again, but tested it more thoroughly and it works. It keeps the tags on submission/repopulation through `channel:form`. This might cause bugs down the line, but it'll do for now.

`/system/expressionengine/modules/rte/libraries/Rte_lib.php`

lines 445 to 447.

```
// Strip paragraph tags
/*
$data = preg_replace("#<(/)?pre[^>]*?>#i", "<$1pre>", $data);
$data = preg_replace("#<p>|<p(?!re)[^>]*?".">|</p>#i", "",  preg_replace("#<\/p><p(?!re)[^>]*?".">#i", "\n", $data));
*/

```
> 1 votes

---
Tags: channel-form, tags, rte, formatting
---


# Question
Title: Simple Commerce - don't want to use PayPal
I'd like a simple ecommerce solution, but don't want to use PayPal. I already have authorize.net set up, so I would rather use that option. Simple Commerce seems to be designed to work around PayPal. Is there a way to make it work with authorize.net? Are there alternative solutions to Simple Commerce that do not cost?

# Answer
> 3 votes
I don't know of any free alternatives for Authorize.net.

Charge (http://devot-ee.com/add-ons/charge) is an affordable ($45) method to integrate Stripe.com and might be a good middle ground solution between Simple Commerce and a true eCommerce add-on such as CartThrob or Exp:resso Store.

---
Tags: simple-commerce
---


title: change category id manually

text:
# Question
Title: change category id manually
I would like to match both production and development versions to have identical category ID's without having to import the db every time. In this case it's only one Category which is out of Sync. (category ID 130 should be 137)

Which statement should I use on the db? (mysql noob)

# Answer
> 2 votes
I think this should do it, but you should take a database backup just in case. You might need to run each group separately.

```
// Update the Categories Table
UPDATE exp_categories
SET 'cat_id' = 137
WHERE 'cat_id' = 130

 // Update the Categories Field Table
UPDATE exp_category_field_data
SET 'cat_id' = 137
WHERE 'cat_id' = 130

// Update the Category Posts Table
UPDATE exp_category_posts
SET 'cat_id' = 137
WHERE 'cat_id' = 130

```

---
Tags: database
---


title: EE Extension for OmniPay / Paypal

text:
# Question
Title: EE Extension for OmniPay / Paypal
I have created a simple extension in EE to handle PayPal payments on submission of a Channel Form, which seems to be working up to a point.

My problem is how do I get the extension to handle the response after the return from PayPal?

My send parameters need to include a 'returnURL' which means that PayPal redirects to this page on successful completion - obviously this means the function in the extension is no longer in play!

Here's the logic in the extension:

```
    $response = $gateway->purchase($args)->send();

if ($response->isSuccessful()) {
    // do something with the response

} elseif ($response->isRedirect()) {
         // redirect to offsite payment gateway
         $response->redirect();

} else {
         // payment failed: display message to customer
         echo $response->getMessage();
}

```

The issue is that on returning from the redirect to the offsite gateway,the 'isSuccessful' branch doesn't get executed, I am just redirected to the page specified in the 'returnURL' parameter sent with the initial request.

How do I process the return from PayPal so I can send the completePurchase() request within the extension?

EDIT I've just had a thought - should I make the returnURL an '?ACT' and add an entry to the actions table to call the next function in the extension?

... I'll try it

EDIT

Except you can't use actions with extensions, only modules. And you can't use hooks in modules, only extensions. As I need to hook into the form submit AND use an action to process the return, it' back to the drawing board :-(

# Answer
> 2 votes
So, the answer was, after all, to create both an extension and a module within the same add-on folder. Extension to hook into the form submission, then a module to process the paypal payment. I created an action id to refer to the method within the module, and then used that as the returnURL

```
$q  = ee() -> db -> select('action_id') -> from('actions') -> where(array('method' => 'complete_purchase','class' => 'Process_payment'))->get();
$action_id = $q -> row('action_id');    $args['cancelUrl'] =  ee() -> functions -> fetch_site_index(true) . 'clients/_cancel';
$args['returnUrl'] =  ee() -> functions -> fetch_site_index(true) . '?ACT='.$action_id;

```

etc etc

I can post more detailed information if anyone else is stuck on this

# Answer
> 0 votes
Yes, with ExpressionEngine you often need to create both an extension and a module. The difference is rather superficial and ideally they would all be the same thing, but that's what we have to work with for now.

You are correct in assuming you need an action URL to deal with this. Make a record of the amount which was to be paid somewhere in the database (if you are using channel entries then this will already be done for you), then create an ACT URL which will allow you to identify the payment. For example:

```
$url = ee()->functions->fetch_site_index().'?ACT='.$action_id.'&entry_id='.$entry_id;

```

If you are using EE 2.7+, make sure you set the `csrf_exempt` database column to `1` in the `exp_actions` table for your action as well (not explicitly needed for Paypal, but other off-site gateways often POST to your action which triggers EE's CSRF protection.

In your module action, simply load up Omnipay and call `$gateway->completePurchase($params)`, which will check for the correct query string parameters and confirm the transaction with PayPal.

---
Tags: extension
---


# Question
Title: Calendar-based Content Displayal like Lumosity
Sorry, I don't know how else to describe this (as in the title). So have you all seen Lumosity's logged-in user page? Basically, it shows a calendar with today's date (Sunday, for example), and games to play for that date. Then, when you login the next day, it'll show that it is Tuesday, and it'll give a selection of games to play for Tuesday.

**Is there a way to do this with ExpressionEngine, where you pull and display random content each day (different content every 24 hours) from a channel (pool of content)?**

Or to make it even more complex, say we want to display 5 content entries. How do we pull 1 entry from 5 different channels, so that the 5 content entries we want to display are all of different types?

Thanks.

# Answer
> 0 votes
You could build a simple add-on that extends the Channel Entry loop and sets the `entry_id=""` parameter based on the random ID's it grabs.

You could select the entry\_ids to load with a method such as those found at https://stackoverflow.com/questions/18346047/select-record-from-database-randomly-based-on-time

You can read about extending Channel Entries here: http://dmlogic.com/blog/extending-the-expression-engine-channel-module/

So your add-on may look like this

```
{exp:date_entries channel="games" limit="5"}
    <li>{title} - <a href="/game/play/{url_title}/">Play now »</a></li>
{/exp:date_entries}

```

If you wanted to load from 5 different channels you could make your addon do that too by using a pipe delimiter so for example

```
{exp:date_entries channel="mind-games|trivia|technology|history|science|visual" limit="5"}

```

Your add-on would then run the SQL query against the channels listed above.

Let me know how you get on.

---
Tags: channel-entries, dynamic
---


title: ExpressionEngine Lexer

text:
# Question
Title: ExpressionEngine Lexer
Has anyone tried or succeeded in building an ExpressionEngine Lexer that could be used to build out customized code hinting and coloring?

I haven't seen one out there, but didn't know if I was just overlooking things or not

# Answer
> 1 votes
There are a number of addons for popular editors to add syntax highlighting and code completion.

Here's some that I'm aware of...

---
Tags: ee2
---


title: Remove category URL last segment

text:
# Question
Title: Remove category URL last segment
I am using the code below to display a list of items all with the same category, which works. However the URL os not want I would like displayed. The URL shows as http://vintageceramics.co/store/products/category/ceramics/264

I would like to remove the /264

How would I do this? I have Low Seg2Cat installed, but I'm not sure how to use it in this case?

I would be most grateful if anyone can help.

```
{exp:channel:entries channel="promotional" status="open" category="{last_segment}" limit="4"}
<div class="item {if count == 1}active{/if}"> <!-- Start .item -->
{promo_product_image}
<img src="{image:url}" alt="{image:title}">
{/promo_product_image}
<div class="container">
<div class="carousel-caption">
<h1>{promo_main_title}</h1>
<p>{promo_product_description}</p>
{categories show_group="26|25|28"}
<a class="btn btn-outline-white" href="{path='store/products'}/{category_id}" role="button">View Details</a>
{/categories}
</div>
</div>
</div> <!-- End .item -->
{/exp:channel:entries}

```

# Answer
I have now got this to work by using this code:

```
 {categories show_group="26|25|28"}
    <a class="btn btn-outline-white" href="{path='store/products'}/{category_id}" role="button">View Details</a>
    {/categories}

```

I removed the show\_group="26|25|28", as this is not needed if the entry as a category selected and also removed the {category\_id} in the URL.

The new code is:

```
 {categories}
    <a class="btn btn-outline-white" href="{path='store/products'}" role="button">View Details</a>
    {/categories}

```
> 1 votes

# Answer
Well, you need to check if 'ceramics' is actually that 264 category, if it is, then you can remove the number at the end and replace {last\_segment} in your Entries tag and use seg2cat {last\_segment\_category\_id} tag, something like this:

```
{exp:channel:entries channel="promotional" status="open" category="{last_segment_category_id}" limit="4"}

```
> 0 votes

---
Tags: categories, url, low-seg2cat
---


# Question
Title: Solspace Facebook Connect {fbc_publish_to_facebook} failing on comments but works on ratings
As the title says, I've implemented Solspace Facebook Connect's {fbc\_publish\_to\_facebook} but it's not working for comments. It does work fine on ratings.

Could this be because I'm submitting my comments via AJAX?

Any other reasons why the sharing to facebook would fail on comments?

Is there any way to debug it so I can see why it's failing?

I don't get any error or indication that it has failed. The comment simply doesn't get posted to facebook and I have no reason why.

The prepare page tags and all other necessities are there.

# Answer
Can you confirm what version of ExpressionEngine and Facebook Connect you are using?

If it's v2.8 (latest) there are issues with a new, more verbose security model. I have submitted a patch to SolSpace for my issue where the facebook registration plugin was causing an EE Form out of date error.

If not, please ignore me!
> 0 votes

---
Tags: solspace, solspace-facebookconnect
---


# Question
Title: Some add-ons don't work after EE1 upgrade
I've upgraded a site from EE1 to EE2 and a few of the add-ons don't seem to be working inside the templates.

They are working fine inside the Admin area and all the content is showing up in the entries perfectly. But on the front end I'm getting things like:

> M90o93H7pQ09L8X1t49cHY01Z5j4TT91fGfr

Appear where that add-on is trying to output the content.

I can't figure it out! All the add-ons are up to date and I'm using the updated / correct template code for that plugin.

One in particular is Structure:

```
{exp:structure:nav start_from="/{segment_1}" include_ul="no" current_class="selected"}

```

Outputs:

> M10O93H7PQ09L8X1T49CHY01Z5J4TT91FGFR

What do these long mix of characters & numbers mean?!

Add-ons currently causing this to happen are:

* Matrix
* Playa
* Structure
* CE Image

# Answer
It turns out I had an old EE1 add-on in the template, which made all the others just die and display the string/characters.
> 1 votes

# Answer
This one is caused from a pseudo caching that the ExpressionEngine template parser does. When it finds the same tag multiple times it will replace it with a string like this. The template parser will often run into an issue when the tag is nested in another tag pair. This being said, the fix is simple. All you really need to do is add a random string to tag (the one that's throwing the random string) so the template parser won't see it as a duplicate tag.

So

```
{exp:structure:nav start_from="/{segment_1}" include_ul="no" current_class="selected"}

```

Could be changed to

```
{exp:structure:nav start_from="/{segment_1}" include_ul="no" current_class="selected" work="yes"}

```

and it should do the trick.
> 0 votes

---
Tags: matrix, playa, structure, ee1, string
---


# Question
Title: Pagination using Structure and Playa entries
Currently on a site using Structure. I've run into a brainteaser I hope someone maybe able to help out with.

The site itself makes use of Structures child pages. In my case these child pages relate to Recipes. ie. the parent page would be Recipes with a child of Main Courses, which would then have child pages of Fish courses, Pasta courses etc. In the publish form of these child pages I have a Playa field, which link documents/recipes from my documents channel.

Thats all fine, but some child pages have a lot of related documents assigned to them, so I want to integrate pagination if possible to avoid long scrolling pages.

This is the bare bones of my markup

```
{exp:channel:entries status="not closed" dynamic="on"}

    {if related_docs}<!--My Playa field-->

    {exp:playa:children
        channel="documents"
        disable="categories|category_fields|member_data"
        orderby="title"
        sort="asc"
        limit="5"
        var_prefix="pages"
        paginate_base="/{segment_1}/{segment_2}/{segment_3}"
        paginate="bottom"}

    <h5>{pages:title}</h5>

    <!--Pagination start-->

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

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

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

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

  {last_page}
    <li><a href="{pagination_url}" class="page-last">Last Page</a></li>
  {/last_page}
</ul>
{/pagination_links}
{/pages:paginate}

    {/exp:playa:children}

    {if:else}

    <p style="padding:15px;">Currently no resources for this area</p>

    {/if}

{/exp:channel:entries}

```

I have read about using pagination within a Playa field, hence the inclusion of `var_prefix`. But the pagination just doesn't seem to be working.

Right now if I navigate to my Structure child page with the related entries displayed, the URL is `domain.com/recipes/main-courses/meat-dishes/`.

Using the default `pagination_url`, this takes me to `domain.com/recipes/main-courses/meat-dishes/P5` . Which implies the pagination URL's are being correctly applied. But when I click on the next page I am merely taken to the homepage, with the `P5` paginated url.

Am I missing something glaringly obvious with this one. Has anyone had any success with this or can someone point me in the right direction.

# Answer
Is meat-dishes an actual Structure page with a listing attached? That's the only way Structure can know to properly paginate.
> 0 votes

---
Tags: playa, structure, url, pagination, related-entries
---


title: Pixel & Tonic compatibility with EE 2.8

text:
# Question
Title: Pixel & Tonic compatibility with EE 2.8
Will Pixel & Tonic modules be upgraded to be compatible with EE 2.8.0? I have noticed several posts in the last week about errors with Playa, Wygwam, Matrix, etc. and I have many sites that are running these modules.

# Answer
Last week I tweeted P&T about possible EE 2.8 issues and they replied that there's a Javascript bug in the initial release that EllisLab has posted a patch for. I've not had a chance to test this personally, but here's the link:

https://support.ellislab.com/bugs/detail/20165
> 1 votes

---
Tags: pixelandtonic, ee, 2.8
---


# Question
Title: Using Solspace Form to add users to a mailing list
I trying to get solspace form to add users to a mailing list, but no cigar. using the latest free version. any help is appreciated.

```
{exp:freeform:form form_name="mailing_list" mailinglist="blog" return="contact/thank_you" notify="xx@gmail.com" required="email"}
<form action="" id="contactForm" type="post">
    <input type="email" name="blog[2]" value="" data-msg-required="Please enter your email address."  maxlength="100" class="form-control" id="email">

    <input type="submit" value="Send Message">

{/exp:freeform:form}

```

# Answer
> 1 votes
Your input fields need to be structured similar to this one below:

{freeform:field:email attr:type="email" attr:class="form-control" attr:placeholder="Your Email Address"}

Take a look at the example for the advanced form found here: http://www.solspace.com/docs/freeform/form/#advanced\_contact\_form

# Answer
> 0 votes
You are trying to use parameters that are for Freeform 3.x. Mailing list is now a fieldtype. You will need to add it to your form and adjust its settings when you create the field.

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

---
Tags: solspace-freeform
---


# Question
Title: Avoid duplicate entries tagged with multiple categories
Let's say I have entries tagged with multiples categories, for example `category_id="1"` and `category_id="2"`.

Then when I do:

```
{exp:channel:entries channel="news" category="1" orderby="date" status="open"}
    {categories}
    <span>{category_id}</span>
    <h5><a href="{site_url}news/category/{category_url_title}/{url_title}">{title}</a></h5>
    {/categories}
{/exp:channel:entries}

```

I get the following result:

```
1
My entry title
2
My entry title
1
Another entry
2
Another entry

```

Why is that? How can I avoid this? If I ask specifically for `category_id="1"` in my `{exp:channel:entries}` parameter, I should get only entries belonging to said category.

Thanks in advance for your help.

FYI: EE version is v2.7.2

# Answer
> 1 votes
Looks like your code is a bit strange here, specifically the `{categories}{/categories}` tag pair wrapping everything.

Could you try the following and see if it works ?

```
{exp:channel:entries channel="news" category="1" orderby="date" status="open"}

    <h5>{title} - {categories}{category_id}{/categories}</h5>

{/exp:channel:entries}

```

If that works, then that's the problem.

Going back to your original code, I see another problem you are going to face if you structure your URLs like this: if an entry belongs to more than one category, you are going to have a problem constructing your URLs as you are doing here. If you can, working with url segments is probably a safer route here.

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


title: Moblog User Authorization not working

text:
# Question
Title: Moblog User Authorization not working
ExpressionEngine 2.7.3

I have installed the moblog add-on and it is working fine except when I try and implement user authorization it refuses to work.

If I make authentication required then the entry is not imported at all and if I set it to delete un-authorized emails it just deletes the email.

If I do not set authorization as required then the import completes but the authorization line is added to the top of the moblog field in the new entry.

This is what my emails contain:

> AUTH:username:user\_password
>
> moblog field content here

Any ideas would be much appreciated. Am I missing a vital setting or permission option somewhere?

# Answer
After having contacted EE support it turns out it was a bug. Here is the fix and upcoming releases should sort it permanently: https://support.ellislab.com/bugs/detail/20199
> 0 votes

---
Tags: module
---


# Question
Title: White Screen Trying to Manage Multiple Site Manager After Upgrade
After upgrading a ExpressionEngine 2.1.0 site to ExpressionEngine 2.5.2 (ran into issues trying to upgrade to 2.7.3 and 2.5.2 was the oldest I had in my archives) I am running into a white screen when trying to access Edit Sites or any of the two sites under the Site Name menu in the ExpressionEngine CP.

I've enabled debugging output everywhere I can think of — in the CP, in index.php files, etc. — but still only see the white screen.

I am trying to do this with MSM 2.1.6.

Any thoughts on what to check for this? Configuration settings that might have been missed? Something in the database that might not have been updated properly between 2.1.0 and 2.5.2? That sort of thing.

**UPDATE (2014/03/10)**

I was able to uncover a couple more useful data points. When I try to load the Edit Sites screen in Chrome, I see this error message:

`Fatal error: Class 'CP_Controller' not found in /Users/bseymore/Sites/backspaceink-252.loc/admin/expressionengine/controllers/cp/sites.php on line 25`

For some reason that error message does not appear in Safari.

When I try to load the Edit Sites screen via Safari, I see this in the Developer Console:

`Failed to load resource: the server responded with a status of 500 (Internal Server Error)
http://[SITE-NAME]/admin/index.php?S=e34bf993965b3c69ce41729920acdf886e3e4dba&D=cp&C=sites&M=manage_sites`

# Answer
After a little bit of poking around, I found a thread in the archived EllisLabs forums with the solution. I needed to make a couple small edits to `/controllers/cp/sites.php` to get up and running.

My hunch is MSM 2.1.6 was not quite compatible with 2.5.2 and so rolling back to an the slightly edited older version of MSM got me moving again.

For future reference, the thread is right here:

http://ellislab.com/forums/viewthread/176048/#837688
> 1 votes

---
Tags: multi-site-manager, white-screen-of-death
---


title: White Screen of Death in CP After Login

text:
# Question
Title: White Screen of Death in CP After Login
I just migrated a site from the development server on MediaTemple (gs) to the production server on EngineHosting (shared). The front-end of the site displays fine (except some random images aren't displaying), but I get white-screen of death after logging-in to the control panel. My system folder is above web root and I'm using Focus Lab Master Config. Here's what I've tried so far:

* I cleared the cache before migrating.
* I've enabled debugging in config.env.php, index.php, and admin.php, but no errors display.
* I've cleared my .htaccess file.
* I checked that my cache folder has 777 permissions.

Not sure what else to try at this point, though I suspect Master Config is the culprit. Suggestions?

EE 2.5.3

**UPDATE:** After suggestions from @Tyssen and @jackmcpickle, I removed Master Config, which revealed an extension error. So I disabled extensions via config.php and the Control Panel is displaying. But if I go to the extensions page, only the 1st party extensions show up, so I can't enable/disable 3rd party extensions one by one. What could be causing that?

**UPDATE 2:** The reason I couldn't see my 3rd party extensions is because my `third_party_path` config var was wrong. Unfortunately, once I fixed the path, I got WSoD in the CP again, even with extensions disabled. So we're back to square one again.

# Answer
> 3 votes
After uselessly beating my head against the wall on this, I just decided to clear all the files from the server, drop the database, and re-upload everything.

Now it works fine.

Thank you, thank you, THANK YOU to everyone for all of your excellent suggestions, and I'm really sorry for totally mangling this question.

# Answer
> 24 votes
Most WSoDs are caused by a PHP error that haults processing combined with configuration that prevents the error from being shows in the browser.

The fastest way to debug white screen errors is to turn on logging and startup errors. The instructions below assume you are running under Apache with an Override setting that will allow php\_flag and php\_value directions in your .htaccess file.

**Of course, before changing any files make sure you have a backup of the database and files!**

1. Create a directory in your home directory named log and make it writeable:

```
$ cd ~
$ mkdir log
$ chmod -R 777 log

```
2. Create an .htaccess file in the root of your project with these lines in it:

```
php_flag display_errors 1
php_flag display_startup_errors 1
php_value error_reporting 30719
php_value error_log /home/USER/log/PROJECT.log
php_flag log_errors 1

```
3. I'd recommend putting the following line at the top of your front controllers (your root level /system/index.php, /index.php and /admin.php) so you can see what requests cause what log output:

```
error_log($_SERVER['REQUEST_METHOD'] . ' ' . $_SERVER['PHP_SELF'] . ($_SERVER['QUERY_STRING'] ? '?' . $_SERVER['QUERY_STRING'] : ''));

```
4. While making the request that crashes EE, watch the log file with:

```
$ tail -f /home/USER/log/PROJECT.log

```

The htaccess file does a few things:

1. Sets error reporting to the current `E_ALL` value (you cannot use constants in .htaccess).
2. You should see any syntax errors - that's what `display_startup_errors` does
3. If the code turns off `display_errors` anywhere (pretty common when you are using a lot of third party code) you should still see the errors in the log.

If this doesn't work, look in your codebase for the following things. ack works best for this - it's like grep on steroids - but you can instead use your text editor's Find in Files functionality to search through a local copy if you have FTP-only access.

Stuff to check for (each of these is a call that may or may not have arguments, just search for each word listed and take the recommended action):

1. `@include`, `@require` \- any of these will ignore syntax errors in the included files. Change these to not have the @ sign so that errors inside them will show up. I believe there is still at least one reference to @require in the Extensions.php file, although this might have been removed finally.
2. `@eval` \- less likely than the above but would also ignore syntax errors. This shouldn't be used by core EE but could be used by add-ons. Change to not have the @ sign.
3. `exit`, `die` \- obvious probably, but make sure there is an echo before any of these so that you can see which one caused the output to end (resulting in a White screen).
4. `log_errors` \- see if someone is turning off error logging for some reason.
5. `error_reporting` \- comment out all of these in third-party add-ons as well as the core. Any of these will disable error reporting to not match the settings provided above.
6. `ini_set('display_errors', '0')` or `ini_set('display_errors', 0)` or `ini_set('display_errors', false)`\- comment out all of these as well

If this still doesn't work, you can use a PHP debugger to trace through the code (such as XDebug and one of the many debugging GUI front-ends available such as PhpStorm), or add `error_log()` and `error_log(print_r($something, true))` calls to write things to the log. This is a lot better than print or echo because it can't be erased or output buffered and gets written instantly to the log file.

Hope this helps.

# Answer
> 3 votes
When I have had a WSoDs in the past it has often been due to third party extensions failing.

Try turning off extensions in config.php and work your way back from there. Also, make sure you third-party extensions are up to date.

# Answer
> 3 votes
If it's a memory issue, add

```
# Increase PHP Memory
php_value memory_limit 32M

```

to your .htaccess on the root of the html folder.

# Answer
> 2 votes
Not sure if this is possible on EngineHosting, but could you try re-booting your server instance? I've had this issue happen before while migrating sites and to fix it I just had to restart apache and everything worked great.

# Answer
> 2 votes
Before going crazy I'd also try clearing your browser cookies.

# Answer
> 2 votes
You don't say which version of EE you're using or what add-ons but from experience a common cause of this has been Image Sizer. The specific problem being large files causing out of memory errors. There have been occasions where it has caused a problem even when the files in question are not being directly accessed.

# Answer
> 0 votes
I solved this by myself today removing expressionengine/cache and then watching the folder on login. Turns out it was a devotee accessory failing due to a disabled php function. But I could see it creating a folder in cache.

Check/disable your accessories and extensions to check they are not the issue. 90% of the time they are when moving servers.

EE version 2.5.5

# Answer
> -1 votes
white screen usually points toward a memory issue.

---
Tags: ee2, white-screen-of-death, focus-lab-master-config, server-migration
---


# Question
Title: Fatal error: Call to undefined method EE_Loader::libary() in EE_Pagination.php
I receive this error from a new installation, 2.8.0

I have only a channel and a template.

If I display a single item, all works fine, if I use pagination, receive this error.

My code is very simple, this is my first site in ee.

```
{exp:channel:entries
    channel="blog"
    limit="10"
    paginate="bottom"
}

    {title}

    {paginate}
        <p>Page {current_page} of {total_pages} pages {pagination_links}</p>
    {/paginate}
{/exp:channel:entries}

```

# Answer
I believe it's a spelling issue in "libary" should be "library"

https://support.ellislab.com/bugs/detail/20172
> 6 votes

---
Tags: pagination
---


title: Arabic, Russian and Japanese in EE?

text:
# Question
Title: Arabic, Russian and Japanese in EE?
I have a client which would like to be able to add Arabic, Russian and Japanese into EE fields.

I have never worked with foreign languages other than French so am wondering if EE works with foreign characters in fieldtypes?

# Answer
Yes it does. I have just done a site with entries in Russian, Latvian, Czech and have another site that uses Chinese and Japanese.
> 1 votes

---
Tags: language
---


# Question
Title: Channel from. The action you have requested is invalid
I have a main site with mobile template group.

And I have a subdomain for mobile site and it will redirect to the mobile group template in main site.

But currently I am facing "The action you have requested is invalid. " when form submit to main site url.

anyone know what the problem?

# Answer
Looks like you might be running into EE's secure form feature. Put the following input tag in your form and see if it works out.

```
<input type='hidden' name='XID' value='{XID_HASH}' />

```
> 1 votes

---
Tags: forms, channel-form
---


# Question
Title: PCI Compliance Failure, “User specified URL redirection (Open Redirect)”, return value of form
I’m 1 vulnerability away from achieving PCI compliance per McAfee’s scan. The dubious “open redirect” remains.

My EE/CartThrob add to cart form returns to “/checkout/review”, but McAfee’s scanner sees that as a vulnerability, whereby a nefarious user changes that url to SomeBadURL.com without the user knowing what occurred.

> Medium User specified URL redirection (Open Redirect) 80/tcp Web Application Fail ￼￼￼￼￼￼￼￼￼Description A parameter has been identified that can be modified to redirect clients to a user controlled page. An attacker could potentially construct a URL that will redirect a victim to a site that they control. This type of attack is typical seen in phishing attacks where the user is presented with a valid link on the site (i.e. http://www.mcafeesecure .com/main.jsp?state=4&page=http://mcafeesecure-evilsite.com) and mcafeesecure.com redirects the user to mcafeesecure-evilsite.com (T he site the attacker controls). The fact that the server name in the modified link is identical to the original site helps the attacker by giving his phishing attempts a more re liable appearance. CVSS Score 4.3 CVSS Fingerprint AV:N/AC:M/Au:N/C:N/I:P/A:N Solution Remove the parameter that allows redirection from your site. If the parameter is required for operation then construct a list of valid links tha t the user can be redirected to \[White List\] and any other links that are specified the user will not be redirected to.

Relevant Form Code:

```
<form method="post" acti  addFormSubmit()" >
<div class='hiddenFields'>
<input type="hidden" name="XID" value="cc7bade5265c13b73a6393f3e0b2db391bd9fdaa" />
<input type="hidden" name="ACT" value="22" />
<input type="hidden" name="RET" value="http://MyDomain.com/MySegment1/MySegment2" />
<input type="hidden" name="URI" value="MySegment1/MySegment2" />
<input type="hidden" name="FRM" value="f9cb7fd2ec650ab25efd8be6e1c59edb" />
<input type="hidden" name="return" value="checkout/review" />
<input type="hidden" name="secure_return" value="yes" />
<input type="hidden" name="AUP" value="WfGXMcTWPOx1XVmFt6LvlI2aYd+YVbZxexIi7hSShFylpXgvWrYjuNLJOB5OY2+BoZWFRV2ZQxxVlW5Ds0pD2g==" />
<input type="hidden" name="AUS" value="fLSHnnXdrpDnGlbvirXr2Z6/4Hg6o/DaSovhbCDs6BK1Me1qV3HHtKD9+DAcDb7RnuEylWkHFN+v0mYiHDoH4w==" />
<input type="hidden" name="AUW" value="FVT0uiqYd/WKlwoJEHb6mvxxD0J8su77K03FcJx8Z49iomBhCmGzlzvplboiFxCXmGIW0oDBXNDWjVTpI/1icQ==" />
<input type="hidden" name="OTF" value="ksN4R7uwmGvsP9G5z+aRoD25vvgiijPjryLML2QAZX8oDM9fpXUrczcqbIMyTY/lWhaui0i7WdF6FrjM5X5qNg==" />
<input type="hidden" name="JSN" value="uYa6FVq5nf8lhBvSBI2gfa4BIw1RJahHoB6xgPGwytgq56MKs9QoRuouIfUYb5jMsXHbiaZftDuJ2DQML7JXtg==" />
<input type="hidden" name="NTX" value="5HSxCqnvnmVKqDz47jAEnMkL06VTktf5VpOzWZ7VOQ2FnGBcm6O+Qmof1a6x7TYmhVKnr9aia7F41IcpQL1d6Q==" />
<input type="hidden" name="NSH" value="4WarxeRUR3TVn1xKBwFgxyWaByb40ZYeMiIx0npn3E+Ng2NEYhkac7r0UNz75+etGeea0iJdBta62f16cWxUXg==" />
<input type="hidden" name="ERR" value="csHkHXrepr1d3tkjOXErV5ovWAU9HjZFWcgVO/Qna4jn/gkb2hCqXiCaOPoR2U+nTJW2MQKhRrqXgbdsSAN0zA==" />
<input type="hidden" name="RLS" value="Kf2tDiVLXg82Dc2z3iQ+IhzTWfltitqVgB7GPCMyh04ytU1DaxkjXxzDY6SA1vD/rPLxTbVYFfpi3SBFIx6p1w==" />
<input type="hidden" name="site_id" value="1" />
</div>

```

McAfee is hung up on this particular line:

```
<input type="hidden" name="return" value="checkout/review" />

```

I can’t see any obvious EE resources (or Cart Throb) that address this issue.

Does anyone know of a workaround?

# Answer
> 1 votes
One workaround I can think of is to use Cartthrob's very own encrypted string.

This may work whereby you would encrypt both or either parts of the segment in the return value, then decrypt them when displaying the entry. Or at least make it more secure if the message still exists. See http://cartthrob.com/docs/tags\_detail/view\_encrypted\_string/ and http://cartthrob.com/docs/tags\_detail/view\_decrypted\_string/index.html

---
Tags: ee2, cartthrob
---


# Question
Title: What's the difference between {exp:stash:get name="foo"}, {exp:stash:foo} and {stash:foo}?
Can someone explain to me the difference between `{exp:stash:get name="foo"}`, `{exp:stash:foo}` and `{stash:foo}`?

I'm relatively new to ExpressionEngine, and after discovering Stash, I'm amazed at how powerful of a tool it can be, when used properly.

In reading the documentation and support forums, I've seen reference to all three tags that, I believe, all serve to retrieve a variable. However when I try them out, I sometimes find that I get slightly different results when I interchange them.

According to the documentation, `{exp:stash:get name="foo"}`, `{exp:stash:foo}` are the same thing, and I've only seen passing references to the third `{stash:foo}`. Even if they all serve the same purpose, do each have their own particular uses that make them differ from the others?

# Answer
> 5 votes
`{exp:stash:get name="foo"}` is a module tag. When the template parser encounters it, it calls the `get()` method of the 'stash' module class, which returns the value of `foo`. If `foo` doesn't exist, an empty value is returned, unless the `default=""` parameter has been set.

`{exp:stash:foo}` is a shorter syntax version of the above tag, for convenience.

`{stash:foo}` used on its own (not as a tag pair) is a *placeholder* for a native Stash variable, similar to an ExpressionEngine snippet. When the parser encounters it, it looks up the value of `foo` in a special array that Stash uses to store all variables that have been created previously in the parse order. The value it finds then replaces the placeholder. If it doesn't find a value the placeholder is left in the template.

Which you use depends on parse order. Inside Stash embeds and any blocks of code parsed by Stash, placeholders in the form `{stash:variable}` are parsed *before* ExpressionEngine tags, but *after* snippets. That makes them useful for passing values into tag parameters which are parsed later.

Note that you can also set a ExpressionEngine snippet value by using `type="snippet"`

`{exp:stash:set name="foo" type="snippet"}value{/exp:stash:set}`

This can then be accessed inside EE or Stash embeds and any blocks of code parsed by Stash in the form:

`{foo}`

# Answer
> 0 votes
`{stash:foo}` can be used when using the set pair tag, so for example

```
{exp:stash:set}
    {stash:foo}bar{/stash:foo}
    {stash:bar}foo{/stash:bar}
{/exp:stash:set}

```

Would set 2 stash variables, foo and bar respectively. I believe the benefit here is that there's less method calls than the `{exp:stash:set name=""}` alternative (although note this is an assumption).

You can also use `{stash:foo}` when within a setting (whether it's normal or lists) pair tag to 'GET'

```
{exp:stash:set}
    {stash:foo}bar{/stash:foo}
    {stash:bar}foo{/stash:bar}
    {stash:foobar}{stash:foo}{stash:bar}{/stash:foobar}
{/exp:stash:set}

```

---
Tags: stash
---


# Question
Title: Matrix: Vertical Cell Organization in cp
I use Matrix with a Multi-language plugin (bieber.ltd). Multi-language capabilities results in a plethora of fields especially within matrix.

So I wonder if its possible to stack cels vertically in the cp-panel:

```
| cell_title_de | cell_description_de |
| cell_title_en | cell_description_en |

```

instead of

```
| cell_title_de | cell_title_en | cell_description_de | cell_description_en |

```

Anybody knows something about this?

# Answer
> 3 votes
I found a solution. The Nolan Add-on does what I wanted. There is an option to stack the nolan field verticaly. Now it looks pretty :) And it even works within the multi-language environment.

---
Tags: matrix
---


title: Grid in Channel Form won't save data

text:
# Question
Title: Grid in Channel Form won't save data
I'm using a channel form to allow readers to submit letters to the editor that can include pictures. Here's the (redacted) code:

```
{exp:channel:form channel="{my_channel}" category="37" return="/site/page/5569" status="closed"}
<textarea name="body" cols="50" rows="20" class="rich_text"></textarea>
{field:pictures}
<input type="submit" value="Post" />
{/exp:channel:form}

```

The form seems to work OK. You can enter photos and captions just as you would in the the control panel. But when I save the form, and go to edit the entry in the control panel, all of the entry is there, except for the grid contents, which are empty.

# Answer
I've resolved this issue by rebuilding the form from scratch. I'm not sure what the original issue was, but I'm now about to use a Grid in a Channel Form for input.
> 0 votes

---
Tags: channel-form, grid
---


# Question
Title: Upgraded ExpressionEngine, php error on site brings entire site down
I've just upgraded from ExpressionEngine 1 to 2. The upgrade ran smoothly and I can access my admin panel. Whenever anyone goes to the site, they're greeted with this error:

> A PHP Error was encountered
>
> Severity: Notice
>
> Message: Channel::parse\_related\_entries() \[channel.parse-related-entries\]: The script tried \>to execute a method or access a property of an incomplete object. Please ensure that the \>class definition "DB\_Cache" of the object you are trying to operate on was loaded *before* \>unserialize() gets called or provide a \__autoload() function to load the class definition
>
> Filename: channel/mod.channel.php
>
> Line Number: 448
>
> Fatal error: Channel::parse\_channel\_entries() \[entries'\>channel.parse-channel-entries\]: The script tried to execute a method or access \>a property of an incomplete object. Please ensure that the class definition \>"DB\_Cache" of the object you are trying to operate on was loaded *before* \>unserialize() gets called or provide a \__autoload() function to load the class definition \>in .../system/expressionengine/modules/channel/mod.channel.php on \>line 3686

Does anybody have a clue what I need to do to bring my site back online? Help greatly appreciated.

**Update:** I have tried to rebuild a template step-by-step and have identified that the problem is when I close the {exp:channel:entries} tag. Does anybody know what might be causing this?

# Answer
> 1 votes
Could it be that one of add-ons you have is using Channel::parse\_related\_entries()?

You might want to check that. Otherwise it looks like some relationship field did not upgrade correctly.

# Answer
> 0 votes
Best bet would be to talk to your hosting provider it looks like you may need a different version of PHP

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


# Question
Title: Add-on - Building Queries w/ Field Names vs Field ID's
I have an add-on I've built to provide custom e-commerce reports for a client. It started as one of those 'we need this very specific thing' builds and of course has grown and grown as more needs arose. At it's core it is querying the db of an EE & Cartthrob site to pull out information about orders, products, etc.

A problem I've run into as it's grown is that it's not very portable between local/dev/live. My queries are built using field ID's, which is problematic if I end up with any discrepancies in when fields were created between those environments. This is a large & very actively developed site, so I'm not often able to wipe out my dev/local DB's with the live DB to correct those problems as they arise.

To solve the issue, I'd prefer to use field name's as opposed to field ID's, but I can't work out how to best integrate that into my queries. I know I can get ahold of field names, but from an add-on development / query standpoint I'm not sure how to best integrate them. Here's a trimmed down & anonymized version of one of my queries. I've removed a lot of fields & all field ID's are 00, which isn't the case in the real query obviously.

```
SELECT FROM_UNIXTIME(pict.entry_date, '%c/%e/%Y %r') as 'Order Date',
picd.field_id_00 as QTYShipped,
ocd.field_id_00 as 'email address',
ocd.field_id_00 as Company,
ocd.field_id_00 as Ship_Address1,
ocd.field_id_00 as Ship_Address2,
ocd.field_id_00 as Ship_City,
ocd.field_id_00 as Ship_State,
ocd.field_id_00 as Ship_Zip,
picd.field_id_00 as 'Order Number',
oct.status as 'Order Status',
pcd.field_id_00 as 'Product ID Number',
pm.member_id as 'Member ID',
pmg.group_title as 'Member Group'
from exp_channel_data as picd
left join exp_channel_titles as pict on picd.entry_id = pict.entry_id
left join exp_channel_data as ocd on picd.field_id_00 = ocd.entry_id
left join exp_channel_titles as oct on ocd.entry_id = oct.entry_id
left join exp_channel_data as pcd on picd.field_id_00 = pcd.entry_id
left join exp_members as pm on oct.author_id = pm.member_id
left join exp_member_groups as pmg on pm.group_id = pmg.group_id
where picd.field_id_00 in (select entry_id from exp_channel_titles where channel_id = '0')
order by pict.entry_date desc

```

So the question is - in an add-on, what's the best way to feed this query from field names rather than field ID's?

# Answer
> 4 votes
You can use the channel fields api to get the field names:

```
ee()->load->library('api');
ee()->api->instantiate('channel_fields');

$fields = ee()->api_channel_fields->fetch_custom_channel_fields();

//change 1 to your site_id if using MSM
$quantity_field_id = $fields['custom_channel_fields'][1]['your_quantity_field_name'];

$sql .= "picd.field_id_{$quantity_field_id} as QTYShipped,"

```

# Answer
> 2 votes
You can store your field id's as config vars, so you can change them per environment. Nice thing about this is you don't incur an extra query to get the field names.

In your main config.php

```
$config['your_addon_quantity_field'] = 3;

```

In your addon:

```
$quantity_field = ee()->config->item('your_addon_quantity_field');
$sql .= "picd.field_id_{$quantity_field} as QTYShipped,"

```

# Answer
> 0 votes
The best practice would be to have fields mapped in add-on settings. If you think that is overkill, store them in custom or global config file.

---
Tags: add-on, add-on-development, database, mysql
---


title: PHP Erros With DataGrab

text:
# Question
Title: PHP Erros With DataGrab
When I open Add Ons \> Modules \> DataGrab I get the following PHP Errors:

I am running EE 2.7.3 and DataGrab 1.8.0. Any ideas what is happening here?

Thanks.

# Answer
> 1 votes
Recasting my comments as an "Answer":

I would guess both DataGrab and Magpie.pi incorporate the Magpie RSS processor written in PHP

That's fine. What isn't fine is that both add-ons are defining variables/classes with the same name.

I'd check to see if you are running the latest version of both of these add-ins as it may be something that one or other developer has encountered and fixed previously.

---
Tags: add-on, module, php-errors, datagrab
---


# Question
Title: Cartthrob packing slip template doesn't display channel fields
Here's a simplified version of my packing slip template code:

```
{exp:channel:entries channel="orders" limit="1" status="open|New|Shipped" dynamic="no" entry_id="{entry_id}"}

<h1>{title}</h1> <!-- Shows order number OK -->

<p><strong>Ship to:</strong> {order_shipping_first_name} {order_shipping_first_name}</p> <!-- Shows nothing -->

{exp:cartthrob:order_items order_id="{entry_id}"}

<p>{item:title} {item:price} {item:quantity} {item:subtotal}</p> <!-- Order items display OK, but I get a PHP warning -->

{/exp:cartthrob:order_items}

{/exp:channel:entries}

```

If I replace {entry\_id} with an actual order entry\_id and view the template outside of the control panel, it displays everything just fine:

However, if I set it as the packing slip template in the CT system settings and click 'Print packing slip', it brings up the template OK, but won't display anything other than the {title} tag from the orders channel and throws a PHP warning when displaying the order items:

Am I using the wrong template tags, or is this a bug in Cartthrob?

Right - I've now installed the example CT templates and tried to use that and... It still doesn't work:

# Answer
Aargh! The issue was with boldminded's Publisher module.

Not sure what the problem is, but if I disable that, the fields come through onto the packing slip no problem at all. Now I just need to see if upgrading Publisher to 1.2.2 makes a difference.

I wish these expensive CT add-ons would play together a bit better :-/
> 0 votes

# Answer
I'd check that your actually passing the entry\_id correctly. But i'd also make sure your not disabling anything on the channel entries loop with the disable="" parameter.

If in doubt, try adding dynamic="no" as well ;)
> 1 votes

# Answer
This appears to be the same problem as here: Cartthrob PHP Error when checking out. Perhaps Chris Newton's suggested fix would solve the problem for now.
> 0 votes

---
Tags: cartthrob, publisher
---