# Question
Title: Providing Tracking Number in Account Order Page
I'm looking to add the {order\_status\_message} when a customer views orders in their account. I see that you can use {order\_status\_message} in an email but I'm having issues having it appear after an item has been shipped and the {order\_status\_message} has been used. Here's the code I'm using:

```
{exp:store:orders
                    order_hash="{segment_3}"
                    member_id="CURRENT_USER"
            }

{if no_orders}
    {redirect="/account/login"}
{/if}

<div class="row">
    <div class="span4">

        {order_status_message}

        <fieldset>
            <legend>Summary</legend>
            <div class="control-group">
                <b>Order ID:</b> {order_id}<br />
                <b>Date:</b> {order_date format="%j %M %Y"}<br />
                <b>Status:</b> {order_status}<br />
                <b>Total:</b> {order_total}<br />
                <b>Paid:</b> {if is_order_paid}Yes{if:else}No{/if}
            </div>
        </fieldset>
    </div>
    <div class="span4">
        <fieldset>
            <legend>Billing Details</legend>
            <div class="control-group">
                <div><b>{billing_name}</b></div>
                <div>{billing_address1}</div>
                <div>{billing_address2}</div>
                <div>{billing_address3}, {billing_region_name}, {billing_postcode}</div>
                <div>{billing_country_name}</div>
                <div>{billing_phone}</div>
                <div>{order_email}</div>
            </div>
        </fieldset>
    </div>
    <div class="span4">
        <fieldset>
            <legend>Shipping Details</legend>
            <div class="control-group">
                {if shipping_same_as_billing}
                    Same as Billing Details
                {if:else}
                    <div><b>{shipping_name}</b></div>
                    <div>{shipping_address1}</div>
                    <div>{shipping_address2}</div>
                    <div>{shipping_address3} {shipping_postcode}</div>
                    <div>{shipping_region_name}</div>
                    <div>{shipping_country_name}</div>
                    <div>{shipping_phone}</div>
                {/if}
            </div>
        </fieldset>
    </div>
</div>

<table class="table">
    <thead>
        <tr>
            <th style="width:60%">Product</th>
            <th style="text-align:right">Price</th>
            <th style="text-align:center">Qty</th>
            <th style="text-align:right">Total</th>
        </tr>
    </thead>
    <tbody>
        {items}
            <tr>
                <td>
                    <h4><a href="{path='store_example/product'}/{url_title}">{title}</a></h4>
                    <p><small>
                        <b>SKU:</b> {sku}<br />
                        {modifiers}
                            <b>{modifier_name}</b>: {modifier_value} {if price_mod_val}({price_mod}){/if}<br />
                        {/modifiers}
                    </small></p>
                </td>
                <td style="text-align:right">{price}</td>
                <td style="text-align:center">{item_qty}</td>
                <td style="text-align:right">{item_subtotal}</td>
            </tr>
        {/items}
        <tr>
            <th colspan="3">Subtotal</th>
            <th style="text-align:right">{order_subtotal}</th>
        </tr>
        {if order_shipping_val}
            <tr>
                <td colspan="3">Shipping</td>
                <td style="text-align:right">{order_shipping}</td>
            </tr>
        {/if}
        {if order_tax_val}
            <tr>
                <td colspan="3">{tax_name} ({tax_percent}%)</td>
                <td style="text-align:right">{order_tax}</td>
            </tr>
        {/if}
        <tr>
            <th colspan="3">Total</th>
            <th style="text-align:right">{order_total}</th>
        </tr>
    </tbody>
</table>

{/exp:store:orders}

```

# Answer
In Store 1.x, `{order_status_message}` was only available in the email templates, and not in the order tag.

In Store 2, this has been added to the order tag as well.
> 1 votes

---
Tags: expresso-store
---


# Question
Title: Expresso Store USPS shipping method for international orders
We run a store that has 50/50 Domestic & International orders daily. I am trying to set up some shipping methods using the USPS Shipping Method & can not see a way to restrict these shipping methods to international countries only.

Heres an example:

1. Create new shipping method called 'USPS International Small Flat Rate Box'
2. Service: Priority
3. Mail Type: Package Service
4. Container: Small Flat Rate Envelope (no small flat rate box avail)

There's a few issues with this. The biggest being no country designation so the method will apply to all countries. The 2nd being only some USPS methods are avail.

The shortcoming I believe I am finding is that the USPS module can only be used for US shipments. All international shipments will need to be created with the 'default shipping module' & using respective rules.

This certainly creates a ton more work as there's no way to set up one rule for all international countries. Basically we ship to over 50 countries. Each country would need a separate rule set up for each international shipping service. Typically this is 'USPS Priority International' , 'USPS Express International', 'USPS First-Class Package International' & 'USPS Small Flat Rate Box' - This would be 200 shipping methods needed to be created manually.

This is one area where I believe Brilliant Retail handles brilliantly with its 'Shipping Calculator'. Am I missing something or is this a huge short coming with store shipping?

# Answer
> 1 votes
Per this answer, Store currently on supports domestic (US) rates for the USPS shipping plugin.

As USPS international rates use a completely separate API, this will require some custom development if you need to get it to work worldwide.

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


title: Item Shipping From

text:
# Question
Title: Item Shipping From
I'm setting up the Google shopping feed for a new site and I need to provide a cost for shipping on each item but I can't find any way to get the lowest possible (or any) shipping cost for that item. How can I get this?

# Answer
> 2 votes
It's not possible using the native Store tags to calculate the shipping address for an item before you add it to your cart (because that would require a destination address).

If you need to do this, the best way would be to use the EE query module to query the `exp_store_shipping_rules` table and select the correct rate based on the item size/weight and destination country/state. How complicated this is depends on how many shipping rules you have set up and which attributes of the product you are using to calculate rates.

---
Tags: expresso-store
---


# Question
Title: How to setup Virtual Gifting between members with Store
Here's what I would like to do, I would like my site members to be able to send virtual gifts to each other, the problem is how to associate that member A sent a gift to member B? And also how to retrieve a list of all the gifts that a certain member has received/gifted?

I'm already using Exp:resso Store on the site and also Zoo Visitor.

Even though Credits apparently doesn't work with Store, ideally these purchases would be made with credits, so that the members could use the credits they received by participating on the site to send free gifts, for example.

Any thoughts?

Also has anyone ever worked with a payment system like Boku?

ETA: I think I've figured out how to decode the stored modifiers for purchased items, so part of my problem is solved, I can write a plugin to retrieve the data. Nevertheless if you have any input related to the implementation of such system, please let me know.

Thanks!

# Answer
Last I heard there was a beta version of Credits with support for Store, so it's worth contacting DevDemon if you want access to that.

To access the list of items purchased for a user you can simply check the `exp_store_order_items` table. The item modifiers are stored as JSON (Store 2) or a Base64 encoded serialized array (Store 1).
> 1 votes

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


# Question
Title: I upgraded my site from 2.1 to 2.6 and I get this error when trying to go to feildtypes
I upgraded my site from 2.1 to 2.6 and I get this error when trying to go to feildtypes:

> Unable to load requested field type file: ft.rel.php. Confirm the fieldtype file is located in the expressionengine/third\_party/ directory

Any ideas?

# Answer
> 2 votes
I deleted the file ft.rel.php in extensions and it works!!!

# Answer
> 1 votes
Get the EE 2.6.1 update, it appears EllisLab updated that fieldtype's structure from 2.6 to 2.61.

# Answer
> 1 votes
I posted the below comment here: Unable to load requested field type file: ft.rel.php

I had the same problem only it was "ft.matrix\_url\_title.php"

I am on 2.6.1 and Matrix 2.5.5

The weird thing was that it was ok on my local machine but not on my dev server.

Turns out that the db table exp\_fieldtypes on the dev server had the field type name ("name" in the db column) as "matrix\_url\_title" whereas the local db had "matrix". Once I changed the dev server db to matrix it worked. So there was obviously a conflict when upgrading either to 2.6.1 (from 2.4.0) or to Matrix 2.5.5.

# Answer
> 1 votes
This is a somewhat old thread, but for anyone else that has this issue... The fix that worked for me was to remove the row in the exp\_fieldtypes table in the EE database.

---
Tags: ee2, plugin, upgrade
---


# Question
Title: Unable to upload files with FF Matrix 1.3.5
All fields using the FF Matrix fieldtype (version 1.3.5) have suddently stopped working. My client can no longer upload files, and the fields can no longer be expanded to add new rows.

This is an old but very active site using EE 1.6.8 build 20100121. The FF Matrix fields are the heart of the site, and my client reports that they were working fine until yesterday.

Is this a known issue? Is there an update to FF Matrix that is compatible with EE 1.6.8 which could fix the problem? Or some other fix?

Brian

# Answer
Have the host look at the /tmp directory for your hosting account. It might be full or permissions may have changed.

Also, look at your php logs. If there is a specific PHP error stopping the upload, it might be there.

Also, look at the actual hosting account's diskspace. Maybe you've hit your limit.
> 1 votes

---
Tags: matrix, file-uploads, ee1, fieldtype
---


# Question
Title: Zenbu errors in log file: Undefined variable: rule_cond
I'm trying to identify and fix the errors that I keep seeing in my log files. I'm on EE2.6.1, with Zenbu 1.8.3, and I'm seeing the following errors all over my log files.

`ERROR - 2013-08-26 13:17:31 --> Severity: Notice --> Undefined variable: rule_cond /home/highland/public_html/system/expressionengine/third_party/zenbu/views/zenbu_index.php 28
ERROR - 2013-08-26 13:17:31 --> Severity: Notice --> Undefined variable: rule_cond /home/highland/public_html/system/expressionengine/third_party/zenbu/views/zenbu_index.php 22`

I'm not sure if this is related or not, but I recently also had an issue with Zenbu when trying to display the "Dates & Options" field from Solspace Calendar events.

Any insights into the cause of this, or possible fix? Thanks!

# Answer
> 3 votes
This should be fixed for next release (i.e. after version 1.8.5.2).

In the meantime, if you want to try and fix this right away, go in **/system/expressionengine/third\_party/zenbu/views/zenbu\_index.php** and change line 22 from

```
<?php $selected = $optval == $rule_cond['field'] ? 'selected="selected"' : '';?>

```

to

```
<?php $selected = isset($rule_cond['field']) && $optval == $rule_cond['field'] ? 'selected="selected"' : '';?>

```

and line 28 from

```
<?php $selected = $val == $rule_cond['field'] ? 'selected="selected"' : '';?>

```

to

```
<?php $selected = isset($rule_cond['field']) && $val == $rule_cond['field'] ? 'selected="selected"' : '';?>

```

---
Tags: ee2, error, solspace-calendar, zenbu
---


title: Grid and Switch Tag unexpected results

text:
# Question
Title: Grid and Switch Tag unexpected results
I'm building out a photo gallery using the grid field type and everything works fine with this code:

```
{gallery}
  <li class="{gallery:switch='one|two|three'}">
    <a href="{gallery:photo}"><img src="{gallery:photo:square}" alt="{gallery:caption}" /></a>

    {if gallery:caption}<h5>{gallery:caption}</h5>{/if}
  </li>
{/gallery}

```

However the switch tag is outputting the classes in the wrong order which is why I changed them to numbers, really they should be clear||last. The unexpeced output is here:

```
<ul id="gallery">
  <li class="two">
    <a href="http://domain.com/uploads/gallery/test16.jpg"><img src="http://domain.com/uploads/gallery/_square/test16.jpg" alt=""></a>

              </li>

  <li class="three">
    <a href="http://domain.com/uploads/gallery/test15.jpg"><img src="http://domain.com/uploads/gallery/_square/test15.jpg" alt="Mmm Caffeine!"></a>

    <h5>Mmm Caffeine!</h5>          </li>

  <li class="one">
    <a href="http://domain.com/uploads/gallery/test12.jpg"><img src="http://domain.com/uploads/gallery/_square/test12.jpg" alt="Marshmallows!"></a>

    <h5>Marshmallows!</h5>          </li>

  <li class="two">
    <a href="http://domain.com/uploads/gallery/test5.jpg"><img src="http://domain.com/uploads/gallery/_square/test5.jpg" alt="Be Careful"></a>

    <h5>Be Careful</h5>          </li>
</ul>

```

Notice that the classes get output two three one two

**not**

one two three

Any idea why this is happening or how to fix it?

# Answer
> 6 votes
It looks like you found a bug, Sean, sorry you got bitten by it. I've reported it and posted a fix here:

https://support.ellislab.com/bugs/detail/19871

---
Tags: templates, grid, switch
---


# Question
Title: Exp:resso Store cart issues on lcoalhost
I'm developing my first Exp:resso Store site and I'm running into an issue with the cart not updating on my local development machine. I develop all my EE sites locally using OSX's built-in apache web server but this is the first time I believe I've ever seen any issues with functionality like this. Are there any reasons why the cart wouldn't update or allow me to add new items when testing on a local environment? I've uploaded this to a staging server and the cart seems to work just fine so it's definitely something in the configuration of my local development web server. It's pretty much the default config with only a couple minor changes to ensure permissions and turn on virtual hosts.

**UPDATE:**

```
RewriteEngine On

# remove index.php
RewriteCond %{QUERY_STRING} !^(ACT=.*)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]

# remove www
# RewriteCond %{HTTP_HOST} ^example.com$ [NC]
# RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]

```

# Answer
> 2 votes
First thing to check is the obvious - is the product out of stock? Have you definitely submitted an `item_qty`?

If those don't work - the best way to diagnose issues like this is to check the Network tab in your browser's developer tools. Make sure the form fields are getting submitted as you expect, and if successful you should see only a single 302 redirect to your checkout page (or wherever your `return=""` tag parameter points to).

Make sure there aren't any extra redirects (for example some script on your website redirecting to HTTPS, or forcing www). Especially since you have a check to force www in your htaccess, make sure you aren't posting to `example.com` and then immediately redirecting to `www.example.com`, because you will lose your form POST data in the process.

---
Tags: expresso-store, apache, localhost
---


title: Problem with pagination

text:
# Question
Title: Problem with pagination
I'm struggling with an issue with pagination on one of our sites...

We are running a multi-language site (English & French). We are using the standard method of having folders at web root (ie. en, fr, etc.). We are also removing index from the URL using the approved Ellis lab way.

```
# rewrite rules
RewriteEngine On

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

```

Lastly We are using the Focus Lab Config file (nothing out of the ordinary here.

The problem is that If I have a URL (http://website.com/index.php/blog) and I click the pagination link, I'm taken to the following URL (http://website.com/en/blogindex.php/P3). It adds index.php after the blog folder, not index as this is the template. secondly it removes index.php after the /en folder which for some reason it seems to need to work. The address that works is (http://website.com/en/index.php/blog/index/P3) OR (http://website.com/en/index.php/blog/P3).

I have absolutely no idea how to modify this URL, it's generated from the pagination.

I have a feeling it has something to do with the Focus Lab Multi config setup, but I wouldn't even know where to start.

Any thoughts? I'm completely baffled...

# Answer
Do you have set $assign\_to\_config\['site\_url'\] in /en/index.php?

~~I recently installed https://github.com/averyvery/Freebie to make EE ignore certain segments.~~

**edit**
i ended up using a find/replace add-on
\- http://devot-ee.com/add-ons/find-and-replace-plus
\- or http://devot-ee.com/add-ons/low-replace
> 1 votes

---
Tags: ee2, focus-lab-master-config, multi-language
---


# Question
Title: How do you manually set the category and status of a channel form?
Right now I have this simple test form:

```
{exp:channel:form channel="data" category="6" status="Closed" return="contact/thanks" }
   <input name="title" type="text">

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

```

The data is submitted but it doesn't set the status or the category. Maybe I am misunderstanding the documentation on how this should work.

# Answer
It appears that the behavior you're experiencing is an accepted bug, at least for the status. See the bug tracker.

There doesn't appear to be a fix posted, but you could potentially create the status and category fields as hidden inputs, if security isn't a big concern.
> 4 votes

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


# Question
Title: How to hide unused member pages from public/google
I recently discovered that member pages for my EE site are showing up in Google search results, even though I'm not currently using members (beyond super admins) and I have no public member page templates.

Here's an example of the page I'm seeing: http://www.weddingwise.co.nz/member/1

Is there any way to hide all pages with "member" in segment1 so they are not visible to public or to Google?

# Answer
> 5 votes
Under Members -\> Preferences in the control panel, you can set the Profile Triggering Word (see docs) to `%` which will make them completely inaccessible from the frontend.

Another technique is to configure it randomly in the config.php like this:

```
$config['profile_trigger'] = rand(0,time());

```

---
Tags: templates, members, google
---


# Question
Title: Problem after upgrading Assets: Underscores in folder-names
I upgraded from assets 1 to assets 2. now my folders which start with an underscore are no more recognized. they exist, the images in those folders are shown in the frontend, but i can no more use them in my filemanager. that's a big problem.

The problem was addressed here, but no solution mentioned. There one of the p&t-stuff writes:

> Firstly, Assets disallows files and folders that begin with a dot or an underscore, as the convention is to user either of those prefixes for hidden files and folders.

Assets 1 did not forbid me to start folder names with underscores, so modestly I expect an assets-immanent solution.

Is there any solution to this problem?

EDIT: just recognized that i am able to create a new folder with underscore in the beginning; this folder is shown.

# Answer
> 2 votes
In Assets 2.2.2 you can't create folders that begin with an underscore. Until we release 2.2.3 it *is* possible to rename a folder to a name that begins with an underscore, but this is a bad idea, as you'll be unable to index these files.

As for the reason why:
1) Since Assets now supports multiple source types, to eliminate the need for querying S3 and other types of servers every time you access a folder, we had to implement an index of all files and all folders.
2) Assets is compatible with EE Image Manipulations (for EE sources)
3) Image manipulations are stored in folders that begin with underscores.

I'm pretty sure you can see where this is going, but I'll explain, anyway.

* Allowing the underscores would mean indexing every file in the image manipulation folder and creating a manipulation for those files. And indexing the created files and so on.
* Allowing folder names that are not used by image manipulations sounds great on paper, until somebody creates an image manipulation that matches the folder name and effectively makes the folder disappear from the File Manager. Not to mention that the user might upload some new files, create a bunch of image manipulations in the folder, delete the manipulation and then complain about how "duplicate have appeared". This all is a support minefield.

So, considering all this and the fact, that having a folder begin with an underscore is rarely a requirement and more often a "I like it that way" kind of thing, we decided to disallow folder names beginning with an underscore.

If you think you have a strong case for having a folder name starting with an underscore, you can update to Assets 2.2.2 and edit the $\_skip\_folder\_patterns array in the third\_party/assets/helper.php file, but the support we can provide in cases of modified installations is pretty limited.

---
Tags: assets, pixelandtonic
---


title: Variables in templates

text:
# Question
Title: Variables in templates
I want to update a variable based on my module. I can pass the variable from the main template (say A) to the embedded one(say B). But how can I retrieve this variable back in Template A after updating the variable from B.

Or is there any other way to use a variable in a template and gets updated from a module and the updated variable to be used in the proceeding exp: calls to the module?

When I try to update the variable, I always get the first assigned value.I think the issue is with the parse order.

If anyone knows, please help how to handle this requirement.

Thanks

# Answer
> 2 votes
Embeds are normally parsed at the end.
You can try setting a variable with Stash.
In the main-template get the variable at process-end.

A better approach is to use stash to store your data
in the first place, and avoid an extra embed altogether.
https://github.com/croxton/Stash

```
// template1 -----------------------------------------
{exp:stash:set name="myvar"}value1{/exp:stash:set}
<h1>Test1</h1>
<p>The value is: {exp:stash:get name="myvar" process="end"}</p>
{embed="group/template2"}

// template2 -----------------------------------------
<h2>The embed</h2>
<p>myvar: {exp:stash:get name="myvar"}</p>
{exp:stash:set name="myvar"}value-embed{/exp:stash:set}

// output --------------------------------------------
Test1
The value is: value-embed
The embed
myvar: value1

```

# Answer
> 1 votes
If you need to modify the variable in the process of template parsing, I would suggest creating a plugin that will utilize EE Session cache.

Depending on your exact needs, you may find Low Variables useful as well.

---
Tags: templates, variable
---


# Question
Title: Using custom field in freemember registration form
I have a Select custom member field, how do I display this in the Freemember registration form?

it is called "school", the below code does not seem to work, maybe I am doing it wrong?

{field:school}

EE 2.7

```
                    {exp:freemember:register return="{segment_1}/{segment_2}/register-success" error_handling="inline" error_delimiters='<span class="error">|</span>'}

                    <p class="form-element">
                        <label for="username">Username</label>
                        <input type="text" name="username" value="" class="txtbox" /><br />
                        {error:username}
                    </p>

                    <p class="form-element">
                        <label for="email">Email Address</label>
                        <input type="email" name="email" value="" class="txtbox" /><br />
                        {error:email}
                    </p>

                    <p class="form-element">
                        <label for="school">School</label>
                        {field:school}
                        {error:school}
                    </p>

                    <p class="form-element">
                        <label for="password">Password</label>
                        <input type="password" name="password" value="" class="txtbox" /><br />
                        {error:password}
                    </p>

                    <p class="form-element">
                        <label for="password_confirm">Confirm Password</label>
                        <input type="password" name="password_confirm" value="" class="txtbox" /><br />
                        {error:password_confirm}
                    </p>

                    {if captcha}
                    <p class="form-element">
                        <label for="captcha" style="margin-bottom:5px;">Please enter the following characters into the box below:</label>
                        <br />{captcha}<br />
                        <input type="text" name="captcha" value="" class="txtbox" /><br />
                        {error:captcha}
                    </p>
                    {/if}

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

                {/exp:freemember:register}

```

# Answer
Your code works fine for me, so here are some things to check:

* Make sure you running the latest version of FreeMember
* Make sure you spelled the custom field correctly. Do you have a prefix that you use for the custom member fields or anything?
> 2 votes

# Answer
I couldn't get this to work unfortunately.

I ended up using a custom member field name in a select drop down populated by categories, so the client could update and change the list options. Thanks
> 0 votes

---
Tags: freemember
---


title: Problems with pages module and page url

text:
# Question
Title: Problems with pages module and page url
At the moment I'm strugling with the pages module and the page uri. I have the following page created with the pages module:

```
members
 |- members/calendar
 |- members/safety

```

When I visit the URL `www.mypage.com/members` I will see the correct page.

When I visit the URL `www.mypage.com/members/calendar`, I will see the correct page.

But when I visit the URL `www.mypage.com/members/calendar/2013-12`, the `/members` page is shown.

But I need the calendar page and the last segment is a kind of variable. I use the Low Events calandar on the calandar page. Strict URL is "off".

If I put a question mark in the url `www.mypage.com/members/calendar/?2013-12` the calandar is shown, but now there is no `segment_3` that I can use in selecting the month in the low events calendar.

How do I fix this issue?

# Answer
> 4 votes
This is what the Template Routes add-on was made for. In your EE config.php, add your template routes config:

```
$config['template_routes'] = array(
  ':page:XX/(\d{4}-\d{2})' => 'site/member-calendar',
);

```

where XX is the entry\_id of the members/calendar entry and 'site/member-calendar' is the template\_group/template\_name of your template.

# Answer
> 3 votes
Since you want the page content to be dynamic and not static the proper way to do this would be via the regular ExpressionEngine group/template/entry url parsing structure.

The Pages module is really for making "static" content. It looks for specific URLs and will not look for partial URLs then take the remainder as parameters - this is what the normal URL parsing is for.

Why are you using it in preference for the "normal" method in this case?

Because there is no Pages URL for /members/calendar/2013-12 the system defaults back to regular URL parsing which is why you get the members page.

---
Tags: url, pages
---


# Question
Title: Wygwam fields disappeared from entry screen
I am using Wygwam 3.2.1 and it has been working fine, but now the field titles are showing on the entry screens but the field and text that had been previously entered is not visible. (it is still showing on the actual rendered website) It almost looks like it's minimised on the entry screen.

I have tried to overwrite the themes and system folders for Wygwam and run the module update, but still no go.

Could anyone help??

# Answer
I have solved the problem: I had added my own styles.js file but the link had an error in it. It was preventing Wygwam from loading.
> 2 votes

---
Tags: wygwam
---


title: Custom Member fields to be unique

text:
# Question
Title: Custom Member fields to be unique
I am using freemember forms to create my "registration" page. I have two custom member fields "employee last name" and "employee id". I added them in the "custom member fields" section. I need to make these two fields unique and fail the registration process if the values entered in the registration process are duplicates.

I could not find "unique" attribute in the custom member fields. Only "required" attribute. any help in this regards will be much appreciated.

# Answer
I don't think that there is anything in Freemember that you can use to force the values to be unique out of the box. Having said that you can do it with a bit of AJAX in your template. MadeByHippo posted an example of it on their blog a while back that might be of interest for you. ClientSide Username Checking
> 1 votes

---
Tags: freemember, member-management
---


title: Disable certain Combination Variations

text:
# Question
Title: Disable certain Combination Variations
So, my first time round with expresso store.

What i'm hoping to do is limit certain combinations of variations, as well as change the price for combinations.

The products are custom made so the materials and dimensions affect the price.

Here's an example.

```
Item      Size      Material     Price
Table     300mm     Mahogany     £250.00
Table     500mm     Plywood      £200.00
Table     500mm     Mahogany     N/A

```

Also, need to be able to display a message dependant on the combination, too - tho I can probably do that easiest by detecting the price (as there will be many variation options, there will be few price variations).

Anyway, will appreciate any and all help, if the answer is 'build an extension to do it' that's fine - just don't want to get into all that if I just don't need to.

# Answer
> 2 votes
You will probably need to write an extension to handle something like this because currently if you have 2 modifier groups "Size" and "Material" you would set how each modifier in each group effects the price individually.

Basically if 300mm added £50 it would add that and then if Mahogany added an additional £50 that would be selected. In a situation where I selected 500mm and Mahogany it would still only add £50 for the Mahogany selection and then whatever you have set the price for 500mm.

You should be able to use the limit stock option however to prevent certain configurations from being selected.

---
Tags: expresso-store
---


title: Output error from cart items

text:
# Question
Title: Output error from cart items
I'm getting an error when trying to call a channel entries tag from inside of {items}. If I remove the channel entries it's fine:

```
{exp:store:checkout}

    {items}

        {exp:channel:entries}
            {title}
        {/exp:channel:entries}

    {/items}

{/exp:store:checkout}

```

The error is just a notice, but an error nonetheless:

> A PHP Error was encountered
>
> Severity: Notice
>
> Message: Undefined property: EE::$typography
>
> Filename: core/EE\_Output.php
>
> Line Number: 308
>
> Fatal error: Call to a member function parse\_type() on a non-object in /Sites/mysite.com/source/ee/expressionengine/core/EE\_Output.php on line 308

Any suggestions?

This is on EE 2.7.2, latest Store.

# Answer
> 2 votes
When you are looping through the items in your cart/checkout tags you should add `entry_id="{entry_id}"` to the channel entries tag as the `{items}` will allow you to output the entry\_id of items in the cart. Your template should look something along the lines of:

```
{exp:store:checkout}
    {items}

        {exp:channel:entries entry_id="{entry_id}" limit="1" dynamic="no"}
            {title}
        {/exp:channel:entries}

    {/items}
{/exp:store:checkout}

```

Having said that you do not need to use a channel entries loop to get the title, url\_title and a bunch of other product related info (you can see the entire list here). You only need to use the channel entries loop if you are trying to grab information that you have stored in other custom fields (images, descriptions, etc).

# Answer
> 1 votes
Try moving your `{exp:channel:entries}` into an embed template like this.

**In your main template use:**

```
{exp:store:checkout}
    {items}
        {embed="store/items"}
    {/items}
{/exp:store:checkout}

```

**In your embed template use:**

```
{exp:channel:entries dynamic="no"}
         {title}
{/exp:channel:entries}

```

**\******* rename "store" to your correct template group name

---
Tags: expresso-store
---


title: Invalid EE Conditional Variable

text:
# Question
Title: Invalid EE Conditional Variable
This error:
Invalid EE Conditional Variable
Filename: libraries/Functions.php
Line Number: 2761

occurs when I have this code in a BrilliantRetail template:

```
{items}
<tr>
  <td class="product_info">
    {!--
        Only show the product image for publications or JM fund
    --}
    {if "{sku}" != "CE_FEE" AND
        (preg_match('/^NOTE/',  "{sku}") OR
         preg_match('/^PUB/',   "{sku}") OR
         preg_match('/^EPUB/',  "{sku}") OR
         preg_match('/^JMMRF/', "{sku}")
        )
    }
         <img src="/media/{image_thumb}" title="{title}" alt="{title}" width="100">
    {/if}
    <h5><a href="{exp:brilliant_retail:path src='product/{url_title}'}">{title}</a></h5>
    {options}
  </td>
  <td class="align_center">{price_html}</td>
  <td class="align_center"><input name="qty[{hash}]" class="input_tiny" type="text" value="{quantity}" /></td>
  <td class="align_center">{subtotal}</td>
  <td><a href="{remove_link}">
    <img src="/images/icons/trash.png" alt="Remove" title="Remove Item" /></a>
  </td>
</tr>
{/items}

```

This only began happening when I upgraded to 2.7.2. Worked perfectly with 2.5.2.

What should I check?

# Answer
> 2 votes
I see that you have php preg\_match but no opening/closing php tags. Are those elsewhere in the code? If not then add opening/closing php tags and see what happens.

# Answer
> 2 votes
A good starting point for an error like this is to reduce your code... remove your conditional line by line until you find the offending line.

Also, try this patch posted to a similar EE bug: https://support.ellislab.com/bugs/detail/17989

# Answer
> 0 votes
Here's the final code:

```
{items}
    <tr>
        <td class="product_info">
<?php
    if("{sku}" != "CE_FEE" AND (preg_match("/^NOTE/",  "{sku}") OR
                                preg_match("/^PUB/",   "{sku}") OR
                                preg_match("/^EPUB/",  "{sku}") OR
                                preg_match("/^JRMMF/", "{sku}"))) {
?>
            <img src="/media/{image_thumb}" title="{title}" alt="{title}" width="100">
<?php
    }
?>
            <h5><a href="{exp:brilliant_retail:path src='product/{url_title}'}">{title}</a></h5>
            {options}
        </td>
        <td class="align_center">{price_html}</td>
        <td class="align_center"><input name="qty[{hash}]" class="input_tiny" type="text" value="{quantity}" /></td>
        <td class="align_center">{subtotal}</td>
        <td><a href="{remove_link}"><img src="/images/icons/trash.png" alt="Remove" title="Remove Item" /></a></td>
    </tr>
{/items}

```

---
Tags: variable, brilliantretail
---


# Question
Title: Expire Entry X days after status changed to X
I would like an entry to fall off of a Channel Entries loop when X days have passed since the status was changed to X. Is there an easy way to accomplish this? Or even another method?

I could have them just set the expiration date out X days instead of using the status change method, I was just looking for an easy and intuitive way to accomplish this.

# Answer
I thinks is no such function from the box. You can make ext. I made small example for you. This ext. don't have any ui for settings, so you will need to setup what you want in

```
if ($meta['status'] != $status_prev && $meta['status'] == "closed" )
{

    $this->EE->api_channel_entries->meta['expiration_date'] = $this->EE->localize->now + 30*60*60*24; // 30 days +
}

```
> 4 votes

# Answer
I use auto\_expire for this. http://devot-ee.com/add-ons/auto-expire

> ... automatically expire new entries. It adds a predefined amount of time to the entry date

auto\_expire just runs an SQL query on entry\_date \> offset change status.

p.s. +1 for swift max\_lazar on status change add-on, set expiration\_date on status change.
> 1 votes

---
Tags: channel-entries, date, expire
---


# Question
Title: Super Search: is it possible to search category1&&category2 from two seperate form fields?
I'm planning on having two category groups assigned to each one of my entries, with one or more categories selected from each group, for each entry.

One category group would be "type" and the other "location".

Using Super Search, would it be possible to build the search form so that each of these category groups had their own select box, and then when the form is submitted, the selected categories from each groups box would be combined into the search string like:

```
category=category1&&category2

```

Essentially what I'm saying is:or can you use a category array search with data from that array coming from multiple inputs?

# Answer
Yes. This is documented in the **SuperSearch docs**.

```
 <select name="category[]">
  <option value="{category_name}&&">{category_name}</option>
</select>

```

All selects will use `name="category[]"` and option values will have `&&` at the end
> 1 votes

---
Tags: solspace, supersearch
---


# Question
Title: Project request form system in EE: Freeform Pro vs Channel Form (SafeCracker)
I'm building a project request system for our organization and think I know what I want to do, but want to run it by some others first.

Our graphics department gets requests from staff and other departments for graphics projects: Newsletters, business cards, branding, posters, event promotion materials, etc. Right now they don't have a very good system, they are using email. People send an email and ask for what they need. THis often leads to many emails going back and forth before the graphics department has all the info they need. They have asked me to find some way to do the following:

* all info from online request form
* Status (Unassigned (red), Assigned (orange), With Designer (yellow), Out for Review (yellow), Out to Client (yellow), Sent to Print (green), Complete(blue)
* Priority (ASAP, High, Medium, Low)
* Date Submitted
* Billed (check box)
* estimate
* sent?(check box)
* project #
* notifications sent to designer when a project is assigned to them

I can do this all in ExpressionEngine at least two ways. The most obvious is to use a Channel and the Channel Form tags to do this on the front end. I could also use Freeform Pro (we are using it for other forms). It seems that using Channels/Channel Form (Safecracker) is the most straightforward approach. Would Freeform Pro offer any advantage? I'm leaning toward Channels right now since everything I'd need (Postmaster for the notifications for one) works natively with Channels and isn't fully supported in Freeform Pro.

Alternatively, are there off the shelf solutions like Basecamp (but not Basecamp) that do this? We don't need the client to be able to edit their entries, just the graphics manager to see the entries, assign them to designers, and mark them as completed when they are done. Sort of a project dashboard for her to keep track of things.

# Answer
If you're going to be using a form submission to track your project requests all the way through and updating status along the way, I'd think the channel form would be the way to go. With Freeform Pro, you can't really do any editing from the front-end after the initial form is submitted. Users of the control panel can definitely access the form submissions and edit them though, but it seems to me that it may be going a bit beyond what Freeform is designed for.

Ultimately, I think it's really just a matter of what you're comfortable with and what accomplishes your needs. Both routes would likely work fine.
> 3 votes

# Answer
I would do Channel Entries with Channel Form (safecracker) as that will give you much more control over how you interact with and edit the data after its submitted.

However, there are other systems that would do this more easily out of the box. Maybe even just set up a Trello board? (https://trello.com/).

Each request would be a new card in Trello. You can use labels for status. Simply drag to re-order cards for urgency/priority. You can add comments and upload files to each card.

Some of the details like billed, project #, sent?, etc. might need to be simple comments.

If not Trello, you could try a issue tracking/ticket system, or a more complete project management tool.
> 1 votes

---
Tags: safecracker, solspace-freeform, solspace, channel-form, postmaster
---


# Question
Title: Setting screen name dynamically in channel forms
Is there a way to set the "screen name" dynamically for a member via `{exp:channel:forms}`?

I only see `dynamic_title` parameter. Is there a way to do this for screen name?

# Answer
> 1 votes
I don't see in the **channel:forms docs** that you can set screen\_name with this tag.

---
Tags: channel-form, screen-name
---


# Question
Title: Exp:resso store add item to cart on load
So I have a part of a site we are working on that has some unusual needs for checkout that I'm wondering how best to accomplish. It's an online application with an application fee at the end of the process. The application is all powered by channel:form and what we are hoping to do is have the last page of the form be a credit card form. We can't figure out how to do a checkout without having them go through an "add to cart" type step?

We have two channels, applications and products, and we made a product called "application fee" but can't figure out how to add it to a cart automatically?

The second part of the question is that ideally after they pay for an item it would update the application's status field...

Are either of these two things possible?

# Answer
There are several answers on this site that will help with adding a product to the cart.

1. This one is for a single page donate process:
https://expressionengine.stackexchange.com/a/11037/28
2. This one is for adding to the cart using Ajax:
https://expressionengine.stackexchange.com/a/6086/28
3. Another using Ajax:
https://expressionengine.stackexchange.com/a/11607/28

---

A couple options for changing the status after payment is complete:

1. Build an Extension using the Exp:resso Store `store_order_complete_end` hook:
https://exp-resso.com/docs/extension\_hooks.html#store\_order\_complete\_end
2. Add channel:form to the order "success page" and set the status in a hidden input... then submit the form using Ajax.
> 4 votes

---
Tags: expresso-store
---


# Question
Title: Invalid EE conditional variable error - UPDATED
**NEW INFO** OK, I found that the error was being thrown by a custom exception built into expression engine that will do partial matches on variable names if it doesn't find the original one.

From libraries/Functions.php:

```
// There is a partial variable match being done
// because they are doing something like segment_11
// when there is no such variable but there is a segment_1
// echo  $x[$j]."\n<br />\n";
trigger_error('Invalid EE Conditional Variable: '.$matches[0][$i], E_USER_WARNING);

```

This code is part of a loop, essentially. We do have a variable called `deal`, which in certain cases evaluates to N (the element that's being processed by the template is not a deal). The error is only being thrown in cases where there is no `deal_original_price` (i.e. on rows that are not deals). I don't know why it's even trying to evaluate that, though, because the entire call is inside another conditional that only runs if `deal` is Y.

```
{if deal == "Y" AND coupon == "N"}
    <tr data-deal_id="{deal_id}">
        <td class="productPrice" style="vertical-align: top;">${deal_total}<br />
            {if deal_original_price && deal_original_price != "" && deal_original_price <> deal_total}
                <span class="originalDealPrice">${deal_original_price}</span><br /><span id="modal_change">Why is there a price difference?</span>
            {if:else}
                <span id="modal_same">Pricing Terms & Conditions</span>
            {/if}
        </td>
    </tr>
{/if}

```

Any ideas?

=====================================================================

I have the following html with embedded ee variable:

```
<td class="productPrice">${deal_total}<br />{if deal_original_price != ""}<span class="originalDealPrice">${deal_original_price}</span><br /><span class="removeItem"></span>{/if}</td>

```

It works, to some extent - it is displaying the correct value for `deal_original_price`. But when I check my error logs, I see this:

> \[06-May-2013 10:50:12\] PHP User Warning: Invalid EE Conditional Variable: {if "N"*original*"$1.50" != ""} in C:\gitRepo\qo5phi\system\expressionengine\libraries\Functions.php on line 2843

(Here's what it actually looks like; SE is interpreting the ascii code for the dollar sign.)

I'm new to EE; can anyone tell me what this means? (I realize it's just a warning, not a fatal error, but we're trying to clean up our code and don't want to do anything that throws warnings.)

**ETA**

```
[06-May-2013 11:07:47] PHP Parse error:  syntax error, unexpected T_STRING in C:\gitRepo\qo5phi\system\expressionengine\libraries\Functions.php(680) : eval()'d code on line 194
[06-May-2013 11:07:47] PHP Stack trace:
[06-May-2013 11:07:47] PHP   1. {main}() C:\gitRepo\qo5phi\index.php:0
[06-May-2013 11:07:47] PHP   2. require_once() C:\gitRepo\qo5phi\index.php:188
[06-May-2013 11:07:47] PHP   3. call_user_func_array() C:\gitRepo\qo5phi\system\codeigniter\system\core\CodeIgniter.php:311
[06-May-2013 11:07:47] PHP   4. EE->index() C:\gitRepo\qo5phi\system\codeigniter\system\core\CodeIgniter.php:311
[06-May-2013 11:07:47] PHP   5. EE_Core->generate_page() C:\gitRepo\qo5phi\system\expressionengine\controllers\ee.php:68
[06-May-2013 11:07:47] PHP   6. EE_Template->run_template_engine() C:\gitRepo\qo5phi\system\expressionengine\libraries\Core.php:643
[06-May-2013 11:07:47] PHP   7. EE_Template->fetch_and_parse() C:\gitRepo\qo5phi\system\expressionengine\libraries\Template.php:179
[06-May-2013 11:07:47] PHP   8. EE_Template->parse() C:\gitRepo\qo5phi\system\expressionengine\libraries\Template.php:231
[06-May-2013 11:07:47] PHP   9. EE_Template->advanced_conditionals() C:\gitRepo\qo5phi\system\expressionengine\libraries\Template.php:488
[06-May-2013 11:07:47] PHP  10. EE_Template->parse_template_php() C:\gitRepo\qo5phi\system\expressionengine\libraries\Template.php:3153
[06-May-2013 11:07:47] PHP  11. EE_Functions->evaluate() C:\gitRepo\qo5phi\system\expressionengine\libraries\Template.php:1579

```

# Answer
You should use quotes with variable in condition to match string like:

```
<td class="productPrice">
    ${deal_total}<br />
    {if "{deal_original_price}" != ""}
        <span class="originalDealPrice">
            ${deal_original_price}
        </span><br />
        <span class="removeItem"></span>
    {/if}
</td>

```
> 1 votes

# Answer
Another short & sweet way to write the conditional is:

```
{if deal_original_price}STUFF HERE{/if}

```
> 0 votes

---
Tags: conditionals, variable
---


# Question
Title: Database error after updating Matrix 2.4.3 to 2.5.8
I just updated an EE site from 2.4.0 to 2.7.2. Now going through and updating (many) plugins. I just updated Matrix from 2.4.3 to 2.5.8 and I get the error below while trying to click on Matrix in the Fieldtypes page in the CP. Any help would be awesome, thanks!

```
A Database Error Occurred
Error Number: 1060

Duplicate column name 'is_draft'

ALTER TABLE `exp_matrix_data` ADD `is_draft` TINYINT(1) UNSIGNED DEFAULT '0'

Filename: third_party/matrix/ft.matrix.php

Line Number: 509

```

# Answer
> 2 votes
See this post for info Matrix (2.5.8) update database error

Sounds like it is the same or similar problem. I had this once and the info there was enough to go into the database and sort out the issue.

---
Tags: matrix, assets, pixelandtonic, updating
---


# Question
Title: Showing information based on an entries category
I'm trying to display some information based on the category an entry is in, however I can't get my head around it… If the entry is in more than 1 category it'll still show the information, how do I make it work so if category\_id is selected at all it'll not show the information? Here's my current code:

```
{exp:channel:entries channel="courses" category="2"}
  {categories show_group="2"}
    {if category_id != "2"}
       {course_start-date format='%d %M %Y'}
    {/if}
 {/categories}
{/exp:channel:entries}

```

# Answer
1. php (PHP Parsing Stage: ouput)

{exp:channel:entries channel="courses" category="2"}

```
<?php $excludefrom = '|{categories}{category_id}|{/categories}'; ?>
<?php if (substr_count($excludefrom, "|2|") == 0){?>
      {course_start-date format='%d %M %Y'}
<?php } ?>

```

{/exp:channel:entries}

(you can do the same using Switchee the same way with regex)

*update*

Additional solution:

```
{exp:channel:entries channel="courses" category="2"}

   {if "{categories show_group="2"}2{/categories}" != "2"}
      {course_start-date format='%d %M %Y'}
   {/if}

{/exp:channel:entries}

```
> 3 votes

---
Tags: conditionals, categories
---


# Question
Title: A user loaded 7 images in EE 2.5.5. Two images are missing from the front end display
I had been using EE 1.7 and I could always download a loaded image to check for a large size or formatting problem from the backend. Now with 2.5.5, I am not able to download the images or otherwise see what might be the problem. How do I find out what might be wrong with the images?

# Answer
> 2 votes
> How do I find out what might be wrong with the images?

There could be one (or more) of several things going on. Here are some things to check:

1. Verify that you can upload an image to the upload directory in question. Content → Files → File Manager → click "Upload File" button and upload to your directory. If you succeed then your images are uploading just fine you may have another issue. If the upload doesn't work continue...
2. Verify you can synchronize the file upload directory in EE. Content → Files → File Upload Preferences → click the synchronize icon for the directory in question, then Submit on the following page. If you have trouble here, continue...
3. Make sure your path to this directory is correct in EE by clicking the Edit link on the File Upload Preferences page
4. Make sure the folder exists on the server and has the proper permissions (most likely chmod 777).
5. Repeat step 1 to see if any changes you made worked.
6. If a Super Admin can upload but another member group cannot, check the member group's upload permissions via the same File Upload Preferences.

This is not exhuastive, but should help you in locating most issues or ruling out the most basic of issues normally encountered with file upload issues.

# Answer
> 1 votes
I came across a similar thing this week.

A client had uploaded IMAGE.jpg and image.jpg and had chosen on to display in an entry. EE couldn't distinguish between them and no matter which was selected the uppercase image showed first. Servers (rightly) see them as two files - all paths being case sensitive.

However it appears EE 2+ doesn't see them as two images (in our case using a grid and file fields) so we've had to do some tinkering to get them to display (deleting or renaming then updating entry).

This dual naming issue with upper/lower case could be the reason possibly?

---
Tags: file-uploads, image
---


# Question
Title: Is there an 'order_save' variable in exp:resso Store?
I'm trying to return the total saving for a basket, based on items bought that are on sale. Is this possible?

There's a {you\_save} variable per line, but I'd like a total value including quantities to be displayed as "total saving" in the basket - 'order\_save' or 'order\_saving' would be ideal.

# Answer
> 3 votes
In addition to the `{order_discount}` variable (which displays the total amount discounted during checkout), Store 2.0.4 adds an `{order_you_save}` variable.

`{order_you_save}` returns the total amount saved by ordering products which are on sale.

https://exp-resso.com/docs/release\_notes.html#store\_204

# Answer
> 2 votes
You are looking for the `{order_discount}` variable which is avilable in the cart, checkout, and orders tags.

---
Tags: expresso-store
---


title: Parse exp:channel

text:
# Question
Title: Parse exp:channel
Is there any way to parse tags exp:channel in a third party module. In my custom module I need to call exp:channel, but need to get entry ids before final rendering of the module. Can anyone know how to parse exp calls before rendering the module?

Thanks

# Answer
> 6 votes
While you can't actually parse the tag using your custom module, you can pass parameters to the channel module and run it. Here's a code sample:

```
function your_module_method()
{
    // Set the parameters for the channel:entries tag
    $this->EE->TMPL->tagparams['entry_id'] = $entry_ids;
    $this->EE->TMPL->tagparams['dynamic'] = 'no';

    require_once(PATH_MOD.'channel/mod.channel.php');

    // Instantiate channel module
    $ch = new Channel();

    // return the entries
    return $ch->entries();
}

```

The result is that your module method will function exactly like a `exp:channel:entries` tag with the parameters set as you configure them.

---
Tags: channel-entries, add-on-development, parse
---


# Question
Title: Filter out entries belonging to a parent category
I'm certain this question must have come up before, but can't find any mention of it.

I need to filter out entries that are assigned to a parent category. I'm using this tag

`{exp:channel:entries channel="blog" dynamic="no" limit="3" category="not 32"}`

but this *includes* those entries categorised with child categories of category 32, and will only filter out those entries that are assigned just that one specific category. I want to retain the Auto-assign parent category functionality for my entries.

Any ideas how I could achieve this?

# Answer
We really need a parameter to do this. Unfortunately, we don't have. So, while this:

```
{embed="pages/.entries"
    to_exclude="{exp:channel:categories style='linear' backspace='1' show='32'}{category_id}|{/exp:channel:categories}"
}

```

On your embed:

```
{exp:channel:entries channel="blog" dynamic="no" limit="3" category="not {embed:to_exclude}"}

```
> 2 votes

# Answer
I had a very similar issue a few months ago. We resolved it by using Solspace Primary Category and a custom plugin. Barring a plugin, you can accomplish it with the Active Record plugin and Stash:

First, use Primary Category to assign the main category for each entry. Then drop this in your template (note how the Stash code at the top is all on one line):

```
{exp:stash:entry_ids parse_tags='yes' parse_conditionals='yes' no_results_prefix='ar'}{exp:activerecord select='entry_id' from='exp_primary_category' where="primary_category_id != '32'"}{entry_id}{if total_results > 1}|{/if}{if ar:no_results}0{/if}{/exp:activerecord}{/exp:stash:entry_ids}

{exp:stash:parse process='end'}
    {exp:channel:entries
        entry_id='{stash:entry_ids}'
    }
        {!-- channel entry data --}
    {/exp:channel:entries}
{/exp:stash:parse}

```

That will output only the entries that do **not** have category 32 assigned as their primary category.

Stash is used so we can create a pipe-delimited list of entry IDs early in the template parsing, then use it later on in the channel entries tag.
> 0 votes

# Answer
In the end I used the Child Categories plugin to query all the child categories of a given parent, an feed that into the category="" param in exp:channel:entries. Not very elegant but works.

http://devot-ee.com/add-ons/child-categories
> 0 votes

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


# Question
Title: Trying to write a simple extension... problem 1, getting it to enable!
I'm trying to put together a simple Extension that will update an existing database table when an entries in a specific channel are set to 'open'.

I have been looking at the Ellislab tutorial on creating an extension and have looked at a few others so I have a basic understanding of what's going on but I'd be lying if I said I had a complete grasp at this stage!

So far, I've just got a debug message in the 'meat' of it so I can see if it is actually being called at the right time.

The first problem I'm running up against is getting the extension to activate. When I click "Enable" the CP reports that the extension has been enabled but the in the list of Extensions it still shows as disabled. No errors are shown.

Here's the code so far:

\[CODE REMOVED - UPDATED VERSION BELOW\]

UPDATE: I realised my error. I needed to include

```
 ee()->db->insert('extensions', $data);

```

within the activate\_extension method.

UPDATE 2: The extension still doesn't show as "enabled" although it gets written into the extensions table and appears to call the add\_credits method when required. Any ideas?

UPDATE 3: I have the extension working albeit with some hardcoded stuff that is only pertinent to this particular project.

However, I still cannot get it to actually show as being Enabled (even though it is) and I cannot get it to create a settings page (I think this is related to not being enabled as the settings link is shown just not active).

Here is the 'finished' code:

```
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/*
This extension is intended to add 'credits' to a users account
It is a custom extension that will take the metre value of an invoice entry and apply the required number of credits to the users account
It requires Cartthrob_credits extension to be installed

*/

class FM_credits_from_entry_ext {

    var $name           = 'FM Credits from entry';
    var $version        = '0.1a';
    var $description    = 'Custom extension that will take the credit value of an invoice entry and apply the required number of credits to the users account';
    var $settings_exist = 'y';
    var $docs_url       = '';

    var $settings       = array();

    /**
     * Constructor
     *
     * @param   mixed   Settings array or empty string if none exist.
     */

    function __construct($settings='') {
        $this->EE =& get_instance();
        $this->settings = $settings;
    } // END

    /** Activate extension **/

    function activate_extension() {

        $this->settings = array(
            'credits_per_metre'   => '1',
        );

        $data = array(
        'class'     => __CLASS__,
        'method'    => 'add_credits',
        'hook'      => 'entry_submission_end',
        'settings'  => serialize($this->settings),
        'priority'  => 10,
        'version'   => $this->version,
        'enabled'   => 'y'
        );

         ee()->db->insert('extensions', $data);
    } // END

        /**
         * Update Extension
         *
         * This function performs any necessary db updates when the extension
         * page is visited
         *
         * @return  mixed   void on update / false if none
         */
        function update_extension($current = '')
        {
            if ($current == '' OR $current == $this->version)
            {
                return FALSE;
            }

            if ($current < '1.0')
            {
                // Update to version 1.0
            }

            ee()->db->where('class', __CLASS__);
            ee()->db->update(
                        'extensions',
                        array('version' => $this->version)
            );
        } // END

        /**
         * Disable Extension
         *
         * This method removes information from the exp_extensions table
         *
         * @return void
         */
        function disable_extension()
        {
            ee()->db->where('class', __CLASS__);
            ee()->db->delete('extensions');
        } //END

         function settings() {
            $settings = array();

            $settings['credits_per_metre']      = array('i', '', "1");

            return $settings;
         } // END

        /**
         * Add Credits
         *
         * This function will fire when an entry is submitted/updates
         * If the entry is in the invoices channel then it will check the status
         * If the entry is being set to Approved (from another status) then it will grab the value of the metres purchased field
         * and add create a database row in the Cartthrob_credits_credits table for the logged in user
         * This is really rudimentary and probably won't port to other sites
         *
         */

        function add_credits($entry_id, $meta, $data) {

            $metres = $data['field_id_74'];

            $customer = $meta['author_id'];
            $status = $meta['status'];

            // check that this entry is in fact pending
            // we don't want to add points more than once
            // we are going to use the status to trigger the points addition
            // I can see a potential problem here if an approved entry is edited
            // may need an additional flag to say these points are already added
            // or a hook for the start of editing that only calls the add credits method
            // if the status is changed from pending to approved
            if($status == 'Approved') {

                if ($this->EE->db->table_exists('exp_cartthrob_credits_credits')) {
                    $this->EE->load->helper('data_formatting');

                    $credits_per_metre = sanitize_number($this->settings['credits_per_metre']);

                    $credits_to_add = $metres * $credits_per_metre;

                    $table_name = 'exp_cartthrob_credits_credits';

                    $query = 'SELECT * FROM '.$table_name.' WHERE member_id = '.$customer.' LIMIT 0,1';
                    $result = ee()->db->query($query);

                    if($result->num_rows()!==0) {

                        $credits = $result->row('credits');
                        $new_credit_total = $credits + $credits_to_add;

                        $query = 'UPDATE '.$table_name.' SET credits = '.$new_credit_total.' WHERE member_id = '.$customer;
                        $result = ee()->db->query($query);
                    } else {

                        // no customer found, create a row for them

                       $sql = 'INSERT INTO '.$table_name.' VALUES(null, '.$customer.',null, null, null, null, null, '.$credits_to_add.')';

                       $result = ee()->db->query($sql);

                    }

                }
            }
            return true;

        } // END

} // END CLASS

```

UPDATE: All sorted! The extension wasn't showing as 'Enabled' in the CP because the class name was 'FM\_credits\_from\_entry\_ext' with 2 capital letters at the start. Changing that to 'Fm\_credits\_from\_entry\_ext' fixed it and allowed access to the settings too.

# Answer
I managed to fix this.

My problem stemmed from an incorrect class name and missing a critical bit of code which inserted the necessary information into the extensions table.

I needed to insert;

```
 ee()->db->insert('extensions', $data);

```

within the activate\_extension method

The extension wasn't showing as 'Enabled' in the CP because the class name was 'FM\_credits\_from\_entry\_ext' with 2 capital letters at the start. Changing that to 'Fm\_credits\_from\_entry\_ext' fixed it and allowed access to the settings too.
> 3 votes

---
Tags: add-on-development, extension
---


# Question
Title: Front end login redirect to {page_url} with structure, how to make this work
EE 2.7.2 Structure 3.3.13

I've got a site where I have a front end login form that is on all pages as a modal when clicking the login link in the header. Everything works fine, however for the redirect="" parameter I would like the form to redirect to the page it was filled out on.

using this code:

```
  {exp:member:login_form return="{page_url}"}
    <label>Username</label>
    <input type="text" name="username" value="" maxlength="32" size="25">

    <label>Password</label>
    <input type="password" name="password" value="" maxlength="32" size="25">

    <input type="submit" name="submit" value="Submit" class="button small">
  {/exp:member:login_form}

```

results in a broken url http://domain.com/%7Bpage\_url%7D

and a white page with this message

> The URI you submitted has disallowed characters.

I tried using low variables and preparsing the {page\_url} (same as embedding a template) but that also did not work.

Is there a way to get the {page\_url} to work in the login form?

# Answer
Use the Structure global variable `{structure:page:uri}` which is the same as EE's native "page\_url" variable.
> 4 votes

# Answer
Sounds like it's just not parsing your {page\_url} -- try parse="inward"?

```
{exp:member:login_form return="{page_url}" parse="inward"}

```
> 1 votes

# Answer
Try using EE's `{current_url}` Standard Global Variable. I've successfully used this for the return parameter on the Member module login\_form tag for exactly the same scenario you are describing.

```
{exp:member:login_form return="{current_url}"}
   ...
{/exp:member:login_form}

```
> 0 votes

---
Tags: structure, login, redirects, member-management
---


# Question
Title: File Field within Matrix inside a Low Variable fails to update file field on save
I'm having a similar issue to this one but with a standard File field type instead of Assets. I tried just a File field type inside a Low Variable and it updated properly. This was dated bcd in June and it appears the problem was resolved with an update to Assets. Any ideas why this happens with the File field type? Solutions?

EE 2.7.2, Matrix 2.5.9, Low Variables 2.4.0

# Answer
> 0 votes
It appears to have been an issue with Matrix and P&T has pushed out a version that resolves this issue. In fact this is the only update according to their change log. Nice job P&T.

# Answer
> 2 votes
I'd suggest reuploading the Matrix theme files. It's possible they were missed or corrupted if you recently upgraded.

---
Tags: matrix, file-uploads, low-variables
---


# Question
Title: Call exp stash multiple times through multiple exp channel calls
Can I set the entry ids to the same stash name multiple times? ie, at one exp channel call , i will call `exp:stash:set name='x'`. Again I want the entry ids append to the same 'x' with another `exp:channel:entries` call. Is it possible?

It seems it's not working if we call `exp:stash:set` again.

My code:

```
{exp:stash:set  name="recently_viewed_ids" replace="yes" output="no" parse_tags="yes" trim="yes" append="yes"  }
  {exp:channel:entries channel="blog"  dynamic="no" backspace="1"  entry_id="not 26|24"}{entry_id}|{/exp:channel:entries}
{/exp:stash:set }

{exp:stash:get name='recently_viewed_ids'}{/exp:stash:get}

```

Outputs `23|22`

```
{exp:stash:append name="recently_viewed_ids"  }
  {exp:channel:entries channel="business"  dynamic="no" backspace="1"  entry_id="8"}{entry_id}|{/exp:channel:entries}
{/exp:stash:append }

{exp:stash:get name='recently_viewed_ids'}{/exp:stash:get}

```

Outputs `23|22`

Please help

# Answer
The reason your output on the second get is the same is because of parse order. If you set that get to run later with process="end" it should show the combined result:

```
{exp:stash:set
    name="recently_viewed_ids"
    parse_tags="yes"
    trim="yes"
}
  {exp:channel:entries channel="blog" dynamic="no" backspace="1"}{entry_id}|{/exp:channel:entries}
{/exp:stash:set}

Result 1: {exp:stash:get name='recently_viewed_ids'}

<hr>

{exp:stash:append
    name="recently_viewed_ids"
    parse_tags="yes"
    trim="yes"
}
  {exp:channel:entries channel="business" dynamic="no" backspace="1"}{entry_id}|{/exp:channel:entries}
{/exp:stash:append}

Result 2: {exp:stash:get name='recently_viewed_ids' process='end'}

```

Also, the first set doesn't need to be an append, and the second set needed a parse\_tags parameter. The get also only needs a single tag not a tag pair, because it isn't set as a stash list.

---

UPDATE: Setting the ids as a list:

```
{exp:stash:set_list
    name="recently_viewed_ids"
    parse_tags="yes"
}
    {stash:ids_1}{exp:channel:entries channel="CHANNEL_1" dynamic="no" backspace="1"}{entry_id}|{/exp:channel:entries}{/stash:ids_1}
    {stash:ids_2}{exp:channel:entries channel="CHANNEL_2" dynamic="no" backspace="1"}{entry_id}|{/exp:channel:entries}{/stash:ids_2}
    {stash:ids_3}{exp:channel:entries channel="CHANNEL_3" dynamic="no" backspace="1"}{entry_id}|{/exp:channel:entries}{/stash:ids_3}
{/exp:stash:set_list}

Result 1: {exp:stash:get_list name='recently_viewed_ids'}{ids_1}{/exp:stash:get_list}
<hr>
Result 2: {exp:stash:get_list name='recently_viewed_ids'}{ids_2}{/exp:stash:get_list}
<hr>
Result 3: {exp:stash:get_list name='recently_viewed_ids'}{ids_3}{/exp:stash:get_list}
<hr>
Result 1+2: {exp:stash:get_list name='recently_viewed_ids'}{ids_1}|{ids_2}{/exp:stash:get_list}
<hr>
Result 1+2+3: {exp:stash:get_list name='recently_viewed_ids'}{ids_1}|{ids_2}|{ids_3}{/exp:stash:get_list}

```
> 2 votes

---
Tags: stash, channel
---


# Question
Title: PHP conditional inside EE conditional - parse order problem
This is a bit of a hard one to explain, but I will do my best. If you need any clarification just ask :)

I have a template that needs to display a list of 3 upcoming events, listed by date ascending (nearest first, farthest away last). I have this working with the following code:

```
{exp:channel:entries channel="news-article" dynamic="no" order_by="entry_date" sort="asc" category="1" sticky="no" show_future_entries="yes"}
    {if '{entry_date format="%Y%m%d"}' >= '{current_time format="%Y%m%d"}'}
            <article>
                <a href="{url_title_path='news'}">
                    <p>
                        {title}
                        <span class="time-block">{entry_date {long-date}}</span>
                    </p>
                </a>
            </article>
    {/if}
{/exp:channel:entries}

```

However, this shows all future events, not just the closest 3. I have tried adding `limit="3"` to the channel entries tag but as there are past events, the conditional is never true so nothing shows at all.

So I tried adding a PHP counter to it like so:

```
<?php $counter = 0; ?>
{exp:channel:entries channel="news-article" dynamic="no" order_by="entry_date" sort="asc" category="1" sticky="no" show_future_entries="yes"}
    {if '{entry_date format="%Y%m%d"}' >= '{current_time format="%Y%m%d"}'}
        <?php if ($counter<3): ?>
            <article>
                <a href="{url_title_path='news'}">
                    <p>
                        {title}
                        <span class="time-block">{entry_date {long-date}}</span>
                    </p>
                </a>
            </article>
            <?php $counter ++;
        endif; ?>
    {/if}
{/exp:channel:entries}

```

Parsing PHP on input still displays all results today or in the future, and parsing PHP on output displays nothing. Does anybody know how to get something like this working?

Thanks in advance!

# Answer
> 4 votes
This is easily accomplished using the **start\_on parameter**.

If the start\_on date/time should be current time use:

```
{exp:channel:entries
    channel="events"
    limit="3"
    sort="asc"
    start_on="{current_time format='%Y-%m-%d %H:%i'}"
    show_future_entries="yes"
}

```

---

If the start\_on date/time should be dynamic, enable PHP in the template and set it to be parsed on "input". This is the code you use:

```
<?php
    $current_time = ee()->localize->format_date('%Y-%m-%d %H:%i', ee()->localize->now - 3600);
?>

```

Change the 3600 in the php code to whatever number you need.

```
{exp:channel:entries
    channel="events"
    limit="3"
    sort="asc"
    start_on="<?php echo $current_time; ?>"
    show_future_entries="yes"
}

```

# Answer
> 3 votes
Not a solution to your specific question, but a solution to your general problem (how to display only upcoming events):

This is exactly why I wrote EEvent Helper years ago. The idea is that you set events to expire at the end of their event date, allowing you to easily pull just past events, or just upcoming events.

```
{!-- Upcoming Events --}
{exp:channel:entries channel="events" show_future_entries="yes" sort="asc"}

{!-- Past Events --}
{exp:channel:entries channel="events" show_expired="yes" sort="desc"}

```

(The add-on is not required to do this, but it automates the setting of the expiration date, making it more client-friendly.)

---
Tags: ee2, channel-entries, conditionals, php
---


title: How to use Switchee

text:
# Question
Title: How to use Switchee
I am unable to get Switchee to work. I have installed the Switchee 2.0.6 with ExpressionEngine 2.5.2.

Here is the conditional statement that I'd like to use, where "champions" is a custom field:

```
{if champions == "team 3"}
   <p>team 3</p>
{/if}

```

and here is how I've incorporated Switchee:

```
{exp:switchee variable = "{champions}" parse="inward"}
    {case value == "team 3"}
        <p>team 3</p>
    {/case}
{/exp:switchee}

```

My switchee statement shows nothing in my template in my browser. What am i doing wrong here?

# Answer
> 3 votes
If you look at the documentation a bit more carefully, you'll see that the `{case value="xxx"}` tags only use a single `=` sign.

So, this should work

```
{exp:switchee variable = "{champions}" parse="inward"}
    {case value="team 3"}
        <p>team 3</p>
    {/case}
{/exp:switchee}

```

---
Tags: conditionals, plugin, switchee
---


# Question
Title: Overriding price-based shipping profiles with weight in Store
I have this issue with Shipping costs.

We have 4 profiles setup

```
0-£100 - £6
£100 - £500 - £12
£501 - £4000 - £20
£4001+ - £25

```

The issue comes as we have a product that is in the £12 shipping price bracket however we only charge £6. Which we set a weight to compensate for this issue and it worked. But the issue comes when someone orders another product in £100 - £500 category. It still only charges the £6.

Any suggestions?

# Answer
This may not be the solution but it was for an issue I was having... Try adjusting your shipping rule thresholds to:

```
0 - £101 - £6
£101 - £501 - £12
£501 - £4001 - £20
£4001+ - £25

```

Or some variation thereof.

---

Apparently the rules in Store are "exclusive of the high number...

So setting 0-£101 works for 0-£100... and £101 - £501 works for £101 - £500
> 1 votes

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


# Question
Title: Is there an add-on for paid "premium" entry purchase/upgrade subscription management?
I have a large EE site. Its main purpose is as a directory. Listings (entries) in the directory can be created for free by any member. But I want people to have the option of upgrading their entry to a "premium" entry by purchasing a yearly premium subscription. (Subscriptions would *ideally* be attached to the entry, not the the member, as it's possible for a member to own more than one entry in the directory). Is there an add-on (or combination of add-ons) that could accomplish these steps (or something similar):

* Member chooses to upgrade their entry to "premium" and is taken to a payment page where they pay for a one-year subscription.
* Once payment is done, the entry in question is altered to somehow indicate that it's now "premium" - this could be a custom field, or maybe status (I need to be able to use this field or status as a sort option in Super Search results).
* When member's subscription for any entry is nearly expired, they are emailed a renewal notice with link to payment page to renew subscription.
* Member could see the expiry date of current entry's premium subscription at any time
* If subscription is not renewed, listing is downgraded back to free listing (with custom field or status returned to normal)

I'm aware of **Membrr** (http://www.membrr.com) but I'm worried about reports of slow or non-existent support, and it's for membership subscriptions (whereas my preference is for subscriptions to be associated with entries instead). It may turn out that Membrr is the only way for me to go but I was really hoping to explore alternatives first.

Any suggestions?

# Answer
It's relatively new to the market but have a look at Charge for member billing. Joel is a solid developer and makes great products.
> 2 votes

# Answer
**CartThrob Subscriptions** is an addon for CartThrob2 Pro which gives you subscription payment capabilities.

> **Features**
>
> * Create, sell, and manage subscription plans
> * Customers can update their own subscriptions
> * Create, sell, and manage permissions (ACL-access control levels)
> * Take subscription payments along with product & donation payments in the same transaction
> * Configurable notifications for purchase, rebill success, and rebill failure events
> * Works with many popular payment gateways including Stripe, Authorize.net and eWay
> * Utilizes token/vault based payments. No credit card data is stored on your site.
> 0 votes

---
Tags: add-on, membrr, subscriptions
---


# Question
Title: Initialize Wygwam within Custom Fieldtype
I'm developing a fieldtype add-on and within the fieldtype, I would like to include the option to let users choose Wygwam as the text element, if they have it installed.

Is there some sort of a "build" method in Wygwam I can use within my fieldtype? Similar to the way the native RTE has the following, which you can use to initialize and assign it to text areas:

```
ee()->rte_lib->build_js(0, '.textarea_class', NULL, TRUE);

```

Anyone know if Wygwam has something similar, or anyone have experience in using Wygwam within their own fieldtype?

# Answer
I've done it before. Take a look at the `display_field` method of ft.wygwam.php. You'll see that it's fairly simple to instantiate a WYGWAM field. A few calls to the Wygwam\_Helper class to load the JS/CSS. There are also some helpers for properly formatting the data. You'll need a textarea with an id, and also the ID number of a WYGWAM config. I don't want to replicate their code here, since it's proprietary, but this should send you in the right direction.
> 3 votes

---
Tags: pixelandtonic, wygwam, add-on-development, fieldtype
---


# Question
Title: Adding a Link in Wygwam causes the link to break
I have a Wygwam 3.2.1 field inside ExpressionEngine 2.5.3. When I add a link to a PDF like so using the Source editor;

```
<p>You can download the <a href="/media/downloads/document.pdf">guide</a> to find out more about .</p>

```

It renders like so in the view source on the front end;

```
<p>You can download the <a href="</p">
                                </a></p>

```

In the browser, this obviously just cuts the text off after '... download the '.

Anyone else experienced this issue?

# Answer
> 1 votes
Try changing the "Restrict allowed HTML?" to 'No' in the Wygwam configuration settings. This is located on the WYGWAM Module settings page.

---
Tags: wygwam
---


title: Conditional Plugins: Switchee & IfElse

text:
# Question
Title: Conditional Plugins: Switchee & IfElse
I have some simple conditionals mixed with some advanced conditionals. I've just downloaded Switchee and IfElse and am trying to figure out which plugin is best for each situation. Can someone help shed some light for me by giving me a bit of advice to clarify the best case to use each?

Here is my complete template's code: http://pastie.org/private/fifymxyldxu01jbex6zbq

I'm having some trouble understanding parsing orders, so any wisdom would be greatly appreciated!

# Answer
> 3 votes
You are doing a ton in your template. After a quick look I'd say your slowness is related to your relationship fields.

I suggest installing the **EE Debug Tool** to determine what specifically is "slow" on the page load. That will help you decide how to optimize the template.

I also suggest taking a look at **CE Cache** to see if it makes sense for your project.

# Answer
> 1 votes
If all this are fields within the same `exp:channel:entries`, to use `switchee` or `IfElse` will make no difference.

Conditionals which uses module data are parsed by the module. There's no reason for use an addon.

Take a look at this answer of Low.

Or start by the slide 66 of his presentation.

The key to use this add-ons is to avoid unnecessary parsing, what, in your case, can be done just by not using native Playa tags.

Try to make them to be parsed after the `exp:channel:entries` conditionals.

For example, take note of how much memory and how many queries your templates uses now. Then start to replace the Playa fields that are inside conditionals by module tags.

```
{if pre_event_banner_extra_info != ''}
    <img class="placeholder" src="{pre_event_banner_extra_info}" width="336" height="305" alt="image description" />
{if:else}
{pre_event_video show_future_entries="yes" show_expired="yes" status="open|not blog|homepage feature"}
    <a href="http://{video_player_url}?autoplay=1" class="vimeo" rel="gallery" title="{title}"><img class="placeholder" src="{featured_image_sm}" width="336" height="305" alt="image description" /></a>
{/pre_event_video}
{/if}

```

By:

```
{exp:switchee variable = "{pre_event_banner_extra_info}" parse="inward"}

    {case value=""}
        {exp:playa:children entry_id="{emebd:e-entry_id}" field="pre_event_video" show_expired="yes" status="open|not blog|homepage feature"}
            <a href="http://{video_player_url}?autoplay=1" class="vimeo" rel="gallery" title="{title}"><img class="placeholder" src="{featured_image_sm}" width="336" height="305" alt="image description" /></a>
        {/exp:playa:children}
    {/case}

    {case default="Yes"}
        <img class="placeholder" src="{pre_event_banner_extra_info}" width="336" height="305" alt="image description" />
    {/case}

{/exp:switchee}

```

Check your memory and queries again.

Now, playa is another module and its tags will be discarded before parsing by switchee when not necessary.

---
Tags: conditionals, plugin, ifelse, switchee
---


title: EE form Post Vars

text:
# Question
Title: EE form Post Vars
I have the following code to parse a form submitted in EE:

```
foreach ($fields as $f)
{
    if(isset($_POST[$f]) {
        $$f = $this->EE->input->post($f);
        $$f = $this->EE->security->xss_clean($$f);
        $clean_data[$f] = $$f;
    }
}

```

Not all members in the $fields array may be present in the post.

Does that raise an exception if the field doesn't exist or will it go ahead and create a member in $clean\_data for the missing postvar?

If so, would this be a simplification of the entire loop above?

```
foreach ($fields as $f)
{
    $$f = $this->EE->input->post($f, true);
    $clean_data[$f] = $$f;
}

```

The $fields array is needed to post to a web service. All fields are required in the $fields array but they may not be present in the post.

# Answer
> 0 votes
Why not skip the extra step

```
$clean_data = array();
foreach ($fields as $f)
{
    $clean_data[$f] = $this->EE->input->post($f, true);
}

```

input-\>post() will return FALSE if the field was not posted.

edit: if fields should be required and contain certain types of values, you need to look at the Form Validation

http://ellislab.com/expressionengine/user-guide/development/usage/form\_validation.html

http://ellislab.com/codeigniter/user-guide/libraries/form\_validation.html

# Answer
> 0 votes
Here is the code that works for me:

```
foreach ($clean_data as $key=>$value)
{
    if(isset($_POST[$key])) {
        $clean_data[$key] = $this->EE->input->post($key, true);
    }
}

```

---
Tags: ee2, forms
---


# Question
Title: Solspace Tag on Channel Form (safecracker) with checkbox list?
I'm wondering if there's any way to create a new input format for assigning tags to entries in Channel Form (previously safecracker). I run a directory site and business owners will be editing their own listings and I want them to be able to assign tags to their entries. But they may not be familiar with how tags work, and even if they are they won't know which tags are available for them to use. So I want to list all possible tags in that tag groups in a list on the entry edit page, and allow them to use checkboxes to select tags that apply to their business.

Is there any way I can create my own HTML structure to have each tag as a checkbox item and tags that get checked are assigned to the entry?

Or am I stuck with using the tag widget or a simple textarea where all tags must be written in?

# Answer
> 1 votes
If the user isn't going to create tags as part of the process, why use the Solspace Tag module at all... just use EE's native categories which you can manually add in the control panel and they can select via checkboxes.

# Answer
> 1 votes
If you are okay with doing a multi-step submission process, you could try a combination of manipulating the Tag:Form template tag and populating it with the Tag:Cloud template tag.

http://www.solspace.com/docs/tag/form/#examples (last example as your base)

```
{exp:tag:form
    form_id="my_form"
    return="path_to/my_template"
    entry_id="{entry_id}"
}

   {exp:tag:cloud
      channel="whatever"
      limit="25"
      orderby="tag_name"
      sort="asc"
   }
      <input type="checkbox" name="tags[]" value="{tag}" id="{tag}_label" />
      <label for="{tag}_label">{tag}</label>
   {/exp:tag:cloud}

   <input type="submit" name="submit" value="Submit Tags" />

{/exp:tag:form}

```

You may have to put the Tag:Cloud tag inside an embed to get it to work, and I'm not 100% certain this solution will work.

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


# Question
Title: {exp:channel:entries} "no category" filter
I have a channel called `foo`.

Some entries in the `foo` channel have been assigned categories, some are not.

I wanted to group the entries based on their categories.

Since some of them don't have categories, I want to be able to specifically search for them.

Is there a way to do it?

```
{exp:channel:entries
    channel="foo"
    disable="member_data|pagination"
    dynamic="no"
    orderby="entry_id"
    sort="asc"
    category="" /* HOW TO FILTER FOR "NO CATEGORIES"? */
}

```

# Answer
Use the "NOT" feature in Categories and list all of your other Categories.

```
category="not 4|5|7"

```

Simply list all of your categories with the "NOT" declaration and it should show everything else.

You could also group multiple categories inside your channel with an if statement for each category.

```
{if category_id == ""} this should target empty categories {/if}

```
> 2 votes

# Answer
If you want a more dynamic solution, this works too:

```
category="not |"

```

I'm not 100% sure why it works but it appears to be because the "not" operator returns entries without a category. The EE help docs mention this:

\[http://ellislab.com/expressionengine/user-guide/modules/channel/channel\_entries.html#category\]\[1\]:

> **NOTE:** When you use the category="3|4" parameter (not excluding), you are implicitly telling ExpressionEngine to only deal with entries that have been assigned one or more categories. If you have entries that haven’t been categorized then they will be ignored and not included in the results. However, if you are using exclusion (category="not 3|4"), then you will be shown all entries without those categories including those without any categories assigned. To change this behavior when excluding categories use the uncategorized\_entries parameter.

Since the above parameter doesn't match any actual categories the result is a list of entries that doesn't have an assigned category.
> 4 votes

---
Tags: channel-entries
---


title: Bulk Entry Time Change

text:
# Question
Title: Bulk Entry Time Change
I've just switched my localization settings for the Daylight Savings folderol. (Something that, admittedly, I haven't done in previous years.) This year, I have over 200 entries in the queue that had their publish times set - and now, with the DST localization change, the publish time has all been changed. Is there a way to globally change entry times? I was looking at this question on bulk-entry status updating to see if I could figure out a way to tweak things, but I'm admittedly not super-strong on SQL syntax.

The changes I want to make are:
where an entry is in the future, and the time equals 8:15 AM,
change the time to 7:15 AM

Forgot to specify: I'm using EE 2.6x

# Answer
Date math is a pain. Here's query that *should* give you entries in the future:

```
SELECT entry_id, title
FROM exp_channel_titles
WHERE UNIX_TIMESTAMP() < entry_date;

```

Double check this to make sure you are getting the 200 results you are expecting. Server Time zone, User time zone, DST settings, server time etc can all throw you off, but in any case it should only be a matter of hours.

Now we want to subtract 3600 seconds (the number of seconds in an hour) from those future records, like so:

```
UPDATE exp_channel_titles
SET entry_date = entry_date - 3600
WHERE UNIX_TIMESTAMP() < entry_date;

```

exp\_channel\_titles also has a column for 'day' so if subtracting one hour from an entry pulls it into the previous day you would really want to update that column too, not sure if there's a consequence of omitting this step and including it is pretty complicated.
> 1 votes

---
Tags: query, sql
---


# Question
Title: Fieldtype to overlay html (tooltips) on top of image?
I would love to find a fieldtype addon that enables me to add tooltips onto an image, like the example here: http://goo.gl/kkLXoZ

Basically a very simple editor that enabled you to select an image and create/edit/delete tooltips on a particular coordinate relative to the image container size. I haven’t seen this on devotee or elsewhere - thought I would try my luck here.

Thank you!

# Answer
> 1 votes
Only Pointee exist. But is not support multi points.

---
Tags: ee2
---


title: Alternatives to NSM Site Generator?

text:
# Question
Title: Alternatives to NSM Site Generator?
I want to create a base configuration of EE that have certain channels, templates, addons, etc. -- and then deploy that over and over again. It seems like NSM Site Generator was the solution I needed, but it's in alpha, doesn't work with the latest version of EE, and not being actively developed (due to time constraints, per the developer).

Are there alternatives?

# Answer
> 2 votes
I just have a local dev environment using MAMP. I have a couple of base setups that I use. One with structure and one without and then my most standard addons that end up on almost every site like wygwam, switchee, stash etc. I keep these up to date on my local machine. When I want to start a new site its simply a matter of uploading the files to the web server. Copy across the database. Make a few configuration file changes and purchase an EE license and any applicable addon licenses and I am good to go. I am sure there are probably fancier more automated ways but this has always worked well for me.

---
Tags: add-on, deployment
---


title: Listing Clickable Channel Entries

text:
# Question
Title: Listing Clickable Channel Entries
I'm quite new to EE2 although fairly proficient with HTML, etc. This may seem as an easy question, but for the life of me, I cannot figure out how to make a clickable list of entries from our blog.

Here's the current code:

```
{exp:channel:entries channel="blog" limit="10"}
<li><a href="#'>{title}</a></li>
{/exp:channel:entries}

```

I'm trying to list all of the entries from the blog in a sidebar on the site. The problem is that the entries show up fine, but they all link to the same blog article no matter what I put in the "#" part. The list of blog entries shows up fine, but I can't get them to link to their source article.

How do I make it so that the listing treats each Title as separate link and links to the proper blog article?

I've searched the parameters field and haven't been able to find one that does what I want it to do. Am I just doing it all wrong?

Thank you so much for your help.

# Answer
> 3 votes
If you use the {url\_title} for the href that should do the trick:

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

{title}

{/exp:channel:entries}`

Also you might need to add the dynamic="no" parameter to stop EE limiting the list based on the URL e.g. if you are on a single entry page. If that's the case try this instead:

```
{exp:channel:entries channel="blog" limit="10" dynamic="no" disable="categories|custom_fields|member_data|pagination"}<li><a href="{url_title}">{title}</a></li>{/exp:channel:entries}

```

Notice I added the 'disabled' parameter too? That helps speed things up and is good practice when you you only want a list of entry titles like this and don't need custom fields, categories or member data and pagination.

Hope that helps and all makes sense you can read more in the docs

---
Tags: channel, entries
---


title: Get query of exp:channel

text:
# Question
Title: Get query of exp:channel
Can I get the sql query after calling exp:channel. I want to see the query behind an exp:channel call? Is this possible by any debugging process?

Thanks

# Answer
If you turn on the Output Profiler, you will be able to see the list of SQL queries generated for any page.
> 4 votes

---
Tags: channel, query
---


# Question
Title: Show entries authored by certain zoo visitor member on their profile page
I've got a profile page for each of my zoo visitor members and on there I want a list of all the entries they've written. My URL is /careers/network/julie-alchin with 'julie-alchin' being the {visitor:url\_title}. I don't know if I can use that segment\_3 in anyway in the channel entries tag?

Any help would be very much appreciated.

Thanks, Julie

# Answer
> 2 votes
You can do this using

```
{exp:zoo_visitor:details url_title="{segment_3}"}
     {exp:channel:entries channel="blog" author_id="{member_id}"}
            <h2>{title}</h2>
            {body}
     {/exp:channel:entries}
{/exp:zoo_visitor:details}

```

But by performance I would choose query:

```
{exp:query sql="SELECT author_id FROM exp_channel_titles WHERE url_title = '{segment_3}'"}
        {exp:channel:entries channel="blog" author_id="{author_id}"}
            <h2>{title}</h2>
            {body}
        {/exp:channel:entries}
{/exp:query}

```

---
Tags: channel-entries, zoo-visitor, author
---


title: include new line in HTML button

text:
# Question
Title: include new line in HTML button
Having textareas with markdown formatting is appealing to me but not everybody is as positive as I am.

Using the HTML buttons could perhaps make the experience a bit more gentle. Editing the H1-6 buttons seemed to be a no-brainer at first. But if I could figure out how to have those buttons append a new line to the headings I would have to handle a lot less complaints about how stupid Markdown is when Wordpress has wysiwyg-editors like Word...

So. Is there a way to achieve a new line with the HTML-buttons?

/David

# Answer
> 1 votes
The HTML button setting fields won't let you pass a line break to the textarea field, so there's no direct way to do it via the button. You may need to look into an alternative markdown fieldtype add-on.

---
Tags: html, markdown
---


# Question
Title: Easy way to check if a category's selected within Channel Form?
In my situation a person will be editing their record within Channel Form. They have a photo field, but I only want to display it if the person is NOT in a particular category. The categories list has about 50 categories, so if possible, it'd be great to do something like:

```
{exp:channel:form...}

if category != "bad category"
show field:photo

{/exp:channel:form}

```

Any ideas on the easiest way to accomplish this? Thanks a million for any tips.

# Answer
> 1 votes
There's no way to do this with native tags. I think your best bet here, since you're dealing with the the front-end is to use some simple jQuery to show and hide your photo field based on the change event of the dropdown menu.

This is really outside the scope of EE, but it'd look something like this:

```
$('#id_of_category_field').change(function(){
    var value = $(this).val();

    if(value != 'some-value')
    {
        $('#id_of_photo_field').show();
    }
    else
    {
        $('#id_of_photo_field').hide();
    }
});

```

This will obviously require a little tweaking for your specific situation, but it should get you going in the right direction.

# Answer
> 0 votes
Per EE documentation for Channel Form, you should be able to do this using the `{category_menu}` tag pair:

```
{exp:channel:form...}

  {category_menu}
    {if category_id != "bad category id"}
      <!-- show field:photo -->
    {/if}
  {/category_menu}

{/exp:channel:form}

```

# Answer
> 0 votes
Thanks for all of your tips. The jQuery method seemed to work for me. Channel Form names all category listings as id "categories" and File fields with class "file\_field" (I just had one), so everything here apart from my check against the "9" category id is standard Channel Form code. Here's what I did:

```
    var arr = new Array;
    $("#categories option").each ( function() {
        if (this.selected) {
            arr.push ( $(this).val() );
        }
    });

    if(jQuery.inArray("9", arr) != -1){
         $('.file_field').hide();
         $('#no_photo_message').html("FDN personnel must contact the office manager to change photos.");
    }

```

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