title: Continuous Errors in EE developer log

text:
# Question
Title: Continuous Errors in EE developer log
I'm having these errors in my EE developer log:

```
Deprecated function set_cookie() called in system/expressionengine/third_party/cartthrob/libraries/Cartthrob_session.php on line 195.

```

From template tag exp:cartthrob:\__construct in core/article. This tag may have been parsed from one of these snippets: {snippet\_header}, {snippet\_header\_testing}, {snippet\_header\_backup\_feb\_1\_2013}, {snippet\_header-donation} Deprecated since 2.8. Use EE\_Input::set\_cookie() instead.

I'm running latest CT and EE versions. is this something that should be ignored?

# Answer
This might turn out to not be a perfectly clear answer (or in the classical meaning), however:

Is that the only error you are getting? I am asking because my dev-log has more entries (I have a lot of Modules and Add-Ons installed), ranging from NSM Better Meta to Profile:Edit to EE Debug Toolbar and others.

I asked the same question a while ago but can't remember where it was. I was told that I shouldn't worry about it too much, since the dev log errors *should* be something tat devs keep an eye on.

I'm on EE 2.7.3 and CT 2.5 and don't get any CartThrob error logs atm. CartThrob is not yet combatible with 2.8 (they are working on it). So I suppose this is where your errors are coming from. Ace McCarttrhob just recently wrote on twitter:

> ok, that is the best combo at the moment. (in reply to a user that said he is on EE 2.7.3 and CT 2.5)

To complete the answer here is what EE writes in the CP popup after clicking on:

*This is a log for developers to bring notices or warnings to the attention of the Super Admins. **What does this mean**?*

> One of two things has happened:
>
> * The system has detected native code or an add-on that is using outdated code that may stop working or cause issues with the system. This means an add-on in your installation is accessing a part of ExpressionEngine's core code which EllisLab plans to remove in the future in order to improve the quality of the product.
> * A warning or message was raised by native code or an add-on for the Super Admin to view.
>
> To remedy this notice, you may need to do any of the following:
>
> * Contact the developer who manages your ExpressionEngine installation for help
> * Make sure you have the latest version of all your installed add-ons
> * Contact the developer of the offending add-on to make sure they're aware of the problem and plans to issue an update
> 1 votes

---
Tags: cartthrob
---


title: Git and Templates saved as file

text:
# Question
Title: Git and Templates saved as file
I am playing around with Git together with an EE install and I think that I have almost nailed it (aka found my workflow).

There is just one small unclarity remaining with Templates being saved as files:

I have a local clone of my install and a central Bitbucket repo. Yesterday I made some changes in my local repo and pushed them to Bitbucket which in turn triggered a post-update hook that updates the files in Production. All fine until here.

But now when I sshed into production and ran "git status" git told me that the two files I have just pushed are modified. I was puzzled at first but then realized that I was connected to the (live) remote DB when editing the template files locally.

So, am I assuming right that this is something I shouldn't do with Git (being connected to remote DB) because a change and save to a file locally will in turn also update a.) the db in Production and b.) the file in Production?

Thanks and Cheers!

**EDIT/UPDATE:** I now did another run with a fresh copy of the db running locally. I am using FTPloy together with Bitbucket so that whenever I push something to BB the changes are being deployed to my Production file system.

So: changed two files locally, pushed them to BB and the Production site got updated with FTPloy. However, I still get these two files as being modified when I run "git status" on the Production server.

On one site it seems totally logical to me because the two files were modified of course. But then again how I can I prevent this behaviour? When I try to pull from Origin I'll get "error: Your local changes to the following files would be overwritten by merge". When I run discard the changes and then pull from Origin it works.

Now I am thinking that it would best be to not have Git running at all on my Production server but what if I (or somebody) has to make changes to the live site in an emergencylike situation?

Don't know how to better describe this. I hope someone will understand my problem.

# Answer
Coming back to this months later (trying to be a good SE user and marking threads as answered):

The question was from my early days of trying to get a grip with Git. The behaviour I experienced as being arkward turned out to be perfectly correct and Git just did what Git does. Changes in the filesystem will be changes in the filesystem and must be watched by Git.

So, I just didn't understand that and tried to combine Git with updating files via FTP, whereas I had to decide: either update files one way with FTP (dev \> prod) or pull changes into production from the central repo.

I settled with the FTP deployment method which brings the restriction that no changes should ever be made on the production server - which isn't a good idea anyways, so everything's fine.
> 0 votes

# Answer
I normally use a shared database between development and staging servers and a separate database for the live one. This prevents issues like this from happening and makes sure that your changes only go live when you intend them to.

Of course, this also introduces the age-old database sync issue, forcing you to manually replicate database changes across environments for things like channel and field structure changes and content update.
> 2 votes

---
Tags: templates, database, files, git
---


# Question
Title: Check if product(s) are in cart of a specific category
I am looking for a way to check if certain products of a specific category are in cart and then based on that hide a specific payment method.

I have found this thread which deals with basically the same problem but checks if a certain product is in cart.

I'd like to tackle this with a broader approach, thus aiming for categories since products can be added all the time.

# Answer
I solved this by using Stash. I now check for certain channels that contain products where payment with PayPal isn't allowed.

It goes like this:

```
{exp:stash:set name="is_channel" parse_tags="yes" parse_conditionals="yes" default="0"}
    {exp:cartthrob:cart_items_info}
        {if channel_name == "channel_a"}1{/if}
        {if channel_name == "channel_b"}1{/if}
        {if channel_name == "channel_c"}1{/if}
    {/exp:cartthrob:cart_items_info}
{/exp:stash:set}

```

then in the template code:

```
{exp:stash:parse process="end"}
    {if {exp:stash:is_empty name="is_channel"}}
        Content here
    {/if}
{/exp:stash:parse}

```
> 0 votes

---
Tags: cartthrob, conditionals, mightybigrobot
---


# Question
Title: Cartthrob: {item_subtotal:plus_tax} rounding problem / CT calculating wrong
I know, this topic or related problems have been covered a lot in the past.

We are having problems with {item\_subtotal:plus\_tax} calculations in the case of having a quantity greater than 1. We are having those problems for a quite some time and I always shyed away from trying to fix it (made a couple of attempts but could never find a way through).

Now we had an order where the discrepancy between what should be calculated and what has been calculated is 2 cents (Euro). It's not much but the accountant has to make an extra step and the invoice we send the customer just doesn't fit his order.

So, we are runnning EE 2.7.3, CT 2.5 and I have these settings:

```
Tab Global:
Decimal Precision: 2
Round Decimals to Nearest: .01 (standard)

Tab Taxes:
Tax plugin: Tax by location - Percentage
Tax 19% - Country Germany - Tax Shipping: Yes

Tab Shipping:
Shipping plugin: By Location - Price Threshold
Location: DEU - Rate: 4.12 - Threshold: 74.78

```

Generally we enter all prices net (without tax) and let the software do the tax calculations.

The order in question contains this product:

```
 product A
 net price: 22,65

```

The cart looks like this:

```
 Product A | Quantity 3 | {item_subtotal} = 67,95 | {item_subtotal:plus_tax} = 80,85

```

In my opinion this is where the problems stem from: the item\_subtotal:plus\_tax calculation.

CartThrob calculates like so:

```
26,95 * 3 = 80,85

```

where it should calculate:

```
22,65 * 3 * tax (in our case 1,19) = 80,86

```

I believe the calculation is done in 2 steps or something because I don't know where or how CT gets the 26,95 from because even if I calculate like this:

```
 (22,65 * 1,19) * 3 = 80,86

```

I am not sure why nobody else has had this problem or if taxes are being calculated differently in other countries or not. For us at least it's wrong and I would like to fix this without hacking the core.

I am still hoping to have somehow overlooked something, so I'd be happy for any head-ups.

Thanks and Cheers.

# Answer
In the meantime I scheduled a support call with the people at CartThrob and they confirmed that this is an issue. They are working on an aditional tax-rate option for the next release of CartThrob (which will also be compatible to EE 2.8 & 2.9) and I have recieved a beta build which already takes care of the problem described above - at least to a certain degree. It's not perfect yet but I have reported my testing results back to CT and believe that it will be completely fixed once the final build will be released.
> 0 votes

---
Tags: cartthrob, mightybigrobot
---


title: CartThrob 2 lite

text:
# Question
Title: CartThrob 2 lite
I am seeing some info on CartThrob 2 Lite at http://cartthrob.com/docs/docs\_cartthrob-lite/ but no pricing or info on how to obtain it.

1) Anyone here have a pre-sale email address for the makers MightyBigRobot? (I am only seeing a phone number for purchased product support.)

2) I presume it costs less, but the documentation makes me wonder if it only can handle one single item being sold on a site. Anyone know?

Thank you.

TMV

# Answer
The CartThrob support team doesn't seem to be actively monitoring StackExchange recently, but they do seem to respond to their Twitter feed more regularly. You might want to try asking them there:

https://twitter.com/cartthrob/with\_replies

If you still get no love, then you could also try scheduling a callback/chat through their support system, which has been pretty reliable in my limited experience:

http://support.mightybigrobot.com/
> 0 votes

# Answer
Answer to part 1) of the question:

Thanks to Positlux's suggestion, I have confirmed via past Mighty Big Robot tweets that they by policy provide no email address for pre- or post-sale support. They want you to tweet them. After three tries, (one tweet a day over the past three days) I have learned that CartThrob Lite is not available, but they hope to make it available again:

My tweet:

@cartthrob Is CartThrob Lite still available? Not seeing where to get it or the cost.

Tweeted answer back from Mighty Big Robot:

"Hi, no sorry, not right now. Should be back in the near future."

On part 2) of the question, I have scheduled a phone call for next week (Mighty Big Robot free support phone calls are available 3 days a week). Will report here what I learn.
> 1 votes

# Answer
I presume it was removed (temporarily?) as per this post:

http://cartthrob.com/docs/docs\_support/

(This is a list of products that Mighty Big Robot has stopped offering for purchase. CartThrob Lite is *not* in the list.)
> 0 votes

---
Tags: cartthrob, ecommerce
---


title: White screen with syncing files

text:
# Question
Title: White screen with syncing files
Experiencing a very strange error at the moment that I can't put my finger on.

Running EE 2.7.0 and any time I try to sync a file from the CP to file system (using something like Libraree, Snippet Sync, Low Variables etc), I get the dreaded WSOD.

Despite having all debug options turned on, I get crickets in output.

# Answer
> 1 votes
So as it turned out, this was nothing to do with EE or any of the addons installed.

We had installed Trace to manage db changes between environments. For the most part, this worked well...until it didn't.

One of the changes that module introduces is a change to your db config, setting the mysql drive to `mysql_trace`

Arbitrarily, I reverted this back to the standard (this was a punt because we were getting no error output) and all was well again.

Back to the drawing board on db management though :(

---
Tags: snippets, white-screen-of-death
---


# Question
Title: I'm getting a PHP error in the Member Profile section : Message: Undefined offset: 0 Filename: cp/myaccount.php
```
Message:
Undefined offset: 0
Filename: cp/myaccount.php
Line Number: 349

```

This is appearing at the top of the page when I go to edit a members profile via the Members tab. It's also preventing me from updating the content.

Any ideas anyone?

# Answer
> 1 votes
It might be that your host is blocking the EE version check. Try to turn off New Version Auto Check from the General Configuration menu and see if the error goes away (source: http://ellislab.com/forums/viewthread/174968/). If it does you'll need to either keep it disabled, or check with your hosting company to get it resolved.

If it does not, the version of EE you're currently running would be helpful to troubleshoot further. Also, as others mentioned, whether or not you have any third-party member add-ons.

---
Tags: members, control-panel, php-errors, ee
---


# Question
Title: Trouble with Conditional inside Matrix Field
I'm trying to setup a conditional to only show the Start Date when the Start Date and End Date match, but I can't get it to work in Matrix and I can't find a similar question anywhere.

Here's what I have so far. I'm using the Time Select fieldtype add-on.

```
{exp:channel:entries entry_id="8" dynamic="off"}
    {sessions}
        {if "{start_date format='%M %j'}" == "{end_date format='%M %j'}"}
            <li>{start_date format="%M %j"}</li>
        {if:else}
            <li>{start_date format="%M %j"} - {end_date format="%M %j"}</li>
        {/if}
    {/sessions}
{/exp:channel:entries}

```

# Answer
> 1 votes
EECMS saves dates as UNIX timestamps. You don't need to format the fields just to compare each other.

I don't know if Time Select uses something different, but it worth a try.

```
{exp:channel:entries entry_id="8" dynamic="off"}
    {sessions}
            <li>
               {start_date format="%M %j"}
               {if start_date != end_date} - {end_date format="%M %j"}{/if}
            </li>
        {/if}
    {/sessions}
{/exp:channel:entries}

```

# Answer
> 0 votes
Try to remove the the quotation marks:

```
  {if "start_date format='%M %j'" == "{end_date format='%M %j'}"}

```

Sometimes it needs to remove them with conditional.

---
Tags: matrix, conditionals
---


# Question
Title: Google Maps for Expression Engine store locator
I'm currently working on implementing a store locator on a new site. Because of the complexity of the old store locator I've chosen to go with Google Maps for EE because of the flexibility of the plugin and the import.

I've been able to import a small subset of the stores for testing and successfully geocode them on import. I've also managed to get pagination working. But there are a few things missing:

I would like the ability to "search by region". So The idea is there is are tabs (or styled radio options) with USA, Canada, and International. When one is selected the map should return the results for that region. I can't figure out how to do this?

The other problem, I'm spitting the results into a `<ol>` to keep a count, with pagination this breaks (for obvious reasons), I tried using the `{count}` variable like so `<li... data-count="{count}"` so I could extract the count, but it also resets on paginate? I would think this value should keep count throughout paginate, but it doesn't?

Last thing is the annoying caching! I've tried to set the tag variable to "false", yet everything is still cached. I would love to turn this off somehow as it's really annoying, and also makes testing more difficult.

Finally, here is the template I'm attempting to use. Any advice is greatly appreciated!!

```
{exp:gmap:search
    channel="store_locations"
    latitude_field="store_lat"
    longitude_field="store_long"
    distance_field="distance_max"
    geocode_field="location"
    cache_post="false"
    }
    <input type="hidden" name="XID" value="{XID_HASH}" />
    <div class="row">
        <div class="small-12 large-6 columns">
             <input type="text" name="location" id="location" value="{if post:location}{post:location}{/if}">
             {if error:location}<p class="error">{error:location}</p>{/if}
        </div>
        <div class="small-12 large-6 columns">
            <select name="distance_max">
                <option value="25" {if="" distance_max="=" 25}selected="selected" {="" if}="">Within 25 Miles</option>
                <option value="50" {if="" distance_max="=" 50}selected="selected" {="" if}="">Within 50 Miles</option>
                <option value="100" {if="" distance_max="=" 100}selected="selected" {="" if}="">Within 100 Miles</option>
            </select>
        </div>
    </div>
  <button type="submit" class="button alert">
    <i class="icon-search icon-white"></i> Search
  </button>
{/exp:gmap:search}

<hr/>

{exp:gmap:results order_by="distance" sort="asc" parse="inward" paginate="true" limit="10"}

<div class="row">
    <div class="small-12 large-6 columns">
        <div class="store-locator-store">

        {if has_searched}
            <ol class="circles-list">
            {results}
                <li data-count="{count}">
                    <div class="row">
                        <div class="small-12 large-9 columns">
                            <h4 class="soft">{result:title}</h4>
                            <p>
                                {result:store_address}<br />
                              {if result:store_address_2 != ""}
                              {result:store_address_2}<br />
                              {/if}
                              {result:store_city}, {result:store_state} {result:store_zip}<br />
                              {if result:store_phone}Telephone: {result:store_phone}{/if}
                            </p>
                        </div>
                        <div class="small-12 large-3 columns">
                            <p>
                            <br/>
                            <strong>
                              {result:distance} miles<br />
                              <a href="{directions_url}" target="_blank">View Map</a><br />
                                <a href="{directions_url}" target="_blank">More Info</a>
                            </strong>
                            </p>
                        </div>
                    </div>
                </li>
            {/results}
            </ol>
        {/if}

        <div class="pagination-count">
        Showing page {current_page} of {total_pages}<br/><br/>
        </div>
        <div class="pagination-links">
        {if prev_page}<a href="{site_url}store_locator/store_temp/page/{prev_page}">← Prev</a>{/if}
        {if next_page}<a href="{site_url}store_locator/store_temp/page/{next_page}">Next →</a>{/if}
        </div>

        </div>
    </div>

    <div id="map_container" class="small-12 large-6 columns">
        <p class="right">
            {if total_results > 1}
            <strong>Here are your results:</strong>
          <br />
            Displaying <strong>{total_results}</strong> matches within {search_distance} miles of <strong>{post:location}</strong>.
        </p>
            {exp:gmap:init id="map" class="google-map" style="width:100%;height:600px"}
            {results}
           {exp:gmap:marker id="map" latitude="{store_lat}" longitude="{store_long}"}
       {/results}
            {if:else}
            <p>Sorry, we were unable to find any matches for {post:location} within {search_distance}.</p>
            {/if}
    </div>

</div>
{/exp:gmap:results}

```

# Answer
> 0 votes
As for keeping the count, try using the {total\_results} variable. That should show you the number of items returned regardless of pagination.

Regions are tricky. I don't think there is any built in method for handling them in Google Maps For ExpressionEngine. Although you can get a marker for a region, it will be in the centre of that region rather than a means to check a boundary. Logically, this is actually extremely difficult to do if you are doing proximity searches rather than just "is this place inside this region". There will always be a case where it just doesn't work sensibly.

Consider a situation where someone lives near the edge of a region. They search for the nearest store by selecting their region. The nearest store might be just over the 'border' but it would not be returned since it isn't in the region searched for.

So the next step is to return stores within a set distance of the border. That's a hell of a calculation to perform and still may not return the closest store due to the 'wiggliness' of borders.

ObjectiveHTML has made a search add-on which might help you as it will let you search within the Gmap4EE field for the address component of your geomarkers. This can go some way to solving the region problem. I don't know if it's on general release but might be worth asking.

# Answer
> 0 votes
I had been having the same issue with pagination but I found that the solution was to add page\_segment="page" to the gmap:search parameters and then include "page" in my pagination links - which you have already according to your template code.

I'm having the same trouble with total\_results though. If I do a search with a 10mile radius, and paginate="true" and limit="10" total\_results returns 10. If I set limit to 50, total results returns 50. So at the moment, while the paginate variables are returning a correct number of pages, I'm having trouble with the ability to display something like "Displaying 1-25 of 86 matches" because total results is displaying the results returned within the pagination limit and not the total matches, as I was expecting.

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


title: Low Search and category keywords

text:
# Question
Title: Low Search and category keywords
Although I've used Low Search in the past, I now have a need to include category keywords in the results.

In the past I've used the standard category dropdown approach to refine (filter) the results to a specific category...

> You can use the native category parameter to filter by category.

ref: http://gotolow.com/addons/low-search/docs/filters#categories

But the docs clearly state that category keyword searching is possible and that seems to be the whole point of having categories within the create collections, and that it can pick up keywords within category description, title, or custom field...

> Low Search can also add category information to the index, making entries searchable by keywords present in their categories.

ref: http://gotolow.com/addons/low-search/docs/collections#categories

So I have a category with the title "Dog Friendly", I've included this in the collection and run a search on "dog". No results. "Dog", "friendly", "Dog Friendly" - all no results (I have tried rebuilding indexes).

If I wanted to just do a search on a specific category, I'd using the category ID from a dropdown, so is irrelevant to title, keyword, description, etc - so I'm assuming that's not what the documentation is referring to. Also not an option as I have hundreds of categories.

I've even tried adding the word "testing" to a category description, then run a search for "testing" and included a dropdown category select with the relevant category selected. Still no results.

What am I doing wrong?

* EE v2.7.2
* Low Search v3.1.5

Other StackExchange Answers:

Can Low Search keywords also search in categories?

Index Categories in Expression Engine search results

# Answer
The cause turned out to be the creation (and rebuild) of the indexes not including category information. This build also included Publisher and included an extension to add Publisher support to Low Search, which it seems doesn't support categories - I've created a ticket with the developer, so hopefully this will get resolved soon.
> 3 votes

---
Tags: categories, low-search
---


# Question
Title: Wordpress to ExpressionEngine, missing tags
I'm currently using DataGrab to pull a WP blog into EE. It works for the most part, but I can't seem to get tags to work?

I added the Wordpress datatype to DataGrab (http://brandnewbox.co.uk/products/datatypes) and I see the "tags" section is looking for `domain="tag"`, which the WP export has? Trying to get it to populate DevDemon Tagger field, but when checking import it looks like it's not seeing the tags at all?

Any suggestions greatly appreciated!!

---

**EDIT**: So I managed to get Wordpress tags pulled in by modifying the Wordpress datatype for DataGrab. Don't remember the line number, but for tags it's looking for `domain="tag"`but Wordpress exported it as `domain="post_tag"`, so once I updated that I was able to get tags in. **However**, DataGrab still doesn't work with Tagger. So I could only import the tags into a text field, and then go into Tagger and import from the field.

This still doesn't completely solve the problem. Now the tags are in Tagger, but no longer attached to the post. So they're basically useless :(

Any thought/ideas on how to ge things re-attached in an automatic way? With 1,000's of post I'm not willing to go through and manually re-assign!

---

**EDIT 2**: I've since tried to use Solspace Tag as an alternative to see if it would work, unfortunately it does not. With DevDemon Tagger no error was returned, with Solspace Tag however I receive a php error:

```
Message: Undefined index: allow_subloop
Filename: fieldtypes/datagrab_tag.php

```

So still trying to figure this out. There are post on the DataGrab forum about this as well, so I know I'm not alone: http://brandnewbox.co.uk/forums/viewthread/858/, I also submitted my own post here: http://brandnewbox.co.uk/forums/viewthread/927/

I will update this post if I manage to get a solution figured out...

# Answer
> 1 votes
The developer of DataGrab emailed me the solution. I figured I would post it here so that anyone else who may have this problem down the road is able to solve it!

First, you need to update the Wordpress plugin as described in my original post. Then copy this bit of code and save it as "datagrab\_tagger.php" and place inside the DataGrab "fieldtypes" folder:

```
<?php

/**
 * DataGrab Tagger fieldtype class
 *
 * @package   DataGrab
 * @author    Andrew Weaver <aweaver@brandnewbox.co.uk>
 * @copyright Copyright (c) Andrew Weaver
 */
class Datagrab_tagger extends Datagrab_fieldtype {

    function prepare_post_data( $DG, $item, $field_id, $field, &$data, $update = FALSE ) {

        $data[ "field_id_" . $field_id ]["tags"] = array();

        // Can the current datatype handle sub-loops (eg, XML)?
        if( $DG->datatype->datatype_info["allow_subloop"] ) {

            // Check this field can be a sub-loop
            if( $DG->datatype->initialise_sub_item(
                $item, $DG->settings["cf"][ $field ], $DG->settings, $field ) ) {

                // Loop over sub items
                $tags = array();
                while( $subitem = $DG->datatype->get_sub_item(
                    $item, $DG->settings["cf"][ $field ], $DG->settings, $field ) ) {

                        $tags[] = $subitem;

                    }
                    $data[ "field_id_" . $field_id ]["tags"] = $tags;

                }

        }

    }

}

?>

```

This will allow you to import Wordpress tags into DevDemon Tagger!

# Answer
> 1 votes
DataGrab doesn't currently have support for the Tagger field type.

However DataGrab does have support for *Solspace Tag* which may provide the correct functionality for you without having to manually update.

Tag isn't free, but Solspace offer a 30-day money back guarantee so if it doesn't work you should be able to get a refund.

http://www.solspace.com/software/detail/tag/

---
Tags: datagrab, solspace-tag, devdemon-tagger
---


# Question
Title: Can you have a relationship with a *category* instead of a 'channel' in channel fields?
I want to setup a 'Pages' channel in such a way where I can include a loop from a different channel (in this case 'Listings') only showing entries for a particular category. I'm using Structure to arrange my sitemap, so I can't use segments in the URL - plus it will only be relevant for certain pages and not others, so I need to find a way the user can select a related 'Listings' category when editing the 'Page' if appropriate which would then power a listings loop.

Can anyone advise or link to somewhere that shows how to do this?

Thanks, Justin

# Answer
> 0 votes
There are a couple of fieldtype add-ons which allow you to select a category. I've used WB Category Select on a number of occasions with great success to do just what you're asking.

---
Tags: categories, relationships, channel-fields
---


# Question
Title: Security issues with putting member id in URI segments?
I'm using Safecracker Registration so that I can leverage Channels for my member data. I want to create pages that display member data in the frontend. Is there a security issue with using member ids (or even Channel entry ids) in the URIs? For example, http://domain.com/foo/123/ -- the 123 is the member id or entry id.

# Answer
> 3 votes
Nope, none whatsoever, those id's are simply unique identifiers, but are not meant to be private.

---
Tags: channel-entries, entry, security
---


title: Postmaster Notifications not sending

text:
# Question
Title: Postmaster Notifications not sending
I'm attempting to setup a reminder calendar implementing the Postmaster module. I've been trying to solve this issue now for a while and can't seem to come up with a solution.

Here's my setup: I have a EE Grid field with 3 columns (title, date, description). The member enters each of the values, with the date being a "date" field.

Within the Postmaster notification I've tried doing post date relative with the relative field having "**-5 days**", as all dates are going to be in the future. But, it seems that Postmaster does not like this syntax as notifications are not sent at all this way. If I keep it post date specific I can ping the url and get the notifications sent the day of (which isn't too helpful for a reminder).

So I installed the math module (http://devot-ee.com/add-ons/math) to try and work some magic, still no go.

Here's what I currently have:

For post date specific I have

```
{exp:channel:entries channel="wedding" dynamic="no" entry_id="1"}{calendar:date format="%m"}/{exp:math formula='{calendar:date format="%d"} - 5'}/{calendar:date format="%Y"}{/exp:channel:entries}

```

Where the channel is wedding, and the grid field is calendar. Then the calendar:date is the date. Within the EE template, this will output the correct date I want the notification to be sent on. So if date entered is 6/11/2014 it will output 6/6/2014, the date the notification should be sent.

Then, to make sure no old notification get sent, I also added a conditional

```
{exp:channel:entries channel="wedding" dynamic="no" entry_id="1"}{calendar}{if '{calendar:date format="%U"}' > '{current_time format="%U"}'}TRUE{if:else}FALSE{/if}{/calendar}{/exp:channel:entries}

```

Just to make sure the information being sent to the member isn't in the past.

Still, no notifications are sent? The only way I can get them to send is placing the specific date in, no relative, and not using math on the input.

How can I get these things to fire 5 days before the date??

# Answer
> 1 votes
Couple things right off hand, but this type of complexity is a little outside the scope of what is provided outside of the box. This is why there is a Notifications API so you can build you own notifications with custom logic to determine when to send emails. You can create database tables to store when emails are sent, and have custom UI's for you to have different variables in your logic that aren't set in the code (for example). If it were me, I would extend the Notifications API and that way you can be sure that it will send when you want. It was built for this exact purpose.

That said... It *might* be possible to get it working using out of the box tools.

1. Using the relative date of "-5 days" would indeed make the email send right away. It works together with the specific date field. So if you plugin your entry date into the specific date, and specify "-5 days" it would subtract 5 days from your entry date and send it then.
2. I am not 100% sure your extra conditional field will work. I think the more optimal way would be to extend the BaseNofication class and build your own logic to prevent it from being sent. This will be much more reliable in the long run.

---
Tags: postmaster, objective-html
---


title: GeoFinder Latitude Error

text:
# Question
Title: GeoFinder Latitude Error
I'm trying to setup GeoFinder and I keep getting this error:

> Latitude field not found, please make sure you have it entered correctly in the latitude parameter.

I thought it would be my segments, but my url is `/site/results2/10030/1/`

and the code from the results page is:

```
    {exp:geofinder:location_results channel="personal_trainer_directory" status="open" limit="10" geoquery="{segment_3}" radius="{segment_4}" latitude="{latitude}" longitude="{longitude}" distance_mode="miles" disable="
"}

{if count == 1}
<p>You searched for personal trainers within <strong>{radius}</strong> {distance_mode} of <strong>{geoquery}</strong>, <strong>{total_results}</strong> personal trainers were found.</p>
<table cellspacing="0" cellpadding="0" width="100%">
{/if}

<tr><td><strong>{title}</strong><br/>{trainer_address}<br/>{trainer_city}, {trainer_state} {trainer_zip}</td><td><a href="{trainer_url}" title="{trainer_url}">{trainer_url}</a></td><td class="distance"><strong>{distance}</strong> {distance_mode}</td></tr>
{if count == total_results}
</table>
{/if}
{if no_results}
<p>We found no personal trainers based on your search.</p>
{/if}
{/exp:geofinder:location_results}

```

any ideas?

# Answer
I'm not totally sure, but I think the longitude and latitude parameters are looking for the field name, and not the field value. Try removing the curly brackets around those two fields and see if it works.
> 2 votes

# Answer
Actually removing the curly brackets helped me:

```
{exp:geofinder:member_results
  member_group="members"
  limit="5"
  geoquery="{segment_3}"
  radius="{segment_4}"
  latitude="member_latitude"
  longitude="member_longitude"
  distance_mode="miles"
}

```
> 0 votes

---
Tags: add-on, module
---


# Question
Title: Categories for e-commerce: n-level deep?
I'm using Exp-resso Store and need my products categorized (like a typical e-commerce site). What is the best way to categorize products? The product categories are n-level deep.

I don't see how to create parent-child relationships in EE Categories, though reference I've found on the Internet and here on SE seem to suggest that there is no limit to the levels of categories.

Or perhaps I should try creating a Channel that has a relationship field and try to mimic categories that way?

My questions:

1. Can EE Categories be nested? If so, how?
2. Is it possible to programmatically populate EE Categories (e.g. via API, DataGrab, etc.)?
3. Would using the relationship field to implement categories be a bad idea? I know I can populate this via DataGrab, which makes it a tempting solution for me (at least it'll be easy for me to populate -- and possibly easy to also assign products to their respective categories?)

# Answer
> 1 votes
It's definitely possible to nest categories and use them in the URL structure. It does take some fiddling to get it to work and the deeper the nesting the more difficult it can be to template.

That being said, there is usually an option to assign categories on import dependent on which module you use. I've seen an option for it in Solspace's importer module.

This is the EE categories documentation

---
Tags: categories, category-group
---


title: Conditionals within Categories

text:
# Question
Title: Conditionals within Categories
I'm attempting to get a conditional statement working within category id parameters.

Ideally, I need the title of certain entries to link to details pages but ONLY if they are in category\_id 38. Then, I'd like to show just the title (without links) only when entries are not in category\_id 38.

This is what I've come up with so far. I have never attempted something exactly like this before. I am getting a parse/syntax error. Could someone take a look and help me to see what I am doing wrong, please and thank you!!

```
{categories}

{if category id == "38"}

    <h4><a href="{url_title_path='product-support/service-centers'}">{facility_title}</a></h4>

{if:else category_id == "32|30|33|31" && category_id != "38"}

    <h4>{facility_title}</h4>

{/if}

{/categories}

```

# Answer
> 1 votes
The `categories` variable pair performs a loop. Always. If your entries has more than one category, it will show all of them. So, if you want to show just one, you have to `limit` it.

Remember that `==`, `!=`, `>`, `<` or any other comparison operator is available just on `if` or `elseif`. `else` haven't operators. It executes on all possible exceptions to the previous conditions.

If you want to compare against several values at once, you gonna need something like an `IN` operator, which isn't currently available on EECMS template language. But, it looks like, for your question, that you just cares about the category 38 to have a link. So, you don't need to test for the others.

```
{categories limit="1"}
    <h4>
        {if category_id == "38"}
            <a href="{url_title_path='product-support/service-centers'}">{facility_title}</a>
        {if:else}
            {facility_title}
        {/if}
    </h4>
{/categories}

```

# Answer
> 0 votes
Try:

```
{categories}
    {if category_id == "38"}
        <h4><a href="{url_title_path='product-support/service-centers'}">{facility_title}</a></h4>

    {if:elseif category_id == "32" OR category_id == "30" OR category_id == "31" OR category_id == "33"}
        <h4>{facility_title}</h4>
    {/if}
{/categories}

```

1) missing underscore in category id 2) elseif instead of else 3) no need to check for category 38 again docs on conditionals

# Answer
> 0 votes
You're along the right lines.

Let's break down your code section-by-section

```
{categories}
{/categories}

```

This will work just fine.

```
 {if category id == "38"}

```

The correct variable name here is `{category_id}` (note the underscore). Getting the variable names correct is imperative when using conditionals - because else you're checking against the wrong thing.

```
 <h4><a href="{url_title_path='product-support/service-centers'}">{facility_title}</a></h4>

```

No problems here

```
 {if:else category_id == "32|30|33|31" && category_id != "38"}

```

This is where it starts to break down. What you have effectively written is *"if it's anything but 38 do this instead"*. But you've hard-coded that. What if category 34 appears tomorrow? You'd be better off going for a simple `{if:else}` line. That does the same thing short-hand.

The second issue is that you use `{if:else}` here, but you wrote it as a `{if:elseif}` statement. Notice the second if there. That allows you to basically say "*If the above conditional isn't true, try this new conditional instead*".

Additionally you're using piped values (`|`) to check the `category_id` variable. This is the syntax for selecting multiple entries but it wouldn't be outputted like that. Unfortunately in conditionals you'd have to go long hand with `{if:elseif category_id=="32" || category_id=="30" || [etc]`} - that's no fun. For your reference though, doing a double-pipe (`||`) in conditionals is to `OR` what `&&` is to `AND`.

And so if we put it all back together, this code will do the job.

```
{categories}
    {if category_id == "38"}
        <h4><a href="{url_title_path='product-support/service-centers'}">{facility_title}</a></h4>
    {if:else}
        <h4>{facility_title}</h4>
    {/if}
{/categories}

```

---
Tags: categories, conditionals
---


title: var_prefix message in ee 2.8.1 dev log

text:
# Question
Title: var_prefix message in ee 2.8.1 dev log
I'm getting this message in **EE 2.8.1** dev logs with **Playa 4.4.5**:

> A template loaded on http://dev.tear.org.au/projects/ is using the deprecated {parent:url\_title} tag. Please use Playa’s var\_prefix parameter instead.

This answer helped, but not enough.

I've seen the var\_prefix docs concerning the module tags, but can't find info regarding the fieldtype tag, which is what I am using.

My code looks like this (simplified):

```
{exp:channel:entries...}
    {project_content} <-- PLAYA FIELD
    {content limit="1"}
        <h4>
            <a href="/projects/{parent:url_title}">{parent:title}</a>
        </h4>
    {/content}
    {/project_content}
{/exp:channel:entries}

```

**How would I need to modify my template to use the new parameter?**

Thank you

# Answer
You shouldn't need to prefix with Playa for what you're doing. You should just be able to use...

```
{exp:channel:entries...}
    {project_content}
        {content limit="1"}
            <h4><a href="/projects/{url_title}">{title}</a></h4>
        {/content}
    {/project_content}
{/exp:channel:entries}

```

The `var_prefix` parameter comes in handy when you want to do things like pagination for your Playa entries. You need to prefix it then so that it doesn't interfere with the main entry's pagination. But in your example, it shouldn't be required.
> 1 votes

---
Tags: playa, 2.8
---


# Question
Title: Solspace Supersearch grid compatibility?
I've been looking but was unable to find an immediate answer within the Superseach documentation, but does Supersearch work with the new EE grid field?

# Answer
> 1 votes
As per the comparison tool at http://www.solspace.com/software/detail/super\_search/ Solspace suggest that **Low Search** would be the better tool for Grid or Matrix searching.

Details about Low Search can be found at http://gotolow.com/addons/low-search

---
Tags: grid, supersearch
---


# Question
Title: Can I use either Store or CT for event product hire/rent?
Just wondered if anyone had previously used either CT or Store for product hire or rent.

I have a potential project that requires the following:

1. The client has a contract to supply wheelchairs to events at a particular venue. This service could develop to cover more venues across the UK so the system should be designed to include multiple venues, events and dates.
2. Client manages the listing and adds events by location, event title and date. The client selects which items can be available at each location. Visitors can search by keyword, event, location or date and will be shown a list of results that can be filtered. Or alternatively, they could choose a product and then the event.
3. Once an event is chosen, the client can choose which item/product they would like to hire and go through the purchase process.
4. The system will log the booking and send confirmation emails to the customer. The site could also check stock levels and either show ‘out of stock’ when the limit is reached or send an email notice to the client.

I'm just looking for pointers as to the best way to achieve the above using one of the add-ons mentioned.

Relationships could be used to assign products to venues, it's assigning the product to the event in some way that decreases the stock level only for that product for that event etc.

I have good experience of using both but not in this way, so I imagine I might require some custom code?

Thanks in advance.

# Answer
That sounds like something Store could handle. Essentially you're able to sell any Channel Entry so you just need to add our single Store Product Details Field to any Channel Group to make it sellable and everything else fits right into EE and your desired workflow.

The only thing to keep it mind however is that if you have one product available at multiple events then each of those would require a different stock level. In this case you couldn't accomplish this with relationships because each 'product' can only have a single stock level. You'd need to list the product for each event but you're still able to organise this however you prefer to, whether it be to have a Category for each event or a Channel etc. It would essentially mean having duplicate products in the system but this will allow you to firmly control the stock for each event and satisfy your 4th point above ensuring more aren't sold per event than are available.
> 3 votes

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


title: Store Submit Button Not Redirecting

text:
# Question
Title: Store Submit Button Not Redirecting
I am having trouble with my submit buttons on my expresso store forms. It does not 'recognise' the next attribute in the checkout tag. I.E. I need to click on PLACE YOUR ORDER on my last checkout step to pay for the items, but nothing responds.

```
{exp:store:checkout next="./payu/payu-enterprise-doTransaction-using-soap.php"
payment_method="Dummy"
return="store/order/ORDER_HASH"
<!--secure="yes"-->
error_handling="inline"}

```

Above is my code for the checkout form. The actual form (not using form tag) is underneath this with control names and values.

When I click on `<input type="submit" name="next" value="PLACE YOUR ORDER" class="button alert" />`, it does not respond at all.

Am I perhaps missing something?

# Answer
> 1 votes
I can see that your form is submitting to hidden a php script ,If this is so this is incorrect because now you are not processing you tags with any of stores/EE methods unless you are doing some magic inside your script that allows the stores/EE tags to be parsed.

You have to submit your form to the next ee template and not a custom script.

hope this helps

# Answer
> 2 votes
If this is the last step of the checkout as you mention then you shouldn't have a `next` parameter in there as there is no next step. The `next` and `return` parameters can never co-exist in the same checkout tag as there's either another step to come in the a multi-step checkout process or it's the end of the line and you need to tell store where they should be sent for their order confirmation.

Also, you'll need to ensure to the name of your submit button is changed accordingly. So on the last step of the checkout, instead of calling it `next` you need to call it `submit`:

```
<input type="submit" name="submit" value="PLACE YOUR ORDER" class="button alert" />

```

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


# Question
Title: Payment Gateway Integration API Directory
I downloaded PayU Integration API php files to be used in EE2, but I am not too sure in which directory to store it? It's not a module or something similar, its just 3 API files I need to reference in my checkout steps. Where would be best to store them in my EE2 project?

# Answer
I would advise that you built it into an Omnipay gateway.

Omnipay is the payment provider library that powers Exp:resso Store 2 and so by building it for Omnipay it will work on Store.

They have a GitHub with examples and documentation https://github.com/omnipay/omnipay

If you decide to go down that route, the ExpressionEngine Answers website wouldn't be the place to get help. Instead you can use StackOverflow with the tag "omnnipay" and they'll be able to assist there.

https://stackoverflow.com/questions/tagged/omnipay
> 3 votes

# Answer
Ideally you should use them to create a plugin but technically you can place them wherever you wish so long as whatever needs to reference them can reach them.
> 2 votes

---
Tags: expresso-store, ee2, payment-gateway, api
---


# Question
Title: Force "free-shipping" inside a product tag.
Is there any way to add a template tag or hidden input and force free shipping for all the items that use a template?

The site I'm working on sells some physical products, but also has a "classes" section.

I'd like to simplify the class creation process for my clients. It would also help them avoid errors if they miss the checkbox.

# Answer
> 1 votes
Why not add the items to discount and check free shipping .

https://exp-resso.com/docs/control\_panel\_discounts.html

# Answer
> 1 votes
The 'Free Shipping' checkbox on the Publish/Edit screen is obviously the best way to do it on a per-product basis but if you wanted to include an extra failsafe then it could be an option to create a Shipping Method with a 'Free Shipping' rule. You could set the shipping rates to 0 in that rule but bear in mind that this applies *per order* and not *per product*. So if there's a chance that someone could add both a physical product as well as a course/class to their cart in the same checkout then it would cause a problem. You could then loop through the cart contents and if it contains a course/class (identified by category, product ID's, SKU's etc) then automatically set the shipping method to 'Free Shipping' in the templates.

---
Tags: expresso-store
---


title: Proper way to add a new action?

text:
# Question
Title: Proper way to add a new action?
What is the correct way to add a new action to the current list of actions?

Is there a specific EE method to add a new action? Or is it just direct database manipulation(that is, add it via SQL)?

# Answer
Usually it's done on the install method of your addon. Best practice is to take advantage of ActiveRecord and a db-\>insert:

```
$data = array(
    'class' => $this->class,
    'method' => $method
);

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

```

You don't need to specify an ACTion ID as this is auto incremented.

You can find a bit more information in the docs for Module Installation.
> 5 votes

---
Tags: action
---


# Question
Title: Where can I find the sitemap.xml on ExpressionEngine?
Where can i find sitemap on ExpressionEngine v2.4.0 so i can input it on webmaster tools

If anyone knows where to find it, it would be very helpful

Many Thanks

# Answer
There is no sitemaps.xml out of the box in EE. You can build it using channel:entries module

Example 1

Example 2

or you can use one of next add-ons:

NSM Better Meta *(~ $40)* SEO module

Sitemap Module *($49)*

Google Sitemap Lite *(free)*
> 20 votes

---
Tags: add-on, google-webmaster-tools
---


title: Using Dynamic URL's in {Segment_1}

text:
# Question
Title: Using Dynamic URL's in {Segment_1}
Is it possible to use dynamic urls in {segment\_1}. I prefer not to use a plugin and might opt for a mod\_rewrite solution but I am curious if this is possible out of the box.

For example... http://domain.com/url-title

To further elaborate, I want a url structure that will allow me to do this type of url structure.

I have looked into freebie, and it would work perfect for my needs. If there is a workaround for segment\_1 removal with Freebie it would be nice to hear.

I also found a great schematic/flowchart for EE urls. might be helpful to others looking into this issue. EE Url Schematic

# Answer
The final result of my trials and errors...

Freebie does indeed work on segment\_1 however your index template will also have to handle the routing if you have dynamic urls.

> You can still use all the segment variables you want with Freebie, HOWEVER, if you use freebie to "remove" segments of the URL, they won't be accessible as segment 1.
>
> For example, if I have the URL:
>
> /foo/bar/baz
>
> and I use Freebie to remove foo and baz, {segment\_1} will return bar, and {segment\_2} and {3} will return nothing. (You can access these vars as {freebie\_1-3}).

(thank you to Doug Avery for the explanation of how freebie handles this)

Because my desired URL scheme cannot be accomplished completely dynamically with Freebie or Template Routes I looked at another slightly more manual approach.

Using the highly regarded Switchee plugin i have set up a case statement on my main index page.

Here is the code that I am using to achieve my desired url paths...

```
{if segment_1 == ''}
This is the home page.
{/if}

{if segment_1 != ''}
{exp:channel:entries limit="1" dynamic="no" url_title="{segment_1}"}
    {exp:switchee variable="{segment_2}" parse="inward"}

        {case value=""}
            {if no_results} {redirect="404"} {/if}
            <h2>{title}</h2>
            <p>This is the main users page</p>
        {/case}

        {case value="admin"}
            {if no_results} {redirect="404"} {/if}
            <h2>{title}</h2>
            <p>This is the admin page</p>
        {/case}

        {case value="signup"}
            {if no_results} {redirect="404"} {/if}
            <h2>{title}</h2>
            <p>Signup Page</p>
        {/case}

    {/exp:switchee}
{/exp:channel:entries}
{/if}

```

A few notes, I did turn off strict urls to achieve 404 pages on non existing elements and will likely use Causing Effect's new 'In' add on to help keep template fast and clean for each of the subpages. I will also need to use conditionals, or case statements for additional url schemes on the site.
> 0 votes

# Answer
ExpressionEngine 2.8's introduced `Template Routes` so you now have more control over how your templates are processed. It allows you to override the default template route, which is `/template_group/template`.

For example instead of going `/blog/read/url_title` you can now add a template route for `read.html` in the `blog` template group to load like `/blog/url_title` \- skipping that middle segment.

However, what you are asking for wouldn't be possible with Template Routes. That's because if you have a dynamic segment in your route then that route must end with a dynamic segment.

So for example: `/blog/{entry_title}/` is accepted, but `/blog/{entry_title}/preview` is not because the dynamic variable (`{entry_title}`) is BEFORE the final variable which isn't dynamic.

If we take your desired URLs they would look like this in template routes:-

* \_view/index.html -\> `/{entry}/`
* \_admin/index.html -\> `/{entry}/admin/`
* \_admin/events.html -\> `/{entry}/admin/events/`
* \_admin/communicate.html -\> `/{entry}/admin/communicate/`

**BUT** as you can see, it relies on the last segment being non-dynamic and so won't work natively in ExpressionEngine.

Trying to subvert how ExpressionEngine natively 'thinks' could lead to unnecessary complex code and the same basic result.

I would suggest that it's not worth the hassle or complexity trying to achieve your desired URL scheme and you would be better off doing the natively possible:-

* \_view/index.html -\> `/{entry}/`
* \_admin/index.html -\> `/admin/{entry}/`
* \_admin/events.html -\> `/admin/events/{entry}/`
* \_admin/communicate.html -\> `/admin/communicate/{entry}/`

With all that said, it would be great if Template Routes allowed for this, and perhaps it's something they'll implement later on.
> 3 votes

# Answer
As long as you don't have a template or template group named that url title, you can code your index template to take in {segment\_1} as a url\_title.

```
{exp:channel:entries channel="foo" {if segment_1}url_title="{segment_1}" dynamic="no"{/if}}

```

edit: This only works if you set strict url's to no
> 2 votes

---
Tags: url, segments, freebie
---


title: Remove double slash using Pages

text:
# Question
Title: Remove double slash using Pages
Link a page usign `{path='site_index'}{page_uri}` (inside an `exp:channel:entries` obviously) generate this url:

```
http://local.sitename.it:8888//centro-accoglienza/la-struttura

```

How can I remove the double slash after site\_index? Is there a way to do that?

Thanks!

# Answer
> 1 votes
Your site URL in your site general configuration (or perhaps your config file, depending on how you set up) likely has a trailing slash which isn't needed. If you remove that it should fix it for you.

In "Admin \> General Configuration" this is referred to as "URL to the root directory of your site"

---
Tags: pages
---


# Question
Title: Deploying and Redeploying ExpressionEngine site on LAMP (templates issue)
**Question:** What is everyone doing to deploy (capistrano) and the redeploy after the client has changed files on production?

**Background:** I have a site in production now. I have deploying down pat with a custom Capistrano script. Life is (was) great...until the client started editing templates directly on the server (as they should since they won't be doing deploys like me).

My NEW deploy steps now look like this:

1. Grab a DB dump of the Production database
2. Import this DB dump into my local database
3. Delete all local templates from my dev folder and ensure the template group folders have write privileges
4. Synchronize the templates locally to recreate the files (locally in the EE admin)

Problem is Git sees these files as changed and it just doesn't seem right.

There must be a better way! One thought is to sftp all templates from Production to local, which would grab the newly edited templates files, but even that seems a bit crazy.

Suggestions?

# Answer
> 1 votes
I would definitely recommend not having the client edit Template files, but if you must (like my current situation), based on @CreateSean's comment, I now do the following:

**Before Editing**

1. Pull the latest copy from Git
2. Grab a DB dump of the Production database
3. Import this DB dump into your local database
4. Grab all template files from Production through SFTP (where ssh-prod is my ssh credentials for Production):

```
$ cd TEMP
$ sftp -rp ssh-prod:/web/templates .

```
5. Paste and overwrite the downloaded templates folder in your local dev directory
6. Grab all images from the Production server if you want a complete data set (in a similar sftp fashion).

# Answer
> 0 votes
I'd say the client shouldn't be changing *anything* on production other than content (a whole other synching issue).

If changes needed to be made then they should be made in a dev environment and pushed to a code repository then deployed after testing. That's why we have dev-\>staging-\>production workflows.

If the client has the technical nous to make these template changes is it not reasonable to assume they could learn to use Git in a basic way and join the "regular" development process?

---
Tags: templates, deployment
---


title: URLs have an extra "w"

text:
# Question
Title: URLs have an extra "w"
I have a weird problem: my EE URLs are generated with an extra "W". For instance, on `http://www.example.com`,

```
<a href="{path='article/details'}">{title}</a>

```

will produce (notice that www becomes wwww):

```
wwww.example.com/index.php/article/details/article-name

```

I can't find anything in the admin where I may have typed in the URL wrong.

Does anyone have an idea for how to solve this?

# Answer
Check the site url for your site in Admin-\>General Configuration

Also check this in your config file.
> 5 votes

# Answer
Found it. the issue was in the 2nd sites index.php file. the url was type wrong. Thanks foamcow for the help!!
> 2 votes

---
Tags: url
---


# Question
Title: Creating links to external sites in drop down menu
Our site was created by a developer before my time at the library and I have been asked to add a link in the drop down menu (http://www.falmouthpubliclibrary.org) to an external site. There are links already - for example if you go to the site and look under For Readers/Books In Print - it links to an external web page.

How is that done? I can't figure out how to make a new link in the drop down menu. Thanks for any help.

Peter

# Answer
The links could be done in a number of different ways. They could be:

* manually coded into a template or snippet
* generated from entries within a channel
* output by an add-on

The first place to look is within your template code. This will at least give you a clue as to what is controlling those links.

Look in you templates (start with the homepage) and see if you can work out where the links are being generated. They could be in that template or within an embedded template.

If you can't find anything there, look in Design-\>Templates-\>Snippets to see if there is anything there

If you can't find anything in Snippets then look in Add-ons-\>Modules for any of the following, "NavEE", "Taxonomy" or "Structure". Any of these add-ons could be creating navigation links for you. Another clue that these are being used would be a tag in the template code.

All of these add-ons will handle creation of new links in their own way but you should be able to work it out.
> 1 votes

---
Tags: site-url
---


# Question
Title: Profile:Edit Registration returning error 'Decryption of form settings failed.'
When attempting to Register on a site, the user is getting the following error on submission of the Registration form:

```
The form you submitted contained the following errors:
Decryption of form settings failed.

```

This error occurs on a Production server after a recent move and was working on a previous server. It IS working on a local dev instance, just not on production. Running EE 2.5.5, MSM 2.1.5, Profile:Edit 1.1.1 which has all the patches mentioned in the MBR forums (https://mightybigrobot.com/forums/viewthread/9721/). Would appreciate any assistance as you can image it's a royal pain in the butt.

Thanks Brendan

# Answer
OK, so thanks to Chris from Mighty Big Robot for his support call this morning, we tracked this back to the Terms of Service text area field being called rules:

```
<textarea name="rules" style="width:98%; margin-bottom: 1.5em;" class="textarea" rows="9" cols="90" readonly="readonly">

```

He changed this to the\_rules and it fixed the initial problem:

```
<textarea name="the_rules" style="width:98%; margin-bottom: 1.5em;" class="textarea" rows="9" cols="90" readonly="readonly">

```

Now, it should be noted that this may point to an underlying problem with the server setup specifically to do with something call 'mcrypt'. I will pass this off to our hosting provider to see what they manage to discover and report back.

But for now, it's at least working again.
> 1 votes

---
Tags: profile-edit, mightybigrobot
---


# Question
Title: Pre-populate a channel custom select field with a list of certain members
I would like to populate a custom select field added to a channel, with a list of members that have a certain selection from a custom member field.

To generate the list of members currently in PHP, I get the id of the particular member field, then search the members list for a match on this field. And I have tried to inject this list to the custom select field via javascript, but on form post the validation fails with 'Invalid Selection', as the injected options are not accepted as valid against that field.

Is there a way to populate the custom select field with a list of members selected on a value of a custom member field?

# Answer
> 0 votes
There are a couple of fieldtypes on devot-ee that will let you run custom SQL queries and display the results as a dropdown for the user to select.

This is one: http://devot-ee.com/add-ons/query-field

Haven't tested it myself but something like that should solve your problem.

# Answer
> 0 votes
The core function in EE that allows this is the Field Type add-on
http://ellislab.com/expressionengine/user-guide/development/fieldtypes.html

Bjorn's answer contains a nice add-on template for this, that allows a SQL query to be provided to populate the list.

This add-on is also a good example, it generates a list of members.

https://github.com/ckimrie/cki.member\_list.ee\_addon

For my question, I was able to modify the logic in this add-on to customise the list of members accordingly.

---
Tags: members, custom-fields, pre-populate
---


# Question
Title: Is there a way to restrict the categories tag pair from displaying a category_group attached to an entry?
I have tried using `category_group="4"` to restrict the categories displayed in the channel entries tag to ONLY that category group, but it's still displaying from category\_group 14 as well. I then tried `category_group="not 14"` to try and restrict it from displaying those categories, but it changed absolutely nothing.

My news entries use 2 category groups, and I need to restrict it to only display categories attached to the entry from category\_group 4. I may just be missing something...but it shouldn't be this hard to only display from one group.

Here is the code I'm currently using, and trying `category_group="4"` didn't help either:

```
{exp:channel:entries status="open|Featured" channel="{channel}" category="{cat}" orderby="date" limit="10" paginate="bottom"}
        <article>
            <figure><img src="{image_upload}" alt="{title}" /></figure>
            <div>
                <h4>{title}</h4>
                <p>{entry_date format="%F %d, %Y"} | Filed under: {categories backspace="7" category_group="not 14"}<a href="{path=news/view}">{category_name}</a>, {/categories}</p>
                {if news_body}<p><a class="more" href="{title_permalink=news/view}" title="Read More"> Read More »</a></p>{/if}
            </div>
        </article>
        {paginate}<p id="pagination">{pagination_links}</p>{/paginate}
{/exp:channel:entries}

```

I would like to add that `show="not 97|98|99"` worked, as these are the exact categories in the group I would like to not show. I need a dynamic solution however, as these could be modified by the client in the future.

# Answer
Actually, in the `categories` tag pair, inside `exp:channel:entries`, the parameter you want is the `show_group`.

```
{exp:channel:entries status="open|Featured" channel="{channel}" category="{cat}" orderby="date" limit="10" paginate="bottom"}
        <article>
            <figure><img src="{image_upload}" alt="{title}" /></figure>
            <div>
                <h4>{title}</h4>
                <p>{entry_date format="%F %d, %Y"} | Filed under: {categories backspace="7" show_group="4"}<a href="{path=news/view}">{category_name}</a>, {/categories}</p>
                {if news_body}<p><a class="more" href="{title_permalink=news/view}" title="Read More"> Read More »</a></p>{/if}
            </div>
        </article>
        {paginate}<p id="pagination">{pagination_links}</p>{/paginate}
{/exp:channel:entries}

```

`category_group` is a parameter of the `exp:channel:categories` tag pair.
> 1 votes

---
Tags: channel-entries, categories, category-group
---


title: Minimum size for image upload

text:
# Question
Title: Minimum size for image upload
I know that one can set a maximum size (in pixels) for images uploaded through the CP, but is there any way to set a *minimum* size? (Ideally without buying a complete image manipulation suite like CE Images, since this is a low budget site and this is the only feature I'd need).

# Answer
I don't have a free solution but Photo Frame will do what you're after. https://objectivehtml.com/photo-frame/settings
> 0 votes

# Answer
This might depend on how you are going to use this. File upload with a Channel Form or via a WYSIWYG editor. However both these examples don't have a straight forward configuration but you could write a conditional with a minimum file size.

CE-image will perform practically any image manipulation you can think of, but it also cannot set an minimum upload size for the original file.

If you wish to avoid conditionals I am sure this can also be done with Javascript.
> 0 votes

---
Tags: image, uploads
---


# Question
Title: Krea Content Elements loses content when there's a validation error
We're using Krea Content Elements (http://www.krea.com/content-elements) on a new site and have discovered that if a standard EE validation issue fires, (i.e. a required field missing content) that on the subsequent page load the content you had added to your Content Elements field is lost! Bit of a showstopper... anyone aware of a resolution to this, in fact can anyone reproduce?

# Answer
> 0 votes
I'm not able to reproduce on CE 1.6.5 at least. Tried saving an entry w/o a Title and then had some content in a Heading and WYSIWIG field in a Content Elements field - hit submit and was redirected back with the content intact.

If you're able to reproduce consistently on a clean install I'd say report a bug.

---
Tags: validation, bug, content-elements
---


title: Solspace - Primary Category no category

text:
# Question
Title: Solspace - Primary Category no category
Is there a way to display something if there IS NOT a primary category?

We've tried these with no luck:

```
{exp:primary_category entry_id="{segment_2}"}

{if primary_category_id}
YES
{if:else}
NO
{/if}

{if primary_category_id} YES {/if}<br>

{if primary_category_id == ""} NO {/if}<br>

{/exp:primary_category}

```

# Answer
Could you perhaps do...

```
{exp:query sql="SELECT primary_category_id FROM exp_primary_category WHERE entry_id='{segment_2}'"}
    {embed="site/yes"}
    {if no_results}
        {embed="site/no"}
    {/if}
{/exp:query}

```

Be careful of placing this inside a channel:entries loop though as the {if no\_results} tag will be caught by that instead of the query loop.

Not verified but worth a try.
> 1 votes

# Answer
Sorry, this is not available with Primary Category at this time.
> 0 votes

---
Tags: solspace, categories
---


# Question
Title: cp_menu_array hook : nav_ not getting picked up
I am hooking in to cp\_menu\_array - which seems light on the old documentation - to stick up a menu for my module.

All works as expected, except the language strings.

```
public function cp_menu($menu)
{
    if ($this->ee->extensions->last_call !== false) {
        $menu = $this->ee->extensions->last_call;
    }

    $menu['giftcards'] = array();
    $menu['giftcards']['view_giftcards'] = BASE.'&C=addons_modules&M=show_module_cp&module=store_giftcard';
    $menu['giftcards']['edit_giftcard_emails'] = BASE.'&C=addons_modules&M=show_module_cp&module=store_giftcard';

    return $menu;
}

```

This gives me the required menu item, but the strings pop up as 'nav\_giftcards', etc. So, one might expect to stick them in the lang array thus:

```
$lang = array(
    "store_giftcard_module_name" => 'Store Giftcard',
    "store_giftcard_module_description" => 'Gift certificate functionality     for Expresso Store',
    "nav_giftcards" => 'Giftcards',
    "nav_view_giftcards" => 'View Giftcards',
    "nav_edit_giftcard_emails" => 'View Giftcards'
);

```

Alas, to no avail.

If anyone can point out the trick I'm probably missing before I need to dive in and walk through the core to find out, I'd be much obliged.

# Answer
> 1 votes
You can try to add next lines into your cp\_menu\_array code in case if you need to have some dynamic code:

```
ee()->lang->language['nav_giftcards'] = 'Giftcards';
ee()->lang->language['nav_view_giftcards'] = 'View Giftcards';
ee()->lang->language['nav_edit_giftcard_emails'] = 'View Giftcardss';

```

Or load your file with lang array:

```
ee()->lang->loadfile($module_name);

```

---
Tags: control-panel, hook
---


# Question
Title: Convert {reverse_related_entries} to relationships
I used "{reverse\_related\_entries}" before but after the upgrade (2.8.1) i like to use the new Relationships.

I found some stuff in the docs. But i can't figure out what i have to do when the relationship-field is into the ChildChannel:

**ParentChannel**

* title

**ChildChannel**

* title
* relationship\_field (Relationship)

**Template for ChildChannel:**

```
{exp:channel:entries channel="ParentChannel"}
{title}
{relationship_field}{relationship_field:title}{/relationship_field}
{/exp:channel:entries}

```

What i need is a menu like this:

* Product-Family (from ParentChannel)
    + Product 1 (from ChildChannel with Relationship to Product-Family)
    + Produkt 2 (from ChildChannel with Relationship to Product-Family)
    + Produkt 3 (from ChildChannel with Relationship to Product-Family)

# Answer
You need to use the `parents` tag pair (docs), since your "child" products are actually the "parents" (because the relationship originated from their entries, not the other way around).

```
{exp:channel:entries channel="ParentChannel"}
    {title}
    {parents field="ChildChannelRelationshipField"}
        {parents:title}
    {/parents}
{/exp:channel:entries}

```
> 1 votes

---
Tags: relationships, child
---


# Question
Title: Cannot find grid fieldtype data in database
I have a grid fieldtype which has a Relationship field "Select one" allowing the user to select a channel in the grid, however although the correct value is shown in the cp (shown below) I cannot find the value in the corresponding MySQL table for the grid (the other values are in the table. Any ideas?

# Answer
You will need to look in the `exp_relationships` table then match the `grid_field_id` along with the `grid_col_id` and `grid_row_id` columns for exactly what you are looking for.
> 0 votes

---
Tags: relationships, grid
---


# Question
Title: Conditional with variable gives php error
I'm using channel:categories and would like to show only child categories so I added the following conditional `{if {parent_id} != 0}...{/if}` but get php errors as soon as I add it to the template. I tried any sort of variable check {category\_description} and get errors.

The above conditional was taken from an accepted answer on another thread.

```
Parse error: syntax error, unexpected '{' in path\to\system\expressionengine\libraries\Functions.php(689) : eval()'d code on line 43

```

My template looks like this:

```
{!--stash 1st level category list--}
{exp:stash:set name="categories" parse_tags="yes"}{exp:gwcode_categories channel="products" depth="1" style="linear" backspace="1"}{cat_url_title}|{/exp:gwcode_categories}{/exp:stash:set}

{!--category ids for sub cats--}
{exp:stash:set name="sub_category_ids" parse_tags="yes"}{exp:gwcode_categories channel="products" output_depth="2" style="linear" backspace="1" cat_url_title="{segment_3}"}{cat_id}|{/exp:gwcode_categories}{/exp:stash:set}

{exp:stash:parse}
{exp:switchee variable="{segment_2}" parse="inward"}
  {case value="#^P(/d+)$#|category|''"}

    {switchee variable="{segment_3}" parse="inward"}

      {case value="{stash:categories}"}{!--level 1 category listing filtered by stashed list --}

        {exp:low_variables:single var="lv-products-cat-tier1"
          preparse:pre_seg_id="{stash:sub_category_ids}"
          preparse:pre_single_cat_id="{segment_3_category_id}"
        }

      {/case}{!--level 1 category listing--}

        some more case checks here

    {/switchee}{!--end nested switchee--}

{/case}{!--listing & category listing--}

some more case checks here
{/exp:switchee}

```

Finally my lv-products-cat-tier1 is a low variable with the following code where the parent conditional will wrapp the double-square div when it is working:

```
        {!--list sub categories--}
        {exp:channel:categories channel="products" show="{pre_single_cat_id}|{pre_seg_id}" style="linear"}

{if {parent_id} != 0}
  yo
{/if}

        <div class="col-xs-6 double-square">
            <img src="http://lorempixel.com/545/270/people" alt="" class="img-responsive">
            <div class="row">
            <div class="pos-ab">
                <div class="col-xs-6 left">
                  <div>
                    <h4><a href="/products/category/{category_url_title}">{category_name}</a></h4>
                  </div>
                </div>

                <div class="col-xs-6 right">
                  <div class="content">
                    {exp:eehive_hacksaw chars="" words="15" cutoff="" append="" allow="<p><b><a>"}
                      {category_description}
                    {/exp:eehive_hacksaw}
                  </div>
                </div><!--right-->
            </div><!--pos-ab-->
            </div><!--row-->
          </div><!--double square-->

        {/exp:channel:categories}

```

# Answer
> 7 votes
The problem with that is that if `{parent_id}` doesn't get replaced with a number before the conditional is evaluated, then EE will choke because when converted to PHP it becomes:

```
if ({parent_id} == 0)

```

Either this

```
{if parent_id != 0}

```

Or this

```
{if "{parent_id}" != "0"}

```

Is more fault tolerant when the variable doesn't exist.

But, you may wonder, why is your conditional getting parsed before `{parent_id}` has been replaced in the first place? Because by default `{exp:stash:parse}` parses conditionals after it has parsed the layers of tags it wraps to a "depth" of 3 (`parse_conditionals="yes"` and `parse_depth="3"` by default).

It so happens that in your code the `{exp:low_variables}` tag is on the deepest layer to be parsed (layer 3). This tag gets replaced with your `{exp:channel:categories}` tag pair which is NOT parsed, because at this point Stash is done parsing and will now parse any conditionals that have been exposed. See the problem?

To stop this undesirable behaviour you can either set `parse_conditionals="no"` on the `{exp:stash:parse}` tag or increase the parse depth with `parse_depth="4"` so that the categories tag is fully parsed before the conditionals are evaluated.

---
Tags: categories, stash, php-errors, gwcode-categories, switchee
---


# Question
Title: How to disable default captcha input on Expression Engine
I tried to implement the below extension on Expression Engine. It is loading fine on the registration page. But I can see a text box along with this recaptcha box. Can any one explain me how to remove the existing text box?

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

Markup for the form is here: http://jsfiddle.net/Jj8yk/
Screenshot of the problem is here: https://unsee.cc/pozisute/

# Answer
You have an extra form input for the CAPTCHA that you do not need.

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

The ReCAPTCHA extension will dynamically create the form input for you in the `recaptcha_container` div, so you can remove that input from your form.
> 0 votes

# Answer
Try going into the admin control panel-\>Members-\>Member Preferences, then choose "Enable Membership CAPTCHA" -\> "No"

**EDIT:**
Apparently the recaptcha plugin does not function if disabling the native EE captcha function. I'm using the strike-through here in case anyone can benefit from this knowledge in the future.
> -1 votes

---
Tags: captcha
---


title: Using SCORM with ExpressionEngine

text:
# Question
Title: Using SCORM with ExpressionEngine
Is it possible to use SCORM within an ExpressionEngine template? I would really appreciate any advice on this.

A broad overview about SCORM can be found at http://en.wikipedia.org/wiki/Sharable\_Content\_Object\_Reference\_Model

Thanks

The types of data we would want to SCORM are quiz answers (radio buttons and multiple select checkboxes) or numbers of pages visited. Sorry to be vague but we are just starting to look into the option of using EE to deliver content. The SCORM results would be sent to an LMS.

# Answer
> 1 votes
In addition to Nathan's answer, you're probably going to want to build a add-on module to do the SCORM conversations and tracking, rather than anything frontend. So ideally you'll need PHP/CodeIgniter experience as well as knowledge of SCORM and LMS systems.

ExpressionEngine would be an ideal platform for the creation and management of content and interactions but it would be some overhead to create the SCORM compatibility. I assume you've already considered the likes of Moodle? Albeit it's a one stop shop covering everything, including the LMS.

In addition to using EE for the content, the other approach to consider is utilising a JavaScript SCORM API, a quick Google found this.

Or convert an existing SCORM PHP module to CodeIgniter.

# Answer
> 0 votes
Not natively no but as ExpressionEngine gives you complete freedom with your front end templates it should be possible to use EE as a tool to create course content. You might also want to look at http://devot-ee.com/search/tags/tag/lms

---
Tags: templates
---


# Question
Title: Recording clicks on banners using the native 'views' columns
A site I'm working on allows a client to place banner ads in various locations using a 'sponsors' channel in EE. The channel is fairly simple and has fields for the banner image itself, a target URL etc.

I would like to record both impressions and click throughs from the banners to the target URLs. In a perfect world the banners when displayed will link directly to the sponsors target URL so that they can gain some SEO value from the link.

Recording banner impressions is easy, I can just use the native 'views' parameter to do this:

```
{exp:channel:entries track_views="one" ...

```

However, how can I ensure that a 'click' on a banner also records a 'view' to the 2nd view column for that entry before the user is redirect to the target URL in the href?

# Answer
Fudge it by by creating a tracker template?

You mention your banners are in a channel entries, so I assume the image, url, etc are all stored there. Instead of using the actual URL for the banner href, use /adverts/tracker/\[entry\_id\]

Create a template group called adverts and a template called tracker, inside this template it does a channel entries tag pair utilising {segment\_3} for the entry\_id and track\_views="two", pulling in the correct URL and redirecting. Utilise either EE redirect tag, meta refresh or JS. Although all would create a 301 issue and not good for SEO.

A better alternative that suits your brief a bit better is to keep the correct final URL in the href tag and use a data-id attribute to the a tag on the banner set with the entry\_id value, and catch the click with JQuery. This then uses the data-id attribute to append the entry\_id to a fixed template URL (tracker template as described above), calling this URL (tracker template) in an Ajax call but without any redirects and stores the click to the entry ID. Once the above page is rendered and click impression stored, the Ajax returns and you continue with the click through to the sponsor.

The ideal solution would be to create a module with an ACTion url that could be called on Ajax and save the track, but more time overhead than creating a template to do it.
> 1 votes

---
Tags: tracking
---


# Question
Title: Low Search: Filter results by Collections
I want to only search results from specific collection on specific search results pages.

My search results is basically like the Low Search Results example

```
{exp:low_search:results query="{segment_3}" limit="10"}
{if count ==  1}<ol>{/if}
<li><a href="{url_title_path="#"}">{title}</a></li>
{if count == total_results}</ol>{/if}
{if no_results}No search results{/if}
{/exp:low_search:results}

```

This shows me matching results from all saved collections. However, I only want to show results from a specific collection.

I see Low has the variable:

```
{collections}{/collections}

```

just not sure how to use it.

Thanks in advance.

# Answer
> 2 votes
If you are using a specific form to search for a single collection the best option would be to pass a hidden input in the search form

```
{exp:low_search:form}
 <input type="hidden" name="collection" value="collection_name">
 <input type="search" name="keywords" placeholder="Search">
 <input type="submit" value="submit">
{/exp:low_search:form}

```

You should also be able to do this on the results loop too but I haven't tested it. From your code above:

```
{exp:low_search:results query="{segment_3}" collection="collection_name_here" limit="10"}
  {if count ==  1}<ol>{/if}
    <li><a href="{url_title_path="#"}">{title}</a></li>
  {if count == total_results}</ol>{/if}
  {if no_results}No search results{/if}
{/exp:low_search:results}

```

---
Tags: low-search
---


# Question
Title: Integrating Discovery Miles Into Website
My website, written in EE2 is using expresso-store as the shopping cart. I am integrating PayU payment gateway via the Enterprise API. Would it be possible to use Discovery Miles with this? How would I integrate Discovery Miles here or how would I go about doing this? The customer is allowed to pay with their discovery miles or credit card.

# Answer
If PayU support payment by Discovery Card (and it looks like they do) then you just need to implement a payment gateway for PayU and PayU will automatically provide that as a payment option presented to customers.

Discovery Miles is the currency earned when customer makes a payment with their Discovery Card and that again is handled automatically by the issuer: DiscoveryCard.
> 2 votes

---
Tags: expresso-store, ee2, payment-gateway
---


# Question
Title: Constructing a single page blog with pagination
Here's the scenario

I have a bunch of blogs to be displayed. 9 blogs with short description in a grid, and then click on the caption to read more of the blog

the blog grid url is www.mysite.com/person1/blog

on clicking the channel entry it takes me to the more detailed view. The url looks like this www.mysite.com/person1/blog/blog-with-url

the url title of the channel entry is blog-with-url I have accomplish this. What I am not able to achieve is, that I pagination to navigate to the next and the previous blog post. How should I do that?

# Answer
With - http://ellislab.com/expressionengine/user-guide/add-ons/channel/entry\_linking.html

```
{exp:channel:next_entry}
<p>Next entry: <a href="{path='site/comments'}">{title}</a></p>
{/exp:channel:next_entry}

{exp:channel:prev_entry}
<p>Previous entry: <a href="{path='site/comments'}">{title}</a></p>
{/exp:channel:prev_entry}

```
> 3 votes

---
Tags: channel-entries, channel, pagination, navigation
---


# Question
Title: Different values of checkbox for different members?
I'm trying to make a 'learning' site, something similar to Codecademy but for a small company. The setup at the moment is that I have a Training channel, with description and courses channel fields. Courses is a grid field with the name and title of the resource (so a book or video etc) and also a checkbox that will show whether the user has completed that resource. The channel entries will be for example, 'HTML' and then the description will be a little bit about HTML, and the grid will contain a list of books, videos etc about learning HTML.

I can set up with jQuery and AJAX to check whether the checkbox should be checked from the database, but the issue is that different members will have different things completed. What's the best way to organise the data so I can record who has done what? Would it be easier to do a separate channel for the resources and use relationships to link it to the types of training, then relationships to the member ID for the checkbox?

# Answer
> 2 votes
> ...and also a checkbox that will show whether the user has completed that resource

You **can't** store the member choices in the channel entries information. *Well, technically you could, but it would have to store every members details so not optimal and not recommended.*

I'm assuming there could be a crossover - so 2 courses could share the same resource. So therefore a better approach would be making the resources a separate channel, linking the course to the resource via a relationship.

The user (member) progress would have to be stored either via a custom add-on and database, or (easier) via a custom field in the member data. It won't be flexible to have a separate member field for each course (or resource), as that will mean each time a new course is added, new member fields would need to be added. Because you're going to be using Ajax to set and retrieve the user progress, I'd suggest a single member field for progress. In this store a JSON encoded array representing each course and resource, say with keys of each entry ID, for example:

```
{1:[{10:0, 11:1, 12:0, 13:1}], 2:[{12:1,14:0,15:1}], etc

```

(Note: mocked up and probably not correct JSON format!)

Entry IDs 1 and 2 would be the course entry IDs. 10 - 15 would be resources. 1 and 0 values would be if they completed the resource. You could take this further to show scores, time spent, whatever.

In your JavaScript you could then decode the JSON and have all the information readily available as an array.

---
Tags: database, jquery, ajax, multiple-channels
---


# Question
Title: Wygwam 3.3.1 Disappears from Channel Entry
I've updated to EE 2.8.1 as well as updating Wygwam to 3.3.1 (and a ton of other add-ons).

Since the updates, the Wygwam field will flash and then disappear on any Channel Entry page. This has been the case in Safari, Firefox, Chrome

* I've cleared caches (EE and browser), refreshed, restarted to no avail.
* I've uninstalled Channel Images to no avail.
* I've created a "Naked" Wygwam config with no style set, etc. to no avail.
* I've created a test channel and field set with only an instance of Wygwam to no avail.
* I've manually refreshed the ckeditor.js to no avail.
* I've googled until my fingers bled. To no avail.

I've attached a screenshot from the Inspector which shows an error which is above head.

I'm stumped. Any thoughts?

# Answer
Turns out the problem was with a Wygwam configuration. In addition to upgrading Wygwam, I upgraded to Channel Images 5.4.17a. Previously, to use CI in Wygwam, one had to add an Advanced Setting to the Wygwam config (extraPlugins -\> "channel images"). Simply removing this setting did the trick.

The new version of CI automatically integrates with Wygwam and does not require that config step (or the addition of anything to the Wygwam theme folder).

Hope this helps somebody down the road.
> 1 votes

---
Tags: ee2, wygwam
---


title: Using categories with Isotope

text:
# Question
Title: Using categories with Isotope
This one maybe a bit tricky, but currently I have a page that is using categories and isotope.js filtering to arrange channel entries.

The filtering using the check-boxes works well. However one thing I'd like to do to extend it further is this;

Using the above image for reference, lets say Entry #1 has categories of Commercial and Construction set. If I click on the Commercial checkbox, then Entry #1 appear in the filter. Likewise if I check Construction, the entry will show, regardless of whether Commercial is checked or not.

What I'd like to happen is if I check the Commercial check-box, then every box except Construction would disappear because hypothetically, only Entry #1 has been assigned to a category in that list (ie. Construction).

Likewise if I clicked on Construction, is it possible to grey out the top list of categories with the exception of Commercial because only Entry#1 'theoretically' has a category assigned in that list.

I apologize in advance as this is quite a difficult problem to word into a question. I hope someone out there is able to get a grip of what I mean and maybe help me out a bit.

\*Obviously I would like to post a JSFiddle to better illustrate the request, but because its currently reliant on EE's channel entries and categories, I'm unable to do so.

## Markup

```
<section>
<div class="container">
    <div class="row">
        <div class="col-xs-12 col-sm-3">
            <div id="filters">
                <h3>Market</h3><br/>
                {exp:channel:categories category_group="7" style="linear" show_empty="no"}
                    <input type="checkbox" name="{category_name}" value=".{category_name}" id="{category_name}"><label for="{category_name}"> {display_name_sectors}</label><br>
                {/exp:channel:categories}<hr/>
                <h3>Capabilities</h3><br/>
                {exp:channel:categories category_group="9" style="linear"}
                    <input type="checkbox" name="{category_name}" value=".{category_name}" id="{category_name}"><label for="{category_name}"> {display_name_capabilities}</label><br>
                {/exp:channel:categories}<hr/>
                <h3>Region</h3><br/>
                {exp:channel:categories category_group="10" style="linear"}
                    <input type="checkbox" name="{category_name}" value=".{category_name}" id="{category_name}"><label for="{category_name}">  {display_name_regions}</label><br>
                {/exp:channel:categories}
            </div>
        </div>
        <div class="col-xs-12 col-sm-9">
            <h3>Filtered Projects</h3><br/>
            <div id="blocks-container">
                {exp:channel:entries dynamic="off" channel="projects" status="not closed"}

                    <div class="iso-block {categories}{category_name} {/categories}">

                        <p>{title}<br/><em>{categories backspace="2"}{category_name}, {/categories}</em></p></div>
                {/exp:channel:entries}
            </div> <!--#blocks-container-->
        </div>
    </div>
</div><!--container-->
</section>

<script src="http://isotope.metafizzy.co/v1/jquery.isotope.min.js"></script>
<script>
$(function(){

  var $container = $('#blocks-container'),
  $checkboxes = $('#filters input');

  $container.isotope({
  itemSelector: '.iso-block',
  masonry: {
  columnWidth: 100
  }
  });

 $checkboxes.change(function(){
 var filters = [];
// get checked checkboxes values
 $checkboxes.filter(':checked').each(function(){
  filters.push( this.value );
 });

filters = filters.join(', ');
$container.isotope({ filter: filters });
});

});
</script>

```

# Answer
Should be pretty straight-forward, though it's really more of a JS question than EE...

In the Isotope callback (ie, after it has finished filtering), you'll need to create a function that fetches all the class names of all visible (filtered) items (jQuery's :visible selector should work there), then pass those class names to a jQuery selection to toggle a class on the associated checkboxes to grey them out - maybe using something like `$($checkboxes).not($classes).toggleClass('nope')`.

You'll just need to format the class list to make a string like: `[name=...],[name=...],[name=...]`.
> 3 votes

---
Tags: categories, filtering
---


# Question
Title: How can I make the Return path for the Freeform Channel Fieldtype dynamic?
I'm using (the latest) Freeform Pro to create forms with its Composer feature. Then I'm using the Freeform Channel Fieldtype to assign a form to a specific channel entry. In my template, I'm outputting the form by simply calling the channel field name. Something like this:

```
{exp:channel:entries
    channel="forms"
    url_title="{segment_2}"
    dynamic="no"
    limit="1"
    disable="member_data|categories|pagination"
}
    <div class="form-header">
        <h2>{title}</h2>
        {form_description}
    </div>
    {form_form}
    {if no_results}{redirect="404"}{/if}
{/exp:channel:entries}

```

...where `{form_form}` is the Freeform Channel Field. This will output the channel entry and form as expected.

In the Freeform Channel Field, you can also define the Return path for the form. However, the only dynamic segment you can set is the Entry ID of the Freeform entry: `form/sent/%%entry_id%%`

I need to add the URL title of the associated channel entry in this return path, so something like: `form/sent/{url_title}/%%entry_id%%` — is this possible?

On top of that, I'd like all my forms to have this particular return path, so there's no need for that input field in the channel form. Can you set the default value and hide the input field?

# Answer
I'd suggest doing this via an extension - your best bet is likely to use the freeform\_module\_insert\_end hook, with one extra form input.

So in your form, add a hidden input so the extension knows the `url_title`:

```
<input type="hidden" name="channel_entry_url_title" value="{url_title}" />

```

This is untested, but it *should* work:

```
public function freeform_module_insert_end($inputs, $entry_id, $form_id, $obj)
{
    if ( ! $obj->edit AND
         ( ! $obj->multipage OR
            ($obj->multipage AND $obj->last_page)
         )
    )
    {
        $obj->params['return'] = 'form/sent/'.ee()->input->post('channel_entry_url_title').'/'.$entry_id;
    }
}

```

(Since `$obj` is an object, it's passed by reference, and `params` is a public variable, so it should set no problem.)
> 3 votes

# Answer
Failing any native way to do this, which I'm not sure if it exists or not, what I usually do is make a single return template with a `{exp:freeform:entries}` tag, pulling the entry ID from the URL.

Then I use a conditional inside the tag to perform a redirect based on one of the fields in the entry.

It's an extra redirect and you have to add a hidden field for whatever your condition is based on, so it's not the ideal solution, but it works.
> 1 votes

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


title: Securing form data

text:
# Question
Title: Securing form data
I have a tag pair that generates a form. I am trying to pass some sensitive information in the tag params, trying to think of a way to avoid exposing it by showing it via hidden field.

For example, let's say I have data A and data B.

```
{exp:foo:bar A="foo" B="bar"}
...
{/exp:foo:bar}

```

I don't want it to be defined in the form as raw data.

```
<input type="hidden" name="A" value="foo">
<input type="hidden" name="B  value="bar">

```

I don't want users to be able to tinker and change the value in the markup. It is a exploitable.

What is the best practice that EE does for this? Encryption? I do see some addons have a hidden field where the value is a long character string.

# Answer
Mathods is dependet on how sensitive this data for you:

1. Yes, you can encrypt this data using openssl-encrypt for example (for php \>=5.3), but if user have enough time and is transparent what data you keep in this encrypted message, user can find way to decrypt. Needs to add salt. Salt needs to keep somewhere.
2. So I think more secure solutions is keep sensitive form data in the DB - add record at the moment when you create form. In form you will have only reference (better do some uniq key, not just id) to record. After n-minutes mark records as expired (or delete it).
> 2 votes

# Answer
If the form is submitted to the same template (e.g. not to a module action-id) then you don't have to expose the data at all on the page to the user.

After posting the form, your template tag is called again. You can handle the form data and at the same time, the tag parameters are available.

## add-on tips

* Make sure the parameter data does not contain the same quote marks as are used for the parameter itself. e.g. only use single quotes inside double quoted parameters `var="...foo'bar'..."`
* Another option is to stuff the data into a tagpair `{var}data{/var}` and grab it from there via the template library or via some regex out of the tag data.
* A good practice is post/redirect/get (wikipedia). This prevents multiple submits to a form when a user reloads the page. For instance, when a form sits on `/group/template` you can post to `/group/template/save/` and after success redirect back. The extra (dummy) segment can be helpful in this procedure.
> 1 votes

---
Tags: forms, security
---