# Question
Title: How do I mock parameters and tagdata when using testee?
I've gotten as far as getting a tag to run with it's default parameters, but I have no clue on how to fake the passing of parameters and tagdata.

I've checked the documentation for testee and munged a bit through it's own tests. I realize it is an unsupported addon as the author has moved away from ExpressionEngine, but that is why I am asking here.

Here's a working test so far:

```
public function test__returns_zero_with_default_attributes() {

    $result = $this->_subject->modulo();
    $this->assertEqual($result, 0);

}

```

# Answer
> 1 votes
Turns out it works this way:

```
$this->_subject->EE->TMPL->returns('fetch_param', 11, array('numerator', '1'));

```

This says when the mock EE object receives a call to fetch\_param with the arguments 'numerator' and '1' (`$this->EE->fetch_param('numerator', '1')` in the plugin code) return the value 11.

Similar can be done for the tagdata property:

```
$this->_subject->EE->tagdata = 'This is text simulating the contents of a tag pair';

```

Voila! Now you can test module and plugin tags.

---
Tags: ee2, add-on-development
---


# Question
Title: Getting the ID or name of a field on a parent entry that holds a Playa relationship
Using the parents() method of Playa, is it possible to get the name or ID of the field in the parent that holds the relationship?

```
{exp:playa:parents entry_id="1" channel="my_channel"}
    parent field name or id = {????}
{/exp:playa:parents}

```

Thanks

# Answer
Is the {entry\_id} tag what you're looking for?

`{exp:playa:parents entry_id="1" channel="my_channel"}
 {entry_id}
{/exp:playa:parents}`

Within the context of `{exp:playa:parents}`, it will refer to the parent's id.

**Edit**

It's entirely not possible to get at the field\_id of the parent that holds the relationship with the way EE and Playa are both architected.
> 0 votes

---
Tags: playa
---


# Question
Title: Private URLs with Assets or Compatibility with Protected Links
Does anyone know if Assets, when used in combination with Amazon S3 to store files can create "signed URLs" when serving up files on the front-end?

S3 provides a time limited signed URL option for ensuring links aren't guessed or shared and would generate a URL that looks something like this:

http://s3.amazonaws.com/quotes/nelson?AWSAccessKeyId=44CF9590006BF252F707&Expires=1141889120&Signature=vjbyPxybdZaNmGa%2ByT272YEAiv4%3D

If not, then is it possible to integrate with Protected Links so files can be uploaded via Safecracker on the front-end into an Assets field to create an entry and then later served back up on the front-end using Protected Links to provide a My Downloads area of secure links?

Has anyone successfully used that combination or know if the two would be compatible?

# Answer
It seems that signed URLs are not an option in Assets at present but the good news is that IntoEEtive have confirmed that Protected Links should work perfectly well with Assets files so it should be possible to provide secure file links on the front-end with the help of this addon.
> 2 votes

---
Tags: assets, pixelandtonic, s3, encryption
---


title: CE Tweet Errors

text:
# Question
Title: CE Tweet Errors
I'm, getting this error in EE Debugging:

```
(0.419939 / 15.94MB)        ***  CE Tweet debug: The cache file "/var/www/vhosts/website.com/httpdocs/system/expressionengine/cache/ce_tweet/p_42b4b77cc4158296d158d8647a04917e" does not exist.
(0.504468 / 16.21MB)        ***  CE Tweet debug: An exception occurred: 401 "{"errors":[{"message":"Invalid or expired token","code":89}]}"

```

I've checked the folder has correct permissions to write the cache file to it and it has 777 on it. It creates the CE Tweet folder if it doesn't exist, but not the cache file.

# Answer
> 1 votes
It looks like CE Tweet is trying to access the cache because your OAuth credentials aren't working with Twitter. I'd double check the credentials in your config file as outlined in the CE Tweet installation instructions and then try regenerating your access token for the twitter application if that doesn't work.

---
Tags: twitter
---


# Question
Title: How to unit test AddOns, plugins and extentions
I tried using Testee as my test framework but found that SimpleTest but the latest release of SimpleTest was in 2010 so I'm presuming that it is no longer supported which is probably why Stephen Lewis hasn't updated Testee for 10 months.

Basically, I can't get this working and because it is unsupported I guess that it would be better to find out what other folks are doing.

I was thinking of Forking the Codeigniter tests and extending them in some way. Is this what others are doing?

# Answer
I'm using PHPUnit, which is by far more popular in PHP-land. The full ins and outs of getting it set up are probably beyond a stack exchange answer, but assuming there are a couple things which should put you in the right direction.

Testing with EE and CI in general is always an uphill battle, since they weren't really designed with testing in mind, and there are no set standards of how to do things.

Use Mockery to stub out all the core EE classes, and set expectations that they are called. Try to avoid loading the core EE framework altogether, just use mock objects.

In my test bootstrap I wrote a `ee()` helper method which returns the global mocked EE instance, which you can use to set expectations on.

Database access is a bit more tricky - best bet is probably to create a test database, and then manually load the CI DB components and hook them up to the test database. Using expectations with database driven methods doesn't work very well in my experience.
> 3 votes

# Answer
I think it's ok to use Testee, though the documentation for it is quite lacking and simpletest has fallen out of favor with the rise of laravel, composer and PHPUnit.

I have been able to get it working. The skeleton for a test file would be like so:

```
<?php

// Need to include the addon you're testing,
// but testee loads Testee_unit_test_case for you
require_once PATH_THIRD.'addon/pi.addon.php';

class Test_addon extends Testee_unit_test_case {

    // The following just makes it easier to
    // call the addon's methods by storing an
    // instance.
    private $_subject;

    function setUp() {
        parent::setUp();

        $this->_subject = new Addon_class();
    }

```

After writing such a test file in the `tests` directory of your addon, you should see it appear in the control panel in the module page for Testee.

I am working on figuring out how to write the tests to mock params and tagdata and the like. I'll report back if i find an answer to that.
> 0 votes

---
Tags: ee2, module, codeigniter
---


# Question
Title: Batch Channel Updating - Multiple Fields
Hi Im looking for advice in either code format or any addons/modules etc available for EE2.

I have a channel that is set out as follows

Title Description Price 1 Price 2 Price 3 Price 4 Category: (A,B,C,D) Actual Price:

I want to be able to batch adjust the price of Price 1,2,3,4 depending on changes with the supplier of the equipment either across the board or dependent on 1 category.

I know I can do it with normally with PHP, but is there a better way built in to EE or a hybrid php/ee option?

# Answer
> 2 votes
You can use DataGrab (http://brandnewbox.co.uk/support/category/datagrab/) or Importer (http://www.solspace.com/software/detail/importer/) module for the batch updating the entries.

I think, these module would be better solution rather than having any other.

---
Tags: ee2, cartthrob, batch-update
---


# Question
Title: returning settings of channel Field using channel_api
I'm trying to pull up the 'settings' from some fieldtypes, particularly the safecracker\_file or the file fieldtype.

I've instantiated the API and I'm calling :

```
$this->EE->api_channel_fields->setup_handler('safecracker_file');
$fieldsettings = $this->EE->api_channel_fields->get_settings(11);

```

where 11 is the reference of the Field ID. however, I'm constantly getting an empty array returned which would indicate that the field doesn’t exist.

I'm following the docs from here http://ellislab.com/expressionengine/user-guide/development/api/api\_channel\_fields.html#id10

# Answer
> 2 votes
This isn't clear from the docs, but you must call one these two methods prior to calling `get_settings`: `setup_entry_settings` or this method which is undocumented and takes no parameters:

```
ee()->api_channel_fields->fetch_custom_channel_fields();

```

# Answer
> 0 votes
I would use Channel Data for this. The models in EE are so inconsistent, I find them hard to use reliably. Perhaps if the documentation was better they would be easy to use, but since it's not I created my own library.

https://github.com/objectivehtml/Channel-Data

Once you instantiate Channel Data, I would use this code.

```
$settings = $this->EE->channel_data->get_field($field_id)->row('field_settings');
$settings = is_string($settings) ? unserialize(base64_decode($settings)) : $settings;

```

In my experience, instantiating the FT object is really unnecessary when the data is stored in the db. However, you very well may need to do so. My answer is merely offering a possible alternative to solving your problem.

You could use a basic Active Record call, and do away with Channel Data. But I use Channel Data in *all* of my add-ons, so it's more like a global polymorphic model. I typically interface with Channel Data through my add-ons model class to keep a strict separation of MVC logic.

Again, not totally sure if this is what you are looking for, but I have solved this problem quite simply by fetching the settings from the DB myself. It should work just fine too provided the data you need isn't generated by instantiating the FT object.

---
Tags: add-on-development
---


# Question
Title: How to make it possible for users to subscribe to entry updates
How to make it possible for users to subscribe to entry updates

I was thinking it would kinda like a newsgroup. User subscribe but to entry and or channel updates - but giving their email.

And they get notification mail when entries are updated.

been looking at a few plugins : ( but it looks like only the admin is notified )

1. http://devot-ee.com/add-ons/safecracker-emailer
2. http://devot-ee.com/add-ons/ee2-entry-notifier

Does any have experince with these two ?

1. http://devot-ee.com/add-ons/mx-notify-control
2. http://devot-ee.com/add-ons/postmaster

# Answer
I am from Objective HTML and created Postmaster. This is a highly requested feature and is rather difficult to solve, since there are so many ways one can solve this problem.

In my mind there are 3 ways to do it, none of which are available out of the box in Postmaster, *yet*. The Postmaster API is more than capable of handling this stuff, but not without some advanced knowledge of OOP and PHP.

1. Create a new list in MailChimp or CampaignMonitor each time an entry is created. I have proposed a FT that would facilitate adding/removing emails from this list in the CP/Safecracker. There are already tags to subscribe/unsubscribe from the front-end, but there is current no mechanism to create the list programmatically. This is in the works, and is the ultimate solutions.
2. Create a mailing list using Matrix. So you would use Safecracker, or some other custom solution to add emails to a matrix field within each entry. In Postmaster 1.4 (the next major release) this will be available. I already have it built, but it's not yet released. I built this recently for somebody who has too many entries, and didn't need MailChimp or CM, so I used Mandrill to send the emails that were stored in a Matrix field. This is a new email service, it's really easy to use and quite effective, but it doesn't do the "subscribing" (just the sending).
3. Use the EE Mailing List module in some fashion. I have been avoiding integrating this for a while simply because it's not a very good module (programmatically speaking). It's not extendible and does a poor job of sending email. The only way I could think to use it better is use a transactional email API to send the emails, but use the Mailing List Module as the gatekeeper for the actual email addresses.

I can't advise on the other solutions, but I will say that Postmaster was built to solve these same exact problems. As of now, only the sending portion of that problem has been solved out of the box with Postmaster, but the subscription part is just as important and definitely needs addressed.

If you have more questions feel free to email support@objectivehtml.com
> 2 votes

---
Tags: channel-entries, notification
---


title: Search {parents} tag

text:
# Question
Title: Search {parents} tag
I have the following code:

```
{exp:channel:entries channel="Sectors"}
{parents field="publication_sector" channel="publications" orderby="publication_date" search:parents:publication_type="Book" sort="desc" limit="1"}

```

However the `search` attribute doesn't make any difference to the results returned by `parents`. I have also tried `search:publication_type="Book"`. The `orderby` also doesn't work. How can I get the parents tag to behave the way I want it to??

# Answer
> 1 votes
I don't think Search is an available parameter for the Parents tag pair: http://ellislab.com/expressionengine/user-guide/modules/channel/relationships.html#id9 That might be throwing off the orderby parameter as well.

You could get more than 1 entry in your Parents loop and use conditionals to filter through those for entries with publication\_type book. Or you could use something like Stash to save your Parents info as a variable list, and then output it separately, which would give you more control with sort and filter.

---
Tags: search, relationships, parent
---


# Question
Title: Stash Snippets not rendering within CE Cache for some content
This is a strange one, so I'll have to give a little history.

To allow ad-hoc image galleries to be placed within the body content of pages on the site I'm using a matrix that holds "galleries" while using an Assets field set to "multiple" for the images in each gallery. A CopeePastee field is used to allow the content editor to easily copy the {gallery\_x} tag so they can place it wherever they need to within the main body content field.

The templates use the template partials technique. My view-model template renders the gallery content into the gallery\_{row\_count} stash variables with the type="snippet" parameter. On the view template, I use parse\_vars="yes" to render those galleries within the body content.

This has been working fine since launch. Today I noticed a live page that had {gallery\_1}, {gallery\_2} tags, etc displayed as a tag instead of rendered.

I immediately thought something was wrong with the Cache so I flushed the cache entry for this specific page. When logged into the CP, the templates do not run through CE Cache and this page rendered fine, although slow due to the 185 queries required to render this many (7) galleries.

I hit the page via a Chrome Incognito browsing session and the galleries display as expected. When I hit refresh to get the newly cached version (and to check speed) it's back to showing the unrendered gallery\_x tags.

Memory utilization for this page is under half of what's available.

Other pages in the site that also use this identical template and identical gallery feature work fine as well. With CE Cache disabled, it renders fine too.

Any ideas?

# Gists

# Example URLs:

# Versions

* EE: 2.5.3
* CE Cache: 1.9.5
* Matrix: 2.5.5
* Assets: 2.0.4
* Stash: 2.3.9 beta

# Answer
It turns out the non-rendering tags were actually within a *different* field... something other than the body text field that had the parse\_vars="yes" parameter set. Something apparently changed in a recent version of Stash or CE Cache that caused those tags to no longer be processed. I'm not sure why it was working before but it was.

Adding the parse\_vars="yes" to the other field solved this specific issue.
> 1 votes

---
Tags: assets, stash, ce-cache
---


title: EE2 JS variables

text:
# Question
Title: EE2 JS variables
I am writing a module that will require a lot of javascript for ajax and instead of building this in the mcp file I wish to do this as straight js files and include them.

I know that I will need to post data back using the XID and this can be done in pure JS, as per: http://ellislab.com/forums/viewthread/171401/

now that's great, i can use EE.XID in JS but can i get any other variables, eg base url etc?

if so is there a list as i cannot even find the EE.XID documentation.

# Answer
> 1 votes
OK I have found them.

I basically dumped the EE var into the console and took a look - dont know why i didnt think about that..

so heres a list of variable that can be used:

```
BASE
CP_SIDEBAR_STATE
PATH_CP_GBL_IMG
SESS_TIMEOUT
SESS_TYPE
THEME_URL
XID
XID_TIMEOUT

```

hope this helps others

---
Tags: ee2, control-panel, javascript
---


# Question
Title: Can I call a get_list within a exp:stash:set and use conditionals + single variables?
I've got an interesting problem that is leading me to believe I am approaching things totally wrong with stash... Essentially I am trying to call a "get\_list" inside a variable that I am using as a placeholder in the layout.

Here is what I am trying to do:

I have a layout that I share across the site

```
<!DOCTYPE html>
{stash:embed:partials:global_html}
  <head>
    {stash:embed:partials:global_html_head}
  </head>
  <body class="{stash:body_class}">
    <div class='container shadow'>
      <header class='header-page' role='banner'>
        {stash:embed:partials:global_html_header}
      </header>
      <!-- /END #Header -->
      <section class='content' role='main'>
        {!-- Define the primary content or listing in the model. --}
        {if {exp:stash:not_empty name="content-primary"}}
          <article class='content-main'>
            {exp:stash:content-primary}
          </article>
          <!-- /END .content-main -->
        {/if}
      </section>
      <!-- /END section .content -->
      <section class='sidebar-page' role='complementary'>
        <h3>Sidebarpaloooooza</h3>
      </section>
      <!-- /END .sidebar-page -->
    </div>
    <!-- /END .container -->
    <footer class='footer-page container' role='contentinfo'>
      {stash:embed:partials:global_html_footer}
    </footer>
  </body>
  <!-- /END .body_class -->
</html>

```

In the layout I have placeholder variables to grab data from my models for display in the layout:

```
{!-- Define the primary content or listing in the model. --}
{if {exp:stash:not_empty name="content-primary"}}
  <section class='content-main'>
    {exp:stash:content-primary}
  </section>
  <!-- /END .content-main -->
{/if}
</section>
<!-- /END section .content -->

```

In my model I am grabbing a nested list of entries

```
{exp:stash:set_list
  name="listing"
  parse_tags="yes"
  parse_depth="2"
}
  {exp:channel:entries
    channel="ch_company_location"
    dynamic="no"
    {global:param_disable_default}
  }
      {stash:some_var}{cf_var_goes_here}{/stash:some_var}
      {!-- This is a Matrix Field --}
      {exp:stash:set_list:nested name="employees"}
        {cf_matrix_field}
          {stash:var_one}{cf_var_1}{/stash:var_one}
          {stash:var_two}{cf_var_2}{/stash:var_two}
          {stash:var_three}{cf_var_3}{/stash:var_three}
        {/cf_matrix_field}
      {/exp:stash:set_list:nested}
  {/exp:channel:entries}
{/exp:stash:set_list}

```

What I can't wrap my head around is how to get conditionals, {count}, {switch}, and {total\_results} to work in when defining {exp:stash:content-primary}:

```
{!-- Primary content area --}
{exp:stash:set
  name="content-primary"
  output="no"
  parse_conditionals="yes"
  parse_tags="no"
  parse_vars="yes"
}
  {exp:stash:get_list
    name="listing"
    prefix ="parent"
  }
    {exp:stash:get_list:nested
      name="employees"
      prefix ="emp"
    }
      {if emp:count == 1}
        <div class="employees">
      {/if}
        <div class="employee {emp:switch="first||last"}">
          <dl>
            <dt>{var_one}</dt>
            <dd>{var_one}</dd>
            <dd>var_one</dd>
          </dl>
        </div>
      {if emp:count == emp:total_results}
        </div>
        <!-- /END .employees -->
      {/if}
    {/exp:stash:get_list:nested}
  {/exp:stash:get_list}
{/exp:stash:set}

```

No matter what I do I trigger the following errors:

```
Parse error: syntax error, unexpected ':' in /system/expressionengine/libraries/Functions.php(683) : eval()'d code on line 9

```

or

```
A PHP Error was encountered
Severity: Notice
Message: Use of undefined constant count - assumed 'count'
Filename: libraries/Functions.php(683) : eval()'d code
Line Number: 9

```

I've tried parent:switch/parent:count/parent:total\_results and just plain old {switch}/{count}/{total\_results} in addition to the "emp:\*" to no avail.

Am I approaching this incorrectly? Is there a way to define global "buckets" that I can load stash variables, lists, and nested lists into inside my layout(s)?

I'm using:

* EE 2.5.5
* Matrix 2.5.5
* Stash 2.3.6

# Answer
> 6 votes
After some help from the wonderful Mr. Croxton I was able to sort it out. Here is how to pull this off.

When grabbing the data in your model you need to stash the {entry\_id} of the parent list (I call mine {e\_id} for no real reason). Then, when setting the nested list, provide context with the {entry\_id} by using name="employees\_{entry\_id}".

```
{exp:stash:set_list
  name="listing"
  parse_tags="yes"
  parse_depth="2"
}
  {exp:channel:entries
    channel="ch_company_location"
    dynamic="no"
    {global:param_disable_default}
  }
      {stash:e_id}{entry_id}{/stash:e_id}
      {stash:some_var}{cf_var_goes_here}{/stash:some_var}
      {!-- This is a Matrix Field --}
      {exp:stash:set_list:nested name="employees_{entry_id}"}
        {cf_matrix_field}
          {stash:var_one}{cf_var_1}{/stash:var_one}
          {stash:var_two}{cf_var_2}{/stash:var_two}
          {stash:var_three}{cf_var_3}{/stash:var_three}
        {/cf_matrix_field}
      {/exp:stash:set_list:nested}
  {/exp:channel:entries}
{/exp:stash:set_list}

```

When getting the list you need to add a prefix to your lists (parent and nested) so that {count}, {switch}, and {total\_results} work as intended. You also need to provide the nested list context using the stashed entry\_id from the parent list. {e\_id} in this case:

```
{!-- Set the primary content area --}
{exp:stash:set
  name="content-primary"
  output="no"
  parse_conditionals="no"
  parse_tags="no"
  parse_vars="yes"
}
  {exp:stash:get_list
    name="listing"
    prefix ="employees"
  }
    {if employees:count == 1}
      <div class="employees">
    {/if}
    {exp:stash:get_list:nested
      name="employees_{e_id}"
      prefix ="employee"
    }
      <div class="employee {employee:switch="first||last"}">
        <dl>
          <dt>{var_one}</dt>
          <dd>{var_two}</dd>
          <dd>{var_three}</dd>
        </dl>
      </div>
    {/exp:stash:get_list:nested}
    {if employees:count == employees:total_results}
      </div>
      <!-- /END .employees -->
    {/if}
  {/exp:stash:get_list}
{/exp:stash:set}

```

---
Tags: matrix, stash, conditionals
---


# Question
Title: CAPTCHA not registering as on/Image not appearing
I have three sites that I'm adding CAPTCHAs to (www.hoekstratruck.com/index.php/contact, www.hoekstratransportation.com/index.php/contact, and www.hoekstraspecialty.com/index.php/contact/ctest). On the first two, the captcha works fine. It shows up and says that it is required to submit the form. On the third site, however, when I include the {if captcha} tag, nothing shows up. If I leave that tag out, just having

`
Please enter the word you see in the image below:

 {captcha}
 <input type="text" name="captcha" value="" size="20" maxlength="20" style="width:140px;" />
`

it displays the prompt and the text box, but not the image (and it doesn't print "{captcha}" either). I have double checked that the server path and image html path are both correct.

All three sites are running off EE v1.7.1 and I don't see any difference in how the first two sites are set up compared to the third site.

Please help!

# Answer
> 2 votes
This has bitten me a few times and it has always been a path issue. Double check your captcha preferences.

Also, make sure the captcha directory/folder is writable by your webserver

---
Tags: ee1, captcha
---


# Question
Title: How to exclude a category from a Playa field?
Im trying to exclude a specific category from a playa loop. As the doc says, most of the exp:channel:entries parameters are available so I've added the category parameter to the playa field.

If i declare a category inside the paya tag as below:

```
{my_playa_field category="16"}
...
{/my_playa_field}

```

all works like a charm.

But if I try this:

```
{my_playa_field category="not 16"}
...
{/my_playa_field}

```

it simply doesn't work.

Where am I wrong?

# Answer
> 1 votes
I have not used playa in a while, but just to make sure before I look further into this, what do you get when you use the "not 16" parameter, any output at all?

Are you sure that there a values that are not category 16?

Maybe try...

```
{my_playa_field category="15"}
...
{/my_playa_field}

```

...to assure you have valid data to return.

---
Tags: playa, categories
---


title: Matching UK postcodes to shipping rules

text:
# Question
Title: Matching UK postcodes to shipping rules
I'm in the process of setting up an e-commerce site using Exp:resso Store version 1.6.3. My client wants to be able to add surcharges to particular UK postcode areas based on the fact that they are hard to reach regions.

I assumed this would be easy using the Standard Shipping Plugin, by adding different rules for the first part of each postcode.

For example, if we wanted to surcharge all customers with postcodes starting 'AB', I would simply add a rule to match postcode 'AB' and apply a charge to that. I'm not sure how to match this though as if I then complete a test order to the checkout confirmation page with postcode 'AB34 3DP', this rule is ignored.

In addition, I would not want to apply this rule if the customer postcode was, for example 'TN4 3AB'. Is there a method to add wildcards to the postcode shipping rules? I could not find any information in the Exp:resso Store docs.

# Answer
> 2 votes
This has been implemented in Store 1.6.4.

You can now use wildcards when entering postcodes, such as `AB*`, and it will match all postcodes starting with AB. As well as `*` to match any number of characters, you can also use `?` to represent any single character - for example, `123?` would match `1234` and `1235`, but not `12345`.

# Answer
> 0 votes
Thanks, this was exactly what I was looking for. Updated from 1.6.3 to 1.6.4

---
Tags: expresso-store, ecommerce, shipping
---


# Question
Title: How can I control the filenames of files uploaded via SAEF/Safecracker using Safecracker File in a Matrix?
Firstly, I *think* the files should have unique names by default - nevertheless a problem came up yesterday in which one member's images were being displayed in place of another member's images because they had the same file names (it could possibly be a case sensitivity issue come to think of it).

I have a Matrix cell that contains a Safecracker file field. The purpose of this is to allow members to upload a series of photos, captions etc to an entry they are creating via the Safecracker form.

The problem I have is that it appears some of the images being uploaded have the same filenames. In my tests it appears that the files are appended with a number if there is a duplicate so I'm a little confused as to how this happened in the first place.

My 'solution' would be to prefix the filenames with the member ID. This should ensure that even if an image is overwritten it will be by the same member.

I found this extension https://github.com/rsanchez/safecracker\_file\_add\_prefix which could do the trick but I am having trouble getting it to work in a Matrix - I think it may be a step too far.

So I'm looking for ideas and/or a solution!

Maybe the answer is to somehow convert the filenames to lowercase?

UPDATE: The issue was definitely caused by case insensitivity. The image pool.jpg was being displayed in place of Pool.jpg The server allows for the difference between upper and lowercase but it appears that ExpressionEngine or Matrix does not.

# Answer
> 1 votes
This is probably way overkill for what you need (just posting it here as a solution for others), but Photo Frame can do this no problem. Photo Frame has a feature that allows you to create dynamic file names so the images never get overwritten. You can create filenames in any format you want. So you could do this (any many more formats):

```
{channel_id}-{entry_id}-{filename}.{extension}
{filename}-{random_string}.{extension}

```

*It currently won't do the suggested format you mention, but I think that is a solid idea and will add it in the future.*

Photo Frame works with Matrix too and you can pretty much control the experience to be whatever you need. Photo Frame is meant to replace the Safecracker File. There are FT settings to make it function in pretty much the same way.

https://objectivehtml.com/photo-frame

---
Tags: safecracker, saef, files, filename
---


# Question
Title: Hacking around EE's requirement for unique screen_names
EE requires screen\_names to be unique. Previously, in conjunction with Profile:Edit, I have appended {current\_time} on to the end of a user's screen\_name during registration to workaround this (it's not used anywhere on the front end so is useless to me). However, the screen\_name variable is used in the default forgotten password email, and there are no other suitable variables available in that email template. So I'm finally resorting to a hack.

Around line 227 of system/libraries/Validate.php there is this

```
        /** -------------------------------------
        /**  Is screen name taken?
        /** -------------------------------------*/

        if (strtolower($this->cur_screen_name) != strtolower($this->screen_name))
        {
            $query = $this->EE->db->query("SELECT COUNT(*) AS count FROM exp_members WHERE screen_name = '".$this->EE->db->escape_str($this->screen_name)."'");

            if ($query->row('count')  > 0)
            {
                $this->errors[] = $this->EE->lang->line('screen_name_taken');
            }
        }

```

Can anyone foresee any problems with simple commenting out this whole block? Is there even a reason I haven't thought of as to why screen\_names should be unique?

# Answer
> 0 votes
I'm not sure about the system ramifications about having non-unique screen names but I'd definitely try to keep them unique, even from an identity point of view. Usually if screen names are used they are to be displayed on the front-end of the site. Identities could quite easily be confused.

The other potential downfall is that it makes the use of {screen\_name} unsafe for member account operations. Even though you're not using it now you may later forget about your hack and then do a check on the {screen\_name} value which could result in incorrect or duplicate returns.

I'd definitely look to try to avoid this as much as possible.

Out of interest is there any particular reason why you need them to NOT be unique?

---
Tags: registration, screen-name
---


title: Can't login to CP after logging out

text:
# Question
Title: Can't login to CP after logging out
Having an issue logging back into the control panel after having been logged out. When attempting to login, I am returned to the login screen with no error messages or other notices. The only way I am able to log in is using an Incognito browser window.

I am using EE v2.5.2 with MSM installed.

UPDATE: I know this typically resolves itself after some time, but is there a known workaround so clients don't have to wait hours before being able to edit their content? Is this just an EE bug?

# Answer
Clearing cookies should get around it.

You might want to look at your cookie settings in the CP and try switching cookies/session authentication.

I was having the same problem with an MSM site. I changed my CP session type to "Sessions and Cookies" and all now seems well.
> 11 votes

# Answer
My first suggestion is to clear browser Cookies and Cache.

The second step is to add the following into your config.php file:

```
$config['cookie_domain'] = "";
$config['cookie_path'] = "";
$config['cookie_prefix'] = "";
$config['admin_session_type'] = "s";
$config['user_session_type'] = "c";
$config['require_ip_for_login'] = "n";
$config['require_ip_for_posting'] = "n";
$config['secure_forms'] = "n";

```
> 7 votes

# Answer
I've had very good luck with setting a specific cookie prefix for every site in the MSM. This can be done via the control panel (Admin › Security and Privacy › Cookie Settings), or you can set it within the config file:

```
$config['cookie_prefix'] = "site_shortname_";

```

I'd recommend against leaving `cookie_domain` and `cookie_prefix` blank, especially if your MSM sites are subdomains on the same domain (e.g. site1.domain.com, site2.domain.com, etc.). I suspect that @MediaGirl is having luck with leaving those blank because she's forcing the admin login to use sessions only with `$config['admin_session_type'] = "s";`
> 1 votes

# Answer
Always, always set a cookie\_domain in your config. That fixes the problem every time I've ever had it. However, do not leave it empty! Set it to the actual appropriate value, as follows:

```
$config['cookie_domain'] = ".domain.com";

```

(Where domain.com is actually your domain, obviously!) *Note the initial dot; that's important.*

I would also usually set both admin and user session types to use both session & cookies, as follows:

```
$config['admin_session_type'] = "cs";
$config['user_session_type'] = "cs";

```
> 1 votes

# Answer
I had a similar problem after installing Zoo\_Visitor module, to top it off I tried to login over 4 times unsuccessfully I triggered the "Admin-\>Session and Security Preferences" I had set to 60 min "Time Interval for Lockout." Lame...

To fix this... \- I logged into my server and PHPmyAdmin db. \- I went into the "exp\_password\_lockout" table and deleted the info in there. \- After that I was able to try an log in again, but for some reason my username and password I've been using still wouldn't work.

When I installed Zoo\_Visitor module my Username changed to my Email address. Light Bulb!

I tried my email address in the "username" field, same password and WHAMMY -\> problem solved. Good thing because I was about to toss my computer out the window, I hope this helps you out.

-cr
> 1 votes

---
Tags: multi-site-manager, control-panel, login
---


# Question
Title: Structure nav tag changing depth when on page of parent
This is confusing and not sure why it is happening. I do not commonly use Structure, so apologize in advance if this is a duh!

I have this tag:

`{exp:structure:nav add_level_classes='yes' show_depth='2' start_from="shareholders"}`

When on any page of the site it shows 2 levels. However when in the actual section that this nav is showing the links to, I get depth of 3. It is almost appears it is pulling them dynamically because if you click on one of those pages you get only that item in the nav.

I didn't see anything in the docs about dynamic navs...

Structure version is: 3.3.8 EE version is: 2.5.5

Thanks.

# Answer
I looks like your missing the `/` in the `start_from` parameter, this could be causing the issue. Also, add the `max_depth` parameter like Mark suggested if you want to cap the depth

```
{exp:structure:nav add_level_classes='yes' show_depth='2' start_from="/shareholders"}

```
> 2 votes

# Answer
I solved the issue by adding max\_depth="2". It appears that structure dynamically ignores the show\_depth parameter when inside that section.
> 2 votes

---
Tags: structure
---


title: Using Plugin Tags Within Channel Tags

text:
# Question
Title: Using Plugin Tags Within Channel Tags
I have a plugin that allows you to set and store cookies using EE tags (so you don't have to enable PHP in your templates).

Unfortunately, I can't get the tag to parse the cookie value within a channel tag:

```
{exp:channel:entries channel="misc{exp:cookie:retrieve name="exp_lang"}"}

```

Any ideas?

# Answer
It turns out that the answer was to add a "random" paramater to the plugin tag, in combination with parse="inward".

From EllisLab: "The random is sort of a hidden trick that is handy in very specific circumstances. Without it, duplicate plugins get replaced by some placeholder text so that the plugin is only run once- and then the content flips into where the placeholder text is. But the way parse order works- if you're using one of those plugins as a parameter, it ends up treating the placeholder string as the parameter value. And basically just does not work. Random causes it to not put in the placeholder text."

I also found out that you want to use single quotes inside the plugin tag.

So this works:

```
{exp:channel:entries parse="inward" channel="misc{exp:cookie:retrieve name='exp_lang' random}"}

```
> 5 votes

# Answer
This is a parse order issue - your Channel Entries tag is being parsed before your custom plugin tag, so you're actually passing `misc{exp:cookie:retrieve name="exp_lang"}` as the `channel` parameter.

What you need to do is turn your plugin into a tag pair, so it works like this:

```
{exp:cookie:retrieve name="exp_lang" parse="inward"}
    {exp:channel:entries channel="misc{exp_lang}"}
    ...
    {/exp:channel:entries}
{/exp:cookie:retrieve}

```

In your plugin you'd do something like this:

```
$vars = array('exp_lang' => 'en');
return $this->EE->TMPL->parse_variables_row($this->EE->TMPL->tagdata, $vars);

```
> 4 votes

# Answer
The value `inward` can be used to parse data inside an opening variable too.

Try this:

```
{exp:channel:entries channel="misc{exp:cookie:retrieve name='exp_lang'}" parse="inward"}
    [...]
{/exp:channel:entries}

```
> 0 votes

# Answer
As has previously been stated, you're running into a classic parse order issue. If you're not already familiar with Low's Parse Order PDF, I would recommend printing it and bookmarking it. It can be really useful until you've managed to memorize the order. http://loweblog.com/downloads/ee-parse-order.pdf

Additionally, you could create an extension to conditionally set the value (currently being set by your plugin) of a global variable. That of course would depend on your cookie name being consistent for this usage.
> 0 votes

---
Tags: channel-entries, parse-order, cookies
---


# Question
Title: How to prepopulate Freeform input values from a channels data?
I have a channel "activities".

In my template the activities look like this:

**Activity titel 1** | 10-10-2013

Some description text

sign-up for this activity \>\>

**Activity titel 2 | 23-11-2013**

Some description text

sign-up for this activity \>\>

**Activity titel 3 | 24-11-2013**

Some description text

sign-up for this activity \>\>

When somebody clic on "sign-up for this activity \>\>" you go to a form (I use Freeform) and I want the "Activity titel" and the activity Date to be already fill, for example:

Activity: Activity titel 1

Date: 10-10-2013

Name:

Adress:

email:

submit button

People just have to fill their name, address and email.

Can someone help me with this.

Francois

# Answer
> 2 votes
You need to pass the entry\_id of the "activities" entry to the template that has the Freeform form.

```
<a href="/templategroup/template/{entry_id}">sign-up for this activity</a>

```

Then in the template with the form, you can do something like this:

```
{exp:channel:entries channel="activities" limit="1" dynamic="no" entry_id="{segment_x}"}
{exp:freeform:form
    form_name="sign-up"
    return="sign-up/thank_you"
}

<p>Your Activity: <input type="text" name="activity" value="{title}" /></p>
<p>Your Date: <input type="text" name="date" value="{your_date_field}" /></p>
<p>Your Name: <input type="text" name="name" value="" /></p>
<p>Your Adress: <input type="text" name="name" value="" /></p>
<p>Your Email: <input type="text" name="email" value="" /></p>

<input type="submit" name="submit" class="button" value="SEND"  />

{/exp:freeform:form}
{/exp:channel:entries}

```

Replace {segment\_x} with the actual segment variable.

# Answer
> 0 votes
In the freeform tag, specify the "value" for each option you want pre-populated.

Taken and modified from the freefrom docs page here... http://www.solspace.com/docs/freeform/form/#tellafriend\_form

```
{exp:freeform:form form_name="tell_a_friend"}

<p>Your Name: <input type="text" name="name" value="John Doe" /></p>
<p>Your Email: <input type="text" name="email" value="johns@email.com" /></p>

<p> Comments:<br />
    <textarea name="comments">
        Hey there! You should check out this site - it’s totally awesome!
    </textarea>
</p>

<p><input type="submit" name="submit" value="Send!" /></p>
{/exp:freeform:form}

```

You could also set the fields as hidden so the user cannot change them, plus there may not be the need to make the form more complicated by displaying additional fields that are not going to be used.

Hope this points in the right direction, be sure to check out all the docs, solspace has excellant documentation.

---
Tags: solspace-freeform
---


title: Control panel not working in IE 9 & 10

text:
# Question
Title: Control panel not working in IE 9 & 10
I am using EE v2.5.5 and the control panel doesn't work properly in IE 9 and 10. The issue seems to be that EE doesn't know you are logged in when a script is requested and so instead of returning the JS you just get the login screen instead. SO the URL below for example:

```
http://www.showsec.co.uk/admin.php?S=24384227da408225ee16a159edfba4966ac36622&D=cp&C=javascript&M=load&file=css&theme=default&v=1369159495

```

Just returns the login page even though I am logged in

In fact if I login to the control panel in IE 9 or 10 and then open a new tab and go to the control panel URL I just get the login screen again. The browser has forgotten I am logged in already!

# Answer
> 1 votes
The control panel of EE 2.5.5 certainly works with IE 9. I have a client using it right now. This would indicate your problem lies elsewhere.

Do you have peculiar settings for handling cookies in your browser?

You could try switching your control panel session type in Admin-\>Security and Sessions. Also check whether you have anything set up in Cookie Settings under the same menu.

# Answer
> 1 votes
Sounds like this could be cookie issue. If you have Firefox with Firebug, or something similar, check the domain in the cookies that are being sent from the server. The last time I had a problem like this the cookie domain didn't exactly match the domain in the URL.

# Answer
> 0 votes
I don't know what the cause was but I found a solution. In system/expressionengine/libraries/core.php on line 467 change the following line:

```
$this->EE->functions->redirect(BASE.AMP.'C=login'.$return_url);

```

To be this:

```
// this if statement is a hack to prevent auth issues in IE when requesting JS and CSS files
if($this->EE->router->fetch_class()!=='javascript' && $this->EE->router->fetch_class()!=='css') {
    $this->EE->functions->redirect(BASE.AMP.'C=login'.$return_url);
}

```

---
Tags: control-panel, javascript
---


# Question
Title: Why can't I change permissions on config.php or database.php?
I am in the process of completing an upgrade to EE 2.6.1 and I am unable to change the file permissions on config.php, database.php or cache.

I make the changes and it just bounces back. The Owner and Group appear to be okay in the file info. Any clues why this may be happening?

Thanks.

# Answer
Try downloading the files, or renaming them to something else. Then create 2 new files directly on the server and copy/paste the contents of the original files into the new files.

Since you created the files, you *should* be able to then change the permissions of them.
> 1 votes

---
Tags: permissions
---


title: Entries with different time zones

text:
# Question
Title: Entries with different time zones
I need to create entries with dates and times based upon the timezone they are occurring in and then display them to the user on the front end with all dates/times in both event date/time and a localised date/time.

Is this possible with ExpressionEngine and if so how should I best approach it?

*Edit*

So it looks like the only real option is to standardise all dates/times entered via the CMS to UTC/GMT and use the users timezone preference to display the dates/times relative to where they are...

OR

Add a custom field that specifies timezone for an event and then offset the display date/time accordingly on the front end using a custom plug-in.

Any other thoughts?

# Answer
If you store all entry dates as UTC you could manipulate what is displayed to the user by using Javascript to detect their timezone offset and adjust your date/time accordingly.

To get the time zone offset you can use the getTimezoneOffset() method of the Date() object in Javascript.

IMHO the only even remotely reliable way to do it is by looking at the user's browser. Of course, you are relying on them having it set correctly in the first place!

It kind of depends on how much you want to use a client side vs a server side approach.
> 0 votes

---
Tags: date, timezone
---


title: Multiple 'pages' in a single entry

text:
# Question
Title: Multiple 'pages' in a single entry
Scoping out a project that is going to be for Training Courses. Each Course will have a range of Topics and each topic will have a sequence of content followed by a Quiz and finally a summary (including quiz results). A notional structure of the content might look like this.

* Course
    + Topic
        - Content
        - Content
        - Content
        - Quiz
    + Topic
        - Content
        - Content
        - Content
        - Quiz
    + Topic
        - Content
        - Content
        - Content
        - Quiz
    + Summary

As the Topics need to be shared across courses, I'll be creating a Course entry that then uses a relationship field to specific the Topics within it. My problem at the moment is how I might create a set of pages within a Topic...it's almost like entries within an entry.

For the quiz component I'm either going to employ the 4-ee.com or eeXam addon, but still evaluating this as they have their own set of problems.

Has anyone any insight into how I might do the Topic pages? My initial thought was to use a Matrix field which each row being a page.

# Answer
> 1 votes
Would Playa work for this?

Create a channel for your "pages". Create a Playa field within your courses channel and hook it up to the Pages channel.

The admin would then be able to select which pages are associated to the course.

Other than that I might also go with a Matrix field with each row being a "page" but really it depends on how complex the pages were and how many fields I would need for each page. Also the complexity of the navigation might be an issue.

As I think about it I would probably go with the Playa option.

---
Tags: pages
---


title: Buy X Get Y for CartThrob

text:
# Question
Title: Buy X Get Y for CartThrob
Just wondering if anyone knows of a discount plugin for CartThrob where you can place a free product in the cart if someone buys another product?

I'd like to set in the admin a discount so that if a person buys product X then product Y will automatically get added to the cart for free.

Thanks

# Answer
Might be a bit late now, but have you tries here: https://github.com/CartThrob/cartthrob-discounts-buy\_x\_get\_y
> 1 votes

---
Tags: cartthrob
---


title: Stash, Playa Parents & Categories

text:
# Question
Title: Stash, Playa Parents & Categories
So i'm trying to stash a category custom field from within a categories tag pair that is within a Playa parents tag pair, and then retrieve it for use outside of the Playa parents tag pair.

Here's what I've got so far.

```
{exp:channel:entries channel="campus" category="not 156" orderby="title" sort="asc"}
   {exp:playa:parents channel="classes" category="304" disable=""}
      {categories}
         {exp:stash:set name="wufoo_id"}
            {classes_wufoo_id}
         {/exp:stash:set}
      {/categories}
   {/exp:playa:parents}
{/exp:channel:entries}

{exp:stash:get name="wufoo_id" process="end"}

```

Not sure why this isn't working. *process="end"* should be forcing the get to wait to parse until the set has parsed, even though it is before the set in the parse order.

Any thoughts?

**EE 2.5.1, Playa 4.3.3 & Stash 2.1**

# Answer
> 2 votes
Mike above is right that you need Stash 2.2.0 or later to use `process="end"`.

However, your code has another problem. You are looping over channel entries, then looping over the parents of each entry, then finally looping over the categories assigned to each parent. Let me show you how that would be parsed:

```
{!-- Start --}
{exp:channel:entries channel="campus" category="not 156" orderby="title" sort="asc"}
   {exp:playa:parents channel="classes" category="304" disable=""}
      {categories}
         {exp:stash:set name="wufoo_id"}
            {classes_wufoo_id}
         {/exp:stash:set}
      {/categories}
   {/exp:playa:parents}
{/exp:channel:entries}

{!-- After first pass, if 2 entries --}

   {exp:playa:parents entry_id="1" channel="classes" category="304" disable=""}
      {categories}
         {exp:stash:set name="wufoo_id"}
            {classes_wufoo_id}
         {/exp:stash:set}
      {/categories}
   {/exp:playa:parents}

   {exp:playa:parents entry_id="1" channel="classes" category="304" disable=""}
      {categories}
         {exp:stash:set name="wufoo_id"}
            {classes_wufoo_id}
         {/exp:stash:set}
      {/categories}
   {/exp:playa:parents}

   {!-- During second pass, if 2 parents for each entry --}

      {categories}
         {exp:stash:set name="wufoo_id"}
            {classes_wufoo_id}
         {/exp:stash:set}
      {/categories}

      {categories}
         {exp:stash:set name="wufoo_id"}
            {classes_wufoo_id}
         {/exp:stash:set}
      {/categories}

      {categories}
         {exp:stash:set name="wufoo_id"}
            {classes_wufoo_id}
         {/exp:stash:set}
      {/categories}

      {categories}
         {exp:stash:set name="wufoo_id"}
            {classes_wufoo_id}
         {/exp:stash:set}
      {/categories}

   {!-- During second pass, if 2 categories for each parent --}

         {exp:stash:set name="wufoo_id"}
            1
         {/exp:stash:set}

         {exp:stash:set name="wufoo_id"}
            5
         {/exp:stash:set}

         {exp:stash:set name="wufoo_id"}
            2
         {/exp:stash:set}

         {exp:stash:set name="wufoo_id"}
            7
         {/exp:stash:set}

         {exp:stash:set name="wufoo_id"}
            9
         {/exp:stash:set}

         {exp:stash:set name="wufoo_id"}
            2
         {/exp:stash:set}

         {exp:stash:set name="wufoo_id"}
            1
         {/exp:stash:set}

         {exp:stash:set name="wufoo_id"}
            9
         {/exp:stash:set}

```

However, you appear to be trying to capture only a *single* variable. Did you instead want a list?

# Answer
> 1 votes
process="end" looks like the correct approach, unfortunatly that was not implemented into Stash until version 2.2 - looks like you will need to upgrade stash to use that feature :D

Heres the snippet from the changelog... https://github.com/croxton/Stash#new-in-v220

> **New in v2.2.0**
>
> {stash:embed} - embed a Stash template file at different points in the parse order of the host template: start (before template parsing), inline (normal), end (post-process after normal template parsing has completed).

---
Tags: playa, categories, stash, pixelandtonic
---


# Question
Title: Synchronize Templates - I've deleted templates, but they're still listed under the "Design" menu
I have EE configured to save my templates as files.

I had several different template groups that I deleted via FTP. I clicked on "Synchronize Templates" and ticked all the boxes, and hit submit. I no longer see those templates listed under the Synchronize Templates page.

However... **The template groups are still listed under the *Design --\> Templates --\> Edit* dropdown menu.** There doesn't seem to be any way to get rid of them.

I have a feeling it's because I have Save Revisions turned on. I can see old templates that have clearly been deleted, so opening them up in the EE editor will show an empty file - but with several revisions available to restore.

Is this an ExpressionEngine bug, or is there any way around this?

Thanks!

# Answer
> 1 votes
Have you tried deleting them from the Template Manager?

---
Tags: templates, bug, sync
---


title: If logged_in conditional

text:
# Question
Title: If logged_in conditional
I'm using an embedded template to include the for my site. I want to use Google Analytics custom variables to track visitor information for logged in users so thought I could selectively show the Analytics code if a user is logged in using the {if logged\_in} conditional.

So in a tag have put the following:

```
{if logged_in}
// define a Visitor-level Custom Variables based on the member ID
_gaq.push(['_setCustomVar',1,'Member ID','{member_id}',1]);
{/if}

```

If the user is logged in then the code works as expected. However if a member is not logged in the template is writing the following to my HTML:

```
{if FALSE}
// define a Visitor-level Custom Variables based on the member ID
_gaq.push(['_setCustomVar',1,'Member ID','0',1]);
{/if}

```

Any thoughts why this might be happening? I would expect that if nobody is logged in the site would return nothing.

Cheers,

Cole

# Answer
> 1 votes
Since your conditional is inside of `<script>` tags, EE by default prevents the advanced conditional from parsing. Add this to your config:

```
$config['protect_javascript'] = 'n';

```

# Answer
> 0 votes
I would suggest not using {if False} and instead using {if:else} and then specifying your analytics code from there.

Because you're not doing that, I would speculate that EE doesn't know what "else" to do and so just tries to go with what it has, which is nothing.

---
Tags: templates, members, conditionals, users
---


# Question
Title: Anyone encountered this? "Error: Failure when receiving data from the peer (56)"
Without making any changes to a website, and without the hosting company making any changes to the server, a site using CT has suddenly started throwing this error using the EE default error template: "Error: Failure when receiving data from the peer (56)"

This happens when someone tries to get to the checkout page. Has anyone experienced anything like this before? It happens whether someone's logged in or not in every browser I could test.

Chris from CT is already looking into it, but I thought I'd see if anyone had ever experienced this before.

# Answer
This was resolved: turns out USPS made changes to their API which caused live rates to fail and throw the error.
> 1 votes

---
Tags: cartthrob, error
---


# Question
Title: Attempting to trouble shoot email issues but I have no exp_postmaster_mailbox
I currently have two sites I'm working on right now which utilize the built in email module. I can fill the form out, hit submit and I get a message saying it's been sent, but it never gets sent. I can also use the communicate field, and again, nothing gets sent although I get confirmation that it did indeed send.

While trouble shooting I've come across the suggestion that I check the database table called "exp\_postmaster\_mailbox" and I wonder if I may have found my issue - there is no "exp\_postmaster\_mailbox" in my database.

Is this a corrupt install? It doesn't work live or local. It also doesn't matter whether I use phpmail, sendgrid, or smtp. None send all, all give confirmation that it sent out.

# Answer
> 1 votes
Just figured I would update this thread for others since I commented. This turns out to be a misunderstanding on my part thinking he was using Postmater since the question has a Postmaster table in the subject and throughout the post. Turns out, reading more carefully reveals he is *not* using Postmaster and just the native email module.

Postmaster would be a perfect candidate as an alternative solution to solving this problem, but it's doesn't exactly solve *this* problem in the direct sense.

And to clarify further, the exp\_postmaster\_mailbox table is a component of the Postmaster add-on by Objective HTML. So this table would not be found in a default EE install.

https://objectivehtml.com/postmaster

---
Tags: php, email, database, mailing
---


# Question
Title: Is it possible to place an embedded template within a snippet?
Is it possible to place an embedded template within a snippet? Reason is I have a client that wants to be able to use the Allow More EE Code plugin http://devot-ee.com/add-ons/allow-more-ee-code to insert certain items into the WYGWAM editor in normal (non-source). Since this plugin does not parse snippet dynamic data, I tried just placing the code \[code\]{embed="includes/.calendar"}\[/code\] into the snippet and to my surprise the dynamic data was parsed! Is it OK to setup a few snippets in this manner to allow the client to insert them were needed or is there a big drawback?

# Answer
As long as you don't notice any performance hits, its perfectly acceptable.

Another solution you might try is to use Low Variables instead of embeds. This is possible as of version 2.3 thanks to this parameter:

```
preparse:my_var=""

```

Read more about this method here.
> 1 votes

---
Tags: ee2, templates, snippets
---


# Question
Title: I am missing the Relationships Field Type
This is simply my problem, I have no relationships field. I have no idea how I would've removed this and or how that would even be possible considering it's a native EE function.

Any clue how to get this back?

# Answer
> 1 votes
Make sure you have Relationships fieldtype installed. Go to Add-Ons \> Fieldtypes, check if Relationships shows as Installed. (moved to answer from comments)

---
Tags: fieldtype, fields
---


# Question
Title: Parse order fun! Getting a stashed Assets image resized using CE Image inside a plugin parameter
Alright, let's see if I can explain this correctly:

* I am using Assets to store images to S3
* CE Image is being used to manipulate the images and save/serve them from S3
* I use stash to try and stay DRY and keep things easier to maintain

So far everything is working great on the site, we're ready to launch, and all humming along... Until I tried to use the SocialEEsta plugin to help spit out share icons.

Here is my model:

```
{!-- SINGLE VARIBLES --}
{exp:stash:set
  parse_tags="no"
  trim="yes"
}
  {stash:share_image_url}
    {exp:ce_img:pair
      src="{cf_featured_image:url}"
      width="800"
      height="450"
      crop="yes"
      allow_scale_larger="yes"
      hide_relative_path="yes"
      cache_dir="cache/img/products/shared/"
    }
      {aws_url}
    {/exp:ce_img:pair}
  {/stash:share_image_url}
{/exp:stash:set}

```

Here is my viewModel that gets all of my vars:

```
{exp:stash:set
  name="hero"
  output="no"
  parse_conditionals="no"
  parse_tags="no"
  parse_vars="yes"
}
  {stash:embed:partials:hero_banner}
{/exp:stash:set}

```

This is in my partial:

```
{exp:socialeesta:pinit url="{current_url}" media="{stash:share_image_url}" count="none" description="{stash:page_body}"}

```

Is this even possible?

I've tried: \- parse\_tags="no/yes" \- parse\_vars="yes" \- process="start/end" \- adding parse="inward" to the plugin tag \- adding random to the plugin tag

# Answer
> 3 votes
Welp, after even more testing an hair pulling I sorted it out. I forgot to set parse\_tags="yes" on the exp:stash:set... d'oh!

Model

```
{!-- SINGLE VARIBLES --}
{exp:stash:set
  parse_tags="yes"
  trim="yes"
}
  {stash:share_image_url}
    {exp:ce_img:pair
      src="{cf_featured_image:url}"
      width="800"
      height="450"
      crop="yes"
      allow_scale_larger="yes"
      hide_relative_path="yes"
      cache_dir="cache/img/products/shared/"
    }
      {aws_url}
    {/exp:ce_img:pair}
  {/stash:share_image_url}
{/exp:stash:set}

```

Here is my viewModel that gets all of my vars:

```
{exp:stash:set
  name="hero"
  output="no"
  parse_conditionals="no"
  parse_tags="no"
  parse_vars="no"
}
  {stash:embed:partials:hero_banner}
{/exp:stash:set}

```

This is in my partial:

```
{exp:socialeesta:pinit url="{current_url}" media="http:{stash:share_image_url}" count="none" description="{stash:page_body}"}

```

---
Tags: assets, parse-order, ce-image
---


# Question
Title: Assigning multiple authors to a channel entry
I need to add multiple authors on post, but I don't know how to do implement this. I'm a new to ExpressionEngine.

My articles have also a multiple bibliography, and I have the same problem, which is how in general to manage a master-detail relationships in ExpressionEngine.

With the new 2.6 relationship, is easy to display related category, but I cannot find a way to insert them.

# Answer
> 2 votes
It kind of depends on how you're handling authorship. There's only so much you can do with the custom fields in the member module, and assigning multiple authors that way is less than ideal, but you could pretty easily create an "authors" channel - whether you tie that to your member logins using one of the "members as channels" add-ons is up to you - and that would allow you to use the native relationship field in 2.6 to assign multiple authors to a single post. I've done it that way before with Playa rather than the native relationship field, but the idea is the same.

Hope that helps.

---
Tags: relationships
---


# Question
Title: Jquery doesn't load for Control Panel after move from Dev to Live
Recently while moving from my first local dev to public site, the jquery that powers the Control Panel basically stopped working/loading. Version is v2.5.3 and I will be upgrading the dev to latest but hope to figure this out before I dive into that.

The signin screen loses all jquery and formatting (no jquery code in HTML head) and menus inside EE no longer function as well as all addons that rely on jquery. The tabs that are usually hidden for accessories such as MC Cloner and ExpressionEngine Info are showing (when they should not).

I've tried the following.

* reuploaded all theme folders and checking permissions
* Cleared Cached before and after upload
* uninstall/reinstall jquery addon
* Checked config.php for conflicting paths
* disabled extensions via config.php

Ensured the following paths are correct

* Admin ‣ General Configuration
* Admin ‣ Security and Privacy ‣ Captcha Preferences
* Admin ‣ System Administration ‣ Emoticon Preferences
* Content ‣ Files ‣ File Upload Preferences
* Members ‣ Preferences
* Design ‣ Templates ‣ Global Preferences
* Admin ‣ Channel Administration ‣ Channels

You can see the cpanel here, notice the missing jquery embed (I will change the url to admin.php before launch) http://www.centerchurchucc.org/admin.php?S=0&D=cp&C=homepage

Really puzzled on this one!

My gen prefs

# Answer
> 1 votes
Please, try to remove the trailing slash on Theme Folder Path.

By the way, you should try to keep this settings on the config.php file. It's easier to fix them on the file.

# Answer
> 1 votes
I have had the EXACT same issue for two weeks. I was able to resolve it by simply overwriting the themes/javascript folder from a previous file backup to the live side via FTP.

I don't know exactly what changed when moving from dev to live originally, but thru process of elimination, I narrowed it down to this folder.

---
Tags: ee2, control-panel, jquery
---


# Question
Title: PHP error on the Expresso Store inventory tab
Good day dear community. I have a problem when you install the store. at the entrance to the tab store -\> inventory, gives me dosing errors. text Errors:

```
A PHP Error was encountered

Severity: Notice

Message: Undefined property: Addons_modules::$api

Filename: core/Model.php

Line Number: 50

Fatal error: Call to a member function instantiate() on a non-object in /home2/softsltn/public_html/pdq2/system/expressionengine/third_party/store/models/store_model.php on line 611

```

thank you in advance for your help

# Answer
You need to upgrade to Store 1.6.4 which is compatible with EE 2.6.
> 1 votes

---
Tags: expresso-store, error
---


# Question
Title: UK Postcode Shipping Rules - more than one postcode per rule
I'm using Exp-resso Store to run the ecommerce functionality of my site. I've upgraded to 1.6.4 which allows me to add rules for different UK postcodes, as per this question:

Matching UK postcodes to shipping rules

The problem being is that my client's shipping rules are going to be fairly complex, in that I have about 30 different rules for each postcode depending if its mainland UK or highland/island/Northern Ireland.

My client has then dropped the bombshell that they can pack two items into a package and therefore prices should be for every two items, i.e. 0-2 items at £15, 3-4 items at £30, 5-6 items at £45, etc. If I combine these with 30 existing rules for postcodes, you can see that I am already in several hundred rules! A nightmare for me or the client to update...

My question is, is there a way of adding more than one postcode per rule? Or another way for me to price per items?

I think an image of my rules will help clarify things:

EDIT:

Sorry, I should mention that I've looked in the Docs and there's nothing obvious there, however I may have missed this. I've tried the obvious "IV1 \*, IV2 \*" and "IV1 \*|IV2 \*" (without the quotes) but no luck.

# Answer
It's not possible to specify multiple postcodes per shipping rule, although I do like your pipe-separated syntax so will make that a feature request.

As you mentioned, it is going to be a nightmare for your client to maintain, so I would first explain this to them and convince them to simplify their shipping rules.

The other alternative would be to write a custom shipping plugin in PHP, which would allow you to use any combination of rules you like, but that will probably be even harder for them to maintain/update so may not be the best solution.
> 1 votes

---
Tags: expresso-store, ecommerce, shipping
---


title: Changing site_url on the fly

text:
# Question
Title: Changing site_url on the fly
We're revamping a site that has a url structure of http://mysite.com/partner\_name. When that first segment matches a partner name, their current custom site changes all urls and logo.

In our case on EE we're using freebie and switchee. We add each partner name (they're not too many) as freebie segments, and add them to a comparison case with switchee. That works great for the first page, but all links are still mysite.com/my\_url, when ideally they'd be mysite.com/partner\_name/my\_url.

Is there any way we can do the comparison with switchee, and save mysite.com/freebie\_1 as {site\_url} when there's a match? Do we need php on the template?

Thanks in advance!

Best,

Santiago

# Answer
> 1 votes
I've seen multi-language site implementations that deal with similar issues since you essentially want something like this:

```
http://mysite.com/en/
http://mysite.com/fr/

```

And depending on the URL, you want {site\_url} to return the language code segment as well as the domain (`http://mysite.com/en/`).

Here's a pretty good write-up of how to accomplish this:

http://cwcrawley.co.uk/2010/01/multi-lingual-websites-in-expressionengine/

Essentially, you create separate directories for the first segment with copies of your index.php files in them.

```
/en
  /index.php
/fr
  /index.php

```

Then you modify each index.php file change the site\_url global variables.

```
$assign_to_config['site_url'] = 'http://mysite.com/fr';

```

Here's a nice slide presentation on the same technique: Multi-Language Websites in ExpressionEngine

Also, if you are using something like Focus Lab's Master Config, or EE-Garage's Config Boostrap, you can possibly override the {site\_url} with some PHP conditionals. I haven't tried this technique before personally.

Here's a similar question about doing this: Set “site\_url” Config Variable in index.php

# Answer
> 0 votes
Try this:

```
$this->EE =& get_instance();

$this->EE->confi->config['site_url'] = "New Site URL";

```

---
Tags: switchee, freebie
---


title: Google Maps for Expression Engine

text:
# Question
Title: Google Maps for Expression Engine
Is it just me or is it very difficult to just pick this add-on up and get it working. I've been trying to follow the documentation on the site for a couple of hours now and I still can't get my first map to display. What I feel is missing from the docs is a simple "How-to" on setting up.

Sorry for the mini-rage but I've wasted a lot of time reading docs that just seem to get straight into using the tags but no intro or walkthrough for what you need to set up in your channel to get it working.

# Answer
Sorry for the frustration. I put a lot of time into making things work properly, but it's sometimes hard to perceive parts of the documentation that are confusing for others (since it all makes sense to me). Appreciate the honest feedback and will definitely add a "Getting Starting" guide to the site.

Derek's post is good too, so be sure to follow all those steps.

I definitely want you to be satisfied and confident in Objective HTML products. If you have any other questions or complaints please don't hesitate to email support@objectivehtml.com.
> 3 votes

# Answer
I agree that Justin's docs make some assumptions and lack a proper "here's how to get started" explainer - but that's partially because his add-ons are all very powerful and can be used in so many different ways. His examples section is the best place to start.

Here's how to get going in the most common circumstance (you want to plot a marker on a map in your entry).

1. Add a map field to your channel using the Google Maps fieldtype.
2. Create an entry where you plot one or more markers on the map.
3. Use the following code in your template.

...

```
{exp:gmap:init id="my_map" style="width:400px;height:300px"}
{exp:channel:entries channel="my_channel"}
    {my_map_field id="my_map"}
{/exp:channel:entries}

```
> 2 votes

---
Tags: google-maps-for-ee, google-maps
---


# Question
Title: How to set EE to ignore a directory running a different application
I have another application running in a directory called "calculator" and I can't seem to get EE to ignore it. When I point to the url /calculator I get a 404.

I have this in my htaccess file:

```
<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{REQUEST_URI} !calculator/
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

```

I also tried changing these two lines:

```
RewriteCond %{REQUEST_URI} !calculator/
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]

```

To:

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

```

Any ideas on what I'm missing here?

I double checked to make sure I don't have any url's "calculator" as well.

**EDIT/Added:**
\- .htaccess in /calculator directory

```
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php
RewriteBase /
RewriteRule ^(.*)\?*$ index.php/$1 [L,QSA]

# Force the latest IE version, in various cases when it may fall back to IE7 mode
# github.com/rails/rails/commit/123eb25
# commitcomment-118920
# Use ChromeFrame if it's installed for a better experience for the poor IE folk
<IfModule mod_setenvif.c>
  <IfModule mod_headers.c>
     BrowserMatch MSIE ie
     Header set X-UA-Compatible "IE=Edge,chrome=1" env=ie
  </IfModule>
</IfModule>

```

# Answer
> 2 votes
```
<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{REQUEST_URI} !(calculator) [NC]
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

```

Explainations...

```
RewriteCond %{REQUEST_URI} !calculator/

```

I think the problem here is that you're not informing it what to ignore by framing in brackets. Also you're specifying the trailing backslash, but that isn't part of the request.

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

```

This won't work because it's looking for extensions - note the `\.` at the beginning of the condition, you're also terminating it with the $, so nothing after it will be matched (/ or filename in the folder). Instead it should be:

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

```

This should have worked...

```
RewriteCond %{REQUEST_FILENAME} !-d

```

But maybe not if you have a trailing slash (according to this post: https://stackoverflow.com/questions/163302/how-do-i-ignore-a-directory-in-mod-rewrite), also I doubt it's the complete request (to access that folder), as I expect you're accessing some file under that folder which may be why the condition isn't matching?!?!

**UPDATE**

The issue raised isn't a problem with the ExpressionEngine .htaccess it's the other .htaccess for the calculator application that's causing the issue.

Change this line:

```
RewriteRule ^(.*)\?*$ index.php/$1 [L,QSA]

```

to

```
RewriteRule ^(.*)\?*$ /calculator/index.php/$1 [L,QSA]

```

The original isn't rewriting within the calculator folder, it's re-writing back to the web root, which contains the EE install.

---
Tags: htaccess, subdomain
---


# Question
Title: Hide Shipping Carrier Depending on Location
Currently my store has two shipping carriers (UPS and the Default Shipping Plugin - called Speed-ee). For the default shipping plugin I only want to use it for four or five US states. For all others states, as well as Canada, I want to use UPS.

Is there a way to show the default shipping plugin option only when the billing address is from those four or five states and hide it if they are shipping to other areas?

I would think a conditional might work but I don't really know where to start. Any help would be appreciated.

# Answer
You would need to write a conditional as you have mentioned, it would need to be similar to this conditional but if you only have 2 shipping options you could actually use a hidden field instead of a select element.
> 1 votes

---
Tags: expresso-store, shipping, checkout, ups-shipping
---


# Question
Title: Playa total_parents tag vs search parameter
I'm using the `{exp:playa:total_parents}` tag with a `search:comment_matrix_row='={segment_3}'` parameter, but it appears to ignore the search-parameter. Is that expected behavior?

Thanks,

* Steven

# Answer
> 0 votes
Yes that’s expected. The `search:field_name=` parameters are actually handled by Channel Entries, which Playa calls at the end of `{exp:playa:parents}` and `{exp:playa:children}` only.

We should probably update the Playa docs to list out specifically which tags `total_parents`, `total_children`, `parent_ids`, and `child_ids` actually support, as their list is much smaller than `parents` and `children`.

---
Tags: playa, search, parameters
---


# Question
Title: Getting an 1054 Error with new EE Twitter Plugin
I recently added the EE Twitter Plug found on github to replace the Twitter Timeline plugin that stopped working.

I followed all the steps as instructed on the github page. But for some reason when I go to get the pin number, I get an Error message. I have uploaded this plugin to other sites and everything worked fine. I'm not sure what happen.

Has anyone else experienced this, if so what did you do to solve this issue? Here is what the Error Message reads:

```
A Database Error Occurred Error Number: 1054

Unknown column 'Array' in 'field list'

INSERT INTO `exp_twitter_settings` (`var`, `var_value`, `site_id`) VALUES ('nsm_twitter', Array, '1')

Filename: third_party/twitter/models/twitter_model.php

Line Number: 103

```

# Answer
> 2 votes
It looks as if there's a conflict between the Click Rain Twitter and NSM Twitter modules. I think that they are both trying to use the 'exp\_twitter\_settings' table for their settings. You could try uninstalling the NSM Twitter module for the moment and then get in contact with both authors to let them know.

# Answer
> 0 votes
There was a conflict between the Click Rain Twitter and NSM Twitter modules. As of this morning, the Click Rain Twitter module is now changed to use the table `exp_cr_twitter_settings` rather than `exp_twitter_settings`, avoiding the conflict.

*Disclosure: I work for Click Rain and help maintain the plugin when possible.*

---
Tags: ee2, error, twitter
---


title: Twitter search for images from user

text:
# Question
Title: Twitter search for images from user
I want to use the twitter user api to get all images from a user. I have tried using search, but sadly the search api only has 6-9 days worth of tweets. (https://dev.twitter.com/docs/using-search)

Is there anything that will filter tweets with an image and give me the direct link to the image? If not I will have to write it myself. I am currently using EE Twitter by Click Rain to get all tweets from a user.

# Answer
Coming back way later, but good job adding this functionality to EE Twitter. And many thanks. The beauty of open source, eh?
> 2 votes

---
Tags: twitter, twitter-search-2
---


# Question
Title: parsing public_custom_profile_fields in discussion forum
Expressionengine 2.5.5 and Discussion Forums 3.1.10

How do i pass public\_custom\_profile\_fields in forum\_thread.html section of the forum.

i have tried placing {custom\_profile\_fields} in forum\_thread.html section but nothing gets displayed.

i am trying to display field name in forum section so that i can create a custom label to a specific member and display it in forum section.

thanks

# Answer
> 1 votes
You can parse the Forum template through the normal template parsing engine, it has it caveats but it might get what you looking for.

http://ellislab.com/expressionengine/user-guide/modules/forum/other\_features.html#running-the-forums-through-regular-templates

---
Tags: ee2, forum
---


title: Twitter Timelines in EE

text:
# Question
Title: Twitter Timelines in EE
I noticed that EllisLab recently deprecated their Twitter-Timeline plugin due to Twitter's retirement of the API it uses:

https://github.com/EllisLab/Twitter-Timeline/

Has anyone been able to use any of the Twitter-related add-ons at Devot:ee to achieve the same effect? If anyone has any suggestions in this area (regarding embedding Twitter timelines in EE page templates), I would be glad to hear them. Similarly, any information about whether an updated version of the EllisLab original plugin is in the works would also be quite welcome.

# Answer
We use CE Tweet by Causing Effect. I'm not really certain all Twitter Timeline did, but CE Tweet uses Twitter's new API v 1.1, OAuth, and has a number of great features.

We primarily use it to bring a clients tweets directly into ExpressionEngine, so we can display however needed. I believe you can also use it to post to Twitter. It was pretty easy to set-up, but make sure you follow the instructions carefully. The various keys you need to create are important.
> 1 votes

# Answer
Have you seen this listing: Twitter API v1.1 add-ons?
> 3 votes

# Answer
I was using Twitter-Timeline and migrated to EE Twitter by Click Rain, it was quick and easy and worked well. I had to make just a couple of template changes and i was off to the races.
> 1 votes

# Answer
This thread has a whole list of Twitter plugins that will work with the new Twitter v1.1 API.
> 0 votes

---
Tags: add-on
---


title: Promo Code Value

text:
# Question
Title: Promo Code Value
Question about the variable "promo\_code\_value". When rendered in the template, it gives 4 decimal points instead of none. So for example, I want to indicate that there's a 25% discount, so in the template I write:

```
{promo_code_value}%

```

But instead of "25%", it renders "25.0000%". Is there some way to change that? Have I done something wrong? Don't know maybe if there's a configuration setting somewhere.

Thanks!

# Answer
> 2 votes
You can use "Number Format" plugin (http://devot-ee.com/add-ons/number-format) and can use it like:

```
{exp:number_format number="{promo_code_value}"}%

```

---
Tags: expresso-store
---


title: Force stock captcha to random string?

text:
# Question
Title: Force stock captcha to random string?
Is there a setting to force the stock EE captcha to use a random string instead of the word list in /config/captcha.php? I was able to do it by copying the random string generator from the captcha\_helper.php file and use that in the captcha.php file to feed the array a random string.

Just wondering if there is some hidden configuration to do this instead of hacking a file.

# Answer
> 3 votes
There is not a hidden config that I'm aware of...

---
Tags: captcha
---


title: trigger Playa’s update script

text:
# Question
Title: trigger Playa’s update script
I updated from 4.3 to 4.4, I followed the update guide, and in the step "Go to Add-Ons → Fieldtypes → Playa to trigger Playa’s update script."

I do not see any button to do that, of it is done automatically?

# Answer
> 3 votes
Just go to the Add-Ons → Fieldtypes → Playa page and the update script will automatically run in the background.

---
Tags: playa
---


# Question
Title: Query tags and setting up expressionengine to read from 2 databases
I know I can assign 2 databases through codeigniter. Is there a way to tell the query tags which database to pull the information from? I'm having to pull data from an external database.

# Answer
The only way I was able to do this was with PHP in the template and using a `mysql_select_db` to switch the database. If you didn't want to use PHP in the template itself then I would think that would be fairly straightforward to code up as a plug in.
> 1 votes

# Answer
No. EE is set-up to check a single database. But you can add additional tables to that database as you see fit, and use QUERY module to access data out of them. For example, when we add custom tables to a solution for a client, we've done things like zip\_code, counties, irs\_data, etc. We use a prefix other than `exp` and add them to the same database. You don't need the prefix, but it will keep the tables grouped together. So say, `mnd_zipcodes`, `mnd_regions`, `mnd_counties`, `mnd_form_990s`, etc.

That works well. We've also run secondary apps on the same database, using different prefixes. You may end up with a lot of tables, but EE's QUERY can access any of the tables.
> 0 votes

---
Tags: query, codeigniter
---


title: Having SMTP email issues

text:
# Question
Title: Having SMTP email issues
Typically I'm able to use PHP Mail on sites I develop but this client has an Exchange Server that requires SMTP over TSL. Since Freeform Pro uses the Email module in EE, my contact form needs to work with SMTP over TSL as well. I should note that PHP Mail works fine, it just won't send an admin notify to anyone with the client's email address domain.

My original attempt at changing the email configuration to SMTP resulted in a string of errors based on this line in the CI email library:

```
A PHP Error was encountered
Severity: Warning
Message: fsockopen() [function.fsockopen]: unable to connect to xxxxxxxx.xxxxxxx.com:25 (Connection refused)
Filename: libraries/Email.php
Line Number: 1675

```

After a little poking around I ran across the SMTP port settings in the email.php library and changed it to 587. I also put the following in my config.php file:

```
/* SMTP mail settings
-------------------------------------------------------------------*/
// $config['protocol'] = "smtp";
$config['smtp_server'] = "xxxxxxxx.xxxxxxx.com";
$config['smtp_username'] = "xxxxxxx@xxxxxxxxx.xxx";
$config['smtp_password'] = "xxxxxxxxx";
$config['email_smtp_port'] = "587";
$config['smtp_timeout'] = 5;
$config['smtp_crypto'] = "tls";

```

`$config['protocol'] = "smtp";` is from the email.php library file in CI but it doesn't change the dropdown value in EE which is why it's commented out. `$config['email_smtp_port'] = "587";` is specified in the hidden config variables in the EE Docs though CI uses `$config['smtp_port'] = "587";`. I tried both with no visible changes in the results. I discovered `$config['smtp_crypto'] = "tls";` in the EL Forums. Not sure if this works or not because I couldn't find any reference to this config variable anywhere else nor was it in the email.php library file in CI (I actually couldn't find any mention of TLS in the email library actually).

After setting all of this I no longer get the errors but the form page just hangs and won't return the thank you page specified in my freeform tags. The form is submitted to Freeform but no user or admin notification emails are sent out.

Per this EL Forum thread I checked to ensure OpenSSL is enabled; it is, from PHP Info `OpenSSL support: enabled`. Per this EESE thread I checked to see if sockets were enabled; they were, from PHP info `Registered Stream Socket Transports: tcp, udp, unix, udg, ssl, sslv3, sslv2, tls`.

Any other suggestions? Thoughts as to why this might not be working?

**UPDATE:** I've marked @nonprofittech's answer as the correct one because it got me 99% of the way there by using Mandrill. There are a few other services as well that would probably work just as well but I trust MailChimp. If you run across this handy article on EE Insider, there seems to be one setting that is different than what's in the screenshot. Mandrill provides a username so use this an not the API key. One other thing I had to do is add `$config['email_smtp_port'] = "587";` to my config file so EE could use port 587 to connect to Mandrill. I'm not sure if it's a MT server configuration thing but I got errors when I didn't add this hidden config variable. Since I'm using Escort I'm not entirely sure all these settings are even relevant but I recommend making your life easier and use this add-on. For Mandrill all you need to do is add your API key and check the box next to the service. You can add multiple services and set them in an order of preference to handle fail overs but I only have a Mandrill account so that's all I setup.

So far so good, so in short, Mandrill account + EE Email configuration settings with Mandrill credentials + hidden config variable for port 587 + Escort add-on worked perfectly. This will be the starting point for any future contact forms I have to submit through an Exchange Server or other SMTP server that doesn't allow PHP Mail or SendMail.

# Answer
I'm going to suggestion bypassing the companies setting all together. This is partially to avoid troubleshooting them (if it's the EE install, you'll run into the same issues with my suggestion), but mostly because I've become a big fan of monitoring transactional email.

We work with nonprofits, but I still agree that the missed opportunity is there. But additionally, there are a number of great services now that allow you track and visualize, your transactional emails. I personally love and use, Mandrill by those monkeys at MailChimp.

If your transactional email volume is under 12,000 per month, the service is free. Though its highly likely, that you have no way of knowing of what your transactional volume is, because most people don't measure it. It's just a black hole.

**Make Notification, Confirmations, and other Transaction Useful**

The above image is just an overview transaction graph from Mandrill. What transaction email is, really kicked in for me, when someone asked me

> Can you tell me how many notification emails EE2 sends and how frequently the bounce?

My response was a big fat, **"NO"**. But then I started making estimates. Turns out, my estimates were way off. I thought around 5,000 transaction per month. That chart above, is a week shy of a full 30 days.

You select any vendor you want, Mandrill, PostMark, Sendgrid, etc. But here's what Mandrill can do for you in your current SMTP situation. You need to figure out:

1. Is the problem the SMTP send set-up?; or
2. Is the problem Outlook?

Create an account on Mandrill. This takes maybe 5 minutes. It will provide you with SMPT authentication data. The username will be the company email address you used to start the account and they will provide a secure password. Complete the set-up, then trigger a system email. Setup a new member account, that uses your email address or if your on gmail you could do username+mandrill@gmail.com.

If the mail sends, you can see it in Mandrill and then hopeful at the same time in your Inbox. That means Outlook configuration was the issue. If you get no love, then its likely that somethings wrong with the SMTP services. The company have ports blocked or some other issue.

The beauty of this as a troubleshooting method is, well you end up with Mandrill configured and tracking all your EE2 generate email. You can see bounces, spam reports, and other issues. Since using it, we've helped clients improve the email messages, focus on reducing registration spam, and more.

At the worse, your client has over 12,000 transactional emails per month and refuses to pay $9.95 per month for up to 40k transactions. You know Outlook is the issue and can focus on that.
> 5 votes

# Answer
These posts gave me the hints I needed.

For others it seems they may have to change `email_newline` and `email_crlf` to `"\r\n"` in your config/bootstrap.

CodeIgniter has a `smtp_crypto` config that can be either `ssl` or `tls`. I needed `tls` to work with AmazonSES. The *actual* config used by EE is `email_smtp_crypto` (same for port, docs say `smtp_port` but in the source `email_smtp_port` is utilized in at least one place).

so to recap here are some relevant settings in one place:

```
$config['email_debug']      = 'y';
$config['webmaster_email']  = "email@domain.tld";
$config['webmaster_name']   = "Site Name";
$config['email_crlf']       = "\r\n"; // default is "\n"
$config['email_newline']    = "\r\n"; // default is "\n"
$config['mail_protocol']    = 'smtp';
$config['smtp_server']      = 'smtp server';
$config['smtp_port']        = '587'; // Not sure if this is used or not, seems legit, too
$config['email_smtp_port']  = '587';
$config['smtp_username']    = 'smtp username';
$config['smtp_password']    = 'smtp password';
//$config['smtp_crypto']      = 'tls'; // CodeIgniter setting, doesn't seem to be used
$config['email_smtp_crypto']= 'tls';

```
> 6 votes

# Answer
Two suggestions:

**Enable Email Debugging**

> When this option is enabled, detailed messages will be displayed whenever you send an email using the Communicate page. This information can be useful in helping to track down any problems you may be experiencing. If you are having difficulty sending email you are encouraged to enable this option.

Then sent test messages from the Communicate page to see the debugging details.

---

Try setting the port to 26 which the ISP may have enabled instead of 25. You can always check settings in Outlook or another email software too to confirm they are working correctly outside EE.
> 1 votes

---
Tags: email, solspace-freeform, smtp
---


title: infinite scroll not triggering

text:
# Question
Title: infinite scroll not triggering
I am attempting to use the infinite scroll scripts located here:

http://iamjustinlong.com/blog/single/implementing\_infinite\_scroll\_in\_your\_expressionengine\_site/

I have followed this pretty much word for word, but it is not working and I am running out of time to get it to work. Below is my code:

SNIPPET:

```
    <div class="col" id="#blog-container">
        {exp:channel:entries
            channel="blog"
            dynamic="no"
            orderby="date"
            limit="2"
            status="open|tall|regular"
            paginate_base="_embed/ajax_scroll"
        }

        {if no_results}
            <div class="entry">
                <article style="min-height: 600px;">
                    <header>
                        <h1>No Results</h1>
                    </header>
                    Check back soon for more blog posts.
                </article>
            </div> <!-- /.entry -->
        {/if}
        <div class="entry">
            <article>
                <header>
                    <p class="meta">
                        <span class="category">{categories}{category_name}{/categories}</span> / <span class="date">{entry_date format="%F %d, %Y"}</span>
                    </p>
                    <h1><a href="{url_title_path='blog/details'}">{title}</a></h1>
                </header>
                <img src="{blog_image}" alt="">
                {blog_excerpt}      <a href="{url_title_path='blog/details'}" style="display: inline-block;">read more</a>
            </article>
        </div> <!-- /.entry -->

        {paginate}
        <p class="morePosts">
            {if next_page}<a href="{auto_path}" class="more" id="next">See More Posts</a>{/if}
        </p>
        {/paginate}
        {/exp:channel:entries}
    </div> <!-- /.col -->

```

BASE CODE:

```
{snip_ajax_scroll}
    <script type="text/javascript" src="{site_url}assets/js/jquery.infinitescroll.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            $('#blog-container').infinitescroll({
                  navSelector : "p.morePosts",
                  nextSelector : "a.more",
                  itemSelector : ".entry",
                  contentSelector: "#blog-container",
                  extractLink: true // This is crucial if you want it work properly. Setting this to false or excluding it will not allow the script to work with EE
             })

        });

        // Unbind normal behavior
        $(window).unbind('.infscr');

        // Bind normal behavior to the click function and prevent the browser from redirecting to the URL.
        $('a#next').click(function(){
            $(document).trigger('retrieve.infscr');
            return false;
         });

    </script>

```

I have used console.log at different parts of the js to see if the scripts are firing and I get a message for all the blocks above except for the click function on a#next. This seems to die.

Let me know if there are any other code items you need and thanks in advance for any help!

# Answer
> 1 votes
I had everything correct except the # in the ID.

---
Tags: jquery
---


title: How to link to file using asset_id

text:
# Question
Title: How to link to file using asset_id
I want to create a template that will show a full size image and all the metadata. So the url would be something like siteurl/photo/221 with the 221 being the asset\_id.

I thought I would use the tag {asset\_id} within my tag pair to build the url link but it just returns {asset\_id} rather than the number.

I then thought I'd use something like:

```
{exp:assets:files asset_id="{segment_2"}
    <img src="{url}" title="{title}" alt="{description}" />
{/exp:assets:files}

```

in the photo template, but it doesn't work.

So is it a bug that {asset\_id} doesn't work, and is my code example the right way to get the data for a single image?

# Answer
This was fixed in Assets 2.1.1
> 0 votes

# Answer
{asset\_id} as a variable isn't currently parsing, which is a known bug - but you're trying it as a parameter. I don't actually see it listed in our docs. I'd be happy to add it to our list for consideration as a future addition though.

Right now, it looks like to get your single file data you'd need to use the Property and Metadata search from the above-linked page (toward the bottom).
> 1 votes

---
Tags: assets
---


# Question
Title: single quotes not escaping in category_description
I am having trouble with single quotes being output in my category\_description field, i have attempted removing them using ce\_string without success.

Also i am outputting category\_description through low Seg2Cat.

Any suggestions?

# Answer
Did you have a go at it using low replace? Guess it will be the same as ce\_string but worth a try.

Also, could you post the actual code you are working with. Would likely help others understanding what's going on.
> 1 votes

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


title: Display Playa inside Matrix

text:
# Question
Title: Display Playa inside Matrix
Have been looking through the previous solutions in here but still not able to make this work. I am able to display the normal data ok however not the Playa data, it is blank. Any help would be great if possible.

```
{exp:channel:entries channel="statistics" dynamic="off" limit="1" url_title="{segment_3}"}
    {title} {!-- Page title --}

    {exp:channel:entries channel="statistics"}

        {stats_driver_points_table}

            {stats_driver} {!-- Matrix field name with playa inside --}
                {title}  {!-- Playa title, display blank --}
            {/stats_driver}
            {stats_r1_q}  {!-- Displays ok --}
            {stats_r1_q}  {!-- Displays ok --}
            {stats_season_total}  {!-- Displays ok --}

        {/stats_driver_points_table}

    {/exp:channel:entries}

{/exp:channel:entries}

```

# Answer
So I have this working now.. turned out that removing it from the embed did the trick

```
{exp:channel:entries channel="statistics" dynamic="no" limit="1" url_title="{segment_3}"}
{title}
{/exp:channel:entries}

{exp:channel:entries
        channel="statistics"
        dynamic="no"
    }

{stats_driver_points_table}

    {stats_position}

    {stats_driver}
    {driver_fullname}
    {/stats_driver}

    {stats_r1_q}
    {stats_r1_c}
    {stats_r2_q}
    {stats_r2_c}
    {stats_season_total}

{/stats_driver_points_table}

{/exp:channel:entries}

```

One last thing is that now only "open" entries will display in the playa field, how can I display closed too, if it's possible?
> 1 votes

# Answer
I'm guessing your inner channel entries tag is an embed? I made a couple of changes to your example that may help. Also, try adding prefixes to the matrix field and the playa cell:

```
{exp:channel:entries
    channel="statistics"
    dynamic="no"
    limit="1"
    url_title="{segment_3}"
}
    {title}

    {!-- EMBED --}
    {exp:channel:entries
        channel="statistics"
        dynamic="no"
    }

        {stats_driver_points_table var_prefix="mx"} {!-- Matrix field --}

            {mx:stats_driver var_prefix="pl"} {!-- Playa column --}
                {pl:title}
            {/mx:stats_driver}

            {mx:stats_r1_q}
            {mx:stats_r1_q}
            {mx:stats_season_total}
        {/stats_driver_points_table}

    {/exp:channel:entries}
    {!-- END EMBED --}

{/exp:channel:entries}

```
> 0 votes

---
Tags: matrix, playa
---