# Question
Title: Multiple channel entry tags on a single template - Have content not repeat itself
I'm fairly new to Expressionengine, as I have taken over a site which a developer helped me build. So I'm still learning all the different things about it. My problem is this - I have a template (homepage) where I have four seperate {exp:channel:entries} tags.

So this is getting the feature.

```
{exp:channel:entries channel="channel1|channel2|channel3" limit="1"}

```

This is getting the four entries after the feature.

```
{exp:channel:entries channel="channel1|channel2|channel3" limit="4" paginate="bottom" offset="1"}

```

**This is the tricky bit**. The next {exp:channel:entries} tag occasionally repeats entries above even though I've set an offset of ('5' - counting the feature and four entries after)

```
{exp:channel:entries channel="channel1" limit="2" orderby="random" sort="desc" dynamic=“no” offset="5"}

```

Lastly, I have one that looks based on the category.

```
{exp:channel:entries channel="channel1|channel2|channel3" limit="2" category="111" orderby="random" offset="5"}

```

My question for this section: is there a way to stop it from posting entries if it is already being spat out by the other {exp:channel:entries} tags.

Please help me as I am fairly new to this. Would love any feedback. Thank you so much.

# Answer
You might use Stash plugin. Keep appending the channel entries of previous channel and then exclude those within next channel entry tag. Like this example: https://github.com/croxton/Stash/wiki/%7Bexp%3Astash%3Aappend%7D
> 2 votes

# Answer
Use an embedded template, and do the other channel loops in there. In that template, pass in the entry IDs you don't want repeated:

{embed="includes/inner" excluded\_ids="not 12|34|56"}

In the inner loop, in the channel entries tag, use entry\_id="{embed:excluded\_ids}"
> 1 votes

# Answer
One possible solution is simple and might work for your situation, but it depends on how often the content is updated.

You could create a custom status for the second group, i.e.,

{exp:channel:entries channel="channel1|channel2|channel3" limit="4" status="2nd" paginate="bottom" offset="1"}

Only the entries marked with the 2nd status would appear there. The third group would have the channel:entries set as status="not 2nd".

It's an approach I use for one site and takes only a minute to update the statuses.

Otherwise, maybe the dynamic="no" in your third group is part of the problem.
> 1 votes

# Answer
Daniel,

Turn on your debugger and profiler.

The channel entries tag has some overhead - number of queries and sever memory. Look at the numbers in your debugger. As a guide, im happy with less than 40 queries, less than 6mb memory and response time less than 0.6 secs. If any of your numbers are way higher(double +) then you need to do some optimising.

On your home page you have 4 x channel entries. If you have plugins installed like matrix or channel images then the channel entries tags will be generating a lot of queries. This is not good for your home page because it will be slow to load.

But there is good news, i hope....

Your 'developer' would have been smart enough to add the disable param to the channel entries tag (and you removed it when you pasted in the code!). Something like this see docs

```
disable="categories|category_fields|custom_fields|member_data|pagination"

```

This will make the channel entries tag lighter/more efficient by reducing the amount of data returned.

Your 'developer' will have also cached the results of the channel entries tags in some way so that the queries dont need to be run every time someone hits the home page. Stash is a good solution here, but if you are new to EE, it may/will take you a while to get it. Hint think parse order

Whilst the suggestion of an embed is good, it adds additional overhead to your page load, which you should want to avoid in this case.

You also have paginate='bottom' for the second channel entries. Do you want to paginate these results? If so, every page of results you go to forces the other channel entries tag queries to be run AGAIN.

As a suggestion, we use stash to cache for 24 hrs the titles of 4 channel entries tags on one of our landing ages. We also gone a step further and used automatee plugin to rebuild this cache at midnight.

Aside from these performance tips ive given, youve been given two good answers on ways to meet specific need.

And, since youre new to the forum, if an answer assists you, ensure you mark it accordingly so others can benefit from your question + answer/s.

Good luck.
> 0 votes

---
Tags: channel-entries, templates, multiple-channels
---


# Question
Title: Exp:resso Store and Minimum Order Quantity
I have a number of products which have a minimum quantity set as follows:

```
<input class="span1" type="text" name="item_qty" value="{min_order_qty}" placeholder="Quantity">
<button class="btn btn-primary"><i class="icon-shopping-cart"></i> Add To Cart</button>

```

However, if the client were to change the value to something less than the {min\_order\_qty} and try adding to cart, it simply posts the form and goes to the value set in my return="" param without erroring.

Whilst it doesn't trigger any kind of error, it also doesn't add the item to the cart, it just seems to fail quietly.

I would have expected it to trigger some kind of error message if I try adding quantity less then the minimum, rather than just failing silently, which is what it's doing.

Anyone able to offer advice on this?

# Answer
> 1 votes
I believe this is expected behavior. Historically there has been no error handling in the add to cart form (I think this is the only error state it could possibly get into anyway).

One solution if you are using minimum order quantities is to add JavaScript validation to your product page. This will result in a nicer error message for your customers anyway. If you don't already have a library, Parsley.js is fantastic.

---
Tags: expresso-store, ecommerce, shopping-cart
---


# Question
Title: Best way to access entry data from within Playa field?
I have a channel `items` and a channel `colors`, and the `items` channel has a Playa field `item_colors` that links to the `colors` channel. What is the best way to loop through the `items` entries and output a construct like this?

{

```
  "color_1" : "item_1",
  "color_2" : "item_1",
  "color_3" : "item_1",

  "color_1" : "item_2",
  "color_4" : "item_2",

  "color_5" : "item_3",

  "color_2" : "item_4",
  "color_3" : "item_4",

}

```

The tricky part is outputting the outer entry title from within the Playa field tag pair. I attempted to do this with a Stash variable:

```
{exp:channel:entries channel="items" dynamic="no" disable="categories|member_data|pagination"}
  {exp:stash:item_title}{title}{/exp:stash:item_title}
  {item_colors}
    "{title}": "{stash:item_title}",
  {/item_colors}
{/exp:channel:entries}

```

But the result is the Stash variable outputs the same (last) entry title for every instance. Something about parse order, undoubtedly… any help would be greatly appreciated.

# Answer
Good news, it should be a quick fix. All you need is to prefix your Playa variables with var\_prefix parameter to differentiate the namespace from the Channel Entry variables, although you might have to use the full module tag:

```
{exp:playa:children field="item_colors" var_prefix="pl"}
    "{pl:title}": "{title}",
{/exp:playa:children}

```
> 3 votes

---
Tags: playa, stash, parse-order
---


# Question
Title: Atom/RSS feed outputting all versions of entries
I'm currently working on an Atom feed (was previously RSS) that outputs 10 recent entries from the blog. That is working fine and looks great in most readers. However on both feedly and theoldreader.com both pull up any changes that have been made to the entries, resulting in "repeats". This doesn't happen in the XML itself, nor in browsers (FF and Chrome).

I've attached the feed code in hopes that someone can point me in the right direction with this one. Is it possible that the feed is cached on theoldreader?

Running EE v2.5.5 and upgrading is not an option at the moment.

```
{exp:debug_suppressor}
{preload_replace:master_channel_name="blog"}
{preload_replace:atom_feed_location="rss/index"}

{exp:rss:feed channel="blog"}
<?xml version="1.0" encoding="{encoding}"?>
  <feed xmlns="http://www.w3.org/2005/Atom" xml:lang="{channel_language}">

    <title type="text">Company Blog</title>
    <subtitle type="text">subtitle</subtitle>
    <link rel="alternate" type="text/html" href="{channel_url}" />
    <link rel="self" type="application/atom+xml" href="{path='{atom_feed_location}'}" />
    <updated>{gmt_edit_date format='%Y-%m-%dT%H:%i:%sZ'}</updated>
    <logo>http://www..org/files/images/general/-logo.png</logo>
    <icon>http://www..org/css/images/img-footer-logo.png</icon>
    <rights>Copyright (c) {gmt_date format="%Y"} Company</rights>
    <generator uri="http://expressionengine.com/" version="{version}">ExpressionEngine</generator>
    <id>http://company.org/</id>

    {exp:channel:entries channel="blog" limit="10" dynamic_start="on" disable="member_data|pagination"}
    <entry>
      <title>{exp:xml_encode}{title}{/exp:xml_encode}</title>
      <link rel="alternate" type="text/html" href="{url_title_path=blog/entry}?utm_source=rss&utm_medium=rss-feed" />
        <id>{site_url}blog/entry/{entry_id}</id>
        <published>{gmt_entry_date format="{DATE_ATOM}"}</published>
        <updated>{gmt_edit_date format="{DATE_ATOM}"}</updated>
        <author>
              <name>author</name>
              <email>blog@company.org</email>
        </author>
        {categories}
          <category term="{exp:xml_encode}{category_name}{/exp:xml_encode}"/>
        {/categories}

        <content type="html">
            <![CDATA[
            {if blog_image}
              <img src="{blog_image}"/><br />
            {/if}
            {exp:xml_encode protect_entities="yes"}
            {blog_summary}
            {/exp:xml_encode}
            ]]>
        </content>

    </entry>
    {/exp:channel:entries}
  </feed>
{/exp:rss:feed}

```

# Answer
I think it's to do with the `{DATE_ATOM}` variable including the seconds which I think gets updated when editing an entry thereby triggering it to be displayed again. If you use `{gmt_date format="%Y-%m-%dT%H:%i%Q"}` (which I use in my RSS templates) or possibly `{entry_date format="%Y-%m-%dT%H:%i%Q"}` if `gmt_date` isn't available for ATOM instead I think you should be OK.
> 1 votes

---
Tags: cache, xml, rss
---


# Question
Title: Tracking entry views by logged in member
I've looked through the questions and responses here in EESE and I've looked at the couple of add-ons that were mentioned. Tracker by Solspace seems close to what I want, but but not quite.

I'm looking to track views of entries - but not just raw numbers as the native entry tracking will allow. I would like to track, at an entry level, which logged-in members have viewed a given entry. Then create a reports template that displays this information. So essentially I want to capture the member ID of the logged in user whenever a specific entry from a given channel is loaded. Is that possible?

I thought of having each link to a single entry template in fact be a channel form submission of entry ID and member ID. But that may be more work than it's worth if there is already a simpler way to achieve this. And it doesn't help me with pages that contain multiple entries (list-view templates). This is a site that is entirely member based

I would appreciate any advice the community can provide.

# Answer
You might be able to use or extend the 'Recently Viewed' module to achieve your objective. :)

https://github.com/ninefour/recently\_viewed.mod.ee\_addon

The "Recently Viewed Entries" module allows you to keep a record of recently viewed entries on a per member basis and display that data back to the user in your page templates. The module uses the members session ID so they need not be logged in.
> 1 votes

# Answer
Jean,

This is something that can be accomplished with a custom built module. You would need both the functionality to record the views and also the tags to display them in your report template. It actually wouldn't be terribly complicated to do.
> 0 votes

---
Tags: statistics
---


# Question
Title: Are there any add-ons which add thesaurus functionality to search
I have a project where whenever we perform a search we would like to check for synonyms and translations and search for them at the same time. For example a search for "mill stone" will also search for "millstone" and "meule".

I'm guessing that this would be impossible with the native search module but is it something that could be achieved with Solspace Super Search or Low Search?

# Answer
> 3 votes
Super Search has fuzzy searching, which basically means plural/singular matching, "sounds like" matching and some spelling matching. However, as far as I know, this is limited to English only.

A solution that would work for both Low Search and Super Search, is to have a hidden field with searchable keywords per entry, which you'd have to populate manually. More work, but more control, too.

If that doesn't work, you might need to go away from EE for the search itself, and use something like a Google custom search.

---
Tags: search
---


# Question
Title: Displaying the value of a specific row/column in a matrix channel field
I am attempting to make a dynamic table for some of my products in ExpressionEngine.

Right now I have the table data set up as a matrix channel field type. Each of my products has 3 variations with 8 columns of specs for each variation. My question is, how can I output a specific row in a column on the front-end.

My channel fields are cell\_1 - cell\_8. If I put {cell\_1} into a `<th>` it generates 3 tables with each table using a different row from that column.

Is it possible to output a specific row from a matrix column?

Thanks!

Here's an example of my current code:

```
<tr>
    <th>Size</th>
    <th>{cell_1} (want to call cell 1 row 1 here)</th>
    <th>{cell_1} (want to call cell 1 row 2 here)</th>
    <th>{cell_1} (want to call cell 1 row 3 here)</th>
</tr>
<tr>
    <td>Color</td>
    <td>{cell_2} (want to call cell 2 row 1 here)</td>
    <td>{cell_2} (want to call cell 2 row 2 here)</td>
    <td>{cell_2} (want to call cell 2 row 3 here)</td>
</tr>

```

# Answer
> 1 votes
Matrix has a "row\_count" variable you could use, something like this:

```
{matrix_field}
  {if row_count == "1"}
    First row content
  {if:else}
    Remaining row content
  {/if}
{/matrix_field}

```

---
Tags: matrix, fields
---


# Question
Title: Help with Matrix->Playa->Matrix while using Stash for {image_1} shortcode replacements
No, it's actually not as convoluted as it sounds... ;)

Got two channels: News, and News Commentary. News entries are published multiple times per day; News Commentary is published once a week and covers 5-10 News entries from that week.

News has a `news__body` field, a `news__images` Matrix of images (containing the usual suspect columns of `file`, `caption`, etc), and a `news__credits` Matrix field with some plain text columns. It uses image shortcodes (those `{image_1}` / `{image_2}` things) in the `news__body` field to insert images from the `news__images` field.

News Commentary basically just has a `commentary__content` Matrix field, which has a `related-news-article` Playa column linking each row to a News entry, as well as a `commentary` textarea for the commentary portion.

The single-entry page for News Commentary displays a list (the `commentary__content` matrix). Each list item should display the related News entry's `news__body` and `news__credits` fields (with images in position), with the commentary following.

I've got much of it working, but seem **unable to get output from the News Commentary -\> related News entry -\> `news__images` or `news__credits` field.** I get the `news__body` content with `{image_1}` shortcodes showing in the text, followed by the `commentary` content - no `news__credits` or replaced image shortcodes.

Following is my (simplified) template. It contains both the `{exp:stash:set_list}` and `{exp:stash:get_list}` loops.

Stash set\_list:

```
{exp:stash:set_list name="news-commentary" parse_tags="yes"}
    {exp:channel:entries channel="news-commentary" require_entry="yes"}
        {stash:commentary__title}{title}{/stash:commentary__title}
        {stash:news-commentary__entry_id}{entry_id}{/stash:news-commentary__entry_id}
        {exp:stash:set_list:commentary__content name="commentary__content" context="entry_{entry_id}"     parse_tags="yes"}
            {commentary__content} {!-- Matrix --}
                {stash:row_count}{row_count}{/stash:row_count}
                {related-news-article var_prefix="related_article"} {!-- Playa --}

                    {stash:news__title}{related_article:title}{/stash:news__title}
                    {stash:news__entry_id}{related_article:entry_id}{/stash:news__entry_id}

                    {related_article:news__images var_prefix="image_matrix"} {!-- Matrix --}
                        {exp:stash:set name="image_{image_matrix:row_count}" type="snippet"}
                            <img src="{image_matrix:file}">
                        {/exp:stash:set}
                    {/related_article:news__images} {!-- END Matrix --}

                    {!-- Parse to replace image shortcodes with images - theoretically --}
                    {exp:stash:parse parse_vars="yes" process="end"}
                        {stash:news__body}{related_article:news__body}{/stash:news__body}
                    {/exp:stash:parse}

                    {exp:stash:set_list:news__credits name="news__credits" context="entry_{entry_id}" parse_tags="yes"}
                        {related_article:news-credits var_prefix="credits_matrix"}
                            {stash:credits__text}{credits_matrix:text}{/stash:credits__text}
                            {stash:credits__url}{credits_matrix:url}{/stash:credits__url}
                        {/related_article:news-credits}
                    {/exp:stash:set_list:credits}

                {/related-news-article} {!-- END Playa --}
                {stash:commentary}{commentary}{/stash:commentary}
            {/commentary__content} {!-- END Matrix --}
        {/exp:stash:set_list:commentary__content}
    {/exp:channel:entries}
{/exp:stash:set_list}

```

Stash get\_list:

```
{exp:stash:get_list name="news-commentary"}
    <h1>{commentary__title}</h1>
    <ol class="commentary-list">
    {exp:stash:get_list:commentary__content name="commentary__content" context="entry_{news-commentary__entry_id}"}
        <li>
            <h2>{news__title}</h2>
            {news__body}

            {exp:stash:get_list:news__credits name="news__credits" context="entry_{news__entry_id}"}
                    {stash:credits__text}
                    {stash:credits__url}
            {/exp:stash:set_list:credits}

            {if commentary}
                <h3>Commentary</h3>
                {commentary}
            {/if}
        </li>
    {/exp:stash:get_list:commentary__content}
    </ol>
{/exp:stash:get_list}

```

FYI, due to massive simplification and obfuscation of the actual template code, any typos you find may or may not be actual problems in the original template. ;)

# Answer
Without digging too much into your code, I think the problem is you need to parse tags on the `get_list` not the `set_list` (or possibly both).

The `news__body` field will need to be parsed again by the template parser for the shortcodes to render as snippets are parsed really early.

So update

```
{exp:stash:get_list name="news-commentary"}...

```

To become:

```
{exp:stash:get_list name="news-commentary" parse_tags="yes"}

```

Hopefully that will get it working for you.
> 1 votes

---
Tags: matrix, playa, stash, shortcode
---


# Question
Title: Low Yearly Archives always uses channel start & end month
This:

```
{exp:low_yearly_archives channel="blog" status="not closed" monthsort="desc" start_year="{segment_3}" end_year="{segment_3}"}

```

Returns:

* August
* July
* June
* May
* April

for `segment_3`=2008 or `segment_3`=2009.

even though 2009 has posts the entire year. It's filtering the results based on the first entry month and last entry month across *all* years even when I use `start_year` and `end_year` params. It should check first & last month within the requested range of years.

I'm using the latest version, downloaded 2 days ago.

# Answer
Current behaviour is that both `start_month` and `end_month` are separate from the `start_year` and `end_year`. The month params will still default to the first and last month in the given entries, regardless of year.

Try adding `start_month="01"` and `end_month="12"` to the tag. I'll mark it as a feature request to make this a bit more intuitive.
> 0 votes

---
Tags: low-yearly-archives, low
---


# Question
Title: when moving from server, I get error when calling data: Error Number: 1054 Unknown column 'session_id' in 'field list'
I moved a site from one server to the other. Before that, I imported a backup. Appearently there is something wrong now. Most of the tnings seem normal, but I get this on the site, and when I try to login the CP. This is bad.

How could I repair this?

```
Error Number: 1054

Unknown column 'session_id' in 'field list'

INSERT INTO `exp_security_hashes` (`date`, `hash`, `session_id`) VALUES (xxlotxxofxxcharactersxx)

Filename: core/EE_Security.php

Line Number: 118

```

# Answer
The right answer is here: https://expressionengine.stackexchange.com/a/4910/1615

he says Run the following SQL on your database;

```
ALTER TABLE  `exp_security_hashes` ADD  `session_id` VARCHAR( 40 ) NOT NULL DEFAULT  '0' AFTER  `date`

```

This will create the necessary column.

And i am thankful having found this!
> 0 votes

---
Tags: database-migrations
---


title: Store Cart not showing items

text:
# Question
Title: Store Cart not showing items
I am working the store default templates into my custom layout. I am using the {exp:store:cart} tag to display totals in my site's header, however it is not displaying any data. If I browse to the example templates it still shows the items in the cart.

I am perplexed to why this is not working, wondering if its a server configuration?

# Answer
Turns out it has to do with sessions or cookies. This site is still in development and the sites url is an IP address. The page the cart was NOT working on I accessed via a subdomain that pointed to the IP. This meant the cookie/session was under a different site.

TLDR - Make sure your sites domain is the same for all functions of Expresso-Store to work.
> 2 votes

---
Tags: expresso-store, shopping-cart
---


# Question
Title: Twitter Summary Cards in ExpressionEngine
Any ideas how I can make use of Twitter Summary Cards via ExpressionEngine?

# Answer
There are a number of approaches you could take.

Here's one using native EE functionality

We can see from the Twitter docs that we need the following markup:

```
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@nytimes">
<meta name="twitter:creator" content="@SarahMaslinNir">
<meta name="twitter:title" content="Parade of Fans for Houston’s Funeral">
<meta name="twitter:description" content="NEWARK - The guest list and parade of limousines with celebrities emerging from them seemed more suited to a red carpet event in Hollywood or New York than than a gritty stretch of Sussex Avenue near the former site of the James M. Baxter Terrace public housing project here.">
<meta name="twitter:image" content="http://graphics8.nytimes.com/images/2012/02/19/us/19whitney-span/19whitney-span-article.jpg">

```

Now if you were on a single entry page you could use an embedded template for the html head that would look like:

```
<head>
  <meta charset="utf-8">
  <title>{embed:blog_title}</title>

  <meta name="description" content="{embed:blog_description}">
  <meta name="author" content="{embed:author}">

  <meta name="twitter:card" content="summary">
  <meta name="twitter:site" content="{gv_site_twitter_handle}">
  <meta name="twitter:creator" content="{embed:twitter_handle}">
  <meta name="twitter:title" content="{embed:blog_title}">
  <meta name="twitter:description" content="{embed:blog_description}">
  <meta name="twitter:image" content="{embed:blog_image}">

  <link rel="stylesheet" href="/a/c/style.css">
  <!--[if lt IE 9]>
  <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  <![endif]-->
</head>

```

If we then look at the single entry template, it could look something like:

```
{exp:channel:entries channel="blog" limit="1" require_entry="yes"}

{embed=_embeds/html_head blog_description="{blog_description}" author="{author}" twitter_handle="{aol_im}" blog_title="{title}" blog_image="{blog_image}{url}{/blog_image}"

...
{/exp:channel:entries}

```

Now, of course, this setup is dependent on having a global variable to store the site's Twitter handle {gv\_site\_twitter\_handle}, a channel called 'blog' and also a custom field group for the blog containing fields: blog\_description and blog\_image. Those, along with the native title variable will do the majority of the work, however, we still need the author's Twitter handle if available.

In this instance, I'd set the author's Twitter ID against their member profile field {aol\_im}. EE gets a hard time for this and other profile fields existing but here's a good place to use it. You could of course create a custom profile field to use instead.
> 2 votes

---
Tags: templates, global-variables, twitter
---


# Question
Title: Wygwam error "Cannot redeclare class Wygwam" error after 2.7.2 upgrade
After upgrading to 2.7.2, I am getting an odd "Cannot redeclare class Wygwam" error in the control panel.

This prevents entries from opening, and also accessing the Fieldtypes list.

Any solution? It's the latest version of Wygwam (3.2.2).

Thanks!

# Answer
> 0 votes
I'd try removing all Wygwam related files in the third\_party directory from the server and readding the 3.2.2 files. Maybe there's a wygwam.bk directory or something like that.

---
Tags: pixelandtonic, wygwam, error, upgrade
---


title: Edit This - Plugin Help

text:
# Question
Title: Edit This - Plugin Help
I've just installed the Edit This 2.1 plugin by Travis Smith (Hop Studios)

I'm on ExpressionEngine v2.7.2.

Here's the documentation for reference : Plugin Documentation

I have inserted this tag within my channel entries.

```
{exp:edit_this:entry entry_id="{entry_id}" channel_id="{channel_id}" author_id="{author_id}"}

```

The little pencil icon is appearing, which is great. However the problem is when I click the icon it opens in a new tab and tells me to login when I'm already logged in. It should just go to the form to edit the entry.

Any ideas?

# Answer
> 1 votes
The issue is that "http://domain.com" is not the same as "http://www.domain.com" to ExpressionEngine. You are logged into the CP using one URL and EditThis is sending you to the other.

This fix this, you need to set a "Cookie Domain" on the **Cookie Settings page**.

> **FROM THE DOCS:**
>
> This preference allows you to set your cookie domain. The vast majority of people will want to set this to:
>
> .example.com
>
> Obviously you’ll use your actual domain name instead of ”.example.com”. Note the period at the beginning as it is very important. Setting the cookie domain like this will allow the cookies to work regardless of whether people specify your URL with the www part or only the http:// part.
>
> If you want to restrict your cookies to a single subdomain then you may set that here as well:
>
> .subdomain.example.com

---
Tags: ee2
---


title: Render HTML only if channel has entries

text:
# Question
Title: Render HTML only if channel has entries
I have an area in my template that has room for a max of three entries, but if there are no entries the entire area needs to be hidden. I have the max of 3 entries showing, but I can't figure out how to add the logic it needs to hide the container divs

here's my code so far

```
<div class="specialoffers">
        <div class="homeshadow"></div>
        <div class="row">
            <h3>Special Offers</h3>
            {exp:channel:entries channel="special_offers" dynamic="off" orderby="entry_id" sort="asc" limit="3"}
                        <div class="large-4 columns offer left">
                            <a href="{site_url}index.php/offers/{url_title}">
                                {offer_image}
                                    <img src="{path}_offerpromo/{filename}.{extension}" alt="{title}"/>
                                {/offer_image}
                            </a>
                            <a href="{site_url}index.php/offers/{url_title}"><h4>{title}</h4></a>
                            <p>{teaser_text}</p>
                            <a href="{site_url}index.php/offers/{url_title}" class="darkgraybtn">Learn More</a>
                        </div>
            {/exp:channel:entries}
        </div>
</div>

```

basically, if there are no entries the "specialoffers" div should not display.

# Answer
You can address this by moving your `channel:entries` tag pair to the outside and then conditionally outputting your opening and closing HTML based on `count`.

```
{exp:channel:entries channel="special_offers" dynamic="off" orderby="entry_id" sort="asc" limit="3"}

    {if count == "1"}
    <div class="specialoffers">
            <div class="homeshadow"></div>
            <div class="row">
                <h3>Special Offers</h3>
    {/if}

        <div class="large-4 columns offer left">
            <a href="{site_url}index.php/offers/{url_title}">
                {offer_image}
                    <img src="{path}_offerpromo/{filename}.{extension}" alt="{title}"/>
                {/offer_image}
            </a>
            <a href="{site_url}index.php/offers/{url_title}"><h4>{title}</h4></a>
            <p>{teaser_text}</p>
            <a href="{site_url}index.php/offers/{url_title}" class="darkgraybtn">Learn More</a>

        </div>

    {if count == total_results}
            </div>
    </div>
    {/if}

{/exp:channel:entries}

```

If there are no entries nothing will be output at all.
> 2 votes

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


title: Calculate age with Low Nice Date

text:
# Question
Title: Calculate age with Low Nice Date
Is it possible to calculate a members' age with Low Nice Date?

Experimented with this but really need to know what format the (native) {member\_birthday} outputs...

```
{exp:low_nice_date date="{current_time format="%F %j%S, %Y"}-{member_birthday}" format="%F %j%S, %Y"}

```

# Answer
> 1 votes
The way EE stores birthday info is in 3 separate columns in the database (ie. Month, Day & Year'), whereas a entry date or date field the value is stored in UNIX timestamp.

So, the native `{birthday}` field outputs: `Month Day, Year`

In order for this to work with `exp:low_nice_date:range` tag, you would need to format the `from` & `to` parameters correctly. At a quick glance, I don't think this is possible from the native birthday field and low nice date.

# Answer
> 0 votes
There are a few addons at Devot-ee that may help you:

http://jeremyworboys.com/add-ons/time-difference

http://devot-ee.com/add-ons/cas-elapsed-time

# Answer
> 0 votes
No, it's not possible to calculate an age based on a date with Low Nice Date.

---
Tags: low
---


# Question
Title: Can Exp:resso Store handle recurring subscriptions
We're about to embark on a new project where we need to deploy a relatively simple shop, subscriptions, donations and the ability to offer subscribed members a percentage discount on all purchases in the shop. Users should also be able to opt to become members (paid subscription) at checkout. It would be great if this then facilitated an immediate percentage discount on products in their basket too.

I've been looking at Exp:resso Store (which I love because it embraces the 'products as entries' approach) but I'm not familiar enough with it to know if there's a way to use it to achieve all or any of the above.

Our client currently uses a very old version of X-cart and PayPal, as I understand it this creates formal subscriptions in PayPal.

Is it reasonable to expect that Store would be able to fulfil the requirements above or am I looking at the wrong product?

# Answer
Unfortunately at this point in time Exp:resso Store does not handle subscriptions of any kind natively. I'm needing subscriptions myself and have reached out to them for any possible help on this matter. They did explain to me that there are installations of store that are handling subscriptions however so it is possible to have store handle that function. It would be something that you would need to develop yourself or hire someone to do.

Cartthrob has a subscription module that you can purchase along with Cartthrob itself, which will run you $600 dollars combined. I would be weary though. I've used both e-commerce products and Cartthrob does have some advantages, but support has essentially dropped off in the past year. Store has had good support and is backed by a staff of people, i believe Cartthrob is maintained by one person it would seem.

I would recommend store as a shopping cart solution in almost all cases if it weren't for the fact that in your case it doesn't handle the main purpose that you need it for.

You might also look at a module called Charge if your needs are simple enough
> 4 votes

# Answer
> Can Exp:resso Store handle recurring subscriptions

No. There's a feature request for it, but it would be a big undertaking to build so I wouldn't hold your breath.

> Users should also be able to opt to become members (paid subscription) at checkout. It would be great if this then facilitated an immediate percentage discount on products in their basket too.

Store does support creating discounts for specific member groups, so if you do use a different system to handle purchasing the subscriptions and maintaining which member group people belong in, Store would probably still be a good fit for selling your products.
> 0 votes

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


title: Order Items with Options Configurator

text:
# Question
Title: Order Items with Options Configurator
I have set up a T-Shirt with the Options Configurator field type named 'inventory\_and\_options' but can't work out how to display its selected item options in an invoice.

The products options are:

Size: Red, Blue

Colour: Small, Medium

I have created an order for a medium blue Tshirt.

My invoice code:

```
{exp:cartthrob:order_items order_id="{entry_id}"}
    {item:title}<br>
    {item_options}
        Option Label = {option_label}<br>
        Option Name = {option_name}<br>
        Option Value = {option_value}<br>
    {/item_options}
{/exp:cartthrob:order_items}

```

This displays:

```
Great T-Shirt
Option Label = Inventory and Options
Option Name = Medium Blue
Option Value = sku-medium-blue
Option Label = Inventory And Options:size
Option Name = Medium
Option Value = Medium
Option Label = Inventory And Options:colour
Option Name = Blue
Option Value = Blue

```

So that has looped through all the item\_options but all I want it to give me is:

```
Great T-Shirt
Size: Medium
Colour: Blue

```

If I get rid of the item\_options tag and hard code the fields created in the order items field in the orders channel..

```
{exp:cartthrob:order_items order_id="{entry_id}"}
    {item:title}<br>
    {item:inventory_and_options}<br>
    {if item:inventory_and_options:size}Size: {item:inventory_and_options:size}{/if}<br>
    {if item:inventory_and_options:colour}Colour: {item:inventory_and_options:colour}{/if}<br>
{/exp:cartthrob:order_items}

```

Displays:

```
Great T-Shirt
sku-medium-blue
Size: Medium
Colour: Blue

```

Which is close but obviously causes a problem if I add other product options other than size and colour as I would have to manually update the template whenever I add a new product option.

Sorry for the rambling explanation, has anyone else had problems displaying options in an invoice?

# Answer
> 2 votes
Use `{if selected}{/if}` inside your `{item_options}` tag.

# Answer
> 1 votes
This was solved by Chris Newton making some tweaks to allow a sub\_label tag..

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

                            {order_items}
                            <tr>
                                <td valign="top"><b>{item:title}</b><br>
                                    <div>

                                        {item_options}
                                            {if sub_label}<i>{sub_label}: {option_value}</i><br>{if:else}<i>{option_label}: {option_value}</i><br>{/if}
                                        {/item_options}

                                    </div>

                                </td>
                                <td valign="top" align="right">{item:quantity}</td>
                                <td valign="top" align="right">{item:price_plus_tax}<br /></td>
                                <td valign="top" align="right">{item:subtotal_plus_tax}<br /></td>
                            </tr>
                            {/order_items}
{/exp:cartthrob:order_items}

```

---
Tags: cartthrob
---


# Question
Title: Channel Form file uploads in Matrix/Grid field not working for guest users
I have created a Channel Form that is intended for guest users (not logged in) to submit information including up to two image files. The form uses a Matrix or Grid field (I've tried both) for the image files. The form works great except that the image files are not uploaded. If I login as a Super Admin and submit the form, the files ARE uploaded, which leads me to believe it is some sort of permissions issue on the upload directory.

I set /images/uploads and /images/uploads/habitats to 777 to try that, and it is still not working.

FORM CODE:

```
{exp:channel:form channel="Habitats" return="/habitats/thank-you"
logged_out_member_id="6"
rules:habitat_story="max_length[500]"
rules:habitat_comments="max_length[500]"
rules:habitat_management_practices="max_length[500]"
rules:habitat_category_other="max_length[50]"
rules:habitat_program_other="max_length[128]"
}

...

<fieldset>
    <label for="habitat_photos">{label:habitat_photos}</label>
    {instructions:habitat_photos}
    {field:habitat_photos}
</fieldset>

...

{/exp:channel:form}

```

Can anyone offer a solution or advice to fix my problem? Thanks!

# Answer
I realized I forgot to give upload permission to my new member group (the one I created for the anonymous submitter) in the File Upload destination preferences. I went in and did that, and now the form is working correctly. :)
> 0 votes

# Answer
By default, the members of the guests group cannot upload to EE; this is a permissions issue, but, it's permissions within EE, not with the filesystem, which is why CHMOD'ing to 777 didn't help.

Here's a link to a previous post with this problem, and a solution.
> 3 votes

---
Tags: matrix, file-uploads, channel-form, grid, guest
---


# Question
Title: Playa not displaying entries from different site within multi site manager
I have site 1 and site 2.

Site 2 has a Playa field related to a channel in site 1. I cannot get the related entries from site 1 to display in site 2.

# Answer
> 1 votes
Add **site="site\_short\_name"** to the Playa tag.

```
{exp:channel:entries channel="my_channel" ...}
    {related_field site="site_1"}
        {some_field}<br>
    {/related_field_name}
{/exp:channel:entries}

```

Note: as of today, this is not included anywhere in Playa's documentation.

---
Tags: playa, multi-site-manager
---


title: .htaccess rewrite issue

text:
# Question
Title: .htaccess rewrite issue
I had do move a functionally old EE 1.6.8 website to a new hosting. It does working so far after I changed the RewriteCond from:

```
RewriteEngine On

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

```

to:

```
RewriteEngine On

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

```

It seem's my new Host requires forced query strings.

But now there are problems to fetching superglobal values in a specific template. I use the following code to catch three values from the URI there:

URI:

http://www.xxxx.ch/kontakt/projectform?mitarbeiter=test&projekt=test&kunde=test

Template code:

```
<?php

function get_id($idname) {

        global $IN;

        $id = $IN->GBL($idname, 'GET');
        echo $id;

}

?>

{assign_variable:mitarbeiter="<?php echo get_id('mitarbeiter'); ?>"}
{assign_variable:projekt="<?php echo get_id('projekt'); ?>"}
{assign_variable:kunde="<?php echo get_id('kunde'); ?>"}

{mitarbeiter}
{projekt}
{kunde}

```

They were all catched on the old hosting, as well when I run the EE with no or clear .htaccess file. I'm not very well expierenced in writing .htaccess files but could be made an exception rule for this template?

Thanks for any hints or advices!

# Answer
This URL appears to function:

`http://www.nanotronic.ch/kontakt/projectform/&mitarbeiter=test&projekt=test&kunde=test`

You might be able to use jQuery or something to build that URL on whichever page/function is generating that address.

If you absolutely have to do it with mod\_rewrite/htaccess, I'd imagine there's a way to do it, but, I'm not sure of what it would be.
> 0 votes

# Answer
In your htaccess, you can add another rule that recognizes query strings, and then appends them with an & to the page URL that gets turned into the first part of the query string (after the ?).

Something like this should work:

```
RewriteEngine on

#URLs WITH a query string
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{QUERY_STRING} !^$
RewriteRule ^(.*)$ /index.php?/$1\&%{QUERY_STRING} [B,L]

# URLs WITHOUT a query string
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]

```

I've done something like this on EE 1.6x sites under FCGI hosting, and had it work.
> 2 votes

---
Tags: htaccess
---


# Question
Title: Output categories of related entry within grid field?
I have a grid field (EE 2.7.2), within which is a relationship field. I want to output the categories associated with the related item within the grid field. Is this possible? I thought this might work, but it might be a step too far, tag-nesting wise:

```
{organisation}
    {organisation:related_organisation:title} {!-- outputs related entry title, yay! --}

    {!-- this doesn't output anything --}
    {organisation:related_organisation:categories}
        {category_id}
    {/organisation:related_organisation:categories}
{/organisation}

```

# Answer
> 2 votes
Try this:

```
{organisation}
    {organisation:related_organisation:title}
    {organisation:related_organisation:categories}
        {organisation:related_organisation:category_id}
    {/organisation:related_organisation:categories}
{/organisation}

```

Note the change, from:

```
{category_id}

```

to:

```
{organisation:related_organisation:category_id}

```

You must remember to reference the parents when nesting.

---
Tags: categories, relationships, grid
---


title: Using Postmaster to send system emails

text:
# Question
Title: Using Postmaster to send system emails
I have Postmaster installed, and parcels set up to handle email notifications of channel entries/status changes etc. This uses Mandrill and works fine.

I would like to utilise Mandrill for the sending of system emails, (new member notification/activation etc) and know that this is possible with Postmaster, but I'm not quite sure how to set it up.

Has anyone else done this, or maybe have a screen shot on how to set it up on the Postmaster CP?

Thanks!

# Answer
This is really easy to do with Postmaster. You just have to setup a Hook that uses the "Send System Email" hook.

First click "New Hook.

Then select the "Send System Email" hook. Be sure to check "End Script" or else two emails will send (the one from Postmaster and the original).

You can see below I have titled the hook "System Emails". This is all that is required to get this working, with the addition to filling in the to email, from email, message and subject. Take a look at this link for the reference of which variables are parsed within this particular hook. Just be sure to prefix all the variables used with the Hooks section with `hook:`.

https://objectivehtml.com/postmaster/hooks/send-system-email
> 4 votes

# Answer
You can use the Escort extension to do that. Really simple to set up:

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

Good luck!

Seamus
> 3 votes

---
Tags: email, postmaster
---


# Question
Title: Video Embed Youtube Coding - Changing to Special Character
I am trying to add a field that allows users to embed a youtube or third party video code. I have the field configured to be a textarea with no formatting. When I try to add the embed code in an entry form EE turns the any \< into a special characters. This cause the video to not load correctly on the front-end website. I tried changing the field to Rich Textarea or Wygwam but the issue still occurs. You can see the error on this page (http://mtcorps.org/blog/view/secretary-jewell-announces-1-million-private-funding-commitment).

I am running EEv2.7.2. Any help is appreciated.

# Answer
You'll notice it's also adding paragraph tags around the content of your text area - double check to ensure that when you have it set as a textarea fieldtype you also have formatting set to "none". It seems you have have XHTML formatting on the field currently.

One thing you might consider, if you won't want to have users inserting embed code (at least for youtube or vimeo) is DevDemon's awesome and free fieldtype called Channel Videos. As a fieldtype, it allows you to search youtube and vimeo from the control panel and allows you to set up all the custom parameters you want within the add-on, removing those aspects of the setup from the user-admin side. And at the template level, it does all the code insertion for you and applies the parameters you have set in your add-on's preferences. It doesn't help you with third party embeds - for that you'd still need a field like you're trying now - but for youtube and vimeo, it's excellent.
> 1 votes

---
Tags: ee2, video, embed-media
---


# Question
Title: Custom facebook button with Solspace Facebook Connect?
I'm setting up Solspace Facebook Connect (fbc) for the first time and I would like to use my own custom buttons (anchor tag) instead of the ugly default button. Is this possible?

# Answer
> 1 votes
Unfortunately Facebook has a lot of control over the display of the Facebook-related UI in FBC, so your options are limited. You can change the label or size of the login button (the list of parameters can be found here: http://www.solspace.com/docs/facebook\_connect/login/), but that's about what is possible with FBC.

If you need to further customize the FBC buttons, try using CSS rules to override the default style provided by Facebook. If you need to add something such as a custom class or id, javascript (which would add said class/id when it's run) would be the way to go. Another way is to wrap the button with an element (eg. a div with a specific class), and modify your CSS rules to do what you need.

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


# Question
Title: How do I list entries by the same author on the single entry page?
I have a simple news site and on a single entry page where a news item is located I would like to list 3 or 4 other entries by the same author in the sidebar sorted by date.

I have one channel entries tag for the article text and another with the same channel but with an author\_id parameter.

There are two problems I'm having, one is getting the author id from the url (I do not want to add another url segment just for this) and the second is making sure that it doesn't list the same entry that's currently being displayed on the page.

I would post my current code but it's all very standard stuff

# Answer
Assuming you're not using stash, you can simply use an embed *within your main channel entries tag* and pass the embed the author\_id of the current author and the entry\_id of the article being displayed:

```
{embed="sidebar/authorlist" author_id="{author_id}" entry_id="{entry_id}"}

```

and in your embed:

```
{exp:channel:entries channel="..." dynamic="no" author_id="{embed:author_id}" entry_id="NOT {embed:entry_id}"}

```

Because it's a single entry page (limit="1") your embed will only be included once - but it means that your sidebar area in your template needs to be within the {exp:channel:entries} loop
> 2 votes

---
Tags: author
---


title: registration forms for mebers groups

text:
# Question
Title: registration forms for mebers groups
I want to create 3 different register forms for 3 member groups. Is this possible within expression engine. I have seen the freemember is theis the best way to achieve this?

# Answer
> 2 votes
There are several add-ons that would accomplish what you're looking to do. Nick already Mentioned Zoo Visitor. Here is a list of other add-ons that will also work well:

Zoo Visitor, Profile:Edit, and Safecracker Registration have the added feature of storing members as Channel entries. So if you need maximum flexibility with your member fields then that feature would be an advantage.

For a detailed comparison of a few of these take a look at Focus Lab's blog post, Member Profile Add-ons in ExpressionEngine.

Because all of these accomplish the goal you outlined in your question, what's "best" will depend on your preferences and on any other goals you might have related to member data on your site.

# Answer
> 1 votes
Zoo Visitor was highly recommended by other developers on Twitter, and I've been quite pleased with it as well.

It supports member group selection in registration forms (and you can create as many as you'd like). Here's the relevant portion of the docs.

---
Tags: members, freemember, register
---


# Question
Title: Return paramater after form submission (in custom module)
I am building a custom module. In my module I have a form function which basically creates the form.

When this form is submitted, I want the form to return to a specific URL.

I have added a 'RET' hidden field to the form with the correct URL, but I am unsure how to have the form actual use this. Can anyone show me what I need to add to my existing code to achieve this.

```
public function form()
{
    $entry_id = $this->EE->TMPL->fetch_param('entry_id');
    if( $entry_id === FALSE ) {
        return "";
    }

    $return = $this->EE->TMPL->fetch_param('return');

    $hidden_fields = array(
        "entry_id" => $entry_id,
        "ACT" => $this->EE->functions->fetch_action_id( 'Cdwd_waiting_list', 'submit_record' ),
        "RET" => $return
    );

    $form_data = array(
        "id" => $this->EE->TMPL->form_id,
        "class" => $this->EE->TMPL->form_class,
        "hidden_fields" => $hidden_fields
    );

    $tagdata = $this->EE->TMPL->tagdata;

    $form = $this->EE->functions->form_declaration($form_data) .
        $tagdata . "</form>";

    return $form;
}

```

# Answer
Inside of your `submit_record` method (of your `Cdwd_waiting_list` class), you'll need to add something like this (after you've done everything else you need to with the form submission):

```
ee()->functions->redirect(
    ee()->input->post('RET')
);
exit();

```
> 2 votes

---
Tags: module, forms
---


# Question
Title: Uninstall Module via Database Query EE1-EE2 upgrade
I'm in the middle of a very very complex EE1-EE2 upgrade and found that I made a mistake and did not uninstall LG Polls before doing the upgrade and am now getting the following error on front end pages

I've commented out template code that references lg polls and also changed the lg polls fieldtype to a text input but the error persists. I'd really rather not have to rollback and do the upgrade again.

Is it possible to uninstall the module using something like Navicat and have these errors disappear?

# Answer
> 4 votes
Funnily enough I'm going through exactly the same process at the moment.

I'm undertaking a conversion from LG Poll to VWM Polls.

If you don't care about these errors, you can just set the field's type to 'text' in the exp\_channel\_fields table, which will at least get your site working again. Then if you don't want to upgrade or migrate LG Polls you can delete the tables, though no need really.

---
Tags: ee2, ee1, upgrade
---


# Question
Title: How do you link to entries from multiple categories using the Relationship field?
The title may be misleading if not confusing, so a little explanation is in order.

I have a basic article channel that feeds content to 38 different pages on a site based on the selected categories. I include summary information for selected articles on the home page of the site using the Relationship field and include a Read More link.

The challenge I am facing is how to link that home page summary to the correct page based on the entry category.

Any guidance on this will be greatly appreciated.

Thanks.

# Answer
If I understand your question correctly, it could be that you're using the incorrect syntax for fetching related categories. The docs don't make it very clear that you need to do it like this, prefixing the categories loop with the name of the relationship field:

```
{exp:channel:entries dynamic="no"}
    {rel_name}<a href="{rel_name:categories limit="1"}{category_url_title}{/rel_name:categories}">{title}</a>{/rel_name}
{/exp:channel:entries}

```

If I misunderstood the question, please add more detail as I'm not entirely sure what you're asking. It strikes me that you may be misusing categories here, since they are meant as a form of organisation that can accept multiple values. You should maybe look into using custom field radio buttons or a select dropdown instead.
> 1 votes

---
Tags: categories, relationships
---


# Question
Title: Does anyone know if it is possible to use Low Search to search within one page
Does anyone know if it is possible to use Low Search to search within one page, rather than pulling all information from a channel. I'm developing a take away directory and users need to be able to search for menu items on each individual businesses page rather than through an entire channel.

# Answer
You need to use JavaScript for something like this. Here's a jQuery tutorial:
http://www.designchemical.com/blog/index.php/jquery/live-text-search-function-using-jquery/
> 0 votes

# Answer
If each business' "page" is a single entry, then no - Low Search (like all EE search modules - and in fact, all search modules everywhere, including Google) returns one result per entry - you cannot have multiple individual search results for a single channel entry/page.

(Think: how would you jump to individual results scattered throughout a single page?)

Perhaps a javascript-based on-page search is a better solution? (Or let users use their own built-in browser page search instead?)
> 0 votes

---
Tags: ee2, low-search, low
---


# Question
Title: Facebook Open Graph pulling ExpressionEngine Data
On a blog detail page I have Facebook OpenGraph tags pulling in various bits of data using ExpressionEngine tags etc. All works fine apart from the images.

Ideally, as the blog posts contain a lot of images, when posting an article to FB it should pull some of the images from the blog post to use as the thumbnail and let the client decide which one to use. If there are no images in the blog post then it falls back to the default thumbnail I've referenced in the 'og:image' tag.

Currently what happens is it only gives the option to use the default thumbnail and if I don't include the 'og:image' tag then it loads no thumbnail at all, instead of scraping the post for a blog image.

Has anyone encountered this before? What EE solutions, if any, are you using to bring in select images? Creating a separate channel field just for a thumbnail for every blog post seems overkill. Also, as it's blog post then all the data is in one channel field in a textarea so I can't pull a specific image out of it.

```
<meta property="og:title" content="{title}"/>
{if facebook_description}
<meta property="og:description" content="{facebook_description}" />
{/if}
<meta property="og:image" content="http://www.client.com/thumbnail.jpg"/>
<meta property="og:site_name" content="{site_name}"/>
<meta property="og:url" content="{page_url}/" />

```

# Answer
> 2 votes
I implemented support for this in SEO Lite a while back. It takes a bit of config setup but after that it works excellent. Basically you map custom fields in the various field groups to the opengraph tags you'd like to use.

See example here https://gist.github.com/bjornbjorn/4039233

It will map fields from the News, Blog and Portfolio channels into {extra:} tags that can be used in the SEO Lite template. Let me know if you have any questions about the implementation:)

More about SEO Lite here: http://wedoaddons.com/addon/seo-lite

# Answer
> 0 votes
I have run into this and it was driving me nuts. I wrote a snippet to handle what I needed based on the fieldtypes I was using. The users wanted it to be auto-"magic" and not require them to upload additional images or add further input. This had me scratching my head for some time. I ended up going through all of the templates for the various social media sites they were affiliated with and went through each API to build out custom "templates" for what they wanted on each site. After gathering the required fields and merging the like fields, I ended up with the below. I just add the snippet in the head with `{snip-meta}`.

Hope this helps...

```
    <!-- Geo Data -->
    <meta name="geo.position" content="my x,my y" />
    <meta name="geo.placename" content="City, ST" />
    <meta name="geo.region" content="US-ST" />

    <!-- Place this data between the <head> tags of your website -->
    <title>{title} - {if segment_1}{segment_1}{/if} - {if segment_2}{segment_2}{/if} - company name here</title>

    {if field_pair:total_rows > 0}
        <meta name="description" content="{exp:eehive_hacksaw chars = '150' append = '...'}{field_pair}{field_pair:field}{/field_pair}{/exp:eehive_hacksaw}" />
    {/if}
    {if field_pair:total_rows > 0}
        <meta name="description" content="{exp:eehive_hacksaw chars = '150' append = '...'}{field_pair}{field_pair:field}{/field_pair}{/exp:eehive_hacksaw}" />
    {/if}
    {if field_pair:total_rows > 0}
        <meta name="description" content="{exp:eehive_hacksaw chars = '150' append = '...'}{field_pair}{field_pair:field}{/field_pair}{/exp:eehive_hacksaw}" />
    {/if}

    <!-- Google Authorship and Publisher Markup -->
    <link rel="author" href="https://plus.google.com/member-id/posts"/>
    <link rel="publisher" href="https://plus.google.com/member-id"/>

    <!-- Schema.org markup for Google+ -->
    <a href="https://plus.google.com/member-id?rel=author" style="display:none;">Google+</a>
    <meta property="url" content="{current_url}" />
    <meta itemprop="name" content="{title} - {if segment_1}{segment_1}{/if} - {if segment_2}{segment_2}{/if} - company name here">
    <meta itemprop="datePublished" content="{entry_date format='%Y-%m-%dT%H:%i:%s%Q'}">

    {if field_pair:total_rows > 0}
        <meta itemprop="description" content="{exp:eehive_hacksaw chars = '150' append = '...'}{field_pair}{field_pair:field}{/field_pair}{/exp:eehive_hacksaw}">
    {/if}
    {if field_pair:total_rows > 0}
        <meta name="description" content="{exp:eehive_hacksaw chars = '150' append = '...'}{field_pair}{field_pair:field}{/field_pair}{/exp:eehive_hacksaw}" />
    {/if}
    {if field_pair:total_rows > 0}
        <meta name="description" content="{exp:eehive_hacksaw chars = '150' append = '...'}{field_pair}{field_pair:field}{/field_pair}{/exp:eehive_hacksaw}" />
    {/if}

    {if field_pair:total_rows > 0}
        {field_pair}
            {if field_pair:field}
                <meta itemprop="image" content="{field_pair:field}">
            {/if}
            {field_pair:field images_only="yes"}
                <meta itemprop="image" content="{field_pair:field}">
            {/field_pair:field}
        {/field_pair}
    {/if}
    {if field_pair:total_rows > 0}
        {field_pair}
            {if field_pair:field}
                <meta itemprop="image" content="{field_pair:field}">
            {/if}
        {/field_pair}
    {/if}
    {if field_pair:total_rows > 0}
        {field_pair}
            {if field_pair:field}
                <meta itemprop="image" content="{field_pair:field}">
            {/if}
            {field_pair:field images_only="yes"}
                <meta itemprop="image" content="{field_pair:field}">
            {/field_pair:field}
        {/field_pair}
    {/if}

    <!-- Twitter Card data -->
    <meta name="twitter:card" content="summary_large_image">
    <meta name="twitter:site" content="@username">
    <meta name="twitter:title" content="{title} - {if segment_1}{segment_1}{/if} - {if segment_2}{segment_2}{/if} - company name here">

    {if field_pair:total_rows > 0}
        <meta name="twitter:description" content="{exp:eehive_hacksaw chars = '150' append = '...'}{field_pair}{field_pair:field}{/field_pair}{/exp:eehive_hacksaw}">
    {/if}
    {if field_pair:total_rows > 0}
        <meta name="description" content="{exp:eehive_hacksaw chars = '150' append = '...'}{field_pair}{field_pair:field}{/field_pair}{/exp:eehive_hacksaw}" />
    {/if}
    {if field_pair:total_rows > 0}
        <meta name="description" content="{exp:eehive_hacksaw chars = '150' append = '...'}{field_pair}{field_pair:field}{/field_pair}{/exp:eehive_hacksaw}" />
    {/if}

    <meta name="twitter:creator" content="@alamodeinc">

    <!-- Twitter summary card with large image must be at least 280x150px -->
    {if field_pair:total_rows > 0}
        {field_pair}
            {if field_pair:field}
                <meta name="twitter:image:src" content="{exp:low_replace find='/product_images/' replace='/product_images/_Twitter_Card_Image'}{field_pair:field}{/exp:low_replace}">
            {/if}
            {field_pair:field images_only="yes"}
                <meta name="twitter:image:src" content="{exp:low_replace find='/product_images/' replace='/product_images/_Twitter_Card_Image'}{field_pair:field}{/exp:low_replace}">
            {/field_pair:field}
        {/field_pair}
    {/if}
    {if field_pair:total_rows > 0}
        {field_pair}
            {if field_pair:field}
                <meta itemprop="image" content="{field_pair:field}">
            {/if}
        {/field_pair}
    {/if}
    {if field_pair:total_rows > 0}
        {field_pair}
            {if field_pair:field}
                <meta itemprop="image" content="{field_pair:field}">
            {/if}
            {field_pair:field images_only="yes"}
                <meta itemprop="image" content="{field_pair:field}">
            {/field_pair:field}
        {/field_pair}
    {/if}

    <meta name="twitter:domain" content="domain.com">

    <!-- Open Graph data -->
    <!-- Used by Facebook and Linked:In -->
    <meta property="og:title" content="{title} - {if segment_1}{segment_1}{/if} - {if segment_2}{segment_2}{/if} - company name here" />
    <meta property="og:type" content="article" />
    <meta property="og:url" content="{current_url}" />

    {if field_pair:total_rows > 0}
        {field_pair}
            {if field_pair:field}
                <meta itemprop="image" content="{field_pair:field}">
            {/if}
            {field_pair:field images_only="yes"}
                <meta itemprop="image" content="{field_pair:field}">
            {/field_pair:field}
        {/field_pair}
    {/if}
    {if field_pair:total_rows > 0}
        {field_pair}
            {if field_pair:field}
                <meta itemprop="image" content="{field_pair:field}">
            {/if}
        {/field_pair}
    {/if}
    {if field_pair:total_rows > 0}
        {field_pair}
            {if field_pair:field}
                <meta itemprop="image" content="{field_pair:field}">
            {/if}
            {field_pair:field images_only="yes"}
                <meta itemprop="image" content="{field_pair:field}">
            {/field_pair:field}
        {/field_pair}
    {/if}

    {if field_pair:total_rows > 0}
        <meta property="og:description" content="{exp:eehive_hacksaw chars = '150' append = '...'}{field_pair}{field_pair:field}{/field_pair}{/exp:eehive_hacksaw}" />
    {/if}
    {if field_pair:total_rows > 0}
        <meta name="description" content="{exp:eehive_hacksaw chars = '150' append = '...'}{field_pair}{field_pair:field}{/field_pair}{/exp:eehive_hacksaw}" />
    {/if}
    {if field_pair:total_rows > 0}
        <meta name="description" content="{exp:eehive_hacksaw chars = '150' append = '...'}{field_pair}{field_pair:field}{/field_pair}{/exp:eehive_hacksaw}" />
    {/if}

    <meta property="og:site_name" content="{site_label} - company name here" />
    <meta property="article:published_time" content="{entry_date format='%Y-%m-%dT%H:%i:%s%Q'}" />
    <meta property="article:modified_time" content="{edit_date format='%Y-%m-%dT%H:%i:%s%Q'}" />
    <meta property="article:section" content="Article Section" />
    <meta property="article:tag" content="Article Tag" />
    <meta property="fb:admins" content="admin-id" />

    <!-- Pinterest Article Pins - not picked up from earlier tags -->
    {exp:tagger:tags entry_id="{entry_id}"}
        <meta property="article:tag" content="{tagger:tag_name}" />
    {/exp:tagger:tags}

```

---
Tags: facebook
---


# Question
Title: Getting random, unformatted page on Template/Channel Entry Edit
**Quick run down of the site:**

* EE 2.6.1
* Media Temple Grid Service

Since we moved the site to their production server, we've noticed that we will randomly receive a page that is missing any formatting and has only bracketed information. For example, when we update a template we will sometimes get this whether or not we use "Update" or "Update and Finished":

```
{"message_success":"Template Has Been Updated"}

```

If we update a channel entry and use "Update and Finished" the system will return a bracketed list of entries within the channel but no admin. The only way to get around the issue I have found is to strip everything after the ?S= key so I can use the admin. If I don't, when I try to log in or go to the admin login page I just get this returned on the page with nothing else:

```
C=login

```

It is important to note that the only EE developer that we had was let go and I have little-to-no experience managing an EE site beyond basic templating and the like so any help would be appreciated.

# Answer
> 2 votes
Within the Media Temple Admin, go to PHP Settings. Within PHP Settings, your particular EE site domain it is probably set to use FastCGI currently. Change it to CGI Stable and your problem will be solved.

---
Tags: ee2, templates, admin, system, administration
---


# Question
Title: Playa: Specify a default child entry if none is selected
I have a channel with a playa field where users can select a block of content to insert into a page.

Is there a way that I can specify a default child entry to display if the playa field is left blank?

# Answer
Yes. One approach would be using a conditional based on `no_children` variable:

```
{exp:playa:children field="your_field"}
    {if no_children}
        No children found...display fallback.
    {/if}
{/exp:playa:children}

```

Or you might find that using a conditional based on the `{exp:playa:total_children}` tag is better suited:

```
{if "{exp:playa:total_children field='your_field'}"}
    No children found...display fallback.
    Perhaps open a channel entry loop here to show your fallback child
{/if}

```
> 1 votes

---
Tags: templates, playa
---


# Question
Title: How to send two different emails (poss customer / thank for submitting) simultaneously with freeform?
I have a simple working contact form that emails a specific person in a company possible customer information. However, the client also wants a confirmation sent to the potential customer when the customer submits the form containing a link and some other general info so that then can return to the "thank you" url, which has some helpful information.

How do you send two different emails at the same time to two a regular email address but also the email inputed in a form?

I doesn't seem you can use {email} to email the person who submitted the form.

```
 {exp:freeform:form
        form:id="employee-form-wrap"
        collection="Employee Relocation Form"
        template="employee-relocation-form"

        return="contact/thank-you"
        notify="contact@mycompany.com"
        }

 {exp:freeform:form
            form:id="employee-form-wrap"
            collection="Employee Relocation Form Thank You Confirmation Email"
            template="Employee-Relocation-Form-Thank-You-Confirmation-Email"
            notify="{email}"
        }

        <p><span>* </span>Indicates required field</p>

        <div>
            <label for="name">Name <span class="req">*</span></label><br>
            <input type="text" id="name" name="name" value=""  class="validate[required] text-input">
        </div>
        <div>
            <label for="email">Email <span class="req">*</span></label><br>
            <input type="email" id="email" name="email" value=""  class="validate[required,custom[email]]">
        </div>
        <div>
            <label for="phone">Phone Number</label><br>
            <input type="text" id="phone" name="phone" value="">
        </div>
        <li class="screen-reader">
            <label for="honeepot">Don't put anything here</label>
            <input type="text" name="honeepot" id="honeepot" />
        </li>

        <input id="submit" type="submit" value="Submit" >

        {/exp:freeform:form}

```

{/exp:freeform:form}

# Answer
> 1 votes
If you look at the Freeform docs under "Notifications" you'll see there is an option to notify both the admin as well as the user: http://www.solspace.com/docs/freeform/form/#parameters. And they each have their own email templates so you can format the emails to each person however you want.

---
Tags: solspace-freeform
---


# Question
Title: Plugin returning wrong value for numbers that start with 0
We have a plugin that takes orders from CarthThrob and then creates a special file for the distributor. This plugin grabs the order information and converts it to a special file type and format they use to fulfill orders. One part of that is to take the three letter country code and convert that to the three digit currency code. It works for most countries, however those that start with a zero don't work.

What we find is that instead of converting the letter code to the right numeric code it converts AUS (should be 036) to 030, Armenia (051) to 041, and Argentina (032) to 026?

This mightn't be a question for the EE community, but thought I'd start here in case someone can see a pattern or maybe it is some binary thing that is doing math and converting that to a different number.

Sample of the code (not all of it):

```
private function alpha_three_to_numeric_country($country)
{
    switch ($country) {
    case "AFG":
        return 004;
        break;
    case "ALA":
        return 248;
        break;
    case "ALB":
        return 008;
        break;
    case "DZA":
        return 012;
        break;
    case "ASM":
        return 016;
        break;
    case "AND":
        return 020;
        break;
    case "AGO":
        return 024;
        break;
    case "AIA":
        return 660;
        break;
    case "ATA":
        return 010;
        break;
    case "ATG":
        return 028;
        break;
    case "ARG":
        return 032; etc...

```

# Answer
> 4 votes
I'm no expert, but I don't think numbers that start with a zero are programatically treated as integers (some Googling suggests they are treated as something called *Octals*).

In your case, unless you need to do mathematical operations on those values, why not just declare them as strings by putting quote marks around them?

```
private function alpha_three_to_numeric_country($country)
{
    switch ($country) {
    case "AFG":
        return "004";
        break;

```

https://stackoverflow.com/questions/2495611/working-with-php-octals-and-string-conversions

---
Tags: plugin
---


# Question
Title: Bypassing Shipping Options for FREE shipping
I asked this question previously and am still having trouble. I want to bypass shipping options for items with free shipping.

I added this code to the shipping options page:

```
 {if order_shipping_val == 0}
    {redirect="Store/Confirm-Order"}
{/if}

```

Unfortunately it redirects for all items including ones that should have paid shipping. Any ideas?

# Answer
> 1 votes
If you want to do that, you need to make sure your regular orders definitely have a shipping cost. You should make sure there is a default shipping method set, and that there is a default country/state set as well, so that all orders have a shipping cost associated with them as soon as an item is added to the cart.

To debug it, try outputting `{order_shipping}` directly onto the page instead of the redirect code, and make sure that it returns a non-zero value even for new carts.

EDIT: If you are using the UPS extension it's a bit more difficult, because you can't set UPS as the default shipping method. You will need to check if the cart has a valid shipping method, and if not, reload the page.

First, I would delete any regular shipping methods you have set up (if you are 100% using UPS for shipping).

Then, create a check to make sure the current cart has a shipping method selected before redirecting to the next step:

```
{if shipping_method == ""}
    {field:shipping_method}
    <script type="text/javascript">
        $("#next-button").click(); // trigger a form submit
    </script>
{if:else}
    {!-- now we know a shipping method has been selected --}
    {if order_shipping_val == 0}
        {redirect="Store/Confirm-Order"}
    {/if}
{/if}

<input type="submit" id="next-button" />

```

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


title: Wygwam & CKeditor wordcount

text:
# Question
Title: Wygwam & CKeditor wordcount
I'm looking to use the wordcount plugin for the CKeditor in WYGWAM. Wordcount states it is compatible with version 4 of CKeditor, which is in v3 of WYGWAM. So my question is - Is it possible to get wordcount working inside of WYGWAM 3? Can anyone confirm before I buy a licence?

# Answer
I can can confirm this works. Here are the steps I took.

1. Copy old WYGWAM folders out of themes/third\_party & expressionengine/third\_party to somewhere safe
2. Copy New folders in respective places.
3. In admin Go to Addons/Modules and click Run Module Updates (top right)
4. In same screen click WYGWAM, and clone and existing config (the one you use)
5. Click new cloned version, under "Advanced Settings" select extraPlugins from the dropdown and type "wordcount" in the text box (sans quotes).
6. At this point my WYGWAM field was broken because it was trying to init old ckeditor plugins, namely channel images, you may or may not get this problem depending on your setup but if you do, copy missing plugins (console.log shows whats missing) from the ckeditor/plugins folder backed up in step one, into the new folder (these plugins are in the theme area).

That's it, I wanted to have a word and character count so I edited themes/third\_party/wygwam/lib/ckeditor/plugins/wordcount/plugin.js and changed the defaultConfig var accordingly.
> 1 votes

# Answer
While I haven't used that particular extension (Wordcount) with Wygam, I have had success using a few others, so it should theoretically work. If it doesn't, Devot-ee has a 30 day return policy.
> 0 votes

---
Tags: wygwam
---


# Question
Title: unserialize() PHP error trying to import XML with solspace importer
I am running EE 2.7.3 and Solspace Importer 2.2.3. I am getting this error when I select the channel for these entries to go in. I am uploading manually using strict XML.

```
A PHP Error was encountered
Severity: Notice

Message: unserialize(): Error at offset 11 of 49151 bytes

Filename: importer/mcp.importer.php
Line Number: 1151

Unable to Retrieve Profile Data

```

Here is an example of the XML:

```
<entries>
    <entry>
        <title>Destiny and a Blue Cloak</title>
        <story_author>481</story_author>
        <story_age_rating>PG</story_age_rating>
        <story_excerpt><![CDATA[ Except goes here]]></story_excerpt>
        <story_box><![CDATA[ Content goes here]]></story_box>
        <categories>
            <category>Romance</category>
            <category>Humour</category>
        </categories>
        <status>open</status>
    </entry>
</entries>

```

Any thoughts?

# Answer
> 1 votes
Try the "Loose XML" option. Also run your xml through a validator just to make sure it's clean.

You might also be missing the XML header in your XML file, eg. `<?xml version="1.0" encoding="UTF-8"?>`

Finally, the `<categories></categories>` node should contain a string of category data, such as a comma-separated list of category names.

---
Tags: solspace, import, solspace-importer
---


# Question
Title: Next and previous entry with category url title
My single entry page URL structure is as follows:

```
sitename.com/channel_name/category_url_title/entry_url_title

```

I want to have previous and next links on each single entry that are NOT limited to the category that is currently in the URL...I just need it to work by date alone, but I do need to retain this url structure...so basically when someone opens this link:

```
sitename.com/channel_name/category_1_url_title/entry_123_url_title

```

and clicks the next button it should take him to:

```
sitename.com/channel_name/category_22_url_title/entry_124_url_title

```

only sorting by entry date and ignoring the category as a filter

is this possible with some good queries or do I need an addon for it?

# Answer
> 1 votes
The Next/Prev entry links will not glean any category information in the URL, so you don't have to worry there.

This should work pretty easily with the Query module:

```
{exp:channel:next_entry channel="channel_name"}
    {exp:query sql="SELECT c.cat_url_title FROM exp_category_posts cp LEFT JOIN exp_categories c ON c.cat_id = cp.cat_id WHERE cp.entry_id = {entry_id} LIMIT 1"}
        <p>Next entry: <a href="/channel_name/{cat_url_title}/{url_title}">{title}</a></p>
    {/exp:query}
{/exp:channel:next_entry}

```

(Use the same code for the `prev_entry` tag.)

---
Tags: categories, next-prev
---


# Question
Title: Adding Category and Subcategories in a multiselect dropdown in Channel Form
I am using channel form to allow users to add a new entry. I need to output a category to allow then to select multiple categories and sub categories. The following code works but it does not order the sub cats below the parent Category:

```
<select name="category[]" size="100" multiple="multiple" id="multiSelect">
{exp:query sql="SELECT cat_name, cat_id FROM exp_categories WHERE group_id='3'"}
<option value='{cat_id}'>{cat_name}</option>
{/exp:query}
</select>

```

I would like to see the categories listing as:

```
Parent 1
 child 1.1
 child 1.2
Parent 2
 Child 2.1
 Child 2.2

```

# Answer
The docs provide a couple of syntax options:

```
{category_menu}
        <label for="categories">Categories</label>
        <select name="category[]" id="categories" size="4" multiple="multiple">
                {select_options}
        </select>
{/category_menu}

```

Or, for finer control:

```
<select name="category[]" id="categories" size="4" multiple="multiple">
        {categories}
                <option value="{category_id}"{selected}>{category_name}</option>
        {/categories}
</select>

```

By using the `{category_group_id}` and `{category_depth}` parameters, you can refine things further. If you need to restrict it by category group, and indent things by depth (and `{select_options}` is inadequate), perhaps something like this would do the trick:

```
<select name="category[]" id="categories" size="4" multiple="multiple">
        {categories}
                {if category_group_id == 3}
                     <option value="{category_id}"{selected}>
                            {if category_depth == 2}  {/if}{category_name}
                      </option>
                {/if}
        {/categories}
</select>

```
> 2 votes

---
Tags: categories, channel-form
---


# Question
Title: Is there any configuration in cartthrob to ignore coupon on discounted product?
We provide, discount and coupon code on our store powered by cartthrob. Its seems, if someone coupon code works too on discounted products but we don't want user to apply coupon code on discounted products. Is there anything built in cartthrob so, we can prevent user to apply coupon code on discounted items? or do we've to alter cartthrob code? I found similar question here - (In Cartthrob, how could one stop a discount being applied with any other coupon?) but that couldn't fulfil my need. Thanks

# Answer
> 1 votes
I'd guess you'd need to build an Extension to handle this since it's so specific to your needs.

CartThrob has their list of hooks here:
http://cartthrob.com/docs/docs\_cartthrob2/developers/hooks/index.html

Looks like using the "cartthrob\_calculate\_discount" hook is your best bet. That's where I'd start at least.

This SE question will lists a number of addon development resources: https://expressionengine.stackexchange.com/a/15168/28

I built by first couple of extensions last month and the first was challenging but the next couple were less challenging. I took an existing Expresso Store extension and broke that down to create mine which helped a ton.

---
Tags: cartthrob, coupon-code, discounts
---


title: Collision Control for entries?

text:
# Question
Title: Collision Control for entries?
I am wondering if there is some sort of "data collision control" system available for EE. I am talking about a warning if a dataset is (about) being changed by two (or more users) at the same time, resulting in a potential dataloss.

EllisLab itself claims that EE is "a true content management system" and has an extensive User and Member Management Module. Even more I am baffled that this is not a core functionalty apparently. In the days of EE 1.x at least there was "Currently logged in Users" info near the footer of the CP.

There is an Extension "Lock Entry" on devotee but it looks like it is abandoned and the last time I tried it it seemed buggy.

Has anybody an idea on how to achieve this or how to maybe continue the work on Lock Entry?

Thanks and Cheers!

# Answer
Indeed, EE is missing a native workflow module. This is what it is. Thankfully, there is a robust developer community that stepped in and created options. I'd say your best bet is to get one of these working to protect the integrity of your data. Here are three in no particular order:

**Better Workflow** http://devot-ee.com/add-ons/better-workflow

**Publisher** http://devot-ee.com/add-ons/publisher

**NSM Publish Plus: Workflow** http://devot-ee.com/add-ons/nsm-publish-plus-workflow

---

You might also check out **Edit Alarm** (http://devot-ee.com/add-ons/edit-alarm). It doesn't lock the entry but displays a message in the CP for a set amount of time after someone has started editing an entry. I used this on an EE1 site which had 8+ editors and it worked well. Haven't used it on an EE2 site.
> 2 votes

---
Tags: ee2, channel-entries, database
---


# Question
Title: All channel entries have had their statuses changed to 'closed'
It looks like one of my sites has been compromised with an SQL injection. All the channel entries have been closed, which amounts to over 5k entries.

I restored the database with a previous daily backed, so all is well again, but have no idea what could have caused this, seems most likely to be a rogue sql query as no way to accidentally change all open statuses to closed in the CP.

I have added in extra security by changing passwords, system directory name, removed some add-ons, switched XSS filter back, check permissions, etc.

The site's still on 1.7 and Ellislab have had a look around the CP and say they can't see any evidence of a virus.

I'd be very interested to hear if anyone has had a similar experience.

# Answer
> 1 votes
He's not a SE user so I'll answer this for him here. Apparently he had the same issue and it was down to a bug with maestro payments. Does that sound like it might be it?

CT gave him a patch to fix it so you should contact them.

# Answer
> 1 votes
Questions: What payment gateway are you using?

NOTE: If it is related to CT, and CT did indeed close ALL entries, it would most likely be some situation where we have a channel entries call to close a specific entry, but without a limit set on it… and a channel entry id was not passed in the call to close the entry.

Over time, I have seen cases where my add-on or other similar add ons would close a junk load of entries if a limit was not set on the close call and the ID passed in was null or blank.

If indeed it was a CT problem, that's where I'd start looking… Most likely culprit would be a bad callback with missing data and a gateway file with a call to close an entry with no limit set, or something in the core itself calling to close an entry based on some condition hit without an entry id.

In CT2 I know I've gone on hunting expeditions for this kind of thing to make sure it wouldn't happen, but I have not gone through the same process for 1.7

---
Tags: mysql
---


title: Developing EE add-ons with code assist

text:
# Question
Title: Developing EE add-ons with code assist
First off, pardon the noob aspect of this question. I have developed on other platforms, but it's been a while now. I was starting to build an EE2 module for one of my sites and I keep getting frustrated in needing to print\_r() everything to see what data is available and if I am in the correct hook/segment.

I know a lot of you are seasoned developers of add-ons for EE and more than likely have a nice workflow you could suggest. I would like to save some time by using something I can view as I write. Currently, I just downloaded Zend Studio to see if I could accomplish what I was after.

I guess, my questions are:

1. What is the best tool for add-on development? (I know this is opinionated, but am open to suggestions)
2. Is it possible to create add-ons within the system folder so that a project "inherits" the code base? I installed a local instance for developing and used Bjorn's DevKit to kickstart the module. (Great help BTW)
3. What are the best ways to review available data? Surely there is a better way than dumping the data each time.

*** EDIT *** For anyone interested, I saw another thread in which someone mentioned using UltraEdit. We use that here in some other areas so I downloaded the studio demo, since we just use the editor. I'm still going through it, but so far, I just started a new project, pointed the editor at my system folder, and all of the methods, classes, etc. seem to be pulled in.

It would still be nice to be able to iterate through data though.

# Answer
> 1 votes
1. Well, I am biased but I use my own Channel Data library for just about everything. I just re-wrote it entirely with full CRUD support, and will save you loads of time. Not familiar with Bjorn's solution, so I can't comment either way.
2. I would advise against this. When you upgrade EE, you will have to constantly backup specific files and ensure they aren't deleted with the update. I would recommend taking the approach I did with Channel Data. You can load the "packages" into your own add-on to reuse the code, but still keep it in the Third Party directories.

Here is an except from the Channel Data readme.

```
/**
 * Required Steps
 *
 * 1. Load the Channel Data package into your add-on
 * 2. Load the Channel Data driver from the package
 * 3. Tell Channel Data where the auto loader should look for your files.
 **/

ee()->load->add_package_path(PATH_THIRD . 'your_addon_name');

// Load the driver and directories at once
ee()->load->driver('ChannelData', array(
    'directories' => array(
        PATH_THIRD . 'your_addon_name/models'
    )
));

// Or use the autoload() method to pass a directory path
ee()->channeldata->autoload(PATH_THIRD . 'your_addon_name/models');

// You can also pass an array of directories
ee()->channeldata->autoload(array(
    PATH_THIRD . 'your_addon_name/models',
    PATH_THIRD . 'your_addon_name/models/channels'
));

```
3. Not really any better way to do this unless you use an IDE, which I don't use. Without an IDE or something similar, var\_dump or print\_r are the accepted methods to dumping objects in the screen. No real way around this in my experience without using an IDE, but even then the setup can be arduous and time consuming. In 2.7 though, its much easier than it once was because you can `var_dump($this)` without having to view the global singleton object.

I also avoid using Third Party libraries, particularly the models. I only use First Party libraries that are documented and not going to intentionally be broken in a future update (unless documented). Native models and methods can change at anytime without notice, and Channel Data is, IMO of course, a better solution for universal models and fetching data.

Hopefully this helps some.

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


# Question
Title: Not Sending notify_user email. Templates made and parameters already added?
I have a simple working contact form that emails a specific person in a company possible customer information. However, the client also wants a confirmation sent to the potential customer when the customer submits the form containing a link and some other general info so that then can return to the "thank you" url, which has some helpful information.

How do you send two different emails at the same time to two a regular email address but also the email inputed in a form?

I doesn't seem you can use {email} to email the person who submitted the form.

I know now from research that you need three items filled out to email the user that submitted the form,

user\_notification\_template="Employee-Relocation-Form-Thank-You-Confirmation-Email" notify\_user="yes" user\_email\_field="email"

I also know that the templates need to be made. They are both made (the first one works) but I still after fiddling with this extension for hours get it to email the submitter/possible future customer. Can some find anything wrong with my form?

```
{exp:freeform:form
        form:id="employee-relocation-form"
        collection="Employee Relocation Form"

    user_notification_template="employee-relocation-form-thank-you-confirmation-email"
    notify_user="yes"
        user_email_field="email"

        return="www.mycompany.com/thankyou"
        admin_notify="employee@mycompany.com"
        admin_notification_template="employee-relocation-form"
    notify_admin="yes"
        }

    <p><span>* </span>Indicates required field</p>

    <div>
        <label for="name">Name <span class="req">*</span></label><br>
        <input type="text" id="name" name="name" value=""  class="validate[required] text-input">
    </div>
    <div>
        <label for="email">Email <span class="req">*</span></label><br>
        <input type="email" id="email" name="email" value=""  class="validate[required,custom[email]]">
    </div>
    <div>
        <label for="phone">Phone Number</label><br>
        <input type="text" id="phone" name="phone" value="">
    </div>

    <input id="submit" type="submit" value="Submit" >

{/exp:freeform:form}

```

# Answer
The parameter 'collection' is no longer used in the latest version of Freeform, therefore, collection="Employee Relocation Form" should be form\_name="Employee Relocation Form", as does form:id \> form\_id.

I always read through this link below when upgrading from old Freeform forms

http://www.solspace.com/docs/freeform/upgrade\_3.x-4.x/
> 2 votes

---
Tags: solspace-freeform
---


title: Dropdown Styling

text:
# Question
Title: Dropdown Styling
Hello I've been trying to get a dropdown on my channelform the only way it seems to work is if I do this.

{field:education\_level}

this outputs fine like this

```
<select name="education_level">
<option value="0">- Please Select -</option>
<option value="10">No Formal Qualifications</option>
<option value="11">GCSE/GNVQ/O levels</option>
</select>

```

But is there anyway to add either an id and class within the select for for my javascript and styling

# Answer
A quick/easy solution would be to wrap the element with a div, and build your selector using that.

In jQuery, for example, you could use `$('.select-wrapper select')` to select this:

`<div class="select-wrapper">{field:education_level}</div>`

The CSS selector would be similar, of course:

`.select-wrapper select{ border: 1px solid green; }`
> 2 votes

---
Tags: field-pack
---


# Question
Title: Content between {exp:channel:entries} tags won't show up
First, I'm on EE v2.3.1 using Structure v3.0

1. I have a channel called "statics"
2. The "statics" channel uses a field group called "statics\_fields" which just has a textarea field called "body" in it.
3. The "statics" channel uses a template group called "statics\_templates" and by default uses "statics\_templates/plain"
4. Everything outside {exp:channel:entries} tag shows up, and nothing inside it does:

```

    {embed="template_html/header" body_class="about_bg"}
        {exp:structure:breadcrumb here_as_title="yes"}{/exp:structure:breadcrumb}
            {embed="template_html/left_nav"}
                    THIS SHOWS UP
                    {exp:channel:entries channel="statics"}
                        NOTHING IN HERE SHOWS UP
                        {title}
                        {body}
                    {/exp:channel:entries}
    {embed="template_html/footer"}

```
* This happens for every new static page regardless of if it's in the "statics" channel.
* Using Structure to move it under a new parent doesn't fix it.
* Using Structure to move it up to it's own level without a parent also doesn't work.
* No errors show up in the debug output.
* No errors show up in the php error log.
* The {exp:channel:entries} tag is not nested.

So the question, of course, is:

**Why is this broken and how can I fix it?**

# Answer
> 4 votes
As Josh suggests in the comments, give this a whirl:

`{exp:channel:entries channel="statics" dynamic="no"}`

---
Tags: ee2, structure
---


# Question
Title: Solspace User "remove_photo" with link instead of input button?
Using Solspace User and the {exp:user:edit} form, is it possible to to create an HTML links that has the same function as the button:

```
<input type="submit" name="remove_photo" value="Remove Current Photo?" />

```

I can't achieve the styling I want using an input button element.

# Answer
The key for the avatar to be removed is to submit form data for "remove\_photo". This means that you need an HTML form field for this to work. Hyperlinks are not form fields.

You can, however, trigger the form submission with a value "remove\_photo" by using javascript/jQuery. The "remove\_photo" field can be a hidden field as well. For example, if you had:

```
{exp:user:edit form:class="user_edit"}
    <a href="#" class="remove_photo">Remove Photo</a>
    <input type="hidden" name="remove_photo" value="Remove Current Photo?" />
{/exp:user:edit}

```

You could use a script like this, for example:

```
$(document).ready( function () {
    $("a.remove_photo").click(function () {
        $("form.user_edit").submit();
    });
});

```
> 1 votes

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


# Question
Title: Would like to apply a class to specific category events within a span title
I'm using Solspace Calendar. I have a very clean monthly calendar where I am using a tool tip to display the events and their details. I also have 3 event categories and I would like to display them with special colors (I am using classes to define the colors). I have the tool tip working wonderfully within the calendar but since i cannot add html(other than a
tag) to the title of the span to use as the tooltip (this is where the event information is pulled into), i'm having a difficult time thinking this out. I want to be able to format the tooltip to show each event in the color that is specified for the category. So really 2 things much happen and I would love to see if anyone else can help me get there.

1. add a conditional to the `{events}` tag pair that displays the event of a particular category. Maybe something like `{if category_id == "3"} show this event {/if}`
2. add a class to the event if the category is specified.

I've tried a dozen ways, but I am sure I am not seeing something. So any suggestions would be GREAT!!! here is my code currently, without the conditionals or the color class.

```
{exp:calendar:cal date_range_start="year-month-01" date_range_end="1 months"}
 {display_each_month}
 <table class="calendar">
 <thead>
 <tr>
 <th>{date format="%F %Y"}</th>
    </tr>
     </thead>
        <tbody>
          <tr>
           <td colspan="7">
             <div class="wrap">
                <table id="fc_inner">
                   <thead>
                      <tr id="days_of_week">
                         {display_each_day_of_week}
                             <th>
                              {day_of_week_short}
                             </th>
                              {/display_each_day_of_week}
                       </tr>
                   </thead>
                   <tbody>
                      {display_each_week}
                      <tr>
                        {display_each_day}
                          <td>
                             <span data-tooltip class="has-tip" title="
                               {display_each_hour}
                               {events}
                                 {event_title} - From: {event_start_date         format="%g"} To: {event_end_date format="%g"}<br>
                               {/events}
                               {/display_each_hour}
                               ">
                               {date format="%j"}
                               </span>
                          </td>
                         {/display_each_day}
                        </tr>
                        {/display_each_week}
                    </tbody>
                   </table>
                 </div>
                </td>
               </tr>
             </tbody>
           </table>
      {/display_each_month}
 {/exp:calendar:cal}

```

# Answer
Within the `{events}{/events}` tag pair, use the `{categories}{/categories}` tag pair as you would with {exp:channel:entries}, and use it for your needs:

```
{categories}{if category_id == 3}Some class{/if}{/categories}

```
> 1 votes

---
Tags: solspace-calendar
---