# Question
Title: Can edit entries authored by others: Not Working
Recently updated to v2.6.1 and I have an issue now where users are not able to edit content authored by other authors. In this case the user group in question has "Can edit entries authored by others" set to yes but whenever the user tried to edit it won't allow it. Any ideas?

Thanks!

Guy

# Answer
> 1 votes
It is most likely that the correct permissions aren't set on the Member group to which the users belong to.

Go to Members \> Member Groups, click on the member group in question and scroll down to the **Channel Posting Privileges**. Check these settings and ensure that **Can edit entries authored by others** is set to **Yes**. Save that and try again.

# Answer
> 0 votes
I'm having the exact same problem here. Upgraded from 2.5.\* to 2.6.1 and my users in a custom group called 'beheerder' can't edit entries without setting a super-admin as the author of a page.

The super-admins are the only ones that show up in the dropdown field.

And yes, my 'beheerder' group has the right to the specific channel assigned to them and has been authorized to change entries posted by others.

# Answer
> 0 votes
I also have the problem with EE 2.6.1 I checked "Include user in PUBLISH page multi-author list?" as mentioned above, but users A can´t edit an entry from user B. But if user B changes the author from A to B, so that he´s the author, he can edit and save.

This is not really what I want.

The Member Account Privileges are correct for the entire memer group and the individual member.

# Answer
> 0 votes
I hit this same issue with 2.7.2, so posting in case it helps anyone else. I had two issues. One was that I had to change preferences for the editing Member Group to enable 'Can change the author name when posting channel entries', even though I am not changing the author. Second, I had to change the privileges of the original author Member Group to enable 'Can edit entries authored by others', even though it is their own record that is being edited on their behalf by the other Member Group.

Here is the code that was throwing the error for me, maybe when I have time I'll see if it's 'fixable':

```
    if ($data['author_id'] != ee()->session->userdata('member_id') && ee()->session->userdata('group_id') != 1)
    {
        if ( ! isset($this->_cache['orig_author_id']) OR $data['author_id'] != $this->_cache['orig_author_id'])
        {
            if (ee()->session->userdata('can_assign_post_authors') != 'y')
            {
                $this->_set_error('not_authorized', 'author');
            }...

```

---
Tags: author
---


# Question
Title: Display store product prices excluding tax
Now that all prices are including tax when the option 'included in price' is set in the settings menu, we appear to have multiple tags for prices inclusive of tax to use in templates inside the {exp:store:product} pair, but none to show the ex-tax price or even the current tax amount to run a quick php calculation.

For example, we can use any of the following to show the price:

```
{price_inc_tax} // deprecated in 2.0
{regular_price}
{price}
{price_val}

```

...but as far as I can see, there are no tags for \_ex\_tax or tax\_val until the user gets to the checkout stage.

There surely must be the ability to show the price *excluding tax* now that prices are entered inclusive of tax?

Is the user option:

A - add prices ex tax and have the facility to display prices \_inc\_tax OR B - add prices inc tax and lose the option to display prices \_ex\_tax

# Answer
> 1 votes
Your choice is basically:

(a) Enter prices ex-tax in the CP, and display them ex-tax on your front end, or

(b) Enter prices inc-tax in the CP, and display them inc-tax on your front end

Therefore, if you want to display prices ex-tax on your front end, you should enter them ex-tax in the CP, and uncheck the "included in price" option for your tax rate.

The reason for this is that in your situation, if prices are entered inclusive of tax, there really is no tax-exclusive price for an individual item until it is added to the cart. If you did try to display this, you would only confuse customers with the tax rounding issues we faced in Store 1.

For example, say your product is $10 including tax, with a 15% tax rate. If you were to calculate the ex-tax price of this product, you would say:

```
$10 / 1.15 = 8.695652174 = $8.70 rounded to 2dp

```

So you cleverly display the price as $8.70 to the user. Then they add 10 items to their cart, thinking the total should be:

```
$8.70 * 10 = $87.00

```

But when you use tax-inclusive pricing, the price that is added to the cart is the price *including tax*. So behind the scenes, Store does:

```
$10 * 10 = $100.00 (including tax)

```

To display the total tax for the order, Store then calculates the tax on the total:

```
$100 - ($100.00 / 1.15) = 13.043478261 = $13.04 tax
$100 - $13.04 = $86.96 excluding tax

```

If you were trying to be clever and display tax-exclusive prices when you entered them inclusive of tax in the CP, your customer would see:

```
$8.70 * 10 = $86.96 <-- whoa! where did my 4c go?!

```

Now, if you really wanted to display tax-exclusive prices in the first place, then you should enter them exclusive of tax in the CP. That will cause Store to calculate tax in the other direction. For example, if your product cost $8.70 with 10% tax:

```
$8.70 * 10 = $87.00 excluding tax
$87.00 * 0.15 = $13.05 tax
$87.00 + 13.05 = $100.05 including tax

```

Hopefully this gives you some insight into the perils of converting between tax-inclusive and tax-exclusive pricing. Basically, by entering prices in the CP the way you want to display them on your site's front end, you allow Store to perform the correct calculations and avoid confusing any of your customers by displaying incorrect calculations.

Either way, Store 2 doesn't calculate the total tax on an order until after it has taken into account the item quantity, so it is wrong to try and back-calculate or display the tax-exclusive price if your customers will be charged based on the tax-inclusive price, or vice versa.

---
Tags: expresso-store
---


# Question
Title: Sending to multiple recipients dynamically via freeform in EE1.6.8
I have been over the docs and still fall short on this one.

I have a form where customers can dynamically add referrals to notify. I just can't get the email to send.

Here is my freeform code:

```
        {exp:freeform:form
            secure_return="yes"
            collection="Loyalty Rewards Referrals"
            required="loyalty_customer_number|loyalty_customer_name|loyalty_referral_name|loyalty_referral_email"
            form_name="referral_form"
            form_id="referral_form"
            template="loyalty_rewards_referral_notice"
            return="/loyalty/thanks"
            recipients="yes"
            recipient_template="loyalty_rewards_referral_notice_email"
            require_ip="yes"
        }

```

I have tried a few different things, but here is the last bit:

```
            <input class="form_field" type="text" name="loyalty_customer_number" id="loyalty_customer_number"  />
            <input class="form_field" type="text" name="loyalty_customer_name" id="loyalty_customer_name" />
            <input class="form_field" type="text" name="loyalty_referral_name" id="loyalty_referral_name" />
            <input class="form_field" type="text" name="loyalty_referral_email" id="loyalty_referral_email" />
            <input class="form_field" type="text" name="recipient_email_user[]" id="recipient_email_user[]" />

```

The form itself is hidden and I do some backend validating, during which I add the following prior to submitting:

```
    //  Create the needed fields in the form
    for (i = 0; i < combinedReferrals.length; ++i) {
        $('<input class="form_field" type="text" name="recipient' + i + '" value="' + combinedReferrals[i] + '" />').insertAfter('.form_field:last');
    }

```

Which adds the fields for the dynamic referrals in the format of:

```
<input class="form_field" type="text" name="recipient1" value="Brian|myEmail@email.com" />
<input class="form_field" type="text" name="recipient2" value="Joe|hisEmail@email.com" />

```

What the heck am I doing wrong here?

*** EDIT ***

Entire freeform code here:

```
        {exp:freeform:form
            secure_return="yes"
            collection="Loyalty Rewards Referrals"
            required="loyalty_customer_number|loyalty_customer_name"
            form_name="referral_form"
            form_id="referral_form"
            require_ip="yes"
            template="loyalty_rewards_referral_notice"
            notify="me@myemail.com"
            return="/loyalty/thanks"
            recipient_user_input="yes"
            recipient_user_limit="1"
            recipient_user_template="loyalty_rewards_referral_notice_email"
        }
            <input class="form_field" type="text" name="loyalty_customer_number" id="loyalty_customer_number"  />
            <input class="form_field" type="text" name="loyalty_customer_name" id="loyalty_customer_name" />
            <input class="form_field" type="text" name="loyalty_referral_name" id="loyalty_referral_name" />
            <input class="form_field" type="text" name="loyalty_referral_email" id="loyalty_referral_email" />
        {/exp:freeform:form}

```

Then prior to submit, I loop through an array of entries and populate the following:

```
    //  Create the needed fields in the form
    for (i = 0; i < combinedReferrals.length; ++i) {
        //$('<input class="form_field" type="text" name="recipient' + i + '" value="' + combinedReferrals[i] + '" />').insertAfter('.form_field:last');
        $('<input class="form_field" type="checkbox" name="recipient_email_user[]" value="' + combinedReferrals[i] + '" checked />').insertAfter('.form_field:last');
    }

```

Where 'combinedReferrals\[i\]' is 'Brian|me@myemail.com'.

*** EDIT ***

I have the emails sending now using the following code:

```
        {exp:freeform:form
            form_name="referral_form"
            form_id="referral_form"
            notify="me@myemail.com"
            require_ip="yes"
            secure_return="yes"
            collection="Loyalty Rewards Referrals"
            required="loyalty_customer_number|loyalty_customer_name"
            return="/loyalty/thanks"
            recipients="yes"
            recipient_limit="10"
            recipient_template="loyalty_rewards_referral_notice_email"
        }
            <!-- Customer Fields -->
            <input class="form_field" type="text" name="loyalty_customer_number" id="loyalty_customer_number"  />
            <input class="form_field" type="text" name="loyalty_customer_name" id="loyalty_customer_name" />

            <!-- Referral Fields -->
            <!-- Limit 10 -->

            <!-- FreeForm Data -->
            <input class="form_field" type="text" name="loyalty_referral_name" id="loyalty_referral_name" />
            <input class="form_field" type="text" name="loyalty_referral_email" id="loyalty_referral_email" />
        {/exp:freeform:form}

```

Then the following is writing the values prior to submission:

```
    //  Create the needed fields in the form
    var splitValue;
    for (i = 0; i < combinedReferrals.length; ++i) {
        //  Split the result
        splitValue = combinedReferrals[i].toString().split("|");

        //  Populate the form
        $('<input class="form_field" type="text" name="recipient_name[]" value="' + splitValue[0] + '" />').insertAfter('.form_field:last');
        $('<input class="form_field" type="text" name="recipient_email[]" value="' + splitValue[1] + '" />').insertAfter('.form_field:last');
    }

```

Each email is sent to each recipient as it should. However, they want to use the recipient NAME field to personalize the email sent. If I try to use `{recipient_name}` I get nothing.

Is there a way to achieve this?

# Answer
> 3 votes
Not sure this approach is going to work.

FreeForm expects you to define `recipient1` and `recipient2` as a parameter of the `exp:freeform:form` tag, they are then encoded on the server side and the html source only shows a hashed value for the recipient, not the value you are inserting dynamically.

If the method you described here were to be permitted then it would be simple to hijack the form to send email to anyone and it would be rife for abuse by spammers.

Solspace's solution to "tell a friend" and potentially what you want to do is the `recipient_user_input="yes"`value in the `exp:freeform:form` tag. You have this value as an `input` but not in the `exp:freeform:form` tag. I've read the docs a couple of times and I don't think that you can use recipient1...2...3... with this approach, but I could be wrong.

Take a look at the tell-a-friend example in the docs.

I think you'll need to specify `recipient_user_template` instead of `recipient_template`. You'll probably want/need to set `recipient_user_limit` as well.

---
Tags: solspace-freeform, solspace, email, ee1
---


# Question
Title: How can I apply field formatting (markdown) when parsing a template in a module?
I have a module that processes web forms and uses a template to generate an email when finished.

Here is the module code:

```
$data['message'] = $message;
$this->EE->load->library('Template', NULL, 'TMPL');
$this->EE->TMPL->depth = 1;
$this->EE->TMPL->fetch_and_parse('experience', '_email');
$this->EE->TMPL->depth = 0;
$html_message = $this->EE->TMPL->parse_globals($this->EE->TMPL->final_template);
$html_message = $this->EE->TMPL->parse_variables_row($html_message, $data);

```

In the template, I want to take advantage of the new Markdown formatting, so there is this bit in the experience/\_email template:

```
<tr>
    <td style="padding:15px 20px;color:#333;line-height:1.25em;font:13px Tahoma, Verdana, Arial, Helvetica, sans-serif;" class="body" colspan="2" bgcolor="#ffffff" valign="top" align="left">
        {exp:markdown}{message}{/exp:markdown}
    </td>
</tr>

```

However, {message} does NOT get converted from Markdown to HTML. I suspect it's something to do with either the order of operations or how template parsing works? Does anyone know why this fails?

Here is a more detailed flow. There is a template\_group/template page visited. In that template is the form. The template is entirely encapsulated with a module call:

```
{exp:custom_module:workshop identifier="{last_segment}"}
    {exp:channel:entries channel="workshops" limit="1" sort="asc"}
        {embed="modules/_header" page_title="{categories show_group="6"}{category_name} - {/categories}Workshop Registration" body-class="pd"}
        <div class="content">...

```

The module then has the correlating method:

```
public function workshop()
{
    $identifier = $this->EE->TMPL->fetch_param('identifier');

    if ($all_of_the_form_data_passes) {
        // send an email and redirect to the thank you page.
        $this->EE->load->library('email');
        $this->EE->email->clear();
        $this->EE->email->mailtype = 'html';
        $this->EE->email->from('info@example.com');
        $this->EE->email->to($user['name_first'] . ' ' . $user['name_last'] . '<' . $user['email'] . '>');
        if ($bcc_recipients)
        {
            $this->EE->email->bcc($bcc_recipients);
        }
        $this->EE->email->subject($subject);

        $this->EE->email->set_alt_message($message);

        $data['message'] = $message;
        $this->EE->load->library('Template', NULL, 'TMPL');
        $this->EE->TMPL->depth = 1;
        $this->EE->TMPL->fetch_and_parse('experience', '_email');
        $this->EE->TMPL->depth = 0;
        $html_message = $this->EE->TMPL->parse_globals($this->EE->TMPL->final_template);
        $html_message = $this->EE->TMPL->parse_variables_row($html_message, $data);
        redirect('somewhere');
    }

    // If anything didn't go well, finish loading the originally requested template_group/template with error messages embedded (in $data)
    return $this->EE->TMPL->parse_variables_row($this->EE->TMPL->tagdata, $data);
}

```

So there's two templates involved in the process. The template the user visits that renders the form. In the method for the module wrapping that template, the form data is analyzed and if it went well, a second template is fetched, parsed and emailed. If anything did NOT go well, the original template is parsed, supplied with error messages and returned to the user.

I've now just worked around the issue by declaring the formatting type in the $data array in the module method as follows:

```
$data['message'] = array(
    $message, array(
        'text_format' => 'markdown',
        'html_format' => 'markdown'
    )
);

```

(as shown in the Template Class instructions.)

I've also just found the Typography Class (not enough reputation points to link to it, but it's part of the EE manual), which let's me do raw formatting in the module:

```
ee()->load->library('typography');
ee()->typography->initialize();
$data['message'] = ee()->typography->markdown($message);

```

Here is now a third solution to the problem, found in this post. Instead of using fetch\_and\_parse in one command, separate them, as the parse step is evaluating the exp:markdown before the {message} is getting injected. So, I did it as follows:

```
ee()->TMPL->depth = 1; // Need to increase the depth to get the hidden template
$email_template = ee()->TMPL->fetch_template('experience', '_email', FALSE, ee()->config->item('site_id')); // Fetch ONLY. We want the variables replaced before doing the final parse.
ee()->TMPL->depth = 0; // Cleaning up
$html_message = ee()->TMPL->parse_variables_row($email_template, $data); // Parse $data
ee()->TMPL->parse($html_message, FALSE, ee()->config->item('site_id')); // Finish up by parsing EE tags.

```

However, none of those tags are in the documentation. I feel like I'm using Private APIs for lack of a better description. Is this the properly sanctioned way of doing this, or is there a way to use `parse="inward"` to get this to work properly without this?

# Answer
> 1 votes
You should set the parameter `parse` to `inward` in you module opening tag, so the `{exp:markdown}` will wait for the `{message}` variable be ready.

If you show you module tags, I can write a sample code.

---
Tags: templates, module, markdown
---


# Question
Title: Best Practice for moving a site using Assets
I have a fairly big site with substantial use of Assets2 in development and am wondering what general guidelines / best practices anyone can suggest for when moving this to the production server? Any gotchas or preparation?

# Answer
> 1 votes
You'll need to update the server & domain paths for each file upload preference. And make sure the permissions are correct on the production server. Once you've moved everything over, update the indexes just to be sure and it should just work.

I've done this several times in the last few months and had very few problems. Assets 2 is superb.

Somewhat related, you can make a number of improvements to the config file that will make the migration more painless. Here's a good primer:

http://eeinsider.com/articles/multi-server-setup-for-ee-2/

But you still need to manually update those file upload preferences.

---
Tags: assets
---


title: Search Module result

text:
# Question
Title: Search Module result
i want the search results linked to the related page.i want to link the related pages to view detail and before it there would be text

**In format**

1.Result1 ***View detail***

1.Result2 ***View detail***

How would i do that..what should i write on result code and also how would i limit the character limit to result text

Regards, Neha

# Answer
> 2 votes
If you are asking what I think you're asking then you would need to set the base path for each channel within the channel's preferences.

---
Tags: search
---


# Question
Title: Memberdata as channel entries, showing amount empty fields in profile
We are setting up a system for members, and will be using a plugin for storing memberdata in a channel. We did not decide yet for Solspace User, Profile:edit (likely since we'll use Cartthrob) or Zoo-visitor.

One feature would be nice to implement, showing the amount of data in a profile. With a message: 'you filled in x% of your profile.' And a congratulation of course the moment they reach 100%. I am interested in how to implement that, if possible.

Is there anyone that has done this?

Thanks for helping out.

# Answer
Whilst I'm keen not to see this site become a 'do-my-homework-for-me' -type thing, I quite fancied having a go at this and had both some spare time and magnanimity... so please try out Perfect.

It's very basic at the moment, but let me know via the Devot:ee forum of any extra features you need to make it useful.
> 2 votes

# Answer
Should be pretty simple with a custom add-on. Select all the profile fields for a member, see how many are not empty, and divide that by the total number of fields to get a percentage.

You may also want to group some fields together as one "value" when doing this calculation, depending on how specific your fields are.

But there is no add-on out there for this - you'll need to write it yourself.
> 0 votes

---
Tags: zoo-visitor, solspace-user, profile-edit
---


title: Parsing URL with hashes

text:
# Question
Title: Parsing URL with hashes
Have this URL:

```
http://192.168.1.2/univsched#/csf

```

How can I parse this using EE tags? I want the value: csf

segment\_x tags don't work.

# Answer
> 2 votes
I actually solved it by using the javascript

```
window.location.hash.substr(2);

```

Thanks.

# Answer
> 7 votes
I believe EE actually throws this value away, and it should. The hash is a front end display feature for your browser, not a url.

Use it for javascript and scroll-to positions on a page.

You should re-think why you need to be using the hash in the first place.

---
Tags: url, segments
---


# Question
Title: "invalid_filename" error when trying to synchronise upload directories
I'm making some changes to an existing ExpressionEngine site which involve moving the system above the web root and using Focus Labs config set up.

Because of the new config set up I had to define the upload directories within my config file.

When I synched the directory within the EE control panel I got error stating

```
invalid_filename on file foo.jpg
invalid_filename on file bar.jpg
etc.

```

# Answer
> 2 votes
This is caused by not having a trailing slash on the server\_path parameter in the upload directory config.

The Focus Labs documentation within the master config doesn't include the slash

```
$env_config['upload_preferences'] = array(
    1 => array(
        'name'              => 'Uploads',
    'server_path'       => $images_path . '/uploads',
    'url'               => $images_url  . '/uploads/'
),

```

By adding a trailing slash to the server\_path you can fix the error

```
$env_config['upload_preferences'] = array(
    1 => array(
        'name'              => 'Uploads',
    'server_path'       => $images_path . '/uploads/',
    'url'               => $images_url  . '/uploads/'
),

```

---
Tags: file-uploads, error, config, uploads, sync
---


# Question
Title: Return all freeform responses from same email
I'm making an rsvp app where a user can register for multiple events. Events may use different forms. In theory, users would use the same email address for all rsvp.

Can I get all freeform entries ie {exp:freeform:entries search:email="a@a.com"} but without form\_id or form\_name?

Thanks Amanda

# Answer
Ended up writing a plugin to get all form entries with the same email.
> 0 votes

# Answer
You may need to do a custom query using the query module. It wouldn't be too difficult to write a query to pull from the Freeform table based on an email address.
> 1 votes

---
Tags: solspace-freeform
---


title: Import Comments from Facebook

text:
# Question
Title: Import Comments from Facebook
If you have a Facebook-Page you know the «problem»: Users post their comments to the facebook-link instead of commenting on your own page. that itself is not the «problem» — the «problem» is, that this way only a fraction of your pages readers acctually see (and could interact with) the comment, while commenting on your own page let everyone be able to see the comment.

There a various pages out there which fetch the comments from «Likers» on Facebook to a Story/Link and include them into the comment-flow on their own page.

Is there a module or a technique (I don't know PHP), to include Comments from Facebook back into ExpressionEngines comments module? (not only «show» but actually include/import into the db)

# Answer
> 1 votes
It'd be a tall order to synchronize activity on any third party social network and your EE site; if you absolutely need a unified experience, pick one and forget about the EE comments module.

How is it a tall order? Imagine Facebook Frank leaving a comment on your Facebook site, which Local Site Larry (who doesn't have a Facebook account) responds to via the comments module in EE. How would you represent Local Site Larry on Facebook when his comment gets synchronized there? What happens when Local Site Lucy, who also has a Facebook account, is participating in a thread via both Facebook and your EE site? How do you tie her EE account to her Facebook account? It's gets mighty complex mighty fast.

Facebook has a few different options for commenting/activity via front-end/JS widgets that can be embedded on your site; if you're looking for a more robust commenting system that's centered on your site, instead of Facebook, Disqus is the go-to tool these days, I believe.

---
Tags: comments, facebook
---


# Question
Title: Accessing categories of a relationship field in EE2.6
I have a channel with a single relationship field. In my template, I want to access the relationship's list of categories. Unfortunately, this does not work: (example simplified to illustrate my point)

```
{exp:channel:entries channel="parent"}
    <h1>{title}</h1>
    <p>{relationship_field:categories backspace="2"}{category_name}, {/relationship_field:categories}</p>
{/exp:channel:entries}

```

Any ideas on how to make something like this work?

# Answer
I believe you need to have your categories tags set within the relationship tag pair like:

```
{exp:channel:entries channel="parent"}
    <h1>{title}</h1>
    {relationship_field}
        <p>{relationship_field:categories backspace="2"}{category_name}, {/relationship_field:categories}</p>
    {/relationship_field}
{/exp:channel:entries}

```
> 6 votes

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


title: Solspace Tag on Multi Entry Pages

text:
# Question
Title: Solspace Tag on Multi Entry Pages
I can't seem to get a list of tags for an entry in multi-entry view. According to the docs, this should work, but I get no output. Anyone have any luck doing this or suggestions?

```
{exp:channel:entries channel="articles"  status="not closed" limit="20"}

  <h1>{title}</h1>
  {exp:tag:tags
    entry_id="{entry_id}"
    backspace="2"
    orderby="relevance"
    sort="asc"
    limit="6"
  }
    <a href="{path='articles'}/tag/{websafe_tag}">{tag}</a>,{/exp:tag:tags}

{/exp:channel:entries}

```

# Answer
> 0 votes
Your tag loop needs to be an embed and passed the entry ID.

---
Tags: solspace, solspace-tag
---


# Question
Title: .htaccess RewriteRule not working as desired
1st off I know about the redirect add-ons, but I need to do this in my .htaccess and not load any more on EE.

Before I found EE and started making EE sites. I used a free gallery program to create my gallery for my web site. Now I'm moving over the images to my EE built gallery.

Many thousands of images, no problem just htaccess it. For the most part old folders went to new posts. A few old galleries needed each picture sent to it's correct post entry.

After creating and testing all looked great, had to do a little more that I would have thought. Then I removed the old files and directories for the RewriteRule's I created.

Now I get my EE 404 and lost page notices.

Then if I recreated the directories, those would work. Then recreated empty html docs named the same as the previous html doc, and then those RewriteRule's worked.

I think if EE sees link to an actual folder it leaves it alone, but if no template for folder exists it serves 404.

(I have switchee checking segments and EE no post settings to verify all pages of my EE site)

But why is EE still serving something thats in the .htaccess

Could add some more to my 404 segment check. Rather not.

Or continue to create empty directories and empty same named html files for a fix, but why?

Before deleting the old files this is what I had to do to get all files and sub directories to redirect to new post entry.

```
RewriteRule gallery/Trees/(.+)?/?$ http://mydomain.com/entry/trees_and_plants [L,R=301]

```

But as of this moment I have to recreate every doc as an empty file named the same. But could there be a way to have EE ignore certain directories?

Thanks Mike

More info,

Basically after my rewrites, pages from my old gallery will be redirected to my new gallery. But as soon as I removed the old galleries files and directories my EE pick up on the bad pages and serves up my 404. right now having problems with gallery/Trees dir and pages.

Here is a shorten version of my htacces

```
RewriteEngine On

RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteBase /

RewriteCond %{HTTP_HOST} ^www.mydomain.com [NC]

RewriteRule ^(.*)$ http://mydomain.com/$1 [L,R=301]

RedirectMatch 301 /forums/(.*) http://mydomain.com/NEW_forums/$1

RewriteCond %{QUERY_STRING} /forums/

RewriteRule (.*) http://mydomain.com/NEW_forums/? [R=301,L]

RewriteRule ^gallery/Trees/ http://mydomain.com/entry/lego_trees_and_plants [L,R=301]

deny from somedomain.com

RewriteCond %{HTTP_REFERER} !^$

RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?otherdomain.com [NC]

RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?otherdomain2.com [NC]

RewriteRule \.(jpg|jpeg|png|js|css|ldr|zip|lxf)$ http://mydomain.com/ask4_hotlink_mydomain_com.gif [NC,R,L]

##EE Spam Block

blah, blah, blah

##End EE Spam Block

```

# Answer
Here are a couple general things that might help:

I think the one RewriteRule you've posted could and should be simplified. From this:

```
RewriteRule gallery/Trees/(.+)?/?$ http://mydomain.com/entry/trees_and_plants [L,R=301]

```

To:

```
RewriteRule ^gallery/Trees/ http://mydomain.com/entry/trees_and_plants [L,R=301]

```

Then, here's a rewrite for EE to remove index.php that excludes the gallery/Trees path -- this should be your **final** rewrite block.

```
RewriteCond $1 !^gallery/Trees/ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L,QSA]

```

If this doesn't help, please post more details about your rewrites, and I'll take another shot.
> 1 votes

---
Tags: redirects, .htaccess
---


# Question
Title: Limiting results returned by nested playa parents tags
I'm hoping someone can give me a pointer on narrowing my returned entries on the basis of nested playa parent relationships. Here's the scoop:

I have a 4 inter-related channels: companies, people, tasks and task statuses. Companies are at the top of the food chain - a lot of the display of the entries in my channels is determine by the company.

People are assigned to companies. When the user logs in, their parent company is stashed as a site variable (member\_company\_id).

Tasks are assigned to companies, and tasks may be shared with multiple companies since they are one central list of tasks. Tasks therefore have a playa relationship field assigned to the companies channel. On the home screen, when the user logs in, they need to see the list of tasks assigned to their company.

So far, all of the above works nicely with playa parents. Where I'm having trouble is the next layer.

My task statuses channel includes 2 playa fields - one for related company and one for related task. The idea being that each company will be assigning a "status" to each task they have been assigned. But because the task itself is not exclusive to the company, the task status must be an entry whose display is based on both relationship fields at the same time. I thought that the relationship to companies would cascade down through the nested parent chain, but I'm discovering that they are not. Here's my template code:

```
{exp:stash:get_list name="member_details" limit="1"}
{exp:channel:entries channel="comp" limit="1" entry_id="{member_company_id}" orderby="date" sort="desc" disable="member_data|pagination" dynamic="no" cache="yes" refresh="720"}

{!-- FETCH TASKS ASSIGNED TO CURRENT LOGGED IN MEMBER COMPANY --}

{exp:playa:parents channel="tasks" field="cf_tasks_related_companies" var_prefix="tasks"}

    <div class="row">
        <div class="large-8 columns">
            <h5>{tasks:title}</h5>
            <p class="smaller">{tasks:cf_tasks_description}</p>
        </div>

        <div class="large-4 columns">
            {!-- FETCH STATUS OF EACH TASK --}

            {tasks:exp:playa:parents limit="1" channel="status" field="cf_status_related_task" var_prefix="status"}
                {if status:no_parents}<a href="#" class="button tiny secondary" data-reveal-id="updateStatusModal">Add Status</a>{/if}
                <div class="smaller" style="margin-bottom: 1.0em;">
                    <div>Status: {status:cf_status_current:label}</div>
                    <div>Target: {status:cf_status_target_date format="%M %d %Y"}</div>
                </div>
                <p><a href="#" class="button tiny secondary" data-reveal-id="updateStatusModal">Update Status</a></p>
            {/tasks:exp:playa:parents}
        </div>

    </div>

{/exp:playa:parents}

{/exp:channel:entries}
{/exp:stash:get_list}

```

What I'm finding is that when I log in as a member of company XYZ, I correctly get the tasks assigned to that company. However, the task statuses being returned by tasks:exp:playa:parents are not limited to the company and instead I'm getting all task statuses assigned to task A.

Is there a way to limit the returned entries in the fashion I am looking for with the nested parents tags, or am I going to need a custom query?

# Answer
> 1 votes
Have you tried adding to your task status lookup a `search` parameter that further filters what Playa returns? Based on your description, I think you'd want to add:

```
search:cf_status_related_company="={member_company_id}"

```

So, what you have here:

```
{tasks:exp:playa:parents limit="1" channel="status" field="cf_status_related_task" var_prefix="status"}

```

Would be changed to:

```
{tasks:exp:playa:parents limit="1" channel="status" field="cf_status_related_task" search:cf_status_related_company="={member_company_id}" var_prefix="status"}

```

If Playa search works the way I think, this would filter out your task statuses to just those that matched the `{member_company_id}`.

Does that work?

---
Tags: playa, relationships, query
---


# Question
Title: Addon to return different values based on environment?
My project links to an external form. Once that external form is submitted, the user is brought back to the ee site. I need to send the form a param (ie ?action=dev) to tell it which environment to return to. We currently have dev, client review, staging (excessive much?) and will eventually have the live site.

I don't want to have to remember to change these external links when updating. One of the links is a Low Variables var so I can't php strpos and it's not even letting me do an if statement on the value of site\_url.

Does a plugin or extension exist that will help me out?

Thanks Amanda

# Answer
This is what the `assign_to_config` array in your main index.php file is for (assuming you're not using something like FocusLab Master Config, which makes multi-environment really easy). If you don't want to use that approach, the quick way is to just crack open your index.php file, scroll down to the bit where `assign_to_config` gets set, and create some global variables based on, say, the $\_SERVER\['HTTP\_HOST'\] var.

Here's a quick example using a switch statement to determine local/dev/live environment and setting some global variables accordingly (I use this as a quick and easy method for displaying draft content on the dev site):

```
switch($_SERVER["HTTP_HOST"]) {
    case "dev.site.com" :
        $assign_to_config['global_vars']['gv_site'] = 'dev';
        $assign_to_config['global_vars']['gv_entry_statuses'] = 'open|Draft';
        $assign_to_config['site_url'] = "http://dev.site.com/"; // if you don't set this, it's taken from the database instead
        break;

    case "www.site.com" :
    case "site.com" :
        $assign_to_config['global_vars']['gv_site'] = 'live';
        $assign_to_config['global_vars']['gv_entry_statuses'] = 'open';
        break;

    case "site.dev" :
    case "localhost" :
        $assign_to_config['global_vars']['gv_site'] = 'dev';
        $assign_to_config['global_vars']['gv_entry_statuses'] = 'open';
        $assign_to_config['site_url'] = "http://site.dev/";
        break;
}

```

You can then use `{gv_site}` anywhere in your templates.
> 2 votes

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


# Question
Title: Can I specify a separate activation email?
I have a general sign up page, and special sign up page that assigns those sign ups to a different group.

Is there a way to send general the normal activation email, and my special group a differently worded activation email?

Thanks!

# Answer
I believe you can do this with Postmaster.
> 1 votes

---
Tags: email, activation
---


# Question
Title: Detecting Server Environment in Template - {site_url} Conditional Fails
Problem: Include analytic JS code in production, but not in staging or development.

Attempted to detect production environment with:

`{if "{site_url}" == "http://www.example.com/"}`

... but that's not evaluating as true; attempted to debug to get correct value of `{site_url}`, but, the value I'm using looks to be correct (copied/pasted to be sure).

`<!-- {site_url} -->` outputs `<!-- http://www.example.com/ -->`

Is this a parse order issue, or is there sometime obvious I'm missing in my pre-coffee state this morning?

If it's parse order, how do you go about doing conditionals on the environment within your templates if not with `{site_url}`?

Note: I'll actually respond if you take the time to assist, and, I'll mark the correct answer as answered ;-)

# Answer
Or set a $env\_global\['myjs'\] in the config.prod.php with the analytics code ID number and leave that var blank in the config.dev.php then just {myjs} in the template and it only outputs the ID in production.
> 5 votes

# Answer
{if site\_url == "www.example.com"} it's true! {/if}

I think your syntax is incorrect. Notice that the site variable does not have {} or uses quotes. That's no correct in the EE syntax.

http://ellislab.com/expressionengine/user-guide/templates/globals/conditionals.html
> 0 votes

---
Tags: templates, conditionals, site-url
---


# Question
Title: EE 2.5.5 Discussion Forum banner customization
I'd like to have the flag banner in our Expressionengine Discussion Forum appear only on the forum homepage.

I'm taking a college php class but we haven't gotten far enough for me to know how to write the code. Any help is greatly appreciated.

# Answer
Something like this should do the trick:

```
<?php
     $url = $_SERVER['REQUEST_URI'];
     $segment = explode("/", $url);

     if ($segment[2] == ""){
       echo "<img src='/path/to/image/'>";
     }
?>

```

This says if segment #2 is equal to blank display the banner. So the banner will only show when the URL is /forum/.
> 1 votes

# Answer
You can edit the `/themes/forum_themes/developer/forum_index/forum_homepage.html` file. I put a banner, for example, between these code snippets:

```
{include:top_bar}
<img src="/uploads/forum-banner.png" alt="" />
<div class="fm-header-wrapper">

```

Only the home page gets this banner. All forum themes, as near as I can tell, have this file.
> 0 votes

---
Tags: php, forum
---


# Question
Title: Is there a way to use Wygwam on the Forum module?
I am setting up an EE Forum for a client and would like to know if there is a way to change the default text entry field to a Wygwam field.

Thanks,

Forrest

# Answer
> 3 votes
fmz - there is not a way to use Wygwam with the forums; though since you have control over the forum themes you may be able to get a CKEditor directly in there.

# Answer
> 1 votes
I got CKEditor working; you can see my answer here: https://expressionengine.stackexchange.com/a/17278/221.

Lisa's right: it's not WYGWAM, but since WYGWAM is, at heart, CKEditor, you can get CKEditor in there. So if you have WYGWAM, you can use its CKEditor files, rather than duplicating code.

---
Tags: wygwam
---


title: How to display category children only?

text:
# Question
Title: How to display category children only?
I'm making a web store with Exp-resso Store and want to have a product category listing on the left side of the web page. The categories are nested four levels. I want the user to click a category to reveal the sub categories. Then the user has to click again to reveal the sub categories of the sub category. Is this even possible with EE?

As an alternate solution, I'm thinking using JS to do everything client side. The upside here is that it's much faster for the categories to reveal/load. (I want to have the first level listed on a separate menu on the top of the website. Is it possible to only list level 2|3|4?)

But if it is possible to do easily with EE I'd love to know it for later use.

EDIT: I've looked at this: http://420creative.com/blog/entry/showing-child-categories-based-on-hierarchy-in-expression-engine But this isn't easier than making everything work with JS...

# Answer
> 2 votes
A plugin like Child Categories may help you with this: http://devot-ee.com/add-ons/child-categories

---
Tags: categories, nesting
---


title: Recurring subscription payments PayPal

text:
# Question
Title: Recurring subscription payments PayPal
Sorry if this is longwinded but I'm trying to add a recurring subscription option to site but want to prepare for future headaches. We have a good core following on a statewide news magazine site. For now I want to implement PayPal's Enhanced Recurring Payments option for subscriptions as I just found out users won't need a PayPal account. This will allow for monetary support and for the moment people won't have to hastle with signing up. But in the future I'd like to wall off some content and make membership mandatory for those areas. What would be the foreseeable problems at a later date if I implemented Solspace's User with PayPal recurring payments and using if statements to wall off content? Would I be able to transfer those people that initially sign up for a recurring subscription to the later setup, which would require membership? Or would I just have to tell people to cancel membership and re-sign up at that time?

BTW, I've researched Membrr, CartThrob, and Charge... and right now, the paypal option for the additional $20/month seems well worth it in light of some of the things i've heard about the other options. Nothing negative on Charge, but more trouble than I want to invest in right now.

Thank you.

# Answer
Regarding Solspacer User & Paypal... The Solspace User module brings membership forms into normal templates. That will be separate from anything you are doing with Paypal & payments.

I believe you & I have emailed before about adding a pay wall to your EE site... Here's a new non EE option that I found recently: **TinyPass**. If it works as described on their site, it's a great option for adding paid content to a site.
> 1 votes

# Answer
We are using solspace User and are in the process of implementing the Simple Commerce Module. User uses the same member groups as usual in Exp Eng so our plan is to move members into a new member group (i.e. "Subscribers") when they purchase a subscription item in SCM.

If you're not concerned with look and feel then you can just as easily use the Exp Eng built-in member functions that work just as well instead of purchasing, installing, and setting up templates with User.

I've run into a snag with SCM (posted here: Why does simple commerce module not update member group upon successful completion of the transaction? ) where the member group is not automatically updating upon purchase but otherwise this seems like a good plan and seems to be working so far.

The other part of this of course is that your page templates need to have code in them that checks a member's group and displays content accordingly...

`{if member_group == '5'}some content{/if}`
> 0 votes

---
Tags: paypal, subscriptions
---


# Question
Title: Why do only certain templates show "No file exists" on Synchronize Templates page?
When I view the Synchronize Templates page, some of my templates consistently show "No file exists" instead of the file edit date.

While reviewing permissions, I discovered the files do indeed exist. Further, the files get updated upon editing and saving the template within EE admin panel. If I check the box to force a sync, the reloaded Synchronize Templates page still shows the error.

The templates seem to work fine aside from the no file exists error.

# Answer
Upon tracing the error in EE 2.7.2, I found it to be caused by LL. 4265–4267 in system/expressionengine/controllers/cp/design.php:

```
if (strlen($template) > 50)
{
    continue;
}

```

If the template name is longer than 50 characters (including an extension like ".html"), the next line does not set `$file_date`:

```
$file_date = get_file_info($basepath.'/'.$group.'/'.$template);

```

This leads to the error being generated in system/expressionengine/views/design/sync\_confirm.php:

```
$file_edit = ($template['file_exists'] === FALSE) ? lang('no_file_exists') : $template['file_edit'];

```

I am not sure why the 50 character arbitrary limit exists in design.php, but it seems to me that limit should be enforced at the points a user sets the template name in the first place. I filed a bug report on this issue, so perhaps EllisLab will enlighten me on the purpose of this code.

Further, I don't see anything in the documentation regarding template name length. All it says is:

> Template Name
>
> Template names may only contain alpha-numberic characters and no spaces. Since template names are typically used as part of a URL they must follow the standard URL naming rules.

So for now, the solution is to limit template names to less than 50 characters. Longer names seem to cause no issues aside from the error on the sync screen, but I haven't traced all the code to verify errors don't occur elsewhere.
> 0 votes

---
Tags: bug, sync
---


# Question
Title: PHP error when using Low Variables 2.4.0
Has anyone come across this error with Low Variables?

Trying to create a new variable (the first one for this install):

```
A Database Error Occurred
Error Number: 1364

Field 'variable_data' doesn't have a default value

INSERT INTO `exp_global_variables` (`variable_name`, `site_id`) VALUES ('lv_test', '1')

Filename: third_party/low_variables/mcp.low_variables.php

Line Number: 1135

```

This was trying to get create a textarea filed. Get the same error when trying to create an Assets field too:

```
Error Number: 1364

Field 'variable_data' doesn't have a default value

INSERT INTO `exp_global_variables` (`variable_name`, `site_id`) VALUES ('lv_assets', '1')

Filename: third_party/low_variables/mcp.low_variables.php

Line Number: 1135

```

EE 2.7.2 LV 2.4.0

# Answer
It's a known issue in LV 2.4.0 with some MySQL environments. Email me at hi at gotolow dot com for a patch. It will be fixed in 2.4.1.
> 0 votes

---
Tags: ee2, low-variables
---


# Question
Title: Expresso store - {order_date} in 2011-04-15T17:58:41.000000 format
We need to export the date of orders into a CRM and it needs to be in the following format:

2011-04-15T17:58:41.000000

The current {order\_date} is exported in unix format, is it easy to change this or is there any other way I can get around this?

# Answer
> 2 votes
Turns out it supports the format="" parameter as per ExpressionEngine's documentation:

{order\_date format="%D, %F %d, %Y - %g:%i:%s"}

---
Tags: expresso-store, date
---


# Question
Title: Default Matrix Rows Showing In Channel Form
Is there any way to use Matrix on the front end via a channel form and have 4 rows pre-populated for new entries.

Basically, we want to have a 'milestone' date area with one column with the milestone description and another column for the milestone date.

Each new job has a minimum of 4 milestones: `Concept, Content, Files, Delivery`. Hence, wanting to start with a default set of 4 rows for new entries.

Any advice would be greatly appreciated.

# Answer
I think if you set the minimum rows to 4 in the matrix field config it will display 4, at least I think it works like that in the cp.
> 1 votes

---
Tags: matrix, safecracker, pixelandtonic, channel-form
---


# Question
Title: Assets 2.1.4 strange behaviour: "Could not upload the file ... "
* Assets is the only thirdparty module/filedtype installed.
* Native cache folder are 777.
* File upload directory is working and uploads images correctly.
* Assets shows no folder at all. But if I upload one image AFTER installing Assets the folder shows up.
* When trying to upload one image to the visible folder I get error message as follows: **"Could not upload the file - server returned an unexpected response. Please check the server settings."**
* The status bar shows full process is done but there is no images.
* When trying to update the button goes "blank" and no result is shown.
* Assets now has created two cache folders in "cache \> assets tmp\_storage" and they are both 777. But no images ...

... ANYONE?

## Versions

* Assets 2.1.4
* EE 2.7.0
* PHP Version 5.3.10-1ubuntu3.8

# Answer
> 1 votes
Update your version of Assets to at least 2.2 as there was a fix for this per the changelog: http://docs.pixelandtonic.com/assets/changelog.html

# Answer
> 1 votes
I just had this exact problem.

I added 777 to:

> system \> expressionengine \> cache \> assets

and

> system \> expressionengine \> cache \> assets \> thumbs

---
Tags: assets, database, error, image, 2.7.0
---


# Question
Title: Use different templates for different categories
I want to use different templates for my categories. E.g. there are 4 templates (t1, t2, t3, t4) and I want to assign them to my categories like

Dogs (t1)
\- small dogs (t1)
\- big dogs (t1)
Cats (t2)
Fishes (t3)
\- small fishes (t3)
\- big fishes (t4)

Right now all categories point to one template which is specified in the categories-tag like

```
{exp:channel:categories ...}
<a href="{path={my_template_group}/categoriesTemplate}"">{category_name}</a>
{/exp:channel:categories}

```

I have a lot of categories, so I want to do it systematically. I cannot list all the categories and manually link them to different templates.

Thanks in advance for any idea!

EDIT in reaction to Phil
The reason why I want to do this to keep the example above: For "Dogs" I have a LOT of content: How to feed them, the funniest name, how to make them obey etc. So I need a template with a lot of lists, links, entries ... For "Cats" I only have some funny pics, so I need a template just with a gallery. And so on.

# Answer
> 1 votes
This requires a couple of add-ons, but, is actually pretty easy to accomplish.

Build a list of links to your category pages (at /template\_group\_name/template\_name/category\_url\_title):

```
{exp:channel:categories ...}
     <a href="{site_url}/template_group_name/template_name/{category_url_title}">{category_name}</a>
{/exp:channel:categories}

```

Here's the conditional logic for analyzing the categories in your template. It will look at the category URL segment (Seg2Cat add-on needed to retrieve category info from URL segments) and use speedy complex conditional using IfElse to determine which layout to use.

```
{exp:ifelse parse="inward"}
  {if "{segment_3_category_id}" == "id of big fishes"}
     ... big fish content ...
  {if:elseif "{segment_3_category_id}" == "id of fishes category" OR "{segment_3_category_parent_id}" == "id of fishes category"}
     ... fishes content ...
  {if:elseif "{segment_3_category_id}" == "id of dogs category" OR "{segment_3_category_parent_id}" == "id of dogs category"}
     ... dogs content ...
  {if:elseif "{segment_3_category_id}" == "id of cats category" OR "{segment_3_category_parent_id}" == "id of cats category"}
     ... cats content ...
  {/if}
{/exp:ifelse}

```

The first check is for your "big fishes" special-case template; after that, it will look at the category (or parent category) of the category specified in the URL in order to display the correct content.

# Answer
> 1 votes
you could use the {category\_url\_title} variable in the path for example

```
<a href="{path='template_group/{category_url_title}'}">{category_name}</a>

```

You will need to manually create each sub template within the group but if I am reading your question correctly that is what it sounds like you are trying to do.

My question might be why? What is it you are trying to accomplish surely there is an easier way than creating a separate template for each category. Whats the reasoning behind the separate templates maybe I can help you streamline what you are trying to accomplish.

---
Tags: templates, categories
---


# Question
Title: {exp:search:keywords} doesn't show keywords used in search
I'm using EE native simple search and in the results template have the following at the opening tag:

```
{exp:search:search_results limit="16"}
{if count=="1"}
<h1>Search Results</h1>
<p>You searched for <strong>{exp:search:keywords}</strong>.</p>
<ul class="product-grid">
{/if}
<li>...</li>

```

But the results shows like this...

The string looks to be the same for each search with results and doesn't match the URL string.

The no\_results page seems to output correctly...

Anyone else come across this?

# Answer
> 2 votes
I've seen this before when `{exp:search:keywords}` is used twice in the same template. Try adding `random` to the tag so that it's not cached by the template parser:

```
{exp:search:keywords random}

```

# Answer
> 0 votes
When I've seen problems like this before it's been a parse order issue; perhaps the unnecessary quotes around "1" in the conditional are throwing things off? Try `{if count==1}` and see what happens.

---
Tags: simple-search
---


# Question
Title: Captcha showing in comment form even with captcha off?
In my comment form I use {if captcha}...{/if} to only show the captcha if it is required. It is showing up for non-logged in users and not for myself, which makes sense.

The question is: How do I turn it off completely? I can not find any setting to turn of captcha's for comment forms in my 2.7.2 install.

# Answer
> 2 votes
You can remove the {captcha} tags from the templates, or comment them out:

```
{!-- {captcha} etc.. --}

```

and / or turn the captcha off on each channel by going to the channel preference for the relevant channel: Admin \> Channel Admin \> Channels \> Edit Prefs

Captcha docs

---
Tags: captcha
---


# Question
Title: Structure Won't Appear in Control Panel Anymore
Made a rookie mistake and deleted Structure from the server before uninstalling it first from the EE CP. Now, after I've reuploaded it, it still won't appear. I've tried going into the config file and turning off extensions while I reinstall it, no luck. Figuring that this error on my part probably caused some Structure tables to be leftover on the database, I logged into the database and deleted all of the prefixes that matched Structure. Still, no luck.

In short, I'm guessing this is a consequence of my error. If so, how would I go about correcting it? I have too much additional unrelated work on this site to do a backup.

Thanks!

# Answer
Make sure you also remove any rows referencing Structure references in the modules, extensions, and accessories tables.
> 2 votes

---
Tags: control-panel, structure, database, plugin
---


title: free form pro: repeatable fieldset

text:
# Question
Title: free form pro: repeatable fieldset
I am creating a signup form for an event where you can register multiple users at once. Does free form pro support some sort of repeatable blocks? Clicking "add another user" would add additional fields for name, surname and emailadres.

Tnx, Kristoffer

# Answer
> 1 votes
Currently, stock, there are no Matrix or Grid like fieldtypes. Sorry. There is however this: http://devot-ee.com/add-ons/grid-fieldtype-for-freeform

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


title: UTF8 characters for Javascript template

text:
# Question
Title: UTF8 characters for Javascript template
I have a strange situation where Russian characters are outputted as garbage if the template type is JavaScript.

I.e. "Российской Федерации" is outputted correctly if the template is "Web Page", but outputted as "Ð Ð¾ÑÑÐ¸Ñ" if JavaScript is selected.

Any ideas where I might be going wrong?

# Answer
> 1 votes
What is going wrong is character encoding. If you have the text Российской Федерации as UTF-8 encoded and this data is then misinterpreted as being windows-1252 encoding, you get Ð Ð¾ÑÑÐ¸Ð¹ÑÐºÐ¾Ð¹ Ð¤ÐµÐ´ÐµÑ€Ð°Ñ†Ð¸Ð¸. So apparently the data has been entered correctly, but the software is not interpreting it properly.

---
Tags: templates, javascript, character-encoding
---


# Question
Title: Getting a "The number parameter is required" when trying to submit a Store purchase to Stripe
I have read every post on this matter and can't seem to solve it. I have Store 2.1.0 and can't get past the "The number parameter is required" error when trying to submit an order.

I've double-checked my secret and public codes, they are both the test pair (no mis-matching).

I've made sure the submit input is labeled correctly.

I'm not 100% sure how to check but I *think* the token is coming back empty. Any guidance in making sure I am checking the right spot would be appreciated.

I am using radio buttons. It seems that was a problem for someone else but they claimed it was fixed in an update some time ago.

Here's my code for the whole page (sorry for indent inconsistencies):

```
<!DOCTYPE HTML>
<html>

{embed='inc/head_responsive'}

<body>

{if logged_in}

<div class="gs960">

    {embed='inc/header'}

    <div class="wrapper">

        {embed='inc/nav_responsive'}

        <div class="sidebar_left_small">

            {embed='inc/store_nav_responsive'}
        </div>

        <div class="three_fourth">

            {embed='inc/store_masthead'}

            <h1 style="margin-bottom:40px;">Confirm & Pay</h1>

            {exp:store:checkout return="account/invoices/ORDER_HASH/new"}

                <script type="text/javascript">
                $(function() {
                    $.getScript('https://js.stripe.com/v2/', function() {
                        Stripe.setPublishableKey('pk_test_sxEaF2h4B9EvdGBlvc3JJdZ6');
                    });

                    /* Ensure your checkout submit button has id="checkout_submit" */
                    $checkout_submit = $("#checkout_submit").click(function() {

                        /* Only handle requests for Stripe gateway */
                        if (this.form.elements["payment_method"].value == "stripe") {

                            /* Temporarily disable the checkout submit button */
                            $checkout_submit.attr('disabled', true);

                            /* Create a Stripe card token */
                            Stripe.card.createToken($(this.form), stripeResponseHandler);

                            /* We don't want to submit the form yet */
                            return false;
                        }
                    });

                    /* This function is triggered once Stripe has generated the token */
                    function stripeResponseHandler(status, response) {
                        /* Re-enable the checkout submit button */
                        $checkout_submit.attr('disabled', false);

                        /* Check whether we have a valid credit card */
                        if (response.error) {
                            alert(response.error.message);
                        } else {
                            /* Set the card token and submit the checkout form */
                            $("#payment_token").val(response.id);
                            $checkout_submit.off("click").click();
                        }
                    }
                });
                </script>

            <div>

                <div style="float:left; width:45%; margin-right:5%;">
                    <h3>Order Summary</h3>
                    <div style="margin-top:10px;">
                                    {items}
                            <div style="margin-top:-10px;">
                                <div style="float:left; width:70%;">
                                                <p>{item_qty} × {title} {modifiers}({modifier_value}){/modifiers}</p>
                                </div>
                                <div style="float:right;">
                                    <p>{item_subtotal}</p>
                                </div>
                            </div>
                            <div class="clear" style="height:0px;"></div>
                                    {/items}
                        <br />

                        <div>
                            <div style="float:left; width:70%;">
                                            <p>Shipping:</p>
                            </div>
                            <div style="float:right;">
                                <p>{order_shipping}</p>
                            </div>
                        </div>
                        <div class="clear"></div>
                        <div>
                            <div style="float:left; width:70%;">
                                            <p>Total:</p>
                            </div>
                            <div style="float:right;">
                                <p style="font-size:20px; color:#e7e6d0;">{order_total}</p>
                            </div>
                        </div>
                        <div class="clear"></div>
                    </div>

                    <br /><br />

                    <h3>Billing Details</h3>
                    <p><b>{billing_name}</b></p>
                    <p style="margin-top:-10px;">{billing_address1}</p>
                    <p style="margin-top:-10px;">{billing_city}, {billing_state}</p>
                    <p style="margin-top:-10px;">{billing_postcode}</p>
                    <p style="margin-top:-10px;">{billing_country}</p>
                    <p style="margin-top:-10px;">{billing_phone}</p>

                    <br /><br />

                    <h3>Shipping Details</h3>
                    {if shipping_same_as_billing}
                        <p>Same as Billing Details</p>
                    {if:else}
                        <p><b>{shipping_name}</b></p>
                        <p style="margin-top:-10px;">{shipping_address1}</p>
                        <p style="margin-top:-10px;">{shipping_city}, {shipping_state}</p>
                        <p style="margin-top:-10px;">{shipping_postcode}</p>
                        <p style="margin-top:-10px;">{shipping_country}</p>
                        <p style="margin-top:-10px;">{shipping_phone}</p>
                    {/if}
                </div>

                <div style="float:left; width:50%;">
                    <h3>Payment Method</h3>
                    <br />

                    {if error:payment_method != ''}
                        <div style="margin: 20px 0; background-color:#660000; border:1px solid #ff0000; padding:10px;">{error:payment_method}</div>
                    {/if}

                    <div style="border:1px solid #4f0000; padding:10px; margin-bottom:20px; background-color:#100804; -webkit-box-shadow: 0px 0px 20px 1px rgba(0,0,0,0.75); -moz-box-shadow: 0px 0px 20px 1px rgba(0,0,0,0.75); box-shadow: 0px 0px 20px 1px rgba(0,0,0,0.75);">
                        <label><input type="radio" name="payment_method" value="PayPal_Express"> Paypal</label><br />
                    </div>
                    <div style="border:1px solid #4f0000; padding:10px; margin-bottom:20px; background-color:#100804; -webkit-box-shadow: 0px 0px 20px 1px rgba(0,0,0,0.75); -moz-box-shadow: 0px 0px 20px 1px rgba(0,0,0,0.75); box-shadow: 0px 0px 20px 1px rgba(0,0,0,0.75);">
                        <label><input type="radio" name="payment_method" value="Stripe"> Credit Card</label><br /><br />

                    <div>
                        <div style="float:left; width:120px; padding:10px 0 0 20px;">
                            Card Number:
                        </div>
                        <div style="float:left;">
                            <input type="text" value="" data-stripe="number" class="form_field" style="width:130px;" />
                        </div>
                        <div style="clear:both;"></div>
                    </div>

                    <div>
                        <div style="float:left; width:120px; padding:10px 0 0 20px;">
                            Name On Card:
                        </div>
                        <div style="float:left;">
                            <input type="text" value="" data-stripe="name" class="form_field" style="width:130px;" />
                        </div>
                        <div style="clear:both;"></div>
                    </div>

                    <div>
                        <div style="float:left; width:120px; padding:10px 0 0 20px;">
                            Exp Month/Year:
                        </div>
                        <div style="float:left; margin-right:10px;">
                            <select data-stripe="exp-month" class="store_select">
                                    <option value=""></option>
                                    {exp_month_options}
                            </select>
                        </div>
                        <div style="float:left;">
                            <select data-stripe="exp-year" class="store_select">
                                <option value=""></option>
                                {exp_year_options}
                            </select>
                        </div>
                        <div style="clear:both;"></div>
                    </div>

                    <div>
                        <div style="float:left; width:120px; padding:10px 0 0 20px;">
                            CVC:
                        </div>
                        <div style="float:left;">
                            <input type="text" size="4" value="" data-stripe="cvc" class="form_field" style="width:30px;" />
                        </div>
                        <div style="clear:both;"></div>
                    </div>

                    <input type="hidden" id="payment_token" name="payment[token]" value="" />

                    </div>

                </div>

                <div class="clear"></div>

            </div>

            <div class="clear"></div>

            <div style="text-align:right;">
                <a href="{path='store/details'}"><span class="button" style="font-size:16px; padding:11px 20px; margin:0px;">Back</span></a>
                <input type="submit" name="submit" id="checkout_submit" class="button" style="font-size:16px; padding:7px 20px; margin:0px;" value="Purchase" />
            </div>

            <div class="clear"></div>

            {/exp:store:checkout}

        </div> <!-- / two_third -->

    </div> <!-- / wrapper -->

    {embed='inc/footer'}

</div>

</body>

{/if}

{if logged_out}{redirect='account/login'}{/if}

</html>

```

Thanks for any help. It would be VERY much appreciated!

# Answer
Adrian showed us the light.

Since we are using radio buttons instead of a select drop-down, this line had to go from:

```
if (this.form.elements["payment_method"].value == "stripe") {

```

to

```
if ($(this.form).find("[name='payment_method']:checked").val() == "Stripe") {

```

Been working like a champ since the fix. Thanks exp-resso guys!
> 2 votes

---
Tags: expresso-store, stripe
---


# Question
Title: Hooks when a member is moved to another member group
Is there a hook in ExpressionEngine that triggers when any one member is moved from group to another?

# Answer
As Derek said, there isn't a hook for member group change, but you could accomplish this by using the two member update hooks provided by the Member Model in conjunction with the Cache Access provided by the Session Class.

**Hook 1: member\_update\_start**
In your method called by this hook store the member's existing group\_id using the Session Class `set_cache()` method.

**Hook 2: member\_update\_end**
In your method called by this hook retrieve the existing group\_id (set above) by using the Session Class `cache()` method and compare it to the updated group\_id to see if it has changed.

This works well in my quick test.
> 2 votes

# Answer
Unfortunately not. Best you could do is run a cron job which replicates the `exp_members` table periodically, then compares it to the real table, and takes action on any members whose groups affiliations have changed.
> 1 votes

---
Tags: hook
---


title: Many to Many Relationships

text:
# Question
Title: Many to Many Relationships
Just wondering if anyone has a solution for this.

I want relationships between two channels... nothing fancy. But in the CP I want from both channels to be able to create the relations.

Say I have the channel Bakery and Bread. 1: From the bakery I want to be able to add one or more breads. 2: From the bread I want to be able to add a bakery.

Right now I could do this by adding a relationships field to both of the channels and point them to the opposite channel. But both fields won't know of each others existence thus not displaying the relations made in the opposite channel.

I think this is probably because of the ability to sort the relations. But that feature is something we don't need for this specific problem.

I hope I made clear what I need :) hopefully someone knows of a solution.

# Answer
> 2 votes
I wrote something nice about this the other day for someone. It can be done in EE without plugins and is pretty straight forward.

I hope it helps.

https://expressionengine.stackexchange.com/a/18229/1872

# Answer
> 1 votes
You might be able to do this with a plugin (maybe Playa), but EE won't do this out of the box.

Really, EE wants you to do relationships one-way. Either set up a bakery to select types of bread OR for each bread-type, say which bakery it's available at.

Any particular reason it needs to be both ways? It might seem easier, but it ends up being confusing.

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


# Question
Title: Expresso Store FedEx Shipping plugin throwing error and not adding shipping methods to checkout
I've set up a working store using Expresso Store for my client that has been live for a few months now. (see http://shoptipsy.com/shop)

I'm trying to extend the functionality of their store using the Fedex shipping plugin Expresso offers. I've installed the Fedex Store plugin according to their instructions, enabled it and added the "test" credentials supplied by FedEx for their FedEx account.

Right now, the additional shipping options that are supposed to be added to my `{field:shipping_method}` template tag are not being added -- only the other shipping options I've already set up in the Store add-on are appearing. I'm seeing this behavior both on my local and staging servers.

Also, when I attempt to choose one of my existing shipping methods ("In-store pickup" for example), I get the following error and can't progress in the checkout:

```
Fatal error: Uncaught exception 'Store\Exception\ShippingException' with message 'Authentication Failed' in /storage/av01061/www/staging_html/tipsymin/expressionengine/third_party/store_fedex/ext.store_fedex.php:200 Stack trace: #0 /storage/av01061/www/staging_html/tipsymin/expressionengine/third_party/store_fedex/ext.store_fedex.php(132): Store_fedex_ext->parse_response(Object(Guzzle\Http\Message\Response)) #1 [internal function]: Store_fedex_ext->shipping_methods(Object(Store\Model\Order), Array) #2 /storage/av01061/www/staging_html/tipsymin/expressionengine/libraries/Extensions.php(262): call_user_func_array(Array, Array) #3 [internal function]: EE_Extensions->universal_call('store_order_shi...', Object(Store\Model\Order), Array) #4 /storage/av01061/www/staging_html/tipsymin/expressionengine/libraries/Extensions.php(119): call_user_func_array(Array, Array) #5 /storage/av01061/www/staging_html/tipsymin/expressionengine/third_party/store/src/Store/Service/OrdersService.php(491): EE_Extensions->call('store_order_shi...', in /storage/av01061/www/staging_html/tipsymin/expressionengine/third_party/store_fedex/ext.store_fedex.php on line 200

```

So it appears that the FedEx extension is doing something, but I'm not sure why I can't even see the options it is supposed to include in my auto-generated shipping methods dropdown.

To give some more info, my checkout process is broken into four screens:

1. View the cart and confirm the contents
2. Enter billing and shipping address and choose shipping method
3. Enter payment details
4. Order confirmation

Any help/suggestions are greatly appreciated. Thanks!

I'm running Store 2.0.4 and Store Fedex Shipping 1.0.2

# Answer
This error suggests that the authentication credentials you provided (in the Settings of the FedEx Shipping extension) are incorrect.

Your best bet is probably to contact FedEx (c.f. http://www.fedex.com/us/developer/) to make sure that (a) your account credentials are correct, and (b) your FedEx account is enabled for third-party integration.

(The FedEx Shipping extension won't add FedEx as an option in the shipping dropdown in your Store templates unless it can successfully authenticate with your FedEx account to retrieve a shipping cost.)
> 1 votes

---
Tags: expresso-store
---


# Question
Title: Stash: How can I get the 'url_title' of the first channel entry?
I am not very used to stash. My code looks like this:

```
{exp:channel:entries
    channel="moebel"
    orderby="date"
    sort="desc"
    dynamic="off"
    disable="member_data|trackbacks|pagination"
}
    <a href="{path=moebel/{url_title}}" {if url_title == '{segment_2}' OR segment_2 == '' AND count == '1'}class="active"{/if} >{count}</a>

{if count == '1'}
    {exp:stash:set name="myurltitle"}{url_title}{/exp:stash:set}
{/if}
{/exp:channel:entries}

```

This does not work because the variable 'myurltitle' will always be the last url\_title of the 10 entries in the channel.

How can I realize this? Thanks!

# Answer
> 1 votes
One way is to use Switchee, which is perfect for use with Stash and probably good for opening bottles and cans of Tuna as well:

```
{exp:channel:entries
    channel="moebel"
}
    {exp:switchee variable="{count}" parse="inward"}
        {case value="1"}
            {exp:stash:set name="myurltitle"}{url_title}{/exp:stash:set}
        {/case}
    {/exp:switchee}
{/exp:channel:entries}

```

# Answer
> 0 votes
I'm fairly new to using stash myself. Try putting the stash in its own channel loop, with a limit of one entry.

Compare "Basic Example" on this page: https://github.com/croxton/Stash/wiki/%7Bexp%3Astash%3Aset%7D

```
// One entry to stash your info here - and ONLY the stash info.
{exp:channel:entries channel="moebel"
    orderby="date"
    sort="desc"
    dynamic="off"
    disable="member_data|trackbacks|pagination"
    limit="1"
    }
    {exp:stash:set name="myurltitle"}{url_title}{/exp:stash:set}
{/exp:channel:entries}

// The primary loop for everything else here

{exp:channel:entries channel="moebel"
    orderby="date"
    sort="desc"
    dynamic="off"
    disable="member_data|trackbacks|pagination"
    }
    <a href="{path=moebel/{url_title}}" {if url_title == '{segment_2}'
    OR segment_2 == '' AND count == '1'}class="active"{/if} >{count}</a>

{/exp:channel:entries}

```

Also, your last if check **{if url\_title == '{segment\_2}' OR segment\_2 == '' AND count == '1'}** could use some parentheses for better operation, e.g. **{if url\_title == '{segment\_2}' OR (segment\_2 == '' AND count == '1')}**

---
Tags: stash
---


title: Delete every entry in Channel

text:
# Question
Title: Delete every entry in Channel
I want to delete all data in one channel. And I found that, the best way to delete all entry in channel is delete this channel and re-create it follow this article: What is the best way to delete every entry in a channel?

and I tried to delete channel follow this article: http://ellislab.com/expressionengine/user-guide/development/api/api\_channel\_structure.html

I know that the site\_id is 1 and the channel\_id of channel I need to delete is 1. But when I tried these code:

```
ee()->load->library('api'); ee()->api->instantiate('channel_structure');
$channel_id = 1;$site_id = 1;
ee()->api_channel_structure->delete_channel((int) $channel_id, [(int) $site_id]);

```

I got this error:

> Parse error: syntax error, unexpected T\_STRING in /var/www/vhosts/au/admin/expressionengine/libraries/Functions.php(679) : eval()'d code on line 7

I tried with:

```
ee()->api_channel_structure->delete_channel((int) 1, [(int) 1]);
ee()->api_channel_structure->delete_channel(1, 1);

```

But got same issue.

Does somebody know how to solve this issue. Thank so much!

# Answer
> 2 votes
If your preferred method to delete all the entries for a given channel is to just delete the channel, then you do not need to use the Channel API. You can just delete the channel in the control panel. Go to *Admin \> Channels* and click "Delete" next to the channel you want to remove.

If instead you prefer to do it using the API, then there is an error in your code that needs to be fixed to begin with. The documentation uses square brackets to indicate arguments that are optional.

So where the documentation for delete\_channel says...

```
ee()->api_channel_structure->delete_channel((int) $channel_id, [(int) $site_id]);

```

...the second argument for `site_id` is optional. If you actually *use* that argument you should not include the brackets.

You would just do:

```
ee()->api_channel_structure->delete_channel(1, 1);

```

You could even just leave the site\_id argument out, since it is optional.

---
Tags: channel, entry, delete
---


# Question
Title: Error upgrading EE1.x to EE 2.7.3 with Cartthrob
I ran through the update process with this site a while ago when I upgraded to EE 2.5.5 and finished the EE upgrade no problem, but today I've tried to run the same update again but going to 2.7.3 and it's got as far as 2.7.2 with no problem and then produces this error:

> {"error":" Error Number: 1146\</p\>\n\n\>
>
> Table 'fabric\_ee\_v2.exp\_cartthrob\_settings' doesn't exist\</p\>\n\n\>
>
> SELECT \*\nFROM (`exp_cartthrob_settings`)\</p\>\n\n\>
>
> Filename: /Users/tyssen/Documents/Tyssen Design/3. Sites 2010-11/Fabric Studio/server/third\_party/cartthrob/upd.cartthrob.php\</p\>\n\n\>
>
> Line Number: 800\</p\>"}

Both CT 2.4 and the updater modules are in place. Last time I did the update I was able to update EE and then update CT later.

# Answer
I always rename my `system/expressionengine/third_party` directory before running EE updates to avoid potential conflicts like this.

Since around 2.6 the EE updater also invokes add-on updates and can cause a failed update with very little debugging information to go on. Renaming the directory simply prevents any of this from happening and lets EE do what it needs to do.

Just remember to update your extensions after the EE update by visiting your extensions page, and associated settings, running module updates, and updating any fieldtypes by visiting the fieldtype's global settings pages (if they exist).
> 2 votes

---
Tags: cartthrob
---


title: Character encoding on export import

text:
# Question
Title: Character encoding on export import
We have an existing site running on EE 1.6.8.

We decided to start afresh, clean new site so we have an install of v2.7.1 running.

We’ve built the site, finished the templates and are starting to look at running imports on any old content we want from the EE 1.6.8 site.

To achieve this we’re using Solspace’s Importer and have XML feeds for the old data.

The problem is some characters are outputting odd characters such as

**`Harrison’s`**

If we check the old database table the data looks fine:

Where as the XML doesn't:

We also have an issue where some entries that have been imported end up showing some strange characters in the new templates. An example of this can be seen here:

Oddly the XML and entry appear ok for this:

The old DB 'was' Latin1 but has been changed to UTF8 and that the new DB is UTF8 and the page template (RE 2nd problem) are UTF8 also as are the XML files.

What have we missed?

# Answer
> 1 votes
At a quick guess, I'd try the following (backup and do it all on local ideally)

1. Change the formatting on those original fields from xhtml to 'none'.
2. On your target install, also set the field formatting from xhtml to 'none'.
3. *After* your import, update the fields to be xhtml formatted.

It's not going to help your titles though, titles are put through a typography filter you have no control over. Maybe use the query module to access title data when generating your xml...

Hopefully this helps.

---
Tags: database, import, xml, character-encoding
---


title: Playa + Pagination = nothing… Why?

text:
# Question
Title: Playa + Pagination = nothing… Why?
I guess I'm missing something obvious since I haven't found any question on this subject… I'm trying to paginate results from `exp:playa:parents` tags to no avail… That's what I got:

```
{exp:playa:parents parent_id="{low_events:entry_ids}" disable="categories|category_fields" limit="5" paginate="bottom"}
  HTML…
  {paginate}
    {pagination_links}
    <ul>
      {page}
      <li><a href="{pagination_url}" class="{if current_page}active{/if}">{pagination_page_number}</a></li>
      {/page}
    </ul>
    {/pagination_links}
  {/paginate}
{/exp:playa:parents}

```

From the Playa docs, it sounds like I'm supposed to override `disable="pagination"` which i set to `true` by default. That's what I'm going for with `disable="categories|category_fields"` and that's the only thing I can think of that might be the problem… (I don't actually know if that's how you're supposed to override the default).

Any idea? Thanks!

# Answer
> 6 votes
I don't know if you already have a anwser yet. But I had the same problem and I. I want to enable pagination within a Playa loop.

You need to do 2 things to enable pagination in a Playa loop.

* Override the default disable of “categories|category\_fields|member\_data|pagination”.
* Put var\_prefix in your Playa tag and pagination tag.

You did a good override of the default disables with `disable="categories|category_fields"`  but also `disable=""` will work if you want to enable all this.

So you only have to do a prefix in your loop and your code should look something like this:

```
{exp:playa:parents parent_id="{low_events:entry_ids}" disable="categories|category_fields" limit="5" paginate="bottom" var_prefix="your_prefix"}
  HTML…
  {your_prefix:paginate}
    {pagination_links}
    <ul>
      {page}
      <li><a href="{pagination_url}" class="{if current_page}active{/if}">{pagination_page_number}</a></li>
      {/page}
    </ul>
    {/pagination_links}
  {/your_prefix:paginate}
{/exp:playa:parents}

```

I hope this helps you.

# Answer
> 2 votes
Have you tried following the instructions here: https://getsatisfaction.com/pixelandtonic/topics/pagination\_in\_playa#reply\_6602199 ?

---
Tags: playa, pagination
---


# Question
Title: WSOD on index.php and system, no problem reaching phpinfo
I have migrated my EE 2.5.1 install to a new dev machine (actually just OS - Ubuntu 13.10 - reinstall from scratch) and cannot get past WSOD in home or system. I checked the instructions from the server migration guide, file permissions etc. seem to be good. Database config is good and config.php has all the same paths as previously.

I can reach phpinfo page in the same directory as index.php. I can also get to the server wizard front page, but as soon as I click "check my server" I get the WSOD again. System requirements are good according to phpinfo.

I have absolutely no debugging info on index.php or system, regardless of debug=1 in index.php and xdebug.scream in php.ini; the only error in Apache logs is a warning from the phpinfo page.

The only difference I can think of between this and the previous install is that I installed PHP5-cli first, before Apache2, and had to install php5-mod-apache afterwards.

How can I get past the WSOD, or at least get some more debugging info?

# Answer
xdebug.scream did start giving output a while later, I presume the WSOD without output was cached or something. It gave me the answer to my question: I hadn't installed php mysql drivers.
> 1 votes

---
Tags: debugging, server-migration, blank-screen
---


# Question
Title: Embed not embedding, but only for 1 member group
My template's \<head\> tag is defined as a snippet combined with preload replace variables, as per Low's idea (http://gotolow.com/blog/snippets-and-preload-replace-variables). On one or two templates, however, this technique won't cut it and I need to use a full embed. That's a shame, but there you go.

Thing is, I'm finding that if I am logged into the CP as an Admin (a member group I created for the client to use for basic site editing, with much less control than a superadmin), the embed *doesn't embed*. So the page has no \<head\> tag at all, with all of the rather unfortunate consequences that that implies.

I'm racking my brains to think what setting in the member groups settings might be causing this; if I'm logged in as a super admin (or not logged in at all) then the embed is processed normally.

Any ideas?

# Answer
> 1 votes
And as I submitted the question (probably *because* of the process of typing it out logically) it dawned on me. The issue wasn't in the member group settings, it was in the access permissions under template management. Admins were not permitted to view that embed template for some reason. Corrected and now all is working.

---
Tags: members, embeds
---


# Question
Title: Pinterest link in modal not referencing correct photo
I have a photo gallery that when you click on a photo, opens a modal of a larger view of the image, which works fine. I also have a Pinterest button in the modal, with the intention of "pinning" said photo. My issue is that I'm having problems getting the proper parameters passed thru to the Pinterest link.

Here is my loop for the photos & Pinterest link...

```
<div class="links">
    {exp:channel:entries channel="tours"}
    {tour_photo_gallery}
    <a href="{tour_photo_gallery:photo:large}" title="{tour_photo_gallery:caption}" data-gallery>
        <img src="{tour_photo_gallery:photo:small}" alt="{tour_photo_gallery:caption}">
    </a>
    {/tour_photo_gallery}
    {/exp:channel:entries}
</div>

<div id="blueimp-gallery" class="blueimp-gallery">
    <!-- The container for the modal slides -->
    <div class="slides"></div>
    <!-- Controls for the borderless lightbox -->
    <h3 class="title"></h3>
    <a class="prev">‹</a>
    <a class="next">›</a>
    <a class="close">×</a>
    <a class="play-pause"></a>
    <ol class="indicator"></ol>
    <!-- The modal dialog, which will be used to wrap the lightbox content -->
    <div class="modal fade">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" aria-hidden="true">×</button>
                    <p class="modal-title"></p>
                </div>
                <div class="modal-body next"></div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-very-light pull-left prev">
                        <i class="fa-icon-chevron-left"></i>
                        Previous
                    </button>
                    <div>
                        {exp:channel:entries channel="tours"}
                        {tour_photo_gallery limit="1"}
                        <span class="pinterestBtn">
                            <a href="//www.pinterest.com/pin/create/button/?url=http%3A%2F%2Fwww.flickr.com%2Fphotos%2Fkentbrew%2F6851755809%2F&media={tour_photo_gallery:photo:large}&description={tour_photo_gallery:caption}" data-pin-do="buttonPin" data-pin-config="none" data-pin-height="28"><img src="//assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_28.png" /></a>
                        </span>
                        {/tour_photo_gallery}
                        {/exp:channel:entries}
                        <button type="button" class="btn btn-contrast next">
                            Next
                            <i class="fa-icon-chevron-right text-white"></i>
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

```

`.links` holds my photos and opens up the lightbox...that works fine. `#blueimp-gallery` is the modal and `{tour_photo_gallery}` is a Grid fieldtype. I set a `limit="1"`, otherwise it loops thru and displays Pinterest links for every image. However, by doing so, whatever photo I click on to display in the lightbox, the Pinterest link is always referencing the 1st entry in the Grid, instead of the one clicked on. I sense the second loop has to be paired w/ the initial one, so the Pinterest link knows which photo to reference...but I'm not sure how to do so. Hopefully I'm explaining this correctly. Any ideas?

# Answer
Right, so essentially, you've got two channel entries loops going here, and they're not at all related. You'll either need to reconfigure your code to use only one, or try to pass a row\_id parameter from the first set of images into the modal.

You could do this several ways - via embed, or stash potentially, etc, etc. I'm not familiar with the gallery you're using - but took a quick look - are you sure you actually need that second loop?
> 1 votes

---
Tags: loop, modal
---


title: Amazon s3 image scaling

text:
# Question
Title: Amazon s3 image scaling
i'd like to use devdemon channel images on amazon s3 hosts but i need to dynamically resizing images on http requests.

i need something very similar to the google cdn:

for example, adding the =s paramter to scale the image i get the needed image

http://lh6.ggpht.com/VMLEHAa3kSHEoRr7AchhQ6HEzHVTn1b7Mf-whpxmPlpdrRfPW216UhYdQy3pzIe4f8Q7PKXN79AD4eRqu1obC7I=s200

do you know if there's similar options on amazon s3? i've looked inside docs, support sites and forums but i was not lucky, too much informations and nothing clear for me (i'm not a expert developer).

or there's a way to use channel images with google cdn in a simply way like as s3?

please, if you know how to do it let me know, thank you Valerio

# Answer
Take a look at **CE Image**.

* Can implement dynamic resizing based on request (use segment variables or GET variables for the dimension parameters on the CE Image template tag).
* Will save manipulated images to Amazon S3.
* Can be used in conjunction with Channel Images (just don't bother with the Channel Image's resizing feature and rely completely on CE Image for that).
> 2 votes

---
Tags: channel-images, s3, devdemon, resize, amazon
---


# Question
Title: what must I do to make a AJAX popup window for logging in and out using freemember?
I am looking for an answer how must I code a link to a AJAX popup window for users to login. I have my login link in a menu that is on all my pages. Also logout. I tried to read about this AJAX but I get **very** confused.

Thanks a lot! for helping me out with a simple answer.

# Answer
> 1 votes
Create a div. Throw your login box inside. Style and position it how you want. Set it to 'display: none'.

Create an event listener, which when triggered, sets the display property to block or anything but none.

Create a listener, which will set it to display none.

```
$( '.context' ).on( 'click', '.my_hidden_Div', function( event ) {
    event.preventDefault();
    $( this ).show();
 } );

$( '.context' ).on( 'click', '.my_hidden_div .close', function( event ) {
    event.preventDefault();
    $( this ).hide();
} );

```

Ajax login can be used, but if your having trouble this is a good start. Simple jQuery.

---
Tags: ajax, freemember
---


# Question
Title: How can I create 2 different layouts on same page with channel entry list and single channel entry?
I am creating a page in my site with a list of entries under 1 channel.

I have the template structure as follows:

* collections/ss14
* collections/aw14
* collections/index

The ss14/aw14 templates pull in data from the channel with all their entries listed here is my template so far:

```
<div id="container" class="collection">
{if segment_4 == "ss14"}
<div id="gallery-t-group" class="rsMinW">
<h1>this is the list view</h1>
   {exp:channel:entries channel="ss14" dynamic="yes" url_title="{segment_4}"}
      <div class="portfolio load-slide">
        <img data-rsh="400" class="rsImg {dimension} root" src="{images}{url}{/images}" alt="{long_name}" />
            <div class="rsTmb"><img class="{dimension}" src="{images}{url}{/images}"></div>
            <input type="hidden" value="{path={site_short_name}/collections/{channel}/{url_title}}" class="perma_link" />
    </div>
   {/exp:channel:entries}
</div>
{/if}
{if segment_4 == ''}
<div id="gallery-t-group" class="rsMinW single">
   {exp:channel:entries channel="ss14" dynamic="no"}
      <div class="portfolio load-slide">
        <img data-rsh="400" class="rsImg {dimension} root" src="{images}{url}{/images}" alt="{long_name}" />
            <div class="rsTmb"><img class="{dimension}" src="{images}{url}{/images}"></div>
            <input type="hidden" value="{path={site_short_name}/collections/{channel}/{url_title}}" class="perma_link" />
    </div>
   {/exp:channel:entries}
</div>
{/if}
<div class="rsnav-container">

</div>
</div><!--End Content-->

```

Basically the idea here is that I am trying to have a list layout if its under the url /collections/ss14 or /collections/aw14 and then when you go into the single entry itself /collections/ss14/entry-title or /collections/aw14/entry-title I would ideally need to have a different layout as it needs to be using some other parameters inside the channel entries tag.

Does anyone know a good solution to this problem as I am sure there are people who run into this problem all the time when dealing with expression engine.

Cheers

# Answer
There are a variety of approaches to this. One tool that always proves useful when trying to serve a wide range of layouts and content from a single template is **Switchee**. This will usually cover all the bases for you! Plus it's more efficient and flexible than native conditionals.

Other approaches to play with (either in conjunction with Switchee or separately):

Use a URL segment variable in the `channel` parameter on your `channel:entries` tag. And if the different channel's have slightly different output requirements you can couple that with a conditional based on `channel_short_name`. For example:

```
{exp:channel:entries channel="{segment_3}" dynamic="yes" url_title="{segment_4}"}
    {if channel_short_name == "ss14"}
        {!-- ss14-specific template stuff here --}
    {/if}
    {if channel_short_name == "aw14"}
        {!-- ss14-specific template stuff here --}
    {/if}
{/exp:channel:entries}

```

And finally, you *can* use *simple* conditionals inside channel:entries tag parameters. Sometimes this can give you an added boost to flexibility that allows you to use a single template in multiple ways. For example, on an opening channel:entries tag:

```
{exp:channel:entries channel="{segment_3}"
    {if segment_4}
        dynamic="yes" url_title="{segment_4}"
    {/if}
}
{/exp:channel:entries}

```

(This last example is pretty hypothetical, and meant only to illustrate how simple conditionals can be used on channel:entries parameters, so please take with a grain of salt.)

I hope that helps!
> 2 votes

---
Tags: ee2, channel-entries, templates, channel, entries
---


title: Outbound Affiliate Links

text:
# Question
Title: Outbound Affiliate Links
So I have an affiliate account with TicketFly that will help us make a few bucks when we send someone to purchase a ticket through their system.

My question is what do you guys think is the best way to take this url `http://www.ticketfly.com/purchase/event/450737/` and convert it into `http://www.shareasale.com/r.cfm?u=841156&b=234786&m=27601&afftrack=&urllink=www%2Eticketfly%2Ecom%2Fpurchase%2Fevent%2F450737%2F`?

I have to make sure that our Affiliate ID number `841156` and TF's ID `27601` remains part of the query as well as the `urllink` parameter. I'm just not sure what path to take. Do I use some concoction of Low Replace or something else?

Any help would be greatly appreciated!

# Answer
> 1 votes
I believe the only part of the original URL you need is the numeric part, which contains the event ID. You should be able to build an anchor using something like this:

`http://www.shareasale.com/r.cfm?u=841156&b=234786&m=27601&afftrack=&urllink=www%2Eticketfly%2Ecom%2Fpurchase%2Fevent%2F{some regex that will extract numbers from your URL field}%2F`

CE String and Low Replace both support regex, not sure on the specifics of the syntax, but, that should be enough to get you going in the right direction.

**Edit - CE String Syntax**

CE String's syntax for doing this would be: `{exp:ce_str:ing preg_rep='[^0-9]||Us' trim}{your_field_with_numbers}{/exp:ce_str:ing}`

So, I believe you could build your anchor with this:

`http://www.shareasale.com/r.cfm?u=841156&b=234786&m=27601&afftrack=&urllink=www%2Eticketfly%2Ecom%2Fpurchase%2Fevent%2F{exp:ce_str:ing preg_rep='[^0-9]||Us' trim}{your_field_with_the_url}{/exp:ce_str:ing}%2F`

---
Tags: low-replace, low, affiliate
---