# Question
Title: Expresso Store, Stripe error: The Token field is required
I keep getting this error even after hours of trial and error changes to the code:

> The Token field is required.

Perhaps my mistake will be immediately obvious to someone who knows javascript. I did see the other question with this problem and made sure this line was included, at least in the HTML version paired with the Store javascript example. It looks like the Stripe javascript ads this line:

```
<input type="hidden" id="payment_token" name="payment[token]" value="" />

```

Hopefully all this code isn't overkill, but I could really use some help and didn't want to leave anything out. The Paypal Express option is working, by the way, and here is the development store index page.

Here are two versions of Javascript in the head I have tried. First, the version from the Store documentation:

```
<script type="text/javascript">

$(document).ready(function() {
  $.getScript('https://js.stripe.com/v1/', function() {
    Stripe.setPublishableKey('pk_test_QcxvwbfdYTdR3z5vUD1Tq27k');
  });

  /* Ensure your checkout submit button has id="checkout_submit" */
  $("#checkout_submit").click(function() {

    /* Only handle requests for Stripe gateway */
    if (this.form.elements["payment_method"].value == "stripe") {

      /* Temporarily disable the checkout submit button */
      $("#checkout_submit").attr('disabled', true);

      /* Create a Stripe card token */
      Stripe.createToken({
        name: $("#payment_name").val(),
        number: $("#payment_card_no").val(),
        cvc: $("#payment_card_csc").val(),
        exp_month: $("#payment_exp_month").val(),
        exp_year: $("#payment_exp_year").val()
      }, stripeResponseHandler);

      /* We don't want to submit the form yet */
      return false;
    }
  });

  /* This function is triggered once Stripe has generated the token */
  function stripeResponseHandler(status, response) {
    /* Re-enable the checkout submit button */
    $("#checkout_submit").attr('disabled', false);

    /* Check whether we have a valid credit card */
    if (response.error) {
      alert(response.error.message);
    } else {
      /* Set the card token and submit the checkout form */
      $("#payment_token").val(response['id']);
      $("#checkout_submit").unbind("click").click();
    }
  }
});

</script>

```

This version is from the Stripe documentation. It's notably different, but doesn't work either.

```
 <!-- The required Stripe lib -->
  <script type="text/javascript" src="https://js.stripe.com/v2/"></script>

  <!-- jQuery is used only for this example; it isn't required to use Stripe -->
  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

  <script type="text/javascript">
    // This identifies your website in the createToken call below
    Stripe.setPublishableKey('pk_test_QcxvwbfdYTdR3z5vUD1Tq27k');

    var stripeResponseHandler = function(status, response) {
      var $form = $('#checkout_submit');

      if (response.error) {
        // Show the errors on the form
        $form.find('.payment-errors').text(response.error.message);
        $form.find('button').prop('disabled', false);
      } else {
        // token contains id, last4, and card type
        var token = response.id;
        // Insert the token into the form so it gets submitted to the server
        $form.append($('<input type="hidden" name="stripeToken" />').val(token));
        // and re-submit
        $form.get(0).submit();
      }
    };

    jQuery(function($) {
      $('#checkout_submit').submit(function(e) {
        var $form = $(this);

        // Disable the submit button to prevent repeated clicks
        $form.find('button').prop('disabled', true);

        Stripe.createToken($form, stripeResponseHandler);

        // Prevent the form from submitting with the default action
        return false;
      });
    });
  </script>

```

This is the Checkout tag and all of its contents:

```
{exp:store:checkout
    form_class="form-horizontal"
    return="store/order/ORDER_HASH"
    error_delimiters='<span class="help-inline">|</span>'}

    {if no_items}
        {redirect="store_example/checkout"}
    {/if}

<div class="row">
    <div class="large-10 large-centered columns">
        <div class="row">
            <div class="large-4 columns">
                    <dl>
                        <dt>Billing Details</dt>
                            <dd>{billing_name}</dd>
                            <dd>{billing_address1}</dd>
                            <dd>{billing_address2}</dd>
                            <dd>{billing_address3} {billing_postcode}</dd>
                            <dd>{billing_region_name}</dd>
                            <dd>{billing_country_name}</dd>
                            <dd>{billing_phone}</dd>
                            <dd>{order_email}</dd>
                    </dl>
                </div>

            <div class="large-4 columns">
                    <dl>
                        <dt>Shipping Details</dt>
                            {if shipping_same_as_billing}
                                Same as Billing Details
                            {if:else}
                                <dd><b>{shipping_name}</b></dd>
                                <dd>{shipping_address1}</dd>
                                <dd>{shipping_address2}</dd>
                                <dd>{shipping_address3} {shipping_postcode}</dd>
                                <dd>{shipping_region_name}</dd>
                                <dd>{shipping_country_name}</dd>
                                <dd>{shipping_phone}</dd>
                            {/if}
                    </dl>
                </div>

            <div class="large-4 columns">
                <fieldset>
                    <legend>Order Summary</legend>

                    <table>
                        <thead>
                            <tr>
                                <th width="800" style="text-align:left">Product</th>
                                <th width="200" style="text-align:right">Total</th>
                            </tr>
                        </thead>
                        <tbody>
                            {items}
                                <tr>
                                    <td style="text-align:left">{item_qty} × {title}</td>
                                    <td style="text-align:right">{item_subtotal}</td>
                                </tr>
                            {/items}
                            <tr>
                                <th style="text-align:left">Subtotal</th>
                                <th style="text-align:right">{order_subtotal}</th>
                            </tr>
                            {if shipping_method_id}
                                <tr>
                                    <td style="text-align:left">Shipping ({shipping_method})</td>
                                    <td style="text-align:right">{order_shipping}</td>
                                </tr>
                            {/if}
                            {if order_tax_val}
                                <tr>
                                    <td style="text-align:left">{tax_name} ({tax_percent}%)</td>
                                    <td style="text-align:right">{order_tax}</td>
                                </tr>
                            {/if}
                            <tr>
                                <th style="text-align:left">Total</th>
                                <th style="text-align:right">{order_total}</th>
                            </tr>
                        </tbody>
                    </table>
                </fieldset>
        </div>
        </div>

        <div class="row">
            <div class="small-12 columns"
            <fieldset>
                <legend>Payment</legend>

                {if error:payment_method}
                    <div>
                        <div class="alert alert-error">{error:payment_method}</div>
                    </div>
                {/if}

                <label for="payment_method"><input type="radio"  checked = "checked" name="payment_method" id="stripe" value="stripe"> Checkout with our secure form.</label>

                <div>
                    <label class="control-label" for="payment_card_no">Card No</label>
                    <div class="controls">
                        <input type="text" id="payment_card_no" value="" />
                    </div>
                </div>

                <div>
                    <label class="control-label" for="payment_name">Name</label>
                    <div class="controls">
                        <input type="text" id="payment_name" value="" />
                    </div>
                </div>

                <div>
                    <label class="control-label" for="payment_exp_month">Expiry</label>
                    <div class="controls">
                        <select id="payment_exp_month" style="width:auto">
                            <option value=""></option>
                            {exp_month_options}
                        </select>
                        <select id="payment_exp_year" style="width:auto">
                            <option value=""></option>
                            {exp_year_options}
                        </select>
                    </div>
                </div>

                <div>
                    <label class="control-label" for="payment_csc">CSC</label>
                    <div class="controls">
                        <input type="text" id="payment_card_csc" value="" class="input-mini" />
                    </div>
                </div>

                <label for="payment_method"><input type="radio" id="paypal" name="payment_method" value="paypal_express"> or Pay with Paypal</label>

            </fieldset>
        </div>
        <div class="form-actions">
            <a href="{path='store/shipping'}" class="store-button back">Back</a>
            <input type="hidden" id="payment_token" name="payment[token]" value="" />
            <input type="submit" id="checkout_submit" name="submit" value="Place Order" class="store-button order" />
        </div>

    </div>
</div>
{/exp:store:checkout}

```

# Answer
This issue resulted from the use of radio buttons in the submit form. One radio button selected Paypal and the other selected Stripe as the payment method. There was a bug in the Store code didn't work with this setup.

The guys at Expresso took care of it quickly and included the fix in the next build of Store (before the release of Store 2). If you run into a similar problem, make sure you're running the latest Store build.
> 1 votes

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


# Question
Title: IIS Errors and Apache Errors with ExpressionEngine
I have been having issues with setups on IIS NOT returning any informative errors what-so-ever. It seems that everything that happens just triggers a 500 Server Error, which is about as helpful as a swift kick in the groin. I have 3 example images from the exact same error on 3 different environments.

Production View:

Production View (Detailed errors on):

Local View (Running through EasyPHP):

Is there not some way to process the errors through IIS in a more legible manner? The logs don't show the issues either.

*** UPDATE ***

As I started digging into it and actually looking (oops), the errors are CI/EE messages. How would I go about enabling those instead of standard IIS 500 errors?

# Answer
For anyone who runs into this, I resolved it by modifying the web.config file to allow errors to "PassThrough".

I changed the following:

```
<httpErrors errorMode="Custom" existingResponse="Replace">

```

To:

```
<httpErrors errorMode="Custom" existingResponse="PassThrough">

```

This resolved the issue I was facing. However, I wil only turn this on when I see an error to get a better feel of what it is. rather than exposing the full error message to the public.
> 1 votes

---
Tags: ee2, error, apache, iis
---


# Question
Title: Expresso Store: disable "add to cart" when variant is out of stock
I don't have the jQuery/Javascript knowledge to solve this one; it has something to do with events and the order in which the DOM gets manipulated.

Expresso Store provides dynamic classes to let you output stock level info for a product's variants dynamically (as the user selects different combinations using the modifier `<select>` menus). So if you have a hat product and it has modifiers called Size and Color, you can show the user that Large Red and Medium Green hats are out of stock, but there are 5 Medium Red hats available. That is, assuming you've set stock levels for every SKU, you can insert this into your template:

```
<p>Stock Level for this variant: <span class="store_product_stock"></span></p>
<p class="store_product_out_of_stock">Sorry, that variant is out of stock.</p>

```

The contents of the `span` in the first paragraph will update dynamically with a number, and the second paragraph will only be shown if the stock level for the variant is 0. This works *even on page load*: that is, Store's javascript assesses the stock of the "default" variant and manipulates both paragraphs above appropriately.

Here's the thing: for out-of-stock variants, I'd like to not only insert the "out of stock" message but also **disable the add-to-cart button**, so users can't attempt to add them (which would confusingly take them to an empty cart page).

So it seems a shortcut would be to check the visibility of the "out of stock" message, then apply the `disabled` attribute to the add-to-cart button:

```
function check_stock() {
    if($('.store_product_out_of_stock').is(':visible')) {
        $('#add-to-bag').attr('disabled','disabled');
    }

    else {
        $('#add-to-bag').removeAttr('disabled');
    }
}

```

And I'd better run that both on page load and on modifier changes:

```
$(document).ready(function() {
     check_stock();

    $(".controls select").change(function() {
        check_stock();
    });
}); // end doc read

```

The problem is, this only works when the modifier `<select>` menus are changed; it doesn't work on page load.

Despite being inside `$(document).ready()`, my `check_stock()` sees the `.store_product_out_of_stock` element as visible even when Store's javascript is hiding it. Once the user starts changing modifier selects, everything works perfectly, but I really need it to work on page load.

So I then tried checking the numeric value of the variant's stock level:

```
function check_stock() {

    var variant_stock =  ($('.store_product_stock_level').text());

    if ( (variant_stock != '') && +variant_stock < 1 ) {
        $('#add-to-bag').attr('disabled','disabled');
    }
    else {
        $('#add-to-bag').removeAttr('disabled');
    }
    console.log("variant stock is " + variant_stock);
    console.log("numberized stock is " + (+variant_stock));
}

```

But this has the same problem: the console shows that, on page load, jQuery is only getting an empty string for variant\_stock, even though right there on the page (and in the web inspector) I can see Store has correctly inserted the stock level.

Is there some way, on page load, to make my jQuery wait for Store's javascript to manipulate the DOM before swooping in and checking the stock situation?

# Answer
Instead of handling the page ready event, or when your select menus changing, you can set your function to run when the stock level changes.

Create a (hidden if necessary) stock level indicator like this:

```
<span class="store_product_stock_level"></span>

```

Then handle its change event:

```
$(function() {
    $('.store_product_stock_level').change(function() {
        if ($(this).text() == '0') {
            $('#add-to-bag').attr('disabled', true);
        } else {
            $('#add-to-bag').attr('disabled', false);
        }
    });
});

```

Note that the `store_product_stock_level` dynamic variable was called `store_product_stock` prior to Store 2.0.4 (and `store_product_stock` is still available for backwards compatibility).
> 4 votes

---
Tags: expresso-store
---


# Question
Title: Stripe error: The Token field is required
I can't get Store working with Stripe 1.6.5. I keep getting the Token is Required messages. Can anyone see why this is happening?

Here is code in head tag:

```

$(function() {
    $.getScript('https://js.stripe.com/v1/', function() {
        Stripe.setPublishableKey('pk_live_XXXXXXXX');
    });

  /* Ensure your checkout submit button has id="checkout_submit" */
  $("#checkout_submit").click(function() {

    /* Only handle requests for Stripe gateway */
    if (this.form.elements["payment_method"].value == "stripe") {

      /* Temporarily disable the checkout submit button */
      $("#checkout_submit").attr('disabled', true);

      /* Create a Stripe card token */
      Stripe.createToken({
        name: $("#payment_name").val(),
        number: $("#payment_card_no").val(),
        cvc: $("#payment_card_csc").val(),
        exp_month: $("#payment_exp_month").val(),
        exp_year: $("#payment_exp_year").val()
      }, stripeResponseHandler);

      /* We don't want to submit the form yet */
      return false;
    }
  });

  /* This function is triggered once Stripe has generated the token */
  function stripeResponseHandler(status, response) {
    /* Re-enable the checkout submit button */
    $("#checkout_submit").attr('disabled', false);

    /* Check whether we have a valid credit card */
    if (response.error) {
      alert(response.error.message);
    } else {
      /* Set the card token and submit the checkout form */
      $("#payment_token").val(response['id']);
      $("#checkout_submit").unbind("click").click();
    }
  }
});

```

Here is the actual HTML

```
{exp:store:checkout
    form_class="form-horizontal"
    return="store/order/ORDER_HASH"
    error_handling="inline"
    payment_method="stripe"
    error_delimiters='|'}
```

```
{if no_items}
    {redirect="store/checkout"}
{/if}

<div class="row">
    <div class="span8">

        <div class="row-store">
            <div class="span4">
                <fieldset>
                    <legend>Billing Details</legend>
                    <div class="control-group">
                        <div><b>{billing_name}</b></div>
                        <div>{billing_address1}</div>
                        <div>{billing_address2}</div>
                        <div>{billing_address3} {billing_postcode}</div>
                        <div>{billing_region_name}</div>
                        <div>{billing_country_name}</div>
                        <div>{billing_phone}</div>
                        <div>{order_email}</div>
                    </div>
                </fieldset>
            </div>
            <div class="span4">
                <fieldset>
                    <legend>Shipping Details</legend>
                    <div class="control-group">
                        {if shipping_same_as_billing}
                            Same as Billing Details
                        {if:else}
                            <div><b>{shipping_name}</b></div>
                            <div>{shipping_address1}</div>
                            <div>{shipping_address2}</div>
                            <div>{shipping_address3} {shipping_postcode}</div>
                            <div>{shipping_region_name}</div>
                            <div>{shipping_country_name}</div>
                            <div>{shipping_phone}</div>
                        {/if}
                    </div>
                </fieldset>
            </div>
        </div>
        <fieldset>
            <legend>Payment</legend>

            {if error:payment_method}
                <div class="control-group">
                    <div class="alert alert-error">{error:payment_method}</div>
                </div>
            {/if}

            <div class="control-group">
                <label class="control-label" for="payment_method">Payment Method</label>
                <div class="controls">
                    <select id="payment_method" name="payment_method">
                        {payment_method_options}
                    </select>
                </div>
            </div>

            <div class="control-group">
                <label class="control-label" for="payment_card_no">Card No</label>
                <div class="controls">
                    <input type="text" id="payment_card_no" value="" />
                </div>
            </div>

            <div class="control-group">
                <label class="control-label" for="payment_name">Name</label>
                <div class="controls">
                    <input type="text" id="payment_name" value="" />
                </div>
            </div>

            <div class="control-group">
                <label class="control-label" for="payment_exp_month">Expiry</label>
                <div class="controls">
                    <select id="payment_exp_month" style="width:auto">
                        <option value=""></option>
                        {exp_month_options}
                    </select>
                    <select id="payment_exp_year" style="width:auto">
                        <option value=""></option>
                        {exp_year_options}
                    </select>
                </div>
            </div>

            <div class="control-group">
                <label class="control-label" for="payment_csc">CSC</label>
                <div class="controls">
                    <input type="text" id="payment_card_csc" value="" class="input-mini" />
                </div>
            </div>

        </fieldset>
    </div>

    <div class="span4"><div class="well">
        <fieldset>
            <legend>Order Summary</legend>

            <table class="table table-condensed">
                <thead>
                    <tr>
                        <th style="width:60%">Product</th>
                        <th style="text-align:right">Total</th>
                    </tr>
                </thead>
                <tbody>
                    {items}
                        <tr>
                            <td>{item_qty} × {title}</td>
                            <td style="text-align:right">{item_subtotal}</td>
                        </tr>
                    {/items}
                    <tr>
                        <th>Subtotal</th>
                        <th style="text-align:right">{order_subtotal}</th>
                    </tr>
                    {if shipping_method_id}
                        <tr>
                            <td>Shipping ({shipping_method})</td>
                            <td style="text-align:right">{order_shipping}</td>
                        </tr>
                    {/if}
                    {if order_tax_val}
                        <tr>
                            <td>{tax_name} ({tax_percent}%)</td>
                            <td style="text-align:right">{order_tax}</td>
                        </tr>
                    {/if}
                    <tr>
                        <th>Total</th>
                        <th style="text-align:right">{order_total}</th>
                    </tr>
                </tbody>
            </table>
        </fieldset>
    </div></div>
</div>

<div class="form-actions">
    <a href="{path='store/checkout2'}" class="btn">Back</a>
    <input type="hidden" id="payment_token" name="payment[token]" value="" />
    <input type="submit" name="submit" id="checkout_submit" value="Place Order" class="btn btn-success" />
</div>

```

```
{/exp:store:checkout}
```

# Answer
Per our email discussion, the actual problem was that jQuery was not loaded, and there were JS errors in the error console because `$` was not defined.

So for anyone else having this problem, it's worth checking your error console and make sure that the javascript is working as expected.
> 1 votes

# Answer
Are you using your publishable key here? This is specific to your stripe account.

```
Stripe.setPublishableKey('pk_live_XXXXXXXX');

```
> 1 votes

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


title: Errors when importing a MySQL database

text:
# Question
Title: Errors when importing a MySQL database
Trying to make a local copy of a live ExpressionEngine site, my process stop when importing the live database. I'm using EE 2.5.5 and several key add-ons like Publisher, Playa, Matrix and CE Cache. I made the import using Sequel Pro and I just click "Ignore errors".

I can see the control panel and everything seems to be OK in the backend. I noticed though that I have to install all the add-ons.

But then, these are the MySQL errors I got when importing:

```
[ERROR in query 52] Duplicate entry '5' for key 'PRIMARY'
[ERROR in query 72] Unknown column 'field_id_2' in 'field list'
[ERROR in query 73] Unknown column 'field_id_2' in 'field list'
[ERROR in query 74] Unknown column 'field_id_2' in 'field list'
[ERROR in query 75] Unknown column 'field_id_2' in 'field list'
[ERROR in query 76] Unknown column 'field_id_2' in 'field list'
[ERROR in query 77] Unknown column 'field_id_2' in 'field list'
[ERROR in query 78] Unknown column 'field_id_2' in 'field list'
[ERROR in query 79] Unknown column 'field_id_2' in 'field list'
[ERROR in query 80] Unknown column 'field_id_2' in 'field list'
[ERROR in query 81] Unknown column 'field_id_2' in 'field list'
[ERROR in query 82] Unknown column 'field_id_2' in 'field list'
[ERROR in query 83] Unknown column 'field_id_2' in 'field list'
[ERROR in query 84] Unknown column 'field_id_2' in 'field list'
[ERROR in query 85] Unknown column 'field_id_2' in 'field list'
[ERROR in query 86] Unknown column 'field_id_2' in 'field list'
[ERROR in query 87] Unknown column 'field_id_2' in 'field list'
[ERROR in query 88] Unknown column 'field_id_2' in 'field list'
[ERROR in query 89] Unknown column 'field_id_2' in 'field list'
[ERROR in query 90] Unknown column 'field_id_2' in 'field list'
[ERROR in query 91] Unknown column 'field_id_2' in 'field list'
[ERROR in query 92] Unknown column 'field_id_2' in 'field list'
[ERROR in query 93] Unknown column 'field_id_2' in 'field list'
[ERROR in query 94] Unknown column 'field_id_2' in 'field list'
[ERROR in query 95] Unknown column 'field_id_2' in 'field list'
[ERROR in query 96] Unknown column 'field_id_2' in 'field list'
[ERROR in query 97] Unknown column 'field_id_2' in 'field list'
[ERROR in query 98] Unknown column 'field_id_2' in 'field list'
[ERROR in query 99] Unknown column 'field_id_2' in 'field list'
[ERROR in query 100] Unknown column 'field_id_2' in 'field list'
[ERROR in query 101] Unknown column 'field_id_2' in 'field list'
[ERROR in query 102] Unknown column 'field_id_2' in 'field list'
[ERROR in query 103] Unknown column 'field_id_2' in 'field list'
[ERROR in query 104] Unknown column 'field_id_2' in 'field list'
[ERROR in query 105] Unknown column 'field_id_2' in 'field list'
[ERROR in query 106] Unknown column 'field_id_2' in 'field list'
[ERROR in query 107] Unknown column 'field_id_2' in 'field list'
[ERROR in query 108] Unknown column 'field_id_2' in 'field list'
[ERROR in query 109] Unknown column 'field_id_2' in 'field list'
[ERROR in query 110] Unknown column 'field_id_2' in 'field list'
[ERROR in query 111] Unknown column 'field_id_2' in 'field list'
[ERROR in query 112] Unknown column 'field_id_2' in 'field list'
[ERROR in query 113] Unknown column 'field_id_2' in 'field list'
[ERROR in query 114] Unknown column 'field_id_2' in 'field list'
[ERROR in query 115] Unknown column 'field_id_2' in 'field list'
[ERROR in query 130] Duplicate entry '1' for key 'PRIMARY'
[ERROR in query 141] Duplicate entry '2' for key 'PRIMARY'
[ERROR in query 143] Duplicate entry '1' for key 'PRIMARY'
[ERROR in query 183] Duplicate entry '1' for key 'PRIMARY'
[ERROR in query 362] Duplicate entry '1' for key 'PRIMARY'
[ERROR in query 365] Duplicate entry '1' for key 'PRIMARY'
[ERROR in query 368] Duplicate entry '1-1' for key 'PRIMARY'
[ERROR in query 370] Duplicate entry '1' for key 'PRIMARY'
[ERROR in query 379] Duplicate entry '3' for key 'PRIMARY'
[ERROR in query 724] Duplicate entry '1' for key 'PRIMARY'
[ERROR in query 726] Duplicate entry '1' for key 'PRIMARY'
[ERROR in query 737] Unknown column 'sess_start' in 'field list'
[ERROR in query 739] Unknown column 'site_pages' in 'field list'
[ERROR in query 743] Duplicate entry '1' for key 'PRIMARY'
[ERROR in query 748] Duplicate entry '1' for key 'PRIMARY'
[ERROR in query 750] Duplicate entry '1' for key 'PRIMARY'
[ERROR in query 752] Duplicate entry '1' for key 'PRIMARY'
[ERROR in query 786] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

```

My concern is that this is going to create problems in my local site, which I need to be in pretty good shape as next step is going into Git workflow and deploy changes to remote, etc.

Any idea?

Sergio

# Answer
> 3 votes
You should never have to reinstall addons locally if you are pulling files/DB from production properly. If you are having this problem, the issue is most likely related to how you are doing the migration.

I'd suggest your errors are caused by your exported SQL not including **DROP TABLE** and you aren't manually dropping the tables in the DB before your import.

---

To test my theory, delete all tables in your local DB and then do the import... Same errors?

If no errors, then you'll need to manually drop tables before importing or get your import to include the DROP TABLE syntax.

---
Tags: database, mysql, database-error
---


# Question
Title: Site failing after update to Playa 4.4.2
I'm in the process of updating my local and staging-environments to EE2.6. I've just updated Matrix, Wygwam and Playa to their latest (EE2.6 compatible) versions, and I'm now getting these errors on the front-end:

```
Error Number: 1054

Unknown column 'rel.parent_is_draft' in 'where clause'

SELECT DISTINCT(rel.child_entry_id) AS entry_id FROM exp_playa_relationships rel WHERE rel.parent_entry_id = 1 AND rel.parent_is_draft = 0 ORDER BY rel.rel_order

Filename: /Applications/MAMP/hqdocs/static/third_party/playa/mod.playa.php

Line Number: 739

```

Backend is functioning fine, all fields are displaying and saving as expected, just the front-end fails... Any thoughts?

# Answer
Looks like the update for Playa didn't complete. The "rel.parent\_is\_draft" column isn't in the database.

Make sure you followed all the **Playa update instructions** including this one:

**Go to Add-Ons → Fieldtypes → Playa to trigger Playa’s update script.**
> 9 votes

# Answer
I just had the same thing happen -- had to comment out line 423:

```
            //$this->EE->db->query('ALTER TABLE exp_playa_relationships ADD parent_var_id INT(6) UNSIGNED AFTER parent_row_id, ADD INDEX (parent_var_id)');

```

That got me past that step and things got better. :)

TTFN Travis
> 1 votes

---
Tags: playa, pixelandtonic
---


# Question
Title: Unformatted Field Data Wrapped in <p> Tags on Output
I have a text field with formatting set to "none". In the database, the data for that field is stored exactly as it should be: as plain text with no html tags.

When I drop the field tag into my template, however, the data is output with `<p>` tags wrapped around it. Here's an example of a really simple channel entries loop I ran in a test template and got the same result:

```
{exp:channel:entries
  channel='videos'
  limit='1'
  require_entry='yes'
  disable='category_fields|member_data|pagination'
  status='not closed'
}
  {video_url}
{/exp:channel:entries}

```

This output:

```
<p>http://myaccount.wistia.com/medias/12345</p>

```

The site is EE 2.6.1 and I can't upgrade the version at the moment, so suggestions on how to troubleshoot this manually are appreciated. I'm not afraid to run some DB queries if necessary. Thanks!

# Answer
> 12 votes
Sounds like the field's settings have gotten mixed up at some point.

I'd try switching the field to "XHTML" formatting, and select the option to "Update all existing channel entries with your new formatting choice?".

Once that's done, then switch back to "None" formatting and update all existing again.

Hopefully that will resolve for you.

# Answer
> 0 votes
You can use the **Hacksaw addon** in your template to remove the formatting.

```
{exp:eehive_hacksaw}
  {video_url}
{/exp:eehive_hacksaw}

```

---
Tags: templates, custom-fields, text-formatting
---


title: Free Form pro to create ads forms

text:
# Question
Title: Free Form pro to create ads forms
I like to use Freeform to create ads on my site - but i like to create member at same page.

So what I like is that first you enter email, then a ajax checks to see if that email is already enter in system (and the user all ready have a account) if not the user proceed to login name, ads title, and all other ads fields.

Is that possible with Freeform Pro?

# Answer
You probably want to use something like Zoo Visitor instead of FreeForm.

While Freeform Pro is quite powerful, you'd need a lot of hacking to get it to create users and such.

Add-ons for the member module, like Zoo Visitor, Profile:Edit and Solspace User tie together the native member module and channel entries.

They would allow you to have users register and create the ads in their profile entry.
> 1 votes

---
Tags: solspace-freeform
---


title: Matrix - Super Admin only columns?

text:
# Question
Title: Matrix - Super Admin only columns?
Has this been done before? I'm in a situation where I need a column hidden from content managers and only visible to the super admin.

# Answer
This is definitely not core functionality for Matrix.

You would need to either write a custom extension that would hide the column from non Super Admins or find another add-on to help.

One possible solution is to use the Securit:ee add-on's encryption fieldtype, which allows you to configure which member groups can view the unencrypted data in a field. If you used this fieldtype for your column, then it should only allow the groups you specify to see the data. Of course this is contingent upon your column being a text field and not some other fieldtype.
> 1 votes

---
Tags: matrix, pixelandtonic
---


# Question
Title: How to get channel field data from a given entry id?
I want to get the channel field data from entry id in my custom module. Is there any way to get the field data. If anyone knows, please help

# Answer
> 4 votes
1. you can open file *expressionengine/modules/channel/mod.channel.php* and check *function entries()*
2. you can use Channel-Data lib from Justin Kimbrell to simplify access to channel data.

*example*

```
    $entries = $this->EE->channel_data->get_channel_entries($channel_id, array(
        'select'    => array('*'),
        'where'     => array('channel_data.entry_id >' => 1),
        'order_by'  => 'title',
        'sort'      => 'ASC',
        'limit'     => 1,
        'offset'    => 5
    ));

```

---
Tags: custom-fields
---


# Question
Title: Decreasing page load time with Solspace Freeform
I wanted to see if anyone had any suggestions on how to optimize the speed of Solspace Freeform.

We've noticed the template caching doesn't help as it generates random numbers in hidden tags combined with the usage of captcha there seems to be few fays to decrease page load times.

Would using CE Cache improve the performance?

# Answer
> 1 votes
Currently Freeform does not natively support being cached as it generates a params\_id and XID hash on page load that is not reusable due to security concerns.

You could, in theory, cache the form, then on submit (or first field change?), use ajax to fetch an uncached version of the same form template and pull the params\_id and XID from that uncached form and inject it into the cached form before submit.

---
Tags: templates, solspace-freeform, forms, cache, ce-cache
---


# Question
Title: Getting Pesky Unable to load site preferences error
I am using EE 2.1.3 within the MSM. I have a number of other sites already setup on this MSM and not having any problems. I tried to add a new site and got the "Unable to load site preferences" message.

I verfied that config.php, database.php for the MSM are set to 777, cleared the cache for the site and still got the error. So, for this sites' index.php file I made $debug = 1; Now it is showing:

```
A PHP Error was encountered

Severity: 8192

Message: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead.

Filename: mysql/mysql_driver.php

Line Number: 303

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /home/techmark/webapps/_system_ee2msm/.system/codeigniter/system/core/Exceptions.php:170)

Filename: core/Common.php

Line Number: 405

A Database Error Occurred
Unable to connect to your database server using the provided settings.

Filename: core/EE_Config.php

Line Number: 176

```

Any idea how to fix this? Like I said earlier all of the other sites on this MSM are working correctly.

Here is the site: http://friendsunday.outreachcs.com/

# Answer
Your error is due to your PHP version being too new for the version of EE you are using.

> This function has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged. Link

Two options:

1. Lower your PHP version to 5.2
2. Upgrade to, at least, EE 2.3
> 1 votes

---
Tags: site-preferences
---


# Question
Title: Zoo Visitor + Radio button & Matrix fields + Inline error handling
These don't seem to be playing very nicely together.

Here's what's happening:

I've got a Zoo Visitor registration form that contains generic member fields and well as a couple of required custom fields, of which, some are matrix and one is a radio button.

With inline error handling enabled, I'm seeing intermittent undefined index errors on submit within:

* matrix/ft.matrix.php :: line 1982 :: field\_required
* radio/ft.radio.php :: line 131 :: field\_pre\_populate
* radio/ft.radio.php :: line 150 :: field\_pre\_field\_id
* radio/ft.radio.php :: line 151 :: field\_pre\_channel\_id

Field layout is as follows:

The matrix field is birthdate - 3 selects, all required. I know, I know... use a date field. Client req. But anyway... it should work. And it does sometimes. It has been addressed (sort of) by P&T and only errors out when the radio button following it is set to required.

The radio is gender, but it's not using the member field. And it's required.

At first, this seems obvious - the fields are set to pre-populate from another channel. But they're not. They're all set to 'n' and stored as such in the db and in the settings array. However, when validation runs and loops through settings, it's reading 'n' as NULL. So it errors out when it tries to query 'field\_id\_' on a null channel.

I'm at a loss here. And open to just about any ideas aside from defaulting everyone to M or F - which actually works when required.

Also - apologies if this is a repeat. I see a bunch of Q&A on related topics but nothing that quite matches my scenario.

# Answer
> 2 votes
From OP in comments above:

> Just wanted to follow up and take credit for a simple mistake that monopolized more time than I'll ever admit. Turns out in my zoo form I had "new\_row\_0" in one of my hidden fields where it should have been "row\_new\_0".

---
Tags: matrix, zoo-visitor, validation
---


# Question
Title: Stash within a stash embed to jump two loop results to two different spots in the markup
I'm having a bit of a stash dilemma brought about by my need to have modal window content inserted at the end of the parent HTML document. Here's the scenario:

I have a "gallery" index template that uses a gallery-pages channel to create the pages within the section. Within that group, I have a radio button field type that the admin uses to select which content (from a pre-existing, pre-formatted list of options) should be inserted after the body field. It is within this radio button that "photo gallery xyz" is selected, which uses an embed to insert a loop coming from the photos channel.

The gallery index template has all this logic in it, with a simple outline like this:

```
{exp:channel:entries channel="gallery_pages" limit="1"}
{exp:stash:set_list name="page_body"}
    {stash:other_variables}
    {stash:entry_body}
       {page_body}
       {if radio == ""}{/if}
       {if radio == "1"}{embed=gallery1}{/if}
       {if radio == "2"}{embed=gallery2}{/if}
       {page_extended}
    {/stash:entry_body}
{/exp:stash:set_list}
{/exp:channel:entries}

```

And so each gallery embed would contain a loop from the photos channel (don't mind the conditional above - I'm actually using switchee). But the reality is, I need two of them - a loop for the displayed items in the page, and a loop to generate the modals for each item in the display loop (which get matched up by entry ID). And so I'm wondering how I might be able to achieve this. In a perfect world, I'm imagining a stash:set\_list inside the embed, setting the display items as variables and the modals as separate variables, which I could then stash:get\_list together in the inside layout template. Something like this:

```
{exp:channel:entries channel="photos" limit="30"}
    {exp:stash:set_list name="display_photos"}
        {stash:photo1}{photo1:small}{/stash:photo1}
        {stash:photo2}{photo2:small}{/stash:photo2}
        {stash:photo3}{photo3:small}{/stash:photo3}
        {stash:modal1}{photo1:large}{/stash:modal1}
        {stash:modal2}{photo2:large}{/stash:modal2}
        {stash:modal3}{photo3:large}{/stash:modal3}
    {/exp:stash:set_list}
{/exp:channel:entries}

```

But I can't but stash in an embed that itself is stashed, can I? I tried it and got no variables set from within the embed. But I suspect there must be a way to achieve what I'm looking to do - I just can't seem to piece it together, though it seems similar in principle to this post on nesting channel entries with stash (which is effectively what I'm doing via the embed).

**UPDATE:** It's hard to describe without posting a lot of the template, but basically, I have a wrapper entries loop with a limit of 1 to create "pages" like company history, management, staff, etc. within the "about" channel, for example. On the "staff" entry, I use a radio button to select the fact that i want a list of staff from the staff channel to appear after the page body - which is presented with an entries loop. So I have nested entries loops. In this one particular case, let's say from the staff list, I want to click on a staff person to open a modal. The modal markup needs to jump to the bottom of the HTML just before for example. So my entries loop of staff really is building two lists - the list of content to display in the page, and a hidden list at the bottom of the HTML markup.

UPDATE 2: Here's what I've done in my template so far:

```
 {exp:channel:entries set_name="gallery-pages" limit="1" dynamic="no" disable="{gv_disable_all}"}

 {exp:stash:set_list name="entry_body_content" scope="site" parse_tags="yes" parse_conditionals="yes"}

    {stash:entry_title}{title}{/stash:entry_title}

    {stash:entry_body}{cf_{my_main_channel_prefix}_body}{/stash:entry_body}
    {stash:entry_list_after}

        {exp:switchee variable="{cf_{my_main_channel_prefix}_list_after}" parse="inward"}
            {case value="none|"}{/case}
            {case value="photos"}
                {embed="embeds/.gallery_cases_list"}
            {/case}
        {/exp:switchee}

    {/stash:entry_list_after}
    {stash:entry_modals}

        {exp:switchee variable="{cf_{my_main_channel_prefix}_list_after}" parse="inward"}
            {case value="none|"}{/case}
            {case value="photos"}
                {embed="embeds/.gallery_modals_list"}
            {/case}
        {/exp:switchee}

    {/stash:entry_modals}

    {stash:entry_extended}{if cf_{my_main_channel_prefix}_extended}{cf_{my_main_channel_prefix}_extended}{/if}{/stash:entry_extended}

{/exp:stash:set_list}
  {/exp:channel:entries}

```

I have other stashed elements as well, such as description and title for the area, but this is the "core" for the body.

This allows me in my inside layout template, within the main content area, a simple structure of

* Body
* List After content (if applicable)
* Extended Body (if applicable)

and right before I can then insert the modals, if applicable (they'd only apply in certain cases - basically any time I assemble an image gallery wherein I want to use a modal window to display a larger version of the contents).

Of course the big issue here is performance and efficiency. .gallery\_cases\_list and .gallery\_modals\_list contain loops of the same channel entries. But I was stumped on how else to do it. Yes, I did try using a stash embed, but I still found I had to use two of them to generate my separately stashed lists of display items and modal items, so there wasn't much of a gain when I tried it that way.

# Answer
From comments above from Mark Croxton:

> Channel Entries can't be nested but exp:stash:set\_list and exp:stash:get\_list have no problem, providing you append a 4th tagpart to the nested tagpair and use the prefix parameter. As far as I can tell you need a very similar solution to this one: Nesting channel entries in Stash \- but you need to output the same list twice in the markup? Can't you just use stash:get\_list twice? I think you need to paste more of your template because I'm struggling to see what the real problem is here.
>
> Example of nesting lists, from the docs: https://github.com/croxton/Stash#example-usage-5-nesting-yep-you-really-can-do-this
> 1 votes

---
Tags: stash, nesting
---


# Question
Title: Error 404 with structure after the 2nd segment
I am using structure, and therefore, sometimes I have more than the standard 2 segements (template\_group/template).

the error page get's triggered whenever the first or the second segment is incorrect, but it's not triggered as soon as there is a third segment.

I've tried this on several structure sites and seems to be consistent.

I also used libraree on these sites.

are you experiencing the same thing?
is there any way to overcome this?

cheers
stefan

# Answer
> 1 votes
If you have Strict URLs turned off, then an incorrect third segment is most likely parsing the index.html template of the default template group. Unless that template has a way to verify the URL against an entry, it will parse normally everything that it can.

So, I'd work in a 404 solution for your default template. Two different options could be:

```
{if segment_3}{embed="templategroup/404"}{/if}

```

OR

```
{if segment_3}{redirect="/"}{/if}

```

---
Tags: segments, error-pages
---


# Question
Title: Field Pack - Dropdown does it work with channel:form?
Field Pack - Dropdown does it work with channel:form?

I can't make it work! I need to use both "name : label"

# Answer
Upgrade to the latest version of EE (2.7.2 as of this posting) and Field Pack (2.1.1).
> 1 votes

---
Tags: pixelandtonic, field-pack
---


title: blurry images after upload

text:
# Question
Title: blurry images after upload
Using Channel Images to upload images. They are uploaded at full size and no resizing is set. When I save the image off the browser and open it Photoshop, they are back to original sharpness. Also, I have an image zoom installed and when you hover the image in the magnified area is sharp. Is this EE or a browser issue? It seems like it IS being resized somewhere along the way...

After / Before

# Answer
Check the image zoom plugin's settings to make sure it is not applying a filter. Also, check your CSS. It could be that a blurring filter effect is being applied (see here).
> 1 votes

---
Tags: image, channel-images, resize
---


# Question
Title: Cannot upload to root images directory in Assets, subdirectories OK
I'm having trouble uploading images using Assets.

Assets: v2.1.4
EE: v2.6.1 - Build Date: 20130506

They are uploading. If I refresh the Assets screen, I see them. But when I upload them, I receive this error:

http://circa1977.net/snap/assets-uploading-trouble.png

Note that's only the case for the Image Uploads level directory. If I select Team on the left, and upload, I have no trouble.

Here's the AJAX response:

```
<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">

<h4>A PHP Error was encountered</h4>

<p>Severity: Warning</p>
<p>Message:  mkdir(): No such file or directory</p>
<p>Filename: libraries/Filemanager.php</p>
<p>Line Number: 1311</p>

</div><div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">

<h4>A PHP Error was encountered</h4>

<p>Severity: Warning</p>
<p>Message:  fopen(../uploads/images/_thumbs/index.html): failed to open stream: No such file or directory</p>
<p>Filename: libraries/Filemanager.php</p>
<p>Line Number: 1315</p>

</div><div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">

<h4>A PHP Error was encountered</h4>

<p>Severity: Warning</p>
<p>Message:  fwrite() expects parameter 1 to be resource, boolean given</p>
<p>Filename: libraries/Filemanager.php</p>
<p>Line Number: 1316</p>

</div><div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">

<h4>A PHP Error was encountered</h4>

<p>Severity: Warning</p>
<p>Message:  fclose() expects parameter 1 to be resource, boolean given</p>
<p>Filename: libraries/Filemanager.php</p>
<p>Line Number: 1317</p>

</div>{"success":true,"file_id":91,"folder_id":"2"}

```

I am able to upload via the native File Manager to that root directory.

I have checked permissions on the cache folder.

I have the following in config.php:

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

$config['assets_cp_path'] = dirname(__FILE__).'/../../syncadmin/';

```

For `server path to upload directory` I have: ../uploads/images/

My system folder resides above public.

I've tried a few different solutions, including switching session from Cookies-only to Cookies + Session ID, changing permissions, changing paths, to no avail.

Any help would be greatly appreciated.

Thanks!

Mark

# Answer
This was a bug that has been fixed in Assets 2.2. See changelog.
> 1 votes

---
Tags: assets, control-panel, uploads, path
---


# Question
Title: Full Path seems incorrect after update to Assets 2.0.4
After updating to Assets 2.0.4 on EE 2.5.1, I noticed that that when I view a custom Assets field, the previously defined upload directories are no longer checked.

After some digging around the assets database tables, I noticed some odd inconsistencies: http://jon.ee/image/2l0B2w2v3A3Y (Screenshot)

All of my images display properly on the front-end.

* What could be causing the upload paths to be unchecked on custom Assets filled
* Should the full\_path column be filled in, and is this causing the issue?

# Answer
This was a bug that has been fixed since Assets 2.2. See changelog.
> 0 votes

---
Tags: assets
---


title: S3 Index Javascript Errors

text:
# Question
Title: S3 Index Javascript Errors
Having the same issue as in this thread:

Console Error with Assets when Attempting to Index Amazon S3 folder

When trying to update the index for an S3 source, getting the following error in the Firebug console:

```
missing ) in parenthetical
</div><div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;"
assets.js?2.0.5 (line 5626, col 11)

```

This was working fine until recently adding additional folders within an S3 bucket. Any ideas?

---

UPDATE: 04/01/2013

This issue ended up being an NAT issue with the Amazon cloud server, which is behind a firewall. It was blocking all outgoing requests. This is what was causing the JS errors I'm assuming.

I discovered this by editing my S3 source and trying to refresh the bucket list. Eventually I got the following error message:

```
Access denied by target host

```

# Answer
> 1 votes
Per original question poster's comment above:

> Thanks, Lisa. Ended up tracking this one down, and updated my original post. This was a firewall issue. May be something to look at for the future though, that if Assets doesn't get a valid response from S3, that some error is displayed. As always, thanks for your help!

---
Tags: assets, s3
---


title: Playa tags rendering in PHP 5.4.10

text:
# Question
Title: Playa tags rendering in PHP 5.4.10
If I set my PHP instance to 5.4.10 any Playa tags are rendered as raw tags but under 5.3.20 they render correctly. Is this too new a version to play with?

# Answer
Look for other extensions using the channel\_entries\_tagdata hook. It's likely that one of them is not respecting ee()-\>extensions-\>last\_call.

For me, it was Better Workflow (they have since fixed the issue).
> 2 votes

---
Tags: channel-entries, playa, pixelandtonic
---


title: Asset field in Matrix not updating

text:
# Question
Title: Asset field in Matrix not updating
I have an Assets field in a Matrix column that has stopped updating. If you edit or delete the asset and save the entry, the entry will save successfully. However, if you reopen the entry (or view it) the image does not change. All other fields update successfully, but not the Asset field. This new behavior *roughly* coincides with updating to EE2.7.2, Matrix 2.5.8, and Assets 2.2.1.

Other odd behavior:

* It is not all Assets-in-Matrix fields -- other channels on the site use a similar Asset-in-Matrix construct and will update their Asset fields successfully.
* Duplicating the entry creates a new entry that will successfully update.

Are there any known issues with the updated plugins/EE build? Has anyone experienced the same thing? Any thoughts on how to further debug this issue?

# Answer
> 3 votes
After updating back to 2.2.1, running the following query will fix this: UPDATE exp\_assets\_selections SET content\_type = 'matrix' WHERE row\_id \> 0 AND (content\_type = '' OR content\_type IS NULL)

We're about to release Assets 2.2.2 that addresses this, but, while it's still not out, the query above should take care of your problem permanently. This only affects Matrix rows created before updating to Assets 2.2.1.

# Answer
> 1 votes
I was having this same issue, but found out that I did not have a column for 'content\_type'. Once I added this column, Matrix/Assets began working correctly.

---
Tags: matrix, assets
---


# Question
Title: Select distinct values from a matrix column
I've got a matrix column with 110 rows but only 11 values (each value in 11 times). Is there a way to query the distinct values in that column rather than returning all the results?

# Answer
You can't do this with a Matrix tag, but you could use Stash to set a list of the Matrix rows, then get the `unique` values only.

https://github.com/croxton/Stash/wiki/%7Bexp%3Astash%3Aget\_list%7D#unique---yes--no-

**matrix set\_list**

```
{exp:channel:entries channel="blog" entry_id="123"}
    {exp:stash:set_list name="blog_related_entries" parse_tags="yes" save="yes" scope="site"}
        {blog_related}
            {stash:item_title}{title}{/stash:item_title}
        {/blog_related}
    {/exp:stash:set_list}
{/exp:channel:entries}

```

**get\_list with unique="yes"**

```
{exp:stash:get_list name="blog_related_entries" unique="yes"}
    {item_title}
{/exp:stash:get_list}

```

Granted, this doesn't really save you on performance since all of the Matrix rows are pulled any way.
> 3 votes

---
Tags: add-on, matrix, pixelandtonic
---


# Question
Title: Emergency: Channel entries tags stopped working on a live site: Please Help!
I have just received a very unusual support request:

All of the content on a live website is no longer displayed on the front end of my clients site. All content is still accessible via control panel.

Basically every instance of Channel:entries isn't working, neither are any structure tags, low event tags, low search results tags- basically if it extends channel entries its stopped working.

I have setup a test template with the simplest of channel entries tags on there, but no matter which channel/entry I try to pull I keep getting the contents of my no\_results conditional. As an a-side, Channel:categories tag works fine. It seems to me that the entries method of the channel module has died somehow- the only changes that have happened on this site in weeks have been content based.

Has anyone experienced this issue before? or have any pointers on how to resolve this- I've been looking at this all morning and can't event find anyone reporting a similar issue in the past (which is very disconcerting)

Thanks in advance!

ISSUE RESOLVED: It turns out that one of my clients employees had somehow applied a custom status to all entries, even those that existed in channels without the custom statuses applied. So the pages, news, events channels etc all returned zero results as they didn't have the matching status!

# Answer
ISSUE RESOLVED: It turns out that one of my clients employees had somehow applied a custom status to all entries, even those that existed in channels without the custom statuses applied. So the pages, news, events channels etc all returned zero results as they didn't have the matching status!

This was resolved by setting all entries back to the relevant entry statuses to open.
> 1 votes

---
Tags: channel-entries
---


# Question
Title: Create month member groups/lists from Solspace User addon
I am looking to create lists/groups of data from the Solspace User addon. I am looking to list the members by their join\_date from a certain group\_id, for example:

July 2013 (2 members)

* member 5
* member 4

June 2013 (3 members)

* member 3
* member 2
* member 1

Would it be possible to display the number of members per group / month?

How would i go about doing this using PHP to create arrays for each grouping {join\_date} should accept a format="" parameter.

Or is there a way to do this with the Stash plugin?

Thanks

# Answer
What you are after is very similar to a blog archive filter. Mark Croxton has provided a very detailed example of how to pull that off.

https://gist.github.com/croxton/6219973
> 1 votes

---
Tags: members, stash, php, solspace-user
---


title: XID POST from third party

text:
# Question
Title: XID POST from third party
I am trying to integrate payment gateway with Paypal express. the issue is the payment gateway sends post data from paypal express checkout back to a specific URL in our ExpressionEngine but does not contain the parameter XID which is required by ExpressionEngine secure formS as of version 2.7.x

is there a way to accept the incoming post from external website without disabling the settings: $config\['secure\_form'\] = 'n';

Thanks

# Answer
You must create a module and a module action. There are docs here. The key is to grant your action a CSRF exemption, like so:

```
ee()->db->insert('actions', array(
  'class' => 'Module_name' ,
  'method' => 'method_to_call',
  'csrf_exempt' => 1,
));

```

Look up the action\_id in the exp\_actions table for your newly created action. Your action can now be triggered via url without XID at http://yoursite.com/?ACT=XX, where XX is your action\_id.
> 6 votes

---
Tags: payment-gateway, paypal-express-checkout, xid
---


# Question
Title: Link to non-image files in the File Manager?
My client recently upgraded to EE2 from EE 1.7 and they lost the ability to directly get the link to non-image files (like PDFs) in the File Manager. They need this feature to insert into their email campaigns. Any idea how to get a direct link to an uploaded doc in EE2?

Screenshot, need link to Breast\_Examination\_Trainer\_Final\_UK.pdf

# Answer
In EE 2.7+ non-image files are linked.

From the EE changelog.

> All files regardless of type are now linked for viewing in the File Manager.
> 2 votes

---
Tags: ee2, file-manager
---


# Question
Title: Can I see the most basic example of a File field in Channel Form (Safecracker)?
I'm using Channel Form/Safecracker and a File field (photo of a person) doesn't work; the UI is messed up: Clicking the "x" only goes to the top of the screen and there's no "Browse" button.

I've dumbed it down to barebones channel/fieldgroup/html, and still it's not working (unix permissions are fine). So I'm out of ideas. Does anyone have working Channel Form File field code? Here's my base that won't work. Page at http://farpoint.fcs.uga.edu/facs/site/test.

Any help is much much appreciated.

```
<html>
<head>
<link href="{path=css/_ee_channel_form_css}" type="text/css" rel="stylesheet" media="screen">
</head>
<body>

{exp:channel:form
    channel="people1"
    url_title="jphansen1"
    logged_out_member_id="1"
    return="site/test"
}

{field:photo1}

<input type="submit" name="submit" value="Next" />

{/exp:channel:form}

</body>
</html>

```

# Answer
> 4 votes
It appears to be stemming from an error in the JS preventing the global `EE` object from being created.

Digging deeper I was able to identify the culprit:

```
{
  "name": "Link in this site",
  "key": "",
  "openWith": "<a href=\"http://farpoint.fcs.uga.edu/facs/template\\" > ",
  "closeWith": " < \/a>",
  "className": "btn_Linkinthissite"
}
```

Note the double backslash at the end of the url for `openWith` which breaks the quote being escaped causing a syntax error.

This is associated to a custom button in the Rich Text Editor. There is a `Fixed link in this site` button, so I am guessing you have noticed an issue with this before. Removing the broken button should solve the issue.

# Answer
> 3 votes
Turns out this was a bug. The bugreport (https://support.ellislab.com/bugs/detail/19837) says to do this, which has resolved it:

In the file system/expressionengine/fieldtypes/file/ft.file.php at line 147 replace:

container.find("input\[type=hidden\]").val(function(i, current\_value) { with

container.find("input\[type=hidden\]\[name\*='hidden'\]").val(function(i, current\_value) {

In file system/expressionengine/libraries/File\_field.php at line 125 add:

$vars\['directory'\] = form\_hidden($field\_name.'\_directory', $vars\['upload\_location\_id'\]);

In file system/expressionengine/views/\_shared/file/field.php at line 23 add:

PHPOPEN else: PHPCLOSE

PHPOPEN=$directoryPHPCLOSE

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


# Question
Title: Navigation: A channel per section, a template group per section, or both?
What is the best practice for creating a site that will have a number of main nav sections along with sub-sections? Do you create a channel per section, a template group per section, or both? If it helps, I'm planning to use Taxonomy--I don't know if this would change the answer.

# Answer
> 5 votes
Knowing that you will use Taxonomy *does* change the answer. With Taxonomy the answer is "Neither." ...Unless that's really how you prefer to build your site!

Taxonomy is very flexible, and will do it's job regardless of how you set up your Channels, template groups, and templates. You don't need to set up channels to hold navigation-related data, that's all handled by Taxonomy.

So, I'd recommend setting up your Channels and templates based on what's efficient and easy to maintain for you, and intuitive and effort-saving for your client. Then you can configure Taxonomy as fits your site content and navigation needs.

I often use a combination of one or more "Pages" Channels (in conjunction with the Pages module and some re-usable templates) and some template groups that correspond to specific site sections/channels. Then I tell Taxonomy which channels entries and templates are available for linking to when creating a navigation node. Taxonomy also includes an option to use the Pages URI of an entry, too, which is handy.

And you can gain even more flexibility through the Taxonomy template tags.

So to summarize, it's totally your choice how to set the site up (and there are many approaches to accomplish the same result). Taxonomy will work with a variety of channel and template set-ups.

---
Tags: navigation, taxonomy
---


title: Filter relationship content by author?

text:
# Question
Title: Filter relationship content by author?
I cant seem to get this working on my test but does anyone know if its possible to filter a related list of entrys by author\_id using the new standard relationships? or am I better off using playa?

```
{exp:channel:entries channel="fairs" entry_id="{active_fair}" dynamic="no"}
  {parents field="application_related_fair" author_id="{member_id}" limit="1"}
    {parents:entry_id}
  {/parents}
{/exp:channel:entries}

```

Im pretty sure i can do this using playa, but not sure that it works with standard relationships?

UPDATE: so i got it working when i hard code the author\_id so it says something like author\_id="1"

my issue now seems to be parse order/stash related

here is the full code... basically trying to set a list but within the stash member\_id is coming back blank?

```
{if logged_in}
    {exp:stash:set_list name="active_application"  parse_tags="yes" parse_vars="yes" scope="user"}
        {exp:channel:entries channel="fairs" entry_id="{active_fair}"  dynamic="no"}
            {parents field="application_related_fair" author_id="{member_id}" limit="1" status="not Closed"}
                {stash:app_id}{parents:entry_id}{/stash:app_id}
                {stash:app_status}{parents:status}{/stash:app_status}
            {/parents}
        {/exp:channel:entries}
    {/exp:stash:set_list}
{/if}

```

So this full block works perfectly if i set author\_id to a specific number... but if i set it to {member\_id} it still outputs but its not taking the author\_id filter into effect.

# Answer
> 2 votes
Thanks to Stephen and Siebird for all your help working through. I finally got it to work just using {logged\_in\_member\_id} instead of author\_id or just member\_id...

Not 100% sure why this works, i guess thats parsed earlier than just member\_id?

```
{if logged_in}
    {exp:stash:set_list name="active_application"  parse_tags="yes" parse_vars="yes"}
        {exp:channel:entries channel="fairs" entry_id="{active_fair}"  dynamic="no" parse="inward"}
            {parents field="application_related_fair" author_id="{logged_in_member_id}" limit="1" status="not Closed"}
                {stash:app_id}{parents:entry_id}{/stash:app_id}
                {stash:app_status}{parents:status}{/stash:app_status}
            {/parents}
        {/exp:channel:entries}
    {/exp:stash:set_list}
{/if}

```

then the block thats reading it

```
{exp:stash:get_list name="active_application" }
    Active Application: {app_id} | app_status:{app_status}
{/exp:stash:get_list}

```

# Answer
> 1 votes
Looks like your missing the closing `"` on the `author_id` parameter. Also, the `{parents}` tag needs to be nested inside the relationship field:

```
{exp:channel:entries channel="fairs" entry_id="{active_fair}" dynamic="no"}
    {application_related_fair}
        {application_related_fair:parents field="application_related_fair" author_id="{member_id}"" limit="1"}
            {application_related_fair:parents:entry_id}
         {/application_related_fair:parents}
    {/application_related_fair}
{/exp:channel:entries}

```

# Answer
> 1 votes
UPDATE 2 - use a stash embed

```
{exp:stash:set parse_tags="yes" scope="user"}
  {stash:mem-id}{member_id}{/stash:mem-id}
{/exp:stash:set}

{if logged_in}
  {exp:stash:set_list name="active_application" parse_tags="yes" scope="user"}
    {stash:embed:path-to:template parse_stage="both" process="start"}
  {/exp:stash:set_list}
{/if}

```

In **path-to/template**

```
{exp:channel:entries channel="fairs" entry_id="{active_fair}" dynamic="no"}
  {parents field="application_related_fair" author_id="{stash:mem-id}" limit="1" status="not Closed"}
    {stash:app_id}{parents:entry_id}{/stash:app_id}
    {stash:app_status}{parents:status}{/stash:app_status}
  {/parents}
{/exp:channel:entries}

```

---

UPDATE

Ah, I think I read your question incorrectly. Does using `{author_id}` instead of `{member_id}` work?

---

ORIGINAL

`{member_id}` is not available inside of the `exp:channel:entries` tag pair because the tag pair is already parsing member data associated with the entry. `{logged_in_member_id}` will not work either. (ref).

You *should* be able to use Stash (or even a basic snippet) to set the `{member_id}` outside of the channel entries loop first.

```
{exp:stash:set name="mem-id" scope="user"}{member_id}{/exp:stash:set}

{exp:channel:entries channel="fairs" entry_id="{active_fair}" dynamic="no"}
    {application_related_fair}
        {application_related_fair:parents field="application_related_fair" author_id="{exp:stash:get name='mem-id'}" limit="1"}
            {application_related_fair:parents:entry_id}
         {/application_related_fair:parents}
    {/application_related_fair}
{/exp:channel:entries}

```

---
Tags: relationships
---


# Question
Title: Call to undefined method EE_Localize::human_time() after matrix update
After updating matrix to 2.5.9 (EE 2.5.5) I'm getting a blank screen and error message both on the front-end and in the control panel:

```
Fatal error: Call to undefined method EE_Localize::human_time() in /www/eh7377/public_html/cmssystem/expressionengine/third_party/matrix/celltypes/date.php on line 92

```

on an entry form that uses a date field inside a matrix (along with a few other fields). Any suggestions?

# Answer
> 3 votes
I think this is a bug specific to the EE 2.5.5 version. It looks like the error was occurring in SuperSearch too in 2.5.5 (http://www.solspace.com/forums/viewthread/17280/#62841) and upgrading to EE v2.6 fixes it.

---
Tags: matrix
---


# Question
Title: Tools for learning ExpressionEngine addon development
What are the available tools/tutorials for learning to develop ExpressionEngine addons (modules, fields, extensions, plugins and accessories)?

# Answer
The following list should get you started:

* **ExpressionEngine Add-On Development Docs**: links to guidelines, reference material, and tutorials for developing Plugins, Modules, and Extensions for ExpressionEngine
* **ExpressionEngine Add-on Development Recipes**: a collection of articles and tutorials to help you learn how to build ExpressionEngine add-ons
* **Add-On Development Cheat Sheet**: freely downloadable cheat sheet and Accessory for ExpressionEngine 2.x. Its purpose is to help add-on developers get used to coding for EE 2, speed up development time and increase productivity.
* **Building an ExpressionEngine Add-on**: Commercial yes, but an excellent video by well-respected add-on developer @low giving a solid introduction into planning and building an add-on.
* **Pkg.io**: Package Builder for ExpressionEngine which will quickly generate boilerplate code for all types of ExpressionEngine add-ons. It includes helpful comments in the source and will jump-start development of your custom add-on.
* **generator-ee-addon** An ExpressionEngine Add-On generator for Yeoman. Capable of building modules, plugins, extensions, accessories and fieldtypes.
* **DevKit for EE 2.0** Generate a new module skeleton, yaml 2 dbforge code generation and global variables / snippets sync from filesystem.
* **Channel-Data (objectivehtml)** A helper class that compiles all the necessary models to easily gather ExpressionEngine channel data. The main benefit of this library is its ability to be dropped into any existing add-on and retrieve channel data extremely easily without having to load all the models.
* **EE-Add-On-Builder** SublimeText plugin to easily build ExpressionEngine Add-Ons.
* **Open API** \- Front-end API for ExpressionEngine that provides authentication and CRUD functionality.
> 23 votes

---
Tags: add-on-development, addons
---


title: Email Contact Form

text:
# Question
Title: Email Contact Form
I have and email form on my website with some jQuery validation in place. What is the best way to plug this form into EE to email me output leaving the jQuery validation in place?

There is front end code (jQuery) performing some validation on my form, that is checking for an actual email address or spam etc... When I use EE's build in form module it seems to ignore this front end validation so anything can go into the form and it submits OK. I need a solution that retains this front end validation within my form before it has been submitted?

Any help would be appreciated.

Hi here is my front end code does this help at all?

```
 <p>
                                          <label for="name">Your Name</label>
                                          <input type="text" name="message[]" id="name" class="required">
                                        </p>

                                        <p>
                                          <label for="email">Your Email</label>
                                          <input type="text" name="message[]" id="email" class="required email">
                                        </p>

                                        <p>
                                          <label for="subject">Subject</label>
                                          <input type="text" name="message[]" id="subject" class="required">
                                        </p>

                                        <p>
                                          <label for="message">Your Message</label>
                                          <textarea name="message[]" id="message" class="required"></textarea>
                                        </p>

                                        <input type="hidden" name="from" value="" />
                                        <input type="hidden" name="subject" value="" />

                                        <p>
                                          <input type="submit" value="Send it">
                                          <img class="ajax-loader" src="/_/images/bckg/loader_light.gif" alt="Sending ...">
                                        </p>

```

# Answer
ExpressionEngine has a built-in email module for just this purpose. It's pretty limited though, but it will accomplish what you need.

If you want something a bit more flexible, try Solspace's Freeform. There are both free and commercial versions available.

I think between the options I've mentioned you should find a good fit for your application. As with any EE module, they're not going to mess with your front-end, so your work on validation with jQuery should be safe.
> 1 votes

---
Tags: forms
---


# Question
Title: Expresso Store, email address for auto generated emails
I'm using Expresso Store, everything is working fine, except the final email generated at the end of the process has an incorrect reply to address. When the customer replies to an email, their reply is not going to the correct client address, but an old, no longer used one. Can anyone tell me where expresso store pulls it's email addresses from?

I've put the new address in the BCC field in email settings and in Admin \> Email Configuration \> Return email address for auto-generated emails is this correct?

On a related note, does anyone know where I can check the email address that the admin email is sent to? Can't seem to find it anywhere.

Thanks,

# Answer
You will want to make sure that you have changed both the **Admin \> Email Configuration \> Return email address for auto-generated emails** as you have already done, also you will want to change Store \> Settings \> General \> Store Email Sender Address to be the new email address. Once you have done that it should be sending from the new email address.

The email templates that an admin receives are set up on a per email basis. You would need to go to **Store \> Settings \> Email Templates \> then click on each of the templates you would like the admin to receive** and make sure that you have added their email address to the BBC field and save the template.
> 2 votes

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


# Question
Title: Setting up UK VAT for European Union countrires
For UK Value Added Tax, we need to charge 20% on goods shipped to countries in the EU, 0% on others. TO achieve that it looks like I need to add a rule for each EU country, rather than one rule for multiple countries.

Is that correct?

# Answer
You will need to add a tax rule for each country that you need to apply the 20% tax to.
> 1 votes

---
Tags: expresso-store
---


title: Snippet inside snippet not rendering

text:
# Question
Title: Snippet inside snippet not rendering
On a template I am calling in a series of snippets like so:

```
{sn-head}

{sn-header}

{sn-page}

{sn-listing-videos}

{sn-footer}

```

The `sn-listing-videos` snippet contains an entries loop like so:

```
{exp:channel:entries channel="video" limit="12" paginate="both" disable="categories|member_data" dynamic="no"}

    {sn-listing-pagination}

    {title}
{/exp:channel:entries}

```

The `sn-listing-pagination` snippet isn't rendering in this instance. In fact, none of my snippets are rendered with the `sn-listing-videos` snippet at all.

I have a few other templates which contain listing snippets for other channels which contain the same code apart from the channel parameter in the exp:channel:entries tag - and the pagination snippet works just fine in these.

I am using the SnippetSync module. I have run a test after having uninstalled it, but still no luck.

What could cause this problem for that particular template/snippet?

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

EDIT:

Here's the code for a different listings page where the same set up works.

Template code:

```
{sn-head}

{sn-header}

{sn-page}

{sn-listing-resource}

{sn-footer}

```

`sn-listing-resource` snippet code:

```
{exp:channel:entries channel="resource" limit="5" paginate="both" disable="categories|member_data" dynamic="no"}
    {sn-listing-pagination}

    {title}
{/exp:channel:entries}

```

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

EDIT #2:

Content of pagination snippet:

```
{paginate}
      <div class="listing-pagination">
          {pagination_links}
            {previous_page}
              <a href="{pagination_url}">Prev</a>
            {/previous_page}

            {page}
              <a href="{pagination_url}" {if current_page}class="active"{/if}>{pagination_page_number}</a>
            {/page}

            {next_page}
              <a href="{pagination_url}" class="button slim next">Next</a>
            {/next_page}
          {/pagination_links}
      </div>
{/paginate}

```

# Answer
> 3 votes
This is due to the parse order. EE parse snippets at a very early stage all at once, hence not being able to have a snippet within a snippet. I suggest removing the `{sn-listing-pageination}` and just hard code that in the `{sn-listing-videos}`.

Or you could convert all your snippets/variables over to Low Variables and set the `{sn-listing-pagination}` to a early parsed variable. This will then parse before the `{sn-listing-video}`

# Answer
> 0 votes
I was just able to accomplish what you're after using Snippet Sync AND **the problem (see below)**.

In EE template, I have just:

```
{sn:snippet_1}

```

In `sn:snippet_1`, I have:

```
{exp:channel:entries channel="pages" limit="1" paginate="both" disable="categories|member_data" dynamic="no"}
  {sn:pagination}
  {title}<br>
{/exp:channel:entries}

```

In `sn:pagination`, I have:

```
{paginate}
  <div class="listing-pagination">
      {pagination_links}
        {previous_page}
          <a href="{pagination_url}">Prev</a>
        {/previous_page}

        {page}
          <a href="{pagination_url}" {if current_page}class="active"{/if}>{pagination_page_number}</a>
        {/page}

        {next_page}
          <a href="{pagination_url}" class="button slim next">Next</a>
        {/next_page}
      {/pagination_links}
  </div>
{/paginate}

```

My output is:

```
<div class="listing-pagination">
  <a href="http://www.starterslab.local" class="active">1</a>
  <a href="http://www.starterslab.local/P1" >2</a>
  <a href="http://www.starterslab.local/P2" >3</a>
  <a href="http://www.starterslab.local/P1" class="button slim next">Next</a>
</div>

Inner Page

<div class="listing-pagination">
  <a href="http://www.starterslab.local" class="active">1</a>
  <a href="http://www.starterslab.local/P1" >2</a>
  <a href="http://www.starterslab.local/P2" >3</a>
  <a href="http://www.starterslab.local/P1" class="button slim next">Next</a>
</div>

```

**HOWEVER**, if I put my pagination code inside of `sn:snippet_1` and my channel entries code into `sn:pagination` I get this unparsed code:

```
{paginate}
  <div class="listing-pagination">
      {pagination_links}
        {previous_page}
          <a href="{pagination_url}">Prev</a>
        {/previous_page}

        {page}
          <a href="{pagination_url}" >{pagination_page_number}</a>
        {/page}

        {next_page}
          <a href="{pagination_url}" class="button slim next">Next</a>
        {/next_page}
      {/pagination_links}
  </div>
{/paginate}

```

**Here's why: Snippets are parsed in order among themselves. So, make sure your `sn-listing-pagination` snippet is listed after/below `sn-listing-videos` in EE. If not, create a new snippet for it so that it is parsed at the end.**

To further illustrate, below is a view of my exp\_snippets table (not used the example above). Note the `snippet_id` column. Snippets are parsed in order, from 1 to whatever you have.

So, you can embed snippet id 7 into 1 and it will parse since 7 is parsed after 1. You can't do the reverse. When snippet 7 is parsed, if snippet 1's tag is embedded it will just come back unparsed, since snippet 1 has already been parsed. It won't know to re-parse it.

---
Tags: snippets, snippet-sync
---


# Question
Title: how to revert to default sort order if segment doesn't exist?
I have one particular page that is being sorted according to the 3rd segment. If that segment doesn't exist, I'd like to have orderby revert to it's default. Basically, if {segment\_3} doesn't exist, then sort this way. How would I acheive this?

```
   {exp:channel:entries channel="news" orderby="{segment_3}|author_id" sort="desc" limit="9" paginate="bottom"}

```

or

```
{exp:channel:entries channel="news" orderby="{segment_3} OR author_id" sort="desc" limit="9" paginate="bottom"}

```

# Answer
You *can* wrap `channel:entries` tag parameters in *simple* conditionals. So a conditional based on a segment variable will work.

This is just an example since I'm not entirely sure I interpreted what you're after, but should give you an idea.

```
{exp:channel:entries
    channel="news"
    limit="9"
    paginate="bottom"
    sort="desc"
    {if segment_3}
        orderby="{segment_3}"
    {/if}
    {if segment_3 == ""}
        orderby="author_id"
    {/if}
}
    {title}<br>

{/exp:channel:entries}

```

**Now that I think about it, though, since pagination is involved you will run into some troubles with this method.** Because even when segment\_3 is blank to begin with, segment\_3 won't be blank on subsequent pages (it will by P10, P20, etc).

**There are other ways to accomplish this, though. Switchee should do the trick:**

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

    {case default="yes"}
        {exp:channel:entries
            channel="news"
            limit="9"
            paginate="bottom"
            sort="desc"
            orderby="{segment_3}"
        }
            {title}<br>

        {/exp:channel:entries}
    {/case}

    {!-- segment_3 is pagination or empty --}
    {case value="#^P(\\d+)$#|''"}
        {exp:channel:entries
            channel="news"
            limit="9"
            paginate="bottom"
            sort="desc"
            orderby="author_id"
        }
            {title}<br>

        {/exp:channel:entries}
    {/case}

{/exp:switchee}

```

For the segment\_3-based sorting to work you'd obviosuly want to be sure that segment\_3 contained a valid value for the channel:entries `order_by` parameter.

---

**OR if this seems like too much segment-based tomfoolery...**

Your suggestion in the comments to use GET variables is a good idea. Mo' Variables will work great for that. So with a URL of http://example.com/foo/bar?orderby=title you could do:

```
{exp:channel:entries
    channel="news"
    limit="9"
    paginate="bottom"
    sort="desc"
    {if get:orderby}
        orderby="{get:orderby}"
    {/if}
}
    {title}<br>

{/exp:channel:entries}

```
> 4 votes

---
Tags: channel-entries, sort, orderby
---


# Question
Title: Pixel and Tonix Assets and Wygwam Fields within Content Elements
I looked around and could not find how to have different types of Wygwam and Asset fields inside of Content Elements.

For example I want to be able to have two different types of Wygwam fields. I assumed my template would look like this:

```
{wygwam}
    {if element_name == "Address Content"}
        <div class="address-content">{value}</div>
    {if:else}
        {value}
    {/if}
{/wygwam}

```

This does not seem to work. Is this even possible at this point in time? Assets is giving me the same issue.

Any clarification would be awesome!

Thanks in advanced!

John

# Answer
You have to wrap the element\_name in quotes:

```
{if "{element_name}" == "Address Content"}

```
> 2 votes

---
Tags: assets, pixelandtonic, wygwam, content-elements
---


# Question
Title: Load RTE into custom module for use in control panel
is there a way to load the RTE javascript in a module for the cpanel?

I have tried the following, but keep getting an error when refreshing the page:

```
ee()->load->library(array('javascript', 'rte_lib'));

ee()->javascript->output(
  ee()->rte_lib->build_js(0, '.WysiHat-field', NULL, TRUE)
);

```

error: `Unable to load the requested class: rte_lib`

any ideas?

thanks in advance.

# Answer
> 1 votes
You have to add the package path for the RTE module first:

```
ee()->load->add_package_path(PATH_MOD.'rte/');

```

---
Tags: control-panel, add-on-development, rte
---


# Question
Title: Has anyone integrated Livefyre comments with EE?
I'm interested in using the free version of Livefyre comments to replace my EE native module, at least for new content. Anyone had experience with this? I've seen Disqus plugins... Thanks, Matthew

# Answer
No, but since the free version is just an embed script with js and html, all you need to do is add it to your template where you want it to appear on the page.

Here's an example embed code:

```
<!-- START: Livefyre Embed -->
<div id="livefyre-comments"></div>
<script type="text/javascript" src="http://zor.livefyre.com/wjs/v3.0/javascripts/livefyre.js"></script>
<script type="text/javascript">
(function () {
    var articleId = fyre.conv.load.makeArticleId(null);
    fyre.conv.load({}, [{
        el: 'livefyre-comments',
        network: "livefyre.com",
        siteId: "######",
        articleId: articleId,
        signed: false,
        collectionMeta: {
            articleId: articleId,
            url: fyre.conv.load.makeCollectionUrl(),
        }
    }], function() {});
}());
</script>
<!-- END: Livefyre Embed -->

```
> 1 votes

---
Tags: comments
---


title: Regional pricing

text:
# Question
Title: Regional pricing
My client would like to increase prices by 20% for some countries. The reason for this is that they want to show a product at £25 inclusive of tax if it's a UK delivery, £25 with no tax if it's a USA delivery.

Is there a way to achieve this using Store?

# Answer
As Justin said this is basically how Store 2 behaves already.

The price you enter for each product is the price that is displayed on your site. You can then set up a tax rate for 20% for the UK and mark it as "included in price". This means all orders with a shipping address in the UK will see a 20% tax (though their order total will not increase).

All orders outside the UK will still be charged the same price, but they will not see any line items for tax included in their order.
> 1 votes

# Answer
In Store 2 you can determine if you want the price to be tax-inclusive or not. If you choose to have the prices as tax-inclusive you will simply need to enter £25 for the price and Store will determine the taxable amount based upon the users location. For this to work properly though you will need to either set a default location for new carts or have the user enter their country to assign it to the cart.
> 1 votes

---
Tags: expresso-store
---


# Question
Title: Help with SQL to Export Channel entry status
I've built an accessory to allow my client to export channel entry data to a CSV. All is working fine but they now want to add the entry status to the list of exported fields and I'm having trouble with the SQL. My select statement as it stands:

```
SELECT
field_id_49 as 'First Name',
field_id_50 as 'Last Name',
field_id_51 as 'Email',
field_id_56 as 'Date of Birth',
field_id_53 as 'Occupation',
field_id_52 as 'Gender',
field_id_57 as 'Address',
field_id_58 as 'Address 2',
field_id_59 as 'City',
field_id_60 as 'Postal Code',
field_id_54 as 'Contact Number',
field_id_55 as 'First Aid Qualification',
field_id_61 as 'Payment Choice'
FROM exp_channel_data
WHERE channel_id = 13

```

I know I need to get the status from exp.channel.titles but I'm not sure how to join it all together. I just need to return a status no matter what it is.

Can any point me in the right direction?

Cheers

# Answer
This should cover it.

```
SELECT
    field_id_49 as 'First Name',
    field_id_50 as 'Last Name',
    field_id_51 as 'Email',
    field_id_56 as 'Date of Birth',
    field_id_53 as 'Occupation',
    field_id_52 as 'Gender',
    field_id_57 as 'Address',
    field_id_58 as 'Address 2',
    field_id_59 as 'City',
    field_id_60 as 'Postal Code',
    field_id_54 as 'Contact Number',
    field_id_55 as 'First Aid Qualification',
    field_id_61 as 'Payment Choice',
    status as 'Status'
FROM exp_channel_data as data
LEFT JOIN exp_channel_titles as titles
ON data.entry_id = titles.entry_id
WHERE data.channel_id = 13
```
> 4 votes

---
Tags: mysql, export, sql
---


# Question
Title: Adding a CP bar to the front end for logged-in members
is there a way to add the top horizontal CP bar that appears in the back end to the front end as well, for logged in members to see? WordPress and Drupal both have this, trying to figure out how to do it in EE. The idea is to provide a shortcut the the backend and to the Content menu.

# Answer
> 1 votes
Check out this add-on, Missing Link:

http://devot-ee.com/add-ons/missing-link

---
Tags: control-panel
---


# Question
Title: Populate one field with Freeform Pro form
I have a Freeform Pro form that emails the acceptance of a print proof. Right now it is just sending an email, but I would like it to also set the Validate Proof channel field to Yes. I have a hidden field with the value, but I am not sure how to submit that value to the channel entry on submit.

Here is my field code:

```
{exp:channel:entries channel="projects" entry_id="{segment_3}" class="new-project"}
             {exp:freeform:form
                form_name="approval_to_print"
                require_captcha="no"
                return="/client/client_area"
                notify_admin="yes"
                notify=" {project_client_name}{sales_rep show="email"}{/project_client_name}"
            }

             <div class="projectHeader">
                <header>
                {if project_approval == 'Yes'}
                    <h2>This proof has been approved and cannot be updated</h2>
                {if:else}
                    <h2>Submit Approval</h2>
                {/if}
                </header>
            </div> <!-- /.projectHeader -->
            <div class="section">
                <section>
                    <div class="contentWrap twoCols">
                        <div class="col">
                            <div class="section">
                                <section>
                                <p><strong>PROOF ALL CONTENT.</strong> Check all of the content - text, numbers and graphics – on your project for accuracy. You are responsible for proofing all of the content, including content that was not marked for changes. Check each feature on the list below, making sure each element is correct and looks as you would like it to appear.</p>
                                    <div class="field">
                                        <span class="label">{freeform:label:logos_and_photos} </span>
                                        {freeform:field:logos_and_photos}
                                    </div> <!-- /.field -->
                                    <div class="field">
                                        <span class="label">{freeform:label:yardages_and_totals} </span>
                                        {freeform:field:yardages_and_totals}
                                    </div> <!-- /.field -->
                                    <div class="field">
                                        <span class="label">{freeform:label:handicaps_and_pars} </span>
                                        {freeform:field:handicaps_and_pars}
                                    </div> <!-- /.field -->
                                    <div class="field">
                                        <span class="label">{freeform:label:rating_slopes} </span>
                                        {freeform:field:rating_slopes}
                                    </div> <!-- /.field -->
                                    <div class="field">
                                        <span class="label">{freeform:label:staff_names_and_titles} </span>
                                        {freeform:field:staff_names_and_titles}
                                    </div> <!-- /.field -->
                                    <div class="field">
                                        <span class="label">{freeform:label:map_graphics_including_hole_numbers} </span>
                                        {freeform:field:map_graphics_including_hole_numbers}
                                    </div> <!-- /.field -->
                                    <div class="field">
                                        <span class="label">{freeform:label:rules_and_regulations} </span>
                                        {freeform:field:rules_and_regulations}
                                    </div> <!-- /.field -->
                                    <div class="field">
                                        <span class="label">{freeform:label:contact_information_including_phone_numbers} </span>
                                        {freeform:field:contact_information_including_phone_numbers}
                                    </div> <!-- /.field -->
                                    <br>
                                    <p><strong>OPTIONAL COMMENTS FOR PRODUCTION.</strong> If you have changes to make, please use the Change Form on the previous page, or contact your rep at 800.238.7267. If you have any final comments that do not involve making changes to the proof, please include them below.</p>
                                    <br>
                                    <div class="field">
                                        <span class="label"><label for="project-notes">Optional Comments:</label></span>
                                        {freeform:field:user_message}
                                    </div> <!-- /.field -->
                                    <br>
                                    <p><strong>3. CLICK ON THE SUBMIT APPROVAL TO PRINT BOX BELOW.</strong></p>

                                    <div class="buttons">
                                        <input type="hidden" name="client_name" value="{title}">
                                        {client_project}
                                        <input type="hidden" name="project_name" value="{title}">
                                        <input type="hidden" name="quantity" value="{project_quantity}">
                                        <input type="hidden" name="size" value="{project_size}">
                                        <input type="hidden" name="features" value="{project_features}">
                                        {/client_project}
                                        <button type="submit" name="submit" class="button large">Send File</button>
                                    </div> <!-- /.buttons -->
                                </section>
                            </div> <!-- /.section -->
                        </div> <!-- /.col -->
                        <div class="col last">
                            <div class="sidebar">
                                <aside>
                                    <p>Note: By submitting this form, you acknowledge that all of the content on this final proof is correct. Content on printed project will be the same as this proof. Golf Scorecards, Inc. is not responsible for errors on the printed piece if you have not indicated corrections using our Change Form. </p>
                                </aside>
                            </div> <!-- /.sidebar -->
                        </div> <!-- /.col -->
                    </div> <!-- /.contentWrap -->
                </section>
            </div> <!-- /.section -->
            {/exp:freeform:form}
        {/exp:channel:entries}

```

Thanks in advance for any help!

# Answer
Another potential solution is to use the Safecracker/Channel Form tag outside of the Freeform tag and use some jQuery to submit both forms when the submit button is clicked, so that the channel field is updated as well as the the form sent.

You'll need to make sure the forms are submitted with AJAX so you can ensure that both are completed submitting before redirecting the user.
> 0 votes

# Answer
Freeform is purely a sending thing.

What you're looking to do used to be called safecracker (its just been renamed to something I can't recall ATM) - the 2 are mutually exclusive.

You need to edit the channel entry then fire off an email .... unless I'm missing something
> 0 votes

---
Tags: solspace-freeform
---


# Question
Title: Get categories that contain entries that are in the current category
How can I get a list of categories that share entries with the currently selected category.

**Huh? Let me explain**

* I have a channel called Portfolio
* Portfolio channel has two category groups (client and role)
* I have a page listing all clients (categories)
* I would like to list all clients who I have made a website (for example) for

# Answer
```
{preload_replace:group_to_display="1"}
{preload_replace:current_category_id="15"}

{exp:query sql="
    SELECT DISTINCT `cats`.*
    FROM `exp_category_posts` AS `posts`
    INNER JOIN `exp_categories` AS `cats`
    ON `posts`.`cat_id` = `cats`.`cat_id`
    WHERE `group_id` = {group_to_display}
    AND `entry_id` IN (
        SELECT DISTINCT `entry_id`
        FROM `exp_category_posts`
        WHERE `cat_id` = {current_category_id}
    )
    ORDER BY `cat_name` ASC;
"}
    {cat_name}
    {cat_url_title}
    etc...
{/exp:query}
```

I have used preload replace variables to show where the variables would go in the query. In reality you would use Low Seg2cat or something similar.
> 1 votes

---
Tags: categories, sql, query-module
---