# Question
Title: Freemember - logout doesn't keep https protocol
I have a https section of my site I am using with Freemember. But when I logout it takes me to the http version. How can I make it logout but stay https?

```
<a href="{exp:freemember:logout_url return='"{current_path}"'}" >Logout</a>

```

# Answer
You'll find this issue with a number of tags and modules, you can use a module like : https://devot-ee.com/add-ons/https-support to alter the base `site_index` variable globally according to the protocol being used. No need to alter 3rd party code...
> 1 votes

# Answer
In the mod.freemember.php

After the following code (line 221):

```
$url = ee()->functions->fetch_site_index().QUERY_MARKER.
        'ACT='.ee()->functions->fetch_action_id(__CLASS__, 'act_logout');

```

Add the following code:

```
if (ee()->TMPL->fetch_param('secure_action') == 'yes') {
        $url = str_replace('http://', 'https://', $url);
    }

```

This will change the logout url to https. You have to add secure\_action to logout url as follows:

```
{exp:freemember:logout_url return="" secure_action="yes"}

```
> 0 votes

---
Tags: freemember
---


# Question
Title: Call to undefined method EE_Javascript::generate_json()
I'm currently running ExpressionEngine v2.10.1. Two plugins currently throw the same error. Seems like something has been depreciated / is broken. The two plugins are:

* Campaigner 4.5.0
* Charge 1.9.2

Fatal error: Call to undefined method EE\_Javascript::generate\_json() in /system/expressionengine/third\_party/campaigner/ext.campaigner.php on line 706

Any suggestions would be welcome.

# Answer
Go to line 706 in `/system/expressionengine/third_party/campaigner/ext.campaigner.php` and change it from:

```
$this->EE->javascript->generate_json($js_member_fields));

```

to:

```
json_encode($js_member_fields));

```

And yes, this line needs double parentheses at the end, since it's a continuation of line 705.
> 7 votes

---
Tags: javascript, bug, charge
---


# Question
Title: Freeform Pro Composer - adding Google conversion code to submit
Good afternoon,

I was wondering whether anyone might know how to change the submit input button code using the Composer Template?

Basically I have been asked to change this code

**input type="submit" name="submit" value="Submit"**

With the following:

**input type="submit" name="submit" value="Submit" onClick=”ga(‘send’, ‘event’, ‘Contact Form’, ‘Form Submit’);"**

to allow my client to track the Submit button through Google Analytics.

I presume it's something that needs adding in the code below?

Many thanks in advance for shedding any light on this issue!

```
{composer:page}
    {composer:rows}
            <div class="line">
        {composer:columns}
                <div class="unit size1of{composer:column_total}">
                {if composer:field_total == 0}

                {/if}
            {composer:fields}
                {if composer:field_label}
                    {if composer:field_type == 'nonfield_captcha'}
                        {if freeform:captcha}
                        <p>
                            <strong>{composer:field_label}</strong>
                        </p>
                        {/if}
                    {if:else}
                        <label class="field_label" {if composer:field_name != ''}for="freeform_{composer:field_name}"{/if}>
                            {composer:field_label}{if composer:field_required}<span class="required_item">*</span>{/if}
                        </label>
                    {/if}
                {/if}
                {if composer:field_output}
                    {if composer:field_type == 'nonfield_title'}
                        <h2>{composer:field_output}</h2>
                    {if:elseif composer:field_type == 'nonfield_captcha'}
                        {if freeform:captcha}
                                {freeform:captcha}<br />
                                <input type="text" name="captcha" value=""
                                       size="20"   maxlength="20" style="width:140px;" />
                        {/if}
                    {if:else}
                        <p>{composer:field_output}</p>
                    {/if}
                {/if}
            {/composer:fields}
                </div>
        {/composer:columns}
            </div>
    {/composer:rows}
{/composer:page}

```

# Answer
An alternative, as I'm not too familiar with composer and I don't know where the composer tags put the submit button out with, and as the composer/multipage mode could put out multiple 'submit' buttons...

Use this below Jquery snippet to add what you want to all the submit buttons of the form in question. You don't include the outer freeform tag pair so for this example I'm going to assume you've used the form\_id parameter. For this example lets say the form has the id of `my_freeform_form`.

Pop this underneth your freeform tags (I also assume you have jQuery available)...

```
<script type="text/javascript">
  $('form#my_freeform_form input[type=submit]').click(function(e){
    if ( ga ) { //saftey, is ga existing?
      ga(‘send’, ‘event’, ‘Contact Form’, ‘Form Submit’);
    }
    //important, return true to allow the 'normal'
    //form submit through after we're done
    return true;
  });
</script>

```
> 1 votes

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


title: Adding more than one entry_id

text:
# Question
Title: Adding more than one entry_id
How can I add more than one entry to this. How do I add for more numerical ids?

{if:elseif entry\_id == 216}

# Answer
> 1 votes
You can use two pipes as an OR operator in EE conditionals:

```
{if:elseif entry_id == 216 || entry_id == 217 || entry_id == 218}

```

You can also use a plugin such as Switchee (https://devot-ee.com/add-ons/switchee) if you have a large amount of conditionals.

---
Tags: entryid
---


title: Pulling data from external database

text:
# Question
Title: Pulling data from external database
Need to pull member information and custom fields from an external SQL (not mySQL) database into EE. The database is too big to export to csv (9gb) and import using Datagrab/Importer. Would JSON be option here as it will be a lot smaller size? So create a page on their server that is in the correct JSON format and then import the feed using Datagrab/Importer?

# Answer
> 1 votes
For an operation of this size, you should be using an enterprise solution, not a web application. You should be exporting the data from the other SQL database in chunks so you can move it gently. What is the other SQL format?

Directly moving the data files would be better than running a 9gb over-the-web import (too many chances for data to get wrecked, lose track of where you're at, etc..). I would recommend physically moving the data as a whole to the EE installation server, and then using a tool like MySQL Workbench or SequelPro, run your imports one table at a time. Then if you run into a failure during the process, you don't have to start over.

http://www.sequelpro.com/

http://www.mysql.com/products/workbench/

---
Tags: solspace, database, datagrab, solspace-importer
---


title: Alphabetical Category Listing

text:
# Question
Title: Alphabetical Category Listing
I have a client who wants to create an alphabetical listing of his categories, broken out by letter. The only way I can think to do this is by restricting each list by the first letter of the category name, but I'm not sure how to accomplish that with expression engine parameters.

This is what I am trying to use, and it is not giving me any entries, even though I have entries whose category name starts with that letter.

```
<h4 class="panel-title">A</h4>
    {exp:channel:categories channel="products" style="linear" category_group="not 4"}
            {if category_name ^= 'a'}
            <ul>
                            <li><a href="{path=visas}">{category_name}</a></li>
            </ul>
            {/if}
    {/exp:channel:categories}

```

Can someone tell me what I'm doing wrong?

# Answer
There isn't something built in to EE, but as usual, there is a plugin to the rescue:

https://devot-ee.com/add-ons/gwcode-categories

http://gwcode.com/add-ons/gwcode-categories/documentation

It's basically a beefed up version of the {exp:channel:categories} tag. To get a result closer to what you want, you probably need to turn PHP on output and do something like this:

```
<?php $alpha_array = array (); ?>

<ul class="category_list">
{exp:gwcode_categories orderby="cat_name"}

    <?php
        $cat = "{cat_name}";
        $starts_with = strtoupper($cat[0]);
        if (!in_array($starts_with, $alpha_array))
        {
            // if we haven't hit this letter yet, add it to our
            // alpha array, and then output that letters header
            $alpha_array[] = $starts_with;
            ?>
            <li class="letter_header">
                <?=$starts_with?>
            </li>
            <li>
                {cat_name}
            </li>
            <?php
        }
        else
        {
            ?>
            <li>
                {cat_name}
            </li>
            <?php
        }
        ?>
    ?>

{/exp:gwcode_categories}
</ul>

```

This will output your categories, and then you can style the li tags with the letter\_header class to look like h4 tags if you want.

**ps** do you have categories that start with a lowercase "a"...? I'd bet not.
> 0 votes

---
Tags: categories
---


title: MYSQL Error Importing Database

text:
# Question
Title: MYSQL Error Importing Database
This is a first for me... I'm importing into an database with no tables from a working backup.

```
Error
SQL query:

--
-- Dumping data for table `exp_accessories`
--

INSERT INTO `exp_accessories` (`accessory_id`, `class`, `member_groups`, `controllers`, `accessory_version`) VALUES
(1, 'Expressionengine_info_acc', '1|5', 'addons|addons_accessories|addons_extensions|addons_fieldtypes|addons_modules|addons_plugins|admin_content|admin_system|content|content_edit|content_files|content_files_modal|content_publish|design|homepage|members|myaccount|tools|tools_communicate|tools_data|tools_logs|tools_utilities', '1.0'),
(2, 'Developer_acc', '1|5', 'addons|addons_accessories|addons_extensions|addons_fieldtypes|addons_modules|addons_plugins|admin_content|admin_system|content|content_edit|content_files|content_files_modal|content_publish|design|homepage|members|myaccount|tools|tools_communicate|tools_data|tools_logs|tools_utilities', '1.7.1'),
(3, 'Devotee_acc', '1|5', 'addons|addons_accessories|addons_extensions|addons_fieldtypes|addons_modules|addons_plugins|admin_content|admin_system|content|content_edit|co[...]
MySQL said: Documentation

#1062 - Duplicate entry '1' for key 'PRIMARY'

```

# Answer
> 1 votes
what does your create table code look like? this?

```
DROP TABLE IF EXISTS `exp_accessories`;
CREATE TABLE `exp_accessories` (
      `accessory_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
      `class` varchar(75) NOT NULL DEFAULT '',
      `member_groups` varchar(50) NOT NULL DEFAULT 'all',
      `controllers` text,
      `accessory_version` varchar(12) NOT NULL,
      PRIMARY KEY (`accessory_id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8;

```

does it include an auto increment value? run a query on the table and see if anything is in there? also try `DESCRIBE exp_accessories`

if you restarted the import at any time, the inserts may have already ran. see if your dump file also includes the `DROP TABLE` call. What DB admin tool are you using to run the import?

---
Tags: mysql
---


# Question
Title: Is there a way to display just 1 low-reorder channel from a order set that has multiple channels?
I have products on my site and the client would like to order them, hence why I am using low reorder. On the main page all the different products need to be displayed, each product is in a different channel and low-reorder does this fine. However for the products individual pages I'd like to use the same order but only display the one channel. Is there a way to do this?

# Answer
Low Reorder extends the native channel entries tag so you should just be able to use the channel parameter. I tried the following and can confirm it works.

```
{exp:low_reorder:entries set="1" channel="channel_short_name"}
    {title}<br />
{/exp:low_reorder:entries}

```
> 3 votes

---
Tags: low-reorder
---


# Question
Title: Expression Engine: Change the style of a template wrapped in another template
I have a post/posts template wrapped inside a template called blog-posts.html . I would like to have the post/posts template display a different grid column class than how it is displayed when it is wrapped in another template. I think I need to write a conditional. Do I write the conditional in the posts/posts template or blog-posts.html. Below is the code from blog-posts.html:

```
{exp:channel:entries channel="post" dynamic="no" status="{permissions}" category="13" parse="inward"}
    {embed="post/posts" entry_id="{entry_id}"}
  {if results_none}
    {embed="main/results_none"}
  {/if}
{/exp:channel:entries}

```

# Answer
First i think your question is better posted on the expressionengine.stackexchange.com site. Generally what you are doing is not the best way to achieve this.

Maybe something like this would be better, because you are not embedding an embed for every result in the channel entries loop:

```
{exp:channel:entries channel="post" dynamic="no" status="{permissions}" category="13" parse="inward"}
   {if count == "1">
      <div class="your_grid_class">
   {/if}
   <article>
      <h2>{title}</h2>
      <p>{body}</p>
    </article>
      {if no_results}
        <div class="your_other_grid_class">
        {embed="main/results_none"}
      {/if}
    {/exp:channel:entries}

```
> 0 votes

---
Tags: php, html, css
---


# Question
Title: How do I determine which channel field groups are not being used?
We've created a lot of channels over the years some of which have been pruned back. This potentially leaves their channel field groups as useless clutter.

There doesn't seem to be a view within expression engine that succinctly displays which template groups are used with which channels -- or if any channel field groups are not being used at all.

How do I see which channel field groups are not associated with any channel?

# Answer
This MySQL query will return a list of all the channel field groups that are not associated with a single channel:

```
SELECT
    *
FROM
    exp_field_groups g
WHERE
    NOT EXISTS( SELECT
            g.group_id
        FROM
            exp_channels c
        WHERE
            g.group_id = c.field_group)

```
> 0 votes

---
Tags: custom-fields
---


# Question
Title: Ecommerce system for EE and requesting a quote
I need customers to submit a quote rather than an order, which as i understand is easy to do just use a manual payment gateway, but the bit I'm not sure on is the admin needs to login in & update product prices and delivery cost for the order then sends this out in an email?

Is this do-able? and which extension would you recommend?

# Answer
You can use BrilliantRetail to generate 'quotes' instead of orders. The quote request would be emailed to admins and the customer. From that point though you would need to handle the actual pricing outside of BrilliantRetail.

You can add order notes to the quote that the client would see but currently you can't edit the line item details to add pricing.

Please let me know if you have any other questions!
> 1 votes

---
Tags: expresso-store, ee2, cartthrob, brilliantretail
---


# Question
Title: FreeForm: Can I make my own template for a user to approve a pending record?
As much as I'd like my user to use the FreeForm Pro Control Panel to approve pending records, I don't want to grant this user access to all of my forms' results. (AFAIK you can't grant access to selected forms--it's either all or none.) So I'm seeing if I can create a template to do this, but I haven't found anything yet in FreeForm's tags. Any ideas on how to do this?

# Answer
take a look at these, you can build lists and edit forms in templates with these.

https://solspace.com/docs/freeform/edit/

https://solspace.com/docs/freeform/entries/
> 0 votes

---
Tags: solspace-freeform
---


# Question
Title: Shipping Rates in {shipping_method} Dropdown - Expresso Store
Is it possible to show the shipping rate next to the shipping option in the {shipping\_method} dropdown? I'm using the Store USPS Shipping Extension to calculate shipping costs.

I would like to show something like this in the dropdown:

* First-Class Mail Parcel ($3.04)
* Priority Mail 2-Day ($7.15)
* Priority Mail Express 1-Day ($31.20)

Thank you!

# Answer
Answering my own question here in case it helps anyone else.

This question/answer pointed me in the right direction: Do the Expresso Store shipping methods have to be displayed in a dropdown?

The solution was to use the {shipping\_methods} variable pair:

```
<select name="shipping_method">
    <option value="">Select a shipping method...</option>
    {shipping_methods}
    <option value="{method_id}">{method_title} ({method_price})</option>
    {/shipping_methods}
</select>

```

I can confirm that this works with the Store USPS Shipping Extension (v1.1.0), contrary to the Expresso Store docs.
> 2 votes

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


title: List upload destinations in module

text:
# Question
Title: List upload destinations in module
I'd like to show a list of available upload destinations on a form in a custom module, are there functions to help with this?

# Answer
Yup, just load and then use the File Upload Preferences model:

```
$group_id = ee()->session->userdata('group_id');
ee()->load->model('file_upload_preferences');
$upload_destinations = ee()->file_upload_preferences_model->get_file_upload_preferences($group_id);

```
> 0 votes

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


# Question
Title: 404 redirect not working, sending to another segment
I'm having problems with a template sending a missing page to another segment rather than the 404 page. For example, The URL below would give us our Disney Ship.

WEBSITE/cruises/disney/ships/disneyship/

What happens if someone types this?

WEBSITE/cruises/disney/ships/disneyshipTHISSHOULDNOTBEHERE/

It should 404 correct? Instead, it keeps the URL above in the browser but displays the contents of segment 2.

I've been testing all over the place and slimmed down the code for testing to just this:

```
{exp:channel:entries channel="at_cruise_ships" require_entry="yes"}
    {if no_results}
        {redirect="404"}
    {/if}
  <h2>{title}</h2>
    {body}
{/exp:channel:entries}

```

**NOTES:**

* this works great if i do the same scenario in segment 2. For example, http://www.example.com/cruises/disneyTEST/ will redirect to the 404 page as expected
* the disney ship exists in the cruise\_ships channel
* strict URLs is enabled in preferences
* my 404 template is assigned in preferences
* I am using Structure, but not directly related to this page

Please let me know if you have any suggestions on this as i'm at a loss. Thanks!

# Answer
The problem you're facing is related to the fact that the Channel Module doesn't look for entries on all segments by default.

Imagine 9 segments. The module would have to test every single segment until find one entry matching it. This could make the system really slow. So, by default, it just looks for entries matching the most common used segments for it: 2 and 3.

But you can still use other segments. You just need to explicitly choose one. You need to set the parameters `dynamic` as `no` and `url_title` as the segment intended.

If you want to use the `segment_4` as your `url_title`, you need to make it explicit:

```
{exp:channel:entries channel="at_cruise_ships" require_entry="yes" dynamic="no" url_title="{segment_4}"}
    {if no_results}
        {redirect="404"}
    {/if}
  <h2>{title}</h2>
    {body}
{/exp:channel:entries}

```

The `require_entry` parameter will trigger the `{if no_results}` conditional if no entry was found and **only** in this case.

No matter how you set your URL structure, you need to deal with extra segments by yourself:

```
{!-- for all extra segments beyond 4th --}
{if segment_5}
 {redirect="404"}
{/if}

```
> 1 votes

# Answer
You can define the 404 page in the control panel so you don't have to do the redirect. EE will do it for you. https://ellislab.com/expressionengine/user-guide/urls/404pages.html
> -1 votes

---
Tags: redirects, 404, segments
---


# Question
Title: How to update a plugiun using info in Developer's Log?
I am getting several messages in my Developer's Log similar to this. It wants me to update a plugin.

```
Deprecated function set_variable() called in system/expressionengine
/third_party/title_master/mcp.title_master.php on line 138.
Deprecated since 2.6. Use view-><var> = <value>; instead.

```

Below is what the above is referring to, but I am not sure what to change it to.

```
public function settings()
{
    $this->EE->cp->set_variable('cp_page_title',
                            lang('channel_settings_page'));

```

Can someone tell me exactly what it should be? Would help me a lot and I thank you in advance. :)

# Answer
> 0 votes
Looks like the add-on has been discontinued, so doubt the developer will (or has) updated. The change in question happened in v2.6 of ExpressionEngine. You've not specified what version of EE you're using.

Change this line:

```
$this->EE->cp->set_variable('cp_page_title',
                            lang('channel_settings_page'));

```

To this:

```
ee()->view->cp_page_title = lang('channel_settings_page');

```

---
Tags: ee, developer-log, title-master
---


# Question
Title: Conditional Comparison Operator Not Working With Snippet
I am trying to get a snippet that calculates a value and compare the result to a number - the value is correctly outputted from my snippet when I include the var by itself. However when I use the snippet in a comparison if statement it doesn't work. Here is my code:

```
{if total-positive-votes > 5} true {/if}

```

My snippet:

```
{exp:math_plus calculate="{var2}-({var1} - {var2})" var1="{overall_count}" var2="{overall_sum}"}
   {math_plus_result}
{/exp:math_plus}

```

Which outputs the following numbers correctly (each comma is a would be comparison):

```
0, 1, 1, 4, 0, 0, 41, 8

```

So my comparison statement should output true on 41 and 8 but nothing comes back. Any one know why this isn't working? The funny thing is it used to work but I didn't use or upgrade this site for 2 years and it broke without me changing anything. Go figure!

# Answer
> 0 votes
If I understood you right, `total-positive-votes` is your snippet.

I think you're over complicating things, since there's a pack of mathematical operators that can be used on conditionals.

```
{if overall_sum - (overall_count - overall_sum) > 5}
  true
{/if}

```

Or, to keep it even simpler, because multiplications always happen before sum, anyway:

```
{if 2 * overall_sum - overall_count > 5}
  true
{/if}

```

---
Tags: ifelse, snippets, comparison
---


title: Restrict sale to guest member group?

text:
# Question
Title: Restrict sale to guest member group?
My client wants guest and member pricing for products.

My initial thoughts were to create two sales one restricted to the members group and one restricted to a logged out (guest) group. It looks like sales can only be restricted to member groups.

How would I go about adding a discount to guests?

# Answer
In the end I hacking ProductsService::apply\_sales() to apply a discount before the `foreach ($this->get_active_sales() as $sale)` loop.

```
public function apply_sales(Product $product)
{
    // set initial option sale prices
    if (isset($product->modifiers)) {
        foreach ($product->modifiers as $modifier) {
            foreach ($modifier->options as $option) {
                $option->sale_price_mod = $option->opt_price_mod;
            }
        }
    }

    // find any sales which apply to this product
    $member_group_id = (int) $this->ee->session->userdata['group_id'];

    /**
     * HACK ^LG
     * Added 10% Discount Member Price
     */
    if($member_group_id) {
        $product->setPriceAttribute(store_round_currency($product->price - (10 * $product->price / 100)));
    }

    foreach ($this->get_active_sales() as $sale) {
        if ($this->sale_applies_to_product($sale, $product, $member_group_id)) {

            if ((float) $sale->per_item_discount) {
                $product->sale_price = store_round_currency($product->sale_price - $sale->per_item_discount);
            }

            if ((float) $sale->percent_discount) {
                $product->sale_price = store_round_currency($product->sale_price - ($sale->percent_discount * $product->sale_price / 100));

                // percentage discount also needs to be applied to loaded modifiers
                if (isset($product->modifiers)) {
                    foreach ($product->modifiers as $modifier) {
                        foreach ($modifier->options as $option) {
                            if ($option->opt_price_mod) {
                                $option->sale_price_mod = store_round_currency($option->sale_price_mod - ($sale->percent_discount * $option->sale_price_mod / 100), true);
                            }
                        }
                    }
                }
            }

            $product->on_sale = true;
        }
    }

    return $product;
}

```
> 1 votes

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


title: File Upload Issue In Channel Form

text:
# Question
Title: File Upload Issue In Channel Form
I am running 2.9.3 using Channel Forms, the issue is if I try and upload a excel or .xlsx file it never uploads, even though eventually the form submits (it's considerable slower submit), no upload happens.

If I try .txt or an image file, it's fine. I have the enctype="multipart/form-data" in the tag, so not sure what might be occurring here. Any ideas, I have been at it for a while and not sure what it might be.

# Answer
> 1 votes
I had the same issue. You can solve it by disabling XSS filtering:

Admin -\> Security and Privacy -\> Security and Sessions. Than select "No" for "Apply XSS Filtering to uploaded files"

---
Tags: safecracker, file-uploads, safecracker-file, channel-files
---


title: Low Search Shop Filter Question

text:
# Question
Title: Low Search Shop Filter Question
I'm trying to replicate one of those "Order By" options that you see in eCommerce websites with Low Search.

The options usually are:

* Most Popular
* Newest
* Price - High to Low
* Price - Low to High

I've worked out I could do something like:

```
<select name="orderby">
    <option value="">Most Popular</option>
    <option value="date">Newest</option>
    <option value="matrix:price">Price - High to Low</option>
</select>

```

But I'm struggling to understand how (Or if possible) to add the Price options in there along with a sorting option.

Also - the prices are set inside a Matrix field, so is it possible to order by using a Matrix field.

It would be good if you could combine the Order By and Sort parameters in EE, without needing to do 2 seperate selects.

# Answer
It's not possible to order by a column in a Matrix field. Just imagine how that's supposed to work: if a Matrix field has multiple rows (and therefore multiple prices), which price should be used for ordering? It doesn't really make sense.

If you want to order by price, there should be a dedicated field that contains the price by which you can sort and order.

> It would be good if you could combine the Order By and Sort parameters in EE, without needing to do 2 separate selects.

This is possible with Low Search, using the `orderby_sort` parameter, eg: `orderby_sort="date|desc"` or `orderby_sort="title|asc"`
> 2 votes

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


# Question
Title: MX Select Plus CE - problems with SQL Query
I've added **MX Select Plus CE** in a Matrix row. The objective is when the user is digitizing inside the select options, appears "on the fly" the "title" of theses entries of a specific channel.

I chose a SQL query:

```
SELECT title FROM exp_channel_titles WHERE channel_id = '2'

```

Inside these **{exp:query}** fields, appears all the titles of the entries.

```
{exp:query sql="SELECT title FROM exp_channel_titles WHERE channel_id = '2'"}
          {title}
{/exp:query}

```

So inside the **MX Select Plus CE** \- **DB REQUEST field**, I inserted the SQL Query:

```
SELECT title FROM exp_channel_titles WHERE channel_id = '2'

```

But in the Channel Entries Edit page, appears error messages:

```
Message: Undefined index: option_name
Message: Undefined index: option_label

```

Inside the DB REQUEST field, what are the parameters for **option\_name** and **option\_label**. Does my SQL Query is correct ?

Does someone have a simple example about to show the titles of channel or other parameters and the option\_name and option\_label parameters?

# Answer
> 3 votes
Take a look at the example on the Field display :

> ex 1: SELECT action\_id as option\_name, method as option\_label, class as optgroup FROM exp\_actions ORDER BY class

You will see that the query needs to mark the fields option\_label and option\_value within the query, using the `AS` operator.

Ergo, to replicate your query I have assumed you wish to display the Entry Title, and store the Entry ID, therefor I used :

```
SELECT entry_id AS option_name, title AS option_label
FROM exp_channel_titles
WHERE channel_id = '2'

```

I set this up and the field worked fine on the edit/publish CP pages, however it caused another error on Save.

```
A PHP Error was encountered
Severity: Warning
Message: is_array() expects exactly 1 parameter, 0 given
Filename: mx_select_plus/ft.mx_select_plus.php
Line Number: 608

```

So I inspected this line, sure enought there seems to be a type-o here (Line 698 of `ft.mx_select_plus.php`:

```
$data = ( is_array() ) ? implode( '|', $data ) : $data;

```

That doesn't look right! I changed this to :

```
$data = ( is_array($data) ) ? implode( '|', $data ) : $data;

```

This makes the `is_array` call valid and my entry is duely saved.

I can display my selected entry too, however this too is also bugged (i'd get the ticket ready for http://www.eec.ms as the documentation if not good either!), it will only display the saved value, not the label when using a database query. Fixing this is way beyond scope however this should get you started.

In summary, I'm seeing some issues in MX Select Plus specifically when using a DB query, I don't think its the 100% finished article. Hopefully the guys over at EEC.MS (MaxLazar, where are you?? :D) will see this and have a look for you.

Otherwise you could report the `is_array` issue and the lack of loading/saving values/labels when using a db query here : https://github.com/MaxLazar/mx-select-plus/issues

---
Tags: query, sql, mx-select-plus
---


# Question
Title: Combining EE + CodeIgniter on existing website?
It’s been a while since my recent post, but I’ll be very happy, if I can get some help from you guys as well as to share an interesting scenario for other newcomers.

We have a website running on a domain like this:

* domain.tld
* domain.tld/section1
* domain.tld/section2

Our goal is to rebuild certain sections on CodeIgniter, since we need flexibility, which is not available in EE (not because of its limitation, but because of the details we stress on in the new version). Simply said, we try to accomplish:

* EE - domain.tld
* EE - domain.tld/section1
* CI - domain.tld/section2

Is there any reasonable way to do this? I know it’s a matter of “hacking” EE core and / or heavily customizing, but any ideas are more than welcome.

Thanks!

# Answer
First thing: ExpressionEngine uses a modified version of CodeIgniter. Ellis Lab maintains their own branch of the main CodeIgniter code base, so expect to run into occasional issues between documentation and actual function.

Second thing: Go to your EE route config file at:

```
/system/expressionengine/config/routes.php

```

and you can go a head and mess about how you want. You should be able to set routes and use CodeIgniter class methods:

http://codeigniter.com/user\_guide/general/routing.html

I've never done this in production, just messed with it at some point a few years ago. But give it a go, this could be your solution.
> 1 votes

---
Tags: ee2, codeigniter
---


title: Brilliant Retail: change order number

text:
# Question
Title: Brilliant Retail: change order number
I have just configured a test site using a fresh install of Brilliant Retail, and it appears the first order number starts with 10000.

Is there a way to change this default starting number? I looked in the settings but either I'm just not seeing it, or it doesn't exist as a user configurable option. In case my client asks, I would like to know if it is possible to change this figure at all?

Thanks.

# Answer
The next order number is set the br\_config\_data table. Look for the 'label' column with the value 'Order ID' and you'll see the next order id in the 'value' field.

You'll want to make sure that its greater than any existing orders in the database since the value is auto incremented.
> 1 votes

---
Tags: ecommerce, brilliantretail
---


title: List Blog Authors

text:
# Question
Title: List Blog Authors
I am trying to set up a “Search by Author” on a blog I am adding to a community website.

I can get the avatars to show up, but instead of a list of avatars, I am getting an avatar for every single entry. I want to remove duplicates and show each author only once.

I understand that the code below will result in it pulling all author's avatars for every.single.post on the site. I have about 10 authors and I want to show their avatars that will link to a list of their blogs.

```
{exp:channel:entries
    channel="blog"
    orderby="asc"
    dynamic="no"
    style="nested"
}
    {if avatar}
        <a href="{site_url}blog/author/{member_id}" class="blogimg">
            <img src="{avatar_url}" class="imgblogauthorbar"/>
        </a>
    {/if}
{/exp:channel:entries}

```

Any advice on how to go about making this work?

# Answer
> 0 votes
If you want to list users, your better option is to use the Query Module. The first sample codes on user guide are all about members.

```
{exp:query sql="SELECT screen_name, email, location FROM exp_members WHERE group_id = '1'"}
        {screen_name}
        {email}
        {location}
{/exp:query}

```

The previous sample, limits the members to who is on group 1, but you can improve it to who is also on author list and have written entries:

```
SELECT
  screen_name,
  email,
  location
FROM
  exp_members
WHERE
  group_id = '1'
  AND in_authorlist = 'y'
  AND total_entries != 0
ORDER BY
  last_entry_date

```

You can use `SELECT *` if you want to return all fields on the `exp_members` table.

---
Tags: author
---


# Question
Title: What is the best approach for sharing templates across MSM sites?
I have an Expresso Store site that I need to be able to process orders in multiple currencies. My approach is going to be to split the site out into an MSM site. The original site will process orders through Store in USD. The second MSM site will process orders through Store in EUR. With MSM, each site can have it's own Store settings, which makes this possible. At least to my knowledge.

Each site will have identical content, pages, products, etc. The only difference will be the display of the price and the currency used throughout the checkout process. My plan for the EUR site is to have a single products channel, with a Store custom field where I can specify the product price and inventory for the EUR version of the product. Then a Playa field that relates to the USD store version of the product, where I can pull in the rest of the product information, like images and details.

Since I need to share so much of the same information, content, and code across sites, what is the best way to setup my EE templates? Is there a way I can effectively use the same template set for both sites? I know I can embed templates from one site into another, but that gets a little messy with template layouts, embeds, partials, etc. Or am I better off just duplicating the templates for the second site and maintaining two separate, but mostly identical template code bases?

# Answer
If you have SSH access to the server you can use symlinks to share templates across sites.

Something like this...

```
/var/www/main_site/templates (Templates live here)
/var/www/site1/templates --> /var/www/main_site/templates
/var/www/site2/templates --> /var/www/main_site/templates

```

Of course, this means the exact same template file needs to work for any of your sub-sites. You might use global variables or Low Variables to handle the per-site customization.

We have used this approach for a network of 200+ sites all running from one of five EE installs that all have identical templates. (It's a nation-wide nonprofit with lots of local chapters.)
> 1 votes

---
Tags: expresso-store, multi-site-manager
---


title: Wygwam - Creating a custom template

text:
# Question
Title: Wygwam - Creating a custom template
I'm using ExpressionEngine v2.7.2 and Wygwam v3.2.2 and I want to be able to add a custom template to the toolbar, to be able to add custom markup.

I've looked at the documentation for both CKEditor and Wygwam, but it's so confusing.

I see that under `third-party/wygwam/ckeditor/plugins/templates/` there are two folders, `dialogs` and `templates`. And it looks like the folder `templates` is the one that is the default one. What are the steps I need to go from here?

In my Wygwam configuration in Expression Engine CP, I can add `Advanced Settings`. But should I choose `templates` or `templates_files`? If I choose `template_files`, this is filled out by default: `plugins/templates/templates/default.js`

This I reckon is the file from third-party/wygwam/ckeditor/plugings/templates/? Would that mean that I can just add `plugins/templates/myCustomTemplate/default.js`

I have already tried that and it comes up blank when I click the button in the wygwam editor. This is really confusing, any pointers?

# Answer
> 1 votes
Really good video on using templates in wygwam here How to use the Templates button in Wygwam for ExpressionEngine

# Answer
> 0 votes
You should define your custom templates in it's own file outside of Wygwam.

e.g. /assets/wysiwyg/wysiwyg-templates.js

```
// Register a template definition set named "default".
CKEDITOR.addTemplates( 'default',
{
    // The name of the subfolder that contains the preview images of the templates.
    imagesPath : '/assets/wysiwyg/images/',

    // Template definitions.
    templates :[
        {
            title: 'Callout - Blue Background',
            image: 'callout-blue.png',
            html:
                '<div class="callout-blue"><p></p></div>' +
                '<p></p>'
        },
        {
            title: 'Custom - List Item',
            image: 'custom-list-item.png',
            html:
                '<p class="custom-li"><span class="key">1.</span> Lorem ipsum</p>' +
                '<p></p>'
        },
        {
            title: 'Styled Link List',
            image: 'link-list.png',
            html:
                '<ul class="link-callout"><li></li></ul>' +
                '<p></p>'
        },
    ]
});

```

Then in the EE control panel go to the Wygwam module, edit your configuration and add an advanced setting for template\_files and set it to the path you used above (e.g. /assets/wysiwyg/wysiwyg-templates.js).

---
Tags: wygwam
---


title: server hacked, what to advise client

text:
# Question
Title: server hacked, what to advise client
The index.php file in root has been injected with code. I do not know what this code means, but this is obviously not good. This is the first time this happens in all the years I work with EE. (BTW, the server that this build runs on is not my choice.)

My questions:

1) what do I tell the client? Does he have to move server (ISP?)

2) What do I do, should I reinstall EE completely?

Hope for an answer here, thanks.

# Answer
The first thing to do is remove the code but you should also look to see there is anything else that has been touched. Reinstalling completely may be unnecessary but it won't do any harm.

If you store any personal information of users you should also determine whether or not this has been taken and your client needs to decide whether or not to inform them of the breach.

But it is pointless fixing anything unless you find out how the code was injected. In all my time working with EE I have only seen a few hacked sites. But they all tend to be on shared servers and the attack vector was another popular CMS hosted on the same server.

The injected code might give you a clue as to where the attack came from. Do some Google research on that as it might help determine your next steps.

As far as your client goes, be up front. This kind of thing happens and anyone that thinks any site is 100% secure is fooling themselves. The real issue is how you deal with it now. Be open and thorough. Try to find out how it happened and take steps to prevent it happening again.
> 2 votes

# Answer
I agree with @foamcow's answer.

Also, change your SFTP and MySQL passwords and look at .htaccess in case they injected some redirects.
> 3 votes

---
Tags: ee, server, core-hacks
---


# Question
Title: MX Notify Control doesn't work on statuses that contain spaces
I've just learned that MX Notify Control apparently sends a "Disallowed Key Characters" error when trying to set up a new rule for a status that contains spaces, like "Awaiting Approval." If I name that status "Awaiting-Approval", the notification does go through.

Any fix for this?

EE 2.9.2 Mx Notify 2.4.6

# Answer
Here you can find a fix: https://github.com/MaxLazar/mx-notify-control/pull/4 (I haven't tried if this works)
> 2 votes

---
Tags: mx-notify
---


title: Point a Low:Search result at its parent

text:
# Question
Title: Point a Low:Search result at its parent
I have a Low:Search result that is a child entry in a relationship, for which I wish to point at it's parent entry.

The child doesn't have its own URL that resolves, it just resides within its parent index. The entries in the other collection have URLs that resolve.

I tried to redirect from the child URL to its parent. No luck, perhaps a parse order issue?

I also tried to set the inner html - that displays the content - based on a conditional within the {low\_search:results} tag, using 'collection\_name', but it also isn't working. I receive a message that the page cannot be properly displayed.

The only way I can get it to work is if I have 2 duplicate {low\_search:results} tags, targeting each collection separately, as per Group Low Search results by channel/collection?, but I get both a result set and a 'Sorry, no results' message as both tags are firing, but the keywords are not in both collections.

I must be missing something obvious, as relationships have been around a long time in EE.

Can anyone with a clear head see what I'm missing?

Thanks very much for reading.

---

Code example - I don't expect this to work as is, but this structure is what I was hoping would work...

```
  {exp:low_search:results query="{segment_3}" limit="10"}

  {if count == 1}
    {if low_search_keywords}<p>Term searched for: <strong>{low_search_keywords}</strong>.</p>{/if}
    <p>Total results: <strong>{absolute_results}</strong>.</p>
  {/if}

  {if channel == "members"} {!-- child of 'bands' --}

  <div class="entry" style="clear: both;">
    <h3><a href="/band-members">{title}</a></h3>
    <p>{low_search_excerpt}</p>
  </div>

  {/if}

  {if channel == "musicians"} {!-- no children --}

  <div class="entry" style="clear: both;">
    <h3><a href="{page_url}">{title}</a></h3>
    <p>{low_search_excerpt}</p>
  </div>

  {/if}

  {paginate}
    <p>Page {current_page} of {total_pages} pages {pagination_links}</p>
  {/paginate}

  {if low_search_no_results}
    <p>Sorry, your query did not return any results. Check your spelling or try a different search term.</p>
  {/if}

{/exp:low_search:results}

```

---

Working code:

```
{if channel_short_name == "members"}

<div class="entry">
{parents field="cf-members_item"}
  <h3><a href="{parents:page_url}">{title}</a></h3>
{/parents}
  <p>{low_search_excerpt}</p>
 </div>

{if:else}

<div class="entry">
  <h3><a href="{page_url}">{title}</a></h3>
  <p>{low_search_excerpt}</p>
</div>

{/if}

```

# Answer
> 2 votes
Really we need to see your template code as it's not really clear what you're doing/trying.

However would it not be a case of using an embed or channel entries loop within the search results? Thats what you want right, to display the parent of an entry within search results, if that result is a child entry 'type' or channel??

Something like this, written on the fly so probably doesn't work but hopefully give you the idea of what I'm getting at:

```
{exp:low_search:results
   orderby_sort="title|asc"
   query="{segment_3}"
}
    {!-- Detect entries of type child --}
    {if channel_short_name == 'child_channel'}

        {!-- get the parent entry
        {parents field="relationship_field"}
                {exp:channel:entries entry_id="{parents:entry_id}" dynamic="no"}

                    {!-- Display Parent Stuff --}
                    {url_title_path='parent_channel/display'}

                {exp:channel:entries}
        {/parents}

{/exp:low_search:results}

```

Or have I missed your point?

---

**Edit 1**

Since code example, I've written a more consise answer for you. It's not clear if you wish to display the `{title}` of the parent or child so I've added alternatives to relect this. Also, I've utilised an embedded template to make the markup more readable, otherwise you'll end up with many EE tags inside the anchor tag!

**Edit 2** : Following Low's comments I've used namespaced variables instead of the extra channel entries loop. I've had issues with parameters and EE tags inside relationship parent loops before (hence initial avoidence) so my code is supplied untested!

First the main template...

```
{if channel == "members"} {!-- child of 'bands' --}

  <div class="entry" style="clear: both;">

   {!-- This example assumes child's title --}
   <h3>
   {parents field="parents_relationship_fieldname"}
     <a href='{parents:url_title_path='templates/bands'}'>
   {/parents}
       {title}
     </a>
   </h3>
   <p>{low_search_excerpt}</p>

  </div>

 {/if}

```

If you wantedt he parent title, try something like this instead:

```
{if channel == "members"} {!-- child of 'bands' --}

  <div class="entry" style="clear: both;">

   {!-- This example assumes parent's title --}
   {parents field="parents_relationship_fieldname"}
     <h3><a href='{parents:url_title_path='templates/bands'}'>{parents:title}</a></h3>
   {/parents}
   <p>{low_search_excerpt}</p>

  </div>

 {/if}

```

# Answer
> 3 votes
@Blatant is on the right track, but the code example isn't optimal.

Since the Results tag builds upon the native `exp:channel:entries` tag, you're able to use the native Relationships Field options. So, to get to an entry's parent, use something like this:

```
{parents field="relationship_field"}
    {parents:url_title}
{/parents}

```

Use that to compose the URL you want for the channel you want.

---
Tags: relationships, low-search
---


# Question
Title: Zoo Visitor not entering member_id on registration
I have a site in development using Zoo Visitor 1.3.34 (latest version) and EE 2.9.2. Currently, I'm running into a small stupid problem that might be a Zoo Visitor bug. I know I could write a tiny extension to fix the issue, but am wondering if anyone else has run into this issue.

When a new user is registered, they get their EE Member rows created, and Zoo Visitor creates an entry in the Zoo Visitor channel. Zoo visitor has a hidden field that holds the Member ID (so it can associate it's channel entry with the logged in user). When a new user is registered via a front-end

```
{exp:zoo_visitor:registration_form}

```

tag, everything goes fine, but the field that holds the Member ID in the Zoo Visitor channel **does not get populated**. If I then open that Members Zoo Channel entry and give a submit, it then populates that field. This is an issue because I'm using a Zoo Channel field to control permissions, and need to look up the members channel entry without someone having to open each new users Zoo channel entry and submitting it.

Any ideas I'm missing besides just making an extension that hooks to

```
zoo_visitor_register_end

```

and updating the Member ID field manually after registration? Zoo Visitor has way too much code for me to spend the time to track this down if it is a bug. Thanks!

# Answer
> 1 votes
I hate to be one of those people, but I couldn't move on until I fixed this issue. Here's how I did it. In my plugin to check for permissions, I was looking up the Zoo Visitor Channel entry by looking at that field to match member\_id:

```
// get zoo row
$member_id  = ee()->session->userdata('member_id');

$zoo_dept   = ee()->db  ->select($this->zoo_department_field)
                        ->from('exp_channel_data')
                        ->where($this->zoo_member_id_field, $member_id)
                        ->get()
                        ->row_array();

```

Instead, I found a helper function in a Zoo Visitor helper called get\_visitor\_id. So in my plugin \__construct, I added this:

```
ee()->load->add_package_path(PATH_THIRD . 'zoo_visitor/');
ee()->load->library('zoo_visitor_lib');

```

and then I use that helper function to look up the row:

```
// get zoo row
$visitor_id = ee()->zoo_visitor_lib->get_visitor_id($member_id);

$zoo_dept   = ee()->db  ->select($this->zoo_department_field)
                        ->from('exp_channel_data')
                        ->where('entry_id', $visitor_id)
                        ->get()
                        ->row_array();

```

and continue along with my normal permissions checks! It would be nice if Zoo Visitor documented their API and helpers for developers, but it's OK, I enjoy investigating code.

# Answer
> 1 votes
On the template where your member is taken **after** registration, try adding this tag : `{exp:zoo_visitor:sync}`

This will force the fields to sycronize between members fields and channel entries, which I beleive is whats happening when you go into the CP and 'submit' the member entry anyway. The tag is undocumented ASAIK, but it's referenced in these places:

It's more for members created by other means (like Social Pro) but I beleive it might help out, and hey, it takes 5 mins to check this solution!! Let us know if it works/how you get on.

Just a guess from a related question but it might kick things into life!!

---
Tags: zoo-visitor
---


title: Multiple currencies in Expresso Store

text:
# Question
Title: Multiple currencies in Expresso Store
Is it possible to add a currency drop-down to Expresso Store's front end to change the currency in the back-end?

I understand I can have the values output as integers and provide conversions via JS, but the cart value would still be in the currency set in the cp, and the transaction would also be in that currency, correct?

Thanks for the help!

# Answer
> 3 votes
No, Store doesn't support multiple currencies. It would require lots of changes to Store (to let you enter each price in each currency), as well as support from your merchant account bank and payment (most merchant accounts don't support multiple currencies).

The best you can do is provide a "live conversion" service for your customers (using javascript), but make it clear they will still be charged in your base currency.

# Answer
> 1 votes
It is possible using the Stripe gateway and hacking the build\_payment\_request method in the PaymentsService class.

You'll want to change this line:

```
$request['currency'] = config_item('store_currency_code');

```

to accept a POST variable:

```
$request['currency'] = $this->ee->input->post('currency', true);

```

Once you've done that, you should be able to pass a 3 letter currency variable through the checkout form, either through a hidden field, or a select dropdown.

I'm basing my currency field based on the billing address, so that the user is charged the currency of the country that they are located in. Example:

```
<input type="hidden" name="currency" value="{if billing_country == "US"}USD{if:else}CAD{/if}">

```

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


title: Add files to entry, twice a week

text:
# Question
Title: Add files to entry, twice a week
I have a channel with entries Every entry have only one field for file upload. How to add second/3-rd/4 etc.. file into entry without adding fields for new files? May be anyone know module?

# Answer
I would recommend something like Matrix. You could have a single column Matrix field of file upload fields. But as for conversion of what you have? Forget it. To do what you want, you need to edit field groups, and it sounds like that isn't an option.

If it is, get Matrix, it's awesome.

https://devot-ee.com/add-ons/matrix
> 1 votes

# Answer
Your easier option for it is to put the File field inside a Grid.

The first example on the user guide is about File fields.
> 0 votes

---
Tags: ee2
---


# Question
Title: Update to v2.10.1 causing layout to be messed up
I updated EE to the latest version including all add-ons (Wygwam, Navee, Channel Images). For some reason the layout of most pages is messed up.

There must obviously be some code update in this version that is preventing something from displaying correctly.

I notice any page that only has one segment in the url appears fine. All multi-segment url's have messed up layouts (98% of the site).

Update: It appears to have something to do with the Navee crumbs. This is the code i am using.

```
{exp:navee:custom_crumbs wrap_type="none" backspace="2" spacer="  > " no_last_spacer="true"}{if link != ""}<a href="{link}" title="{text}">{text}</a>{if:else}{text}{/if} {spacer}
{/exp:navee:custom_crumbs}

```

Is there something not right about this? It was previously working fine!

# Answer
> 0 votes
Turns out the backspace="2" was causing the issue. Maybe Navee updated their code so it was no longer required.

---
Tags: update, debugging, navee
---


# Question
Title: MX Notify Control not parsing Channel Entries tag
I'm trying to replicate the example here but Channel Entries tag in the notification email is not rendering at all. I've tried both Plain Text and HTML emails.

Any ideas?

# Answer
Is the entry showing when you open the page in your browser? (Use the entry\_id to debug.)

Two things come to my mind:

1. Is the status of the entry other than 'open'? Than you should use the parameter status="\[the other status\]"
2. Is the entry\_date a date in the future? Than use the parameter show\_future\_entries="yes"
> 0 votes

---
Tags: mx-notify
---


# Question
Title: Exp-resso Store - custom fields in control panel
Is it possible to add a custom order field to the Orders page in the control panel of Exp:resso Store? If it is possible, how is it done?

Edit: I need to include the customers company name not a custom field.

# Answer
I presume that you have checked the Order fields in Store Settings in the CP? Do you have a Billing\_company and shipping\_company field? If so, these are easily mapped to your existing member fields. You would need to create any custom member fields first (e.g. billing\_company).
> 0 votes

---
Tags: expresso-store
---


title: Upgrade from 2.3 to 2.9 strange errors

text:
# Question
Title: Upgrade from 2.3 to 2.9 strange errors
Running EE 2.3 and trying to upgrade, the first error is a message which says:

> We have detected that you are currently running ExpressionEngine version Public Beta pb01 If you are ready to update ExpressionEngine to version 2.5.0 click the link below:

Which is odd in itself as it is not a public beta but v2.3.

Then there are a slew of errors relating to duplicated tables and no primary key - these are all fixable in PhpMyAdmin by deleting or editing but is a major pita.

Next, with those errors fixed we run into one for which I have no solution: the installer stalls because a field/table prefixed with 'weblog\_' does not exist. Which of course it does not as we're not upgrading from V1. Obviously though the installer thinks we are and won't go further.

Is pretty imperative we get this upgrade done asap.

Anyone have any suggestions? This is on EngineHosting and they can't help.. what's next? Can't really abandon the upgrade....

Cheers

# Answer
> 1 votes
I've had problems such as this before. The answer was to make a note of the problems and then modify the database manually accordingly so that the installer can cope with the changes. This is usually a problem when there is a significant difference between the current version and the one you are upgrading to.

I wrote a blog item about a particular upgrade which might help to point you to the right direction: http://www.climbingturn.co.uk/tech\_tips/expressionengine-tips-and-tricks/expressionengine-upgrade-271-to-290/

I hope that helps.

---
Tags: ee2-upgrades
---


# Question
Title: Expressionengine Comment Form And Entries Dissapear on some occassions
Very quick question. I'm relatively new to Expressionengine and unsure what could be causing my issue. So I have an Article template, inside of it I have comments:

```
<!-- Comments -->
        <div class="comments">
            <div class="existing-comments">
                <h3> Comments </h3>
                {exp:comment:entries sort="desc"}
                <div class="comment">
                    <div class="initial">
                        {if no_results}
                            <p class="center"> Be the first to write a comment. </p>
                        {/if}
                        <p>
                            {comment}
                        </p>
                        <span class="posted-by">Posted by <a href="{if url}{url}{if:else}#{/if}">{name}</a> on <strong>{comment_date format="%Y %m %d"}</strong></span>
                    </div>
                </div>
                {/exp:comment:entries}
            </div>
            <div class="comment-form">
                <h3> Leave a comment </h3>
                {exp:comment:form channel="blog_post" rules:name="required|email=required|comment=required"}
                    <ol>
                        <li>
                            <label>YOUR NAME<span>*</span></label>
                            <input type="text" name="name" value="{name}" required/>
                            {if error}
                            <p class="error">Name is a required field. </p>
                            {/if}
                        </li>
                        <li>
                            <label>YOUR EMAIL<span>*</span></label>
                            <input type="email" name="email" value="{email}" required/>
                            {if error}
                            <p class="error">Please enter a valid email. </p>
                            {/if}
                        </li>
                        <li>
                            <label>YOUR WEBSITE</label>
                            <input type="text" name="url" value="{url}" required/>
                        </li>
                        <li>
                            <label>YOUR COMMENT<span>*</span></label>
                            <textarea name="comment">{comment}</textarea>
                            {if error}
                            <p class="error">Comment is a required field </p>
                            {/if}
                        </li>
                        <li class="captcha">
                            {if captcha}
                                  {captcha}
                            {/if}
                        </li>
                        <li class="submit"><button type="submit">POST COMMENT</button></li>
                    </ol>
                {/exp:comment:form}
            </div>
        </div>

```

For some reason on only some of the articles the comment form and exp:comment:entries dissapear. 95% of articles are fine. Could you see if I made a mistake somewhere? Gone through 100 times through the code cant spot the difference.

I should also probably point out that comments are not nested. I use reCaptcha(if this makes a difference). Anybody encountered issue like this before?

Here is affected url: http://www.yourpeakstate.com/blog/the-4-secrets-to-living-your-dream-life-1

# Answer
Have you enabled guest posts? Go to Admin -\> channel administration -\> channel form. Than select "yes" for "allow guest posts" at the blog\_post channel. You can also use the parameter allow\_comments="yes" instead.

Is this post indeed in the blogpost channel which you have specified in your tag?

Edit:

Now I also notice that your comment:entries tag is not showing any text

* Are your comment tags placed inside your channel tag? If so, place them outside.
* As a last option you could als try to use the tag like this: {exp:comment:form channel="blog\_post" dynamic="no" url\_title="{segment\_2}" rules:name="required|email=required|comment=required"}
> 0 votes

# Answer
The ReCaptcha should not make a difference, it should invalidate the comment form and show errors.

As Balloonatic implies, review your comment settings as a first step.

Because you say this only affects like 5% of your articles, I would check the Options tab on the affected articles, in there is a check box for "Allow Comments", is this unticked on the affected articles? If so, there ya go.

The other things to check are :

* Flood Control (Have you just posted a comment)
* Member Group Comment Posting Priviledges

There is a flood control mechanism in EE, if it's a case of comment section disappearing on articles where I've just posted a comment I'd look into that (pretty long shot).

There are also a bunch of comment settings in the member group priviledges, check these as well. Are you looking at the site as a guest or while logged in?

* Comment Posting Priviledges
    + **Can submit comments**
    + Exclude member from comment moderation
* Comment Administration
    + Can Moderate Comments
    + **Can view comments in channel entries authored by others**
    + Can edit comments in their own channel entries
    + Can delete comments in their own channel entries
    + Can edit comments in ANY channel entries
    + Can delete comments in ANY channel entries

I'v highlighted some of the more applicable ones, have you checked the authors of the entries affected? perhaps this is affecting the 5%?

**Edit 1** Some more ideas

Short of jumping into the core code and sticking some debugging trace style messages in there (line 148\[ee2.10.1\] of file `/system/expressionengine/modules/comment/mod.comment.php` is a good starting point if your interested) I'd ask you to compare an entry that works 100% and one that doesn't and note down any and all differences in the hunt for clues.

Perhaps try using the `entry_id` parameter in case there's something fudged in the dynamic handling on `exp:comment:entries`?

Also whats the status setup and expired/future entries setup is on this channel? Theres code in the comments module that filters comments on statuses (I've seen issues with this too!) and expired/future entries.
> 0 votes

---
Tags: channel-entries, channel, comments, comment-form
---


# Question
Title: How to tell what languages phrases appear on the frontend?
I need to translate everything on my MSM sites into different languages. I notice that a lot of general error messages such as "The username you chose is not available" appear in the files in the folder `/system/expressionengine/language/xyz` however there are thousands of lines of phrases, most of which appear in the control panel only. How can I tell which phrases appear in the front end so I can translate them, without having to laboriously try to trigger each message or guess where they are used? I found language packs for German, French, Spanish but not Italian or Polish.

EE version 2.9.2

# Answer
I've had a look around and could not find language packs for either language, sorry (There is an Italian version but the price is high!).

I'm not aware of the 'minimum' list for front end translations either (lots on negative answer here I'm afraid). I do hope someone can give you a link to a positive answer though.

It might be down to you doing it yourself, using the Translation Utility

Something that may help is that there are language packs for these for CodeIgnitor which EE is built on. It may well share a number of these phrases, even more so if its in the CI lang pack but not in the EE one, it's more likely to be an EE only/usind in CP/front end. CI Language Packs
> 1 votes

---
Tags: language
---


title: MP3/Audio Player

text:
# Question
Title: MP3/Audio Player
I looked over at devot-ee for something that could play audio files. I did not see anything that is compatible with EE 2.9+. Does anyone have suggestions or know of any plugin that could be used?

# Answer
> 5 votes
Any audio player will work with EE. It doesn't need to be an EE specific plugin. Just something you can pass a filename to from an EE field.

---
Tags: embed-media
---


# Question
Title: Migrate site, Assets not displaying files
I've checked the other threads on this, removed the cached files, cleared my browser cache and changed CP to cookies only and it's not helping.

Assets won't display anything but the file folders. I can't see the individual files after migration. I checked the paths to the files in the file upload preferences and they are correct.

# Answer
> 1 votes
Are these fields set appropriately? Are you making sure if your site is behind a certificate, it uses HTTPS for a protocol? These settings affect the config variable Derek Hogue was speaking of (specifically "URL to the root directory of your site" is that variable):

I believe it is possibly overridden by your config file. Go to

```
your_html_root_folder/system/expressionengine/config/

```

and edit your config.php file, and look for that variable. Make sure it is set correctly there as well.

# Answer
> 0 votes
Go to **Admin → System Administration** and verify that `$config['site_url']` is correct.

Assets uses an action appended to that value via an AJAX call in order to display thumbnails, so if it's incorrect it can't display images in the admin.

---
Tags: assets
---


title: no debug output

text:
# Question
Title: no debug output
I'm working on an extension for expresso store and I want to output some variables, using print\_r or echo but nothing is outputted on the front-end.

I'm logged in as admin, I have template debugging on, I have php enabled for the template I'm looking (and yes the template is calling the extension)

any help?

thanks Francesco

EE 2.9.3

# Answer
> 2 votes
put in die(); or exit(); after the stuff you'd like to inspect. otherwise your extension will keep running and you may not see the output.

---
Tags: debugging
---


# Question
Title: Assets External Source File Directory Number?
When adding an external source to Assets like S3, the database doesn't store that directory. So I am unable to figure out what the file directory number is. I am using the {exp:assets:folders} tag pair with the parent\_folder parameter. To use this parameter I need the file directory number for {filedir\_X}. Because when using Assets on the front-end I am using Segments to changes the directory.

Is there a way to get that directory number?

# Answer
To solve this when using an external source for files, use {source\_X} in the documentation. I didn't use this in the beginning because I had to no way of founding out how to get he source id number. To find the source id number go back in the external source settings and it is in the URL.

I have asked Pixel and Tonic to please add a way on the front-end to show the source and file directory id without having to find it in the EE back-end URL or in your database.
> 0 votes

---
Tags: assets
---


# Question
Title: Disabling transcribe for Expresso store pages
Wondering if there is a way to disable or redirect Transcribe to the english version of Expresso Store.

# Answer
> 1 votes
The easiest way is probably to force your english translation in all of your store templates. Lets for example say you have a header that is shared across all of your templates and that your store templates are in a group called `shop`. Also lets assume that your English translation has an ID of `1` and a name of `english`.

In your header template you would be able to simply add:

```
{if segment_1 == "shop"}
 {exp:transcribe:language name="english"}
  {!-- Alternatively you could use --
   {exp:transcribe:language id="1"}
  --}
{/if}

```

> Sets the language to be used from the template. This can be used to override the default behavior of Transcribe which is to figure out what language to load automatically.

Full documentation for the tag can be found in the 3rd item on EEHarbor.

# Answer
> 0 votes
In version 1.6.1 of transcribe you can now use transcribe="disable" in your channel entries tag to force the default language for all.

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


title: Solspace USER Registration module

text:
# Question
Title: Solspace USER Registration module
Does any one have an example of how to submit data to an outside site from the form submitted on signup using the Solspace User Module.

I have my cURL code nailed (calling from another page), but have not been able to send the form data to that CURL script after successful submit. I need to include this to fire off: require\_once("/base/cleintapps/mysubmit.php"); \<- this is where I am sending data through CURL.

Thinking it's the user\_register\_end hook but have not been able to get it working. No matter how many times I look at and try the EE docs, I don't get how to put a hook together. I simply want to submit the info, including the custom fields. Thanks!

# Answer
> 3 votes
You need to craft an extension for that hook.

https://ellislab.com/expressionengine/user-guide/development/extensions.html

This guide is pretty thorough... did you make sure to **install** your extension after you made it? If it's not in the

```
exp_extensions

```

table, your extensions method won't get fired on that hook. Could you post your extensions contents (here or on a pastie site like pastebin and share) so we can help you? I will edit my answer once I see what you've done so far.

**Edit**

Here's some changes you need to make to your extension file. First, you have to give your method a name! And you **need** to allow it to accept the required parameters from the hook, even if you don't use them:

https://solspace.com/docs/user/extension\_hooks/#user\_register\_end

```
public function my_submit ($user_ob, $member_id)
{
    // add code for the user_register_end hook here.
    require_once("/base/cleintapps/mysubmit.php");
}

```

Then you have to make sure you are telling ExpressionEngine to use that method when the hook is called (notice the 'method'=\>'my\_submit' part):

```
public function activate_extension()
{
    // Setup custom settings in this array.
    $this->settings = array();

    $data = array(
        'class'     => __CLASS__,
        'method'    => 'my_submit',
        'hook'      => 'user_register_end',
        'settings'  => serialize($this->settings),
        'version'   => $this->version,
        'enabled'   => 'y'
    );

    $this->EE->db->insert('extensions', $data);

}

```

And you **need** to make sure this extension file is called:

```
ext.send_external_data.php

```

and lives in this folder:

```
/your_website_html_root/system/expressionengine/third_party/send_external_data

```

Depending on how the User module handles hook calls, you might need to add

```
return;

```

or

```
return $user_ob;

```

after your require\_once call inside of that function. Make sure that you **disable** this extension, make the changes (specifically the 'method'=\>'my\_submit' part) to this file, and reinstall it via the

```
Add-Ons -> Extensions

```

menu in your ExpressionEngine control panel. The extension table has a column called method, and if you don't get your method name in that cell ('my\_submit' or whatever you choose), ExpressionEngine won't call your function. Let me know how it goes, and feel free to update your code pastie if it still isn't working, and I'll gladly suss it out for you!

# Answer
> 1 votes
Along with having the naming conventions correct and the files in the right place, mentioned above. I see a couple of things that jump out at me. 1) in the activate extension method, the value for 'method' is blank. this tells the extension what function to run when the hook fires. It should read something like: 'method' =\> 'send\_my\_data'.

```
$data = array(
            'class'     => __CLASS__,
            'method'    => '',
            'hook'      => 'user_register_end',
            'settings'  => serialize($this->settings),
            'version'   => $this->version,
            'enabled'   => 'y'
        );

```

2) There is no name for the function which calls your curl code. See:

```
public function ()
    {
        // Add Code for the user_register_end hook here.
        require_once("/base/cleintapps/mysubmit.php");
    }

```

should be

```
public function send_my_data()
    {
        // Add Code for the user_register_end hook here.
        require_once("/base/cleintapps/mysubmit.php");
    }

```

what ever's in here (mysubmit.php) could be written in the method without including it. What's it look like? not sure what version of EE but

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

```

should be

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

```

---
Tags: solspace-user
---


# Question
Title: How to create modules in ExpressionEngine?
I am new on ExpressionEngine. I want to create a module from scratch can anyone help me out?

It will be a recruitment module which will first validate the email entered and then send a verification link to that email id.

And on click of that link the data will be fetched so that the user can update the result.

# Answer
The 1st party guide is everything you need to get the concept of module/extension/add-on/plugin/fieldtype development : https://ellislab.com/expressionengine/user-guide/development/index.html

If you're looking to hook into existing events refer to the list of hooks availabel and create an extension : https://ellislab.com/expressionengine/user-guide/development/extension\_hooks/

It looks to me like you don't need to do everything yourself as EE has a lot of what you want available. For instance you've described a classic Email sign up with a custom action on acceptance. You could use the registration system, with self verification via email, don't collect, set or otherwise set a passsword, when the user verifys registration hook the relivent event to do what you need, then put the 'signed up' user in a group that doesn't allow classic log in. This way the member system also acts as your information on who signed up, with what email and when, also who signed up but didn't validate...

Fill ya boots :D
> 3 votes

---
Tags: module
---


# Question
Title: When using subfolder site is not indexing properly
Now i indexed my site for testing purpose inside a sub folder like www.example.com/test but it is not working properly. But when i change the url like www.example.com/test/index.php it is working.

This is my .htaccess file

RewriteEngine On

```
    # Removes index.php from ExpressionEngine URLs
    RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]

```

Thanks in advance.

# Answer
Ok this is a very poor quality question, you don't say what you're trying to achive at all, and it doesn't sound like you've searched for your answer at all or you'd have found the manual pages (that cover sub directories) : https://www.google.co.uk/search?q=expressionengine+in+a+sub+directory&ie=utf-8&oe=utf-8&gws\_rd=cr&ei=dnVxVZzAGMqI7Abj5IN4

Still, it sounds like your trying to get frienly URL's working in a sub-directory from the htaccess, therefor here's the answer (without explanation) :

```
 # Removes index.php from ExpressionEngine URLs
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ test/index.php/$1 [L]

```

Now, url's like www.mysite.com are re-written to www.mysite.com/test/index.php.

You'll also need to set your base URL to www.mysite.com of course.

Lastly you mention indexing in your title, I'm assuming you mean you can't access index.php? Indexing is a very different activity that search engines and crawlers (non exclusively) use ...

Ref : Remove index.php and subdirectory in url string
> 0 votes

---
Tags: .htaccess
---


# Question
Title: Transcribe adding 'favicon.ico' to url on language switch
I have EE 2.9.3, Transcribe 1.6.1 and Structure 3.3.14.7 running on a bilingual website and sometimes when the language switch button is pressed 'favicon.ico' is added the end of the url, thus giving a 404 error.

This addition of 'favicon.ico' seems to be random, it happens sometimes and is fine at other times.

I have absolutely no idea why this might be happening and have been advised to use the {exp:transcribe:no\_match} tag, but I am completely lost and do not know where and how to use this tag in my template.

To display the language switcher I am using the following code:

```
{exp:transcribe:language_links}
     <ul class="languageSelector">
          {languages}
               <li {if current} class="activeList"{/if}><a href="{link}"{if current} class="active"{/if}>{name}</a></li>
          {/languages}
     </ul>
{/exp:transcribe:language_links}

```

Any help would be muchly appreciated.

Thanks.

# Answer
After some advice from Tom at Transcribe I managed to fix this issue.

I got around this by adding {exp:transcribe:no\_match segment="favicon.ico"} to the head section of my template so it is available on all pages.

This seems to have stopped 'favicon.ico' being added to the url.
> 1 votes

# Answer
May be a long shot, but do you have a `.htaccess` file for your site? Does it contain ReWrites (for freindly URL's ect)??

It could be an errand rewrite rule, designed to pass-through the favicon path but in fact transforming your URL incorrectly...

Also, please supply example links from the switcher (i.e. the output of `{link}` so we can inspect this...
> 0 votes

---
Tags: ee2, structure, transcribe
---


# Question
Title: Why does {comment_url_title_auto_path} not honor URLs across MSM sites?
I have a `sidebar/latest-news` template in `siteA` containing a few `{comment_url_title_auto_path}` links, resulting in URLs such as `siteA.com/news/article/[url_title_here]`.

I embed it from a template in `siteB` like this: `{embed="siteA:sidebar/latest-news"}`. When I do so, the URLs that are generated by that template are `siteB.org/news/article/[url_title_here]`.

Is there any way to get it to link to the proper URL over on `siteA`?

> EDIT: Just realized the core of this issue is the fact that the Comment Page URL setting in the channel prefs is `{site_url}/news/article`, and that apparently the `{site_url}` var gets parsed by the parent template's site, not by that channel's site (Edit 2: reported this as a bug).
>
> The site in question has multiple country-code subfolders with `index.php` files in them, each one setting custom global vars according to the country. So, going to `siteA.com/us/news/` will set a global var of `{gv_current_country}` to "us" and a `{gv_current_country_category}` var to something like "123" - whatever the ID is of the "USA" category to which entries are assigned.
>
> Therefore, using something like `/news/articles/` in the channel's "Comment Page URL" setting won't work, since it would be tossing the geolocated visitors out of their `siteA.com/[country_code]/` subfolders each time they clicked a link.

# Answer
> 1 votes
I would suggeest pasing the site ID you need via am embed parameter al'a `{embed="siteA:sidebar/latest-news" origin={site_id}}` then using the `sites` parameter in the internal comments tag to force the comments to be drawn from the other site.

https://ellislab.com/expressionengine/user-guide/cp/sites/code.html#specifying-multiple-sites-prepare-for-a-head-trip

That might work as you'd be forcing the comments to be drawn from SiteA. Another alternative might be to use the MSM Site URL plugin with in the embedded template to get your site\_url for siteA, then build the URL yourself :

```
{exp:msm_site_url site_short_name=sitea"}/news/article/{url_title}

```

---
Tags: multi-site-manager, path, entrylinks
---


# Question
Title: file_after_save Hook - Does it run when Synchronising a directory of files?
I am using this plugin here to compress images throughout my site: https://bitbucket.org/bulldogcreative/tinypng/src

Ideally I would like to synchronise a directory of existing images through that plugin. The plugin hooks on to `file_after_save`. So it compresses the images when a new image is uploaded, but it doesn't seem to run when EE synchronises and re-saves the file.

Any ideas if I am doing something wrong or if EE just doesn't trigger on that condition?

# Answer
That event won't fire on a syncronisation, think about the flow...

Syncronisation happens after files are saved on the file system, it's designed to check the physical files and add any that are new to the database, it does not create files on upload and save them to the disk (which is where the `file_save_after` event occurs.

If you're interested, the sync code is on lines 1053 to 1178 of file `/system/expressionengine/controllers/cp/content_files.php`. I've scanned this code and don't see an obvious hook to get on board with I'm afraid :(

you could generate a script to do this job for you though, you can borrow some code from the content\_files.php file that will help you understand how it iterates. As you iterate you can check if tinypng has generated a file yet, if not you could copy the file somewhere, delete it via the filemanager then re-add it. Re-adding the file from the temp locatio back into filemanager should cause the `file_save_after` event to fire!
> 0 votes

---
Tags: file-uploads, file-manager, hook
---


# Question
Title: Call to undefined method InvalidArgumentException::getJsonBody()
I'm having an issue with Charge (v. 1.9.2) running on EE (v. 2.10.1). Whenever I try to process a test payment, I get the following error:

```
Fatal error: Call to undefined method InvalidArgumentException::getJsonBody() in /system/expressionengine/third_party/charge/models/charge_stripe_model.php on line 894

```

# Answer
This issue has been fixed with Charge 1.9.4
> 0 votes

---
Tags: stripe, charge
---


title: Playa Title Changes and Native Search

text:
# Question
Title: Playa Title Changes and Native Search
Using Playa setup in a standard way… (ex. I have a channel of Videos and a channel of Papers. In the Video entry, the admin has a playa where they drag over any related Papers.)

The issue I've noticed is that if there is a change to a Paper's Title, the related Video's searchable data doesn't pick up that change (ex. have an existing relationship between Video/Paper, change the paper title, the new title will be right when output in the template, but native search does not reflect the new title where it's related — so a search for the new title doesn't help you find the video.)

This makes sense as my understanding is that: * You create a relationship in an entry * When you save that entry Playa copies the Title of the related item into exp\_channel\_data for search purposes

The problem is I need to make sure that exp\_channel\_data gets updated when that related title of the related item changes to keep native search working correctly.

Has anyone else run into this/found a workaround? The only thing I've found is to re-save all the entries after a Title change, but that's really not a sustainable fix :/

Tks in advance.

# Answer
I've run up a test and can confirm this bug.

Additionally I can see that if you edit/submit (no change) the parent (playa holding) entry the child title is updated.

So in order to fix I beleive the easiest approch would be to develop an extension, look for entry\_saved events on entries with ID's that are in the `exp_playa_relationships.child_entry_id` column, and if so 'touch' the parent too.

And of course, report it to P&T as a bug...

Related Posts : How can I bulk update the Matrix search index without re-saving each entry? (same effect, different module!)

Found a nice little bit o info to help you out, you'll have to create your extension, hook the `entry_submission_end` event in your extension, then you'll need a function like this :

```
function _ChekcUpdateParentChannelData($entryId, $meta){
    $res = ee()->db->select('parent_entry_id')
                   ->where('child_entry_id', $entryId)
                   ->get('playa_relationships');
    if ( $res->num_rows() > 0 ) {
        //aha, this is a child entry, get all the children of the parent!
        //you'll need to fetch ALL the child entry_id's, url_titles and
        //Titles, assuming we have these in an array now called $children

        //from ft.playa.php line 2714, this is the code that sets the channel_data table
        $keywords = "";
        foreach ($children as $entry)
        {
            $keywords .= ($keywords ? "\n" : '') . "[{$entry['entry_id']}] [{$entry['url_title']}] ".str_replace('\'', '', $entry['title']);
        }

        //we now have a data to stick back into the channel_data
        //so here write an update query, where entry_id = parent
        //entry_id set the field_XX to $keywords

    }
}

```

Lots to fill in there, but you should get there. Let us know if you contact P&T and if they are going to patch or not. If they don't I might be inclined to write a 3rd party utility for this, and also for grid n matrix too if they still exhibit the same behaviour!
> 1 votes

---
Tags: playa, search
---


# Question
Title: Conditional logic inside of <script> tags
Having issues trying to wrap logic inside of `<script>` tags, it seems my "if/else" statements get printed instead of parsed?

As an example, if I do something like:

```
{exp:query sql="SELECT a_field FROM some_table"}
<script>
{if "{a_field}" == ""}
var field = "some value";
{if:else}
var field = "{a_field}";
{/if}
</script>
{/exp:query}

```

You would think it would output `var field = "some value";` if the field is empty, else output `var field = "{a_field}";`. In actuality, it will output the actual logic?

E.g., the above would actually output

```
<script>
{if "field value" == ""}
var field = "field value";
{if:else}
var field = "field value";
{/if}
</script>

<script>
{if "" == ""}
var field = "";
{if:else}
var field = "";
{/if}
</script>

...

```

If I move the logic outside of the `<script>` tags, or simply remove them, the logic is parsed as expected. Never ran across this before, so hoping someone has some insight...

P.S. using EE 2.8.1 and (if it matters) PHP 5.4.39 for testing currently.

# Answer
> 3 votes
OK, I feel like an idiot! Forgot about the Javascript template type.

**Solution**: I simply created a new template, designated it as type "JavaScript", inserted my code, minus the `<script>` tags, then did `<script src="{path="paht_to_js_template"}"></script>`.

Simple ;)

---
Tags: conditionals, javascript, advanced-conditionals
---


# Question
Title: Import data into EE database in a module - matrix error
I am importing data from another site via a module i am building. The channel I am importing to has a matrix field.

I am doing this like so:

```
    ee()->load->library('api');
    ee()->api->instantiate('channel_entries');
    ee()->api->instantiate('channel_fields');

    $data = array(
        'title' => 'TEST'
    );
    ee()->api_channel_fields->setup_entry_settings($this->customer_channel_id, $data);
    $success = ee()->api_channel_entries->save_entry($data, $this->customer_channel_id);

    $entry_id = ee()->api_channel_entries->entry_id;

```

Problem i am having is this error:

```
A PHP Error was encountered
Severity: Warning
Message: Illegal string offset 'is_draft'
Filename: matrix/ft.matrix.php
Line Number: 2409

A PHP Error was encountered
Severity: Warning
Message: Illegal string offset 'is_draft'
Filename: matrix/ft.matrix.php
Line Number: 2461

```

Any ideas?

# Answer
Would it be possible to get you to export the exp\_matrix\_data? There are a couple of scenarios that I can think could be causing this issue.

* Check and make sure that there is a a column for 'is\_draft'. If you do not see one you need to manually or see the syntax below.

> ```
>       $this->EE->dbforge->add_column('matrix_data', array(
>           'is_draft' => array('type' => 'TINYINT', 'constraint' => '1', 'unsigned' => TRUE, 'default' => 0),          ));
>
> ```

* If that column is there can you provide both the export and sample file of the data being imported?
> 0 votes

---
Tags: matrix, pixelandtonic, module, plugin
---


title: How to make Assets ignore html files

text:
# Question
Title: How to make Assets ignore html files
I'd like to make Assets ignore html files that appear in my file upload directories. I've looked through the Assets docs, and can see that there's a config override that seems to allow this named assets\_ignore\_file\_patterns.

However, I can't find a working example of how to use this that I can copy from, so can anyone give me a complete working example that I could use in my EE config file that would allow Assets to ignore files that have a .html extension please? I'm using ExpressionEngine 2.7.2 and Assets 2.2.2, and thanks in advance for any help.

Also, as an aside, the reason my upload directory has an index.html file within it is because I'm using this method for my .gitignore file.

# Answer
Sure, try this in your config file:

```
$config['assets_ignore_file_patterns'] = array('/\.html$/');

```
> 1 votes

# Answer
There was a change in Assets 2.2.3, "config settings no longer require slashes in the array values". If you want Asset to ignore PHP, HTML and JavaScript files, you can try this:

```
$config['assets_ignore_file_patterns'] = array('^.*\.(php|html|htm|js)$');

```

Important step: after changing the config, you have to update the indexes.
> 1 votes

---
Tags: assets, pixelandtonic, config
---


# Question
Title: Channel Images in Wygwam, images dissapear
So, the Channel Images input for Wygwam works fine. We can add an image to the wygwam field, save it, and voila. When we edit the entry though, click the wygwam to edit, the images disappear. Not just visually, but also in code.

All modules are up to date (Wygwam is 3.3.3 and Channel Images is 5.4.19). Expression engine is 2.9.3

Known issue?

# Answer
I had to set 'Restrict allowed HTML' to no in my Wygwam fieldtype. That did it.
> 1 votes

---
Tags: wygwam, channel-images, bug
---


# Question
Title: Order Status Email Fields... which box is being used?
https://www.exp-resso.com/docs/settings\_order\_statuses.html

There are the two boxes containing email templates, which box should contain the emails I want to send?

# Answer
The left panel is where you search for/browse the available emails, and the right panel is where the email(s) you've selected appear.

Generally in all EE add-ons with split-select interfaces like this, the left panel is the source, and the right panel is the selection (see the native Relationships field and Playa as examples).
> 2 votes

---
Tags: expresso-store
---


title: Assets 2.0 with Throttling enabled

text:
# Question
Title: Assets 2.0 with Throttling enabled
It appears that when I enable throttling in EE (2.5.5), assets stops rendering thumbnails or other files. Shouldn't there be a way to get around this throttling issue with logged in members?

UPDATE:

htaccess file

RewriteEngine On RewriteCond $1 !.(gif|jpe?g|png)$ \[NC\] RewriteCond %{REQUEST\_FILENAME} !-f RewriteCond %{REQUEST\_FILENAME} !-d RewriteRule ^(.\*)$ /index.php/$1 \[L\]

# Answer
Thanks for adding your .htaccess, Nuno. Shouldn't be a problem there. Can you try adding:

```
$config['assets_site_url'] = '/index.php';

```

to your /system/expressionengine/config/config.php file? Please let me know if that clears up this issue for you.

Also, please make sure that you've "Updated Indexes" in Assets. Thank you!
> 1 votes

# Answer
EE 2.10.1, Assets 2.5: I hope to find a better solution than modifying a core file... For now, one way I found was to edit system/libraries/Core.php. In function run\_ee(), search "// Throttle and Blacklist Check". Remove (line 305):

```
if (REQ != 'CP')

```

Add:

```
if (REQ != 'CP' AND ee()->session->userdata('can_access_cp') != 'y')

```

Therefore, you have to load the session library before you can use the userdate method. To keep it simple, search for:

```
ee()->load->library('remember');
ee()->load->library('localize');
ee()->load->library('session');
ee()->load->library('user_agent');

```

Move these lines above "// Throttle and Blacklist Check". Of course, it would be better to do the blacklist check and the throttling before loading these classes...
> 0 votes

---
Tags: assets
---


title: Redirect in template issue

text:
# Question
Title: Redirect in template issue
I use redirect template variable to redirect user conditionally:

```
{if logged_in AND (segment_3 ~ "/[^\d+]/" OR segment_3 == "")}
    {!-- Redirect to own profile if logged in--}
    {redirect="account/profile/{member_id}"}
{/if}

```

But instead of redirect to it's profile, I got url like: http://domain.com/account/profile/%7Bmember\_id%7D

{member\_id} prints correctly in template fine, but not in {redirect}. Also i tried use other variables in `redirect`, like {site\_name}, etc., result the same they doesn't works too...

Have any ideas?

# Answer
> 0 votes
This will be a parse order issue, your if statement is an Advanced Conditional (Step 7 in Low's EE parse order) whereas member\_id is a User Defined Global Variable (Step 9 in Low's EE parse order) so is parsed later. You'll notice the redirect works because it is on Step 8 (in Low's EE parse order) so the ordrr your template is parsed is as so :

1. Advanced Conditional
2. Redirect
3. User Defined Global Variable

You see, when the redirect happens (and it happens straight away on the tag) it's too early for the `member_id`.

You can use a little PHP snippet or pop a script based redirect in there, js won't be executed until it gets to the browser but relies on JS. The PHP solution will work with either PHp on Input or Output.

```
{if logged_in AND (segment_3 ~ "/[^\d+]/" OR segment_3 == "")}
    {!-- Redirect to own profile if logged in--}
    {redirect="account/profile/<?php echo ee()->session->userdata('member_id'); ?>"}
{/if}

```

That should get you cookin, interestingly you can do the entire logged in check with PHP if you desire, if used with PHP on Early parsing you can acheive some efficiency as the redirect will occur before the tags are all parsed on the template...

summin like (untested)...

```
<?php
    if (
      ee()->session->userdata('group_id') != 0 &&
      preg_match( '/[^\d+]/', ee()->uri->segment(3,"X") )
    ) {
        ee()->functions->redirect('account/profile/'.ee()->session->userdata('member_id'));
    }
?>

```

Check out the EE User Data in the Session Class, Segements in the URI class and Redirect in Functions Class documentation.

---
Tags: redirects
---


# Question
Title: CE Image Not Processing an Image That Exists
Running into an issue with CE Image 2.4.1 on an ExpressionEngine 2.5.3.

The code below is grabbing an image from a Matrix 2.5.2 field. In the first line, with the tag, the image displays as expected. In the second line, where CE Image enters the picture, the image neither appears nor is cropped.

```
{work_process_gallery}
  <img src="{mx_image}" />
  {exp:ce_img:single src="{mx_image}" width="200" height="200" crop="yes|center,center"}
{/work_process_gallery}

```

Following the troubleshooting instructions on the CE Image website, I enabled Template Debugging and I am seeing this when I load the page:

```
***  CE Image debug: Base path: '/usr/local/apache/htdocs/'
***  CE Image debug: Source image: '[REDACTED_URL]/images/uploads/adidas-apparel1.jpg', Fallback image: ''
***  CE Image debug: Source image is not readable or does not exist: '/images/uploads/adidas-apparel1.jpg'.
***  CE Image debug: Fallback source image is not readable or does not exist: ''.

```

If I take the URL from the second line, the image loads as expected in my browser, so isn't the source image both readable and exists?

# Answer
Brooks,

The image may exist at the url, but, the base path may be the issue if it's not pointing to the public folder. The debug gives the base path as,

```
/usr/local/apache/htdocs/

```

and then you have the route to the image as,

```
/images/uploads/adidas-apparel1.jpg

```

Which means that the image needs to be in,

```
/usr/local/apache/htdocs/images/uploads/

```

Without knowing the server set up I am guessing, but I would expect to see a public or public\_html directory somewhere in the mix, which may be the issue.

If your permissions and the (full) path above is correct, then there is another issue that cannot be determined with the details we have here.
> 4 votes

# Answer
I believe I came accross something similar and using pair tags instead of single tag worked. I never did get a chance to figure out why but refer to the docs for pair usage. Also try adding parse="inward" to your matrix tag, a plugin within a plugin may be in play.
> 3 votes

# Answer
Brooks were you ever able to get this working?
on a new server move I keep getting no images where CE Image is referenced.. single or paired tags. My debug looks like this

(1.030295 / 13.96MB) \*** CE Image debug: Base path: '/pathto/my/public\_html/'

(1.030330 / 13.96MB) \*** CE Image debug: Source image: 'http://correcturl.com/assets/domain/upload/posting/Dinosaur\_(1).JPG', Fallback image: ''

(1.030350 / 13.96MB) \*** CE Image debug: The image '/pathto/my/public\_html/images/made/assets/domain/upload/posting/Dinosaur\_(1)\_1000\_667\_80\_col-255-0-0-0.JPG' is not cached.

(1.030366 / 13.96MB) \*** CE Image debug: A problem occurred trying to open the image '/pathto/my/public\_html/assets/domain/upload/posting/Dinosaur\_(1).JPG'.

Can you see my error? I've cleared cache for the tag and have added $config\['ce\_image\_document\_root'\] = '/pathto/my/public\_html/' to the config.php

I'm lost for my options from here.
> 0 votes

---
Tags: ce-image
---