# Question
Title: Solspace Freeform Dynamic Recipients Notification Email
Using Freeform Next. I have a feeling this is way basic and Im just missing it.

I have a dynamic recipients set up with on a "Select Division" drop down.

Currently the email is returning the email address Im filtering too. I want the option label of the division.

How do I get that?

Basic form is ....

Contact Form Submitted on: {current\_time format="%l, %F %j, %Y at %g:%i%a"}

* Name: {field:name:value}
* Email: {field:email:value}
* Phone Number: {field:phone:value}
* Division: {field:division:options}{option:label}{/field:division:options}
* Message: {field:message:value}

# Answer
> 0 votes
Have you set up a custom email notification template for the form? You should be able to add `{field:division:label}` and `{field:division:value}` to the body and whatever other variables from the form you want displayed in the notification email. https://solspace.com/expressionengine/freeform/docs/email-notifications/#email-body

# Answer
> 0 votes
I've just found a workaround for this, although it's not very elegant.

On my Dynamic Recipients field, I have 2 options available. Each one has 2 email addresses, which the Notifications will be sent to, upon the customer submitting the form.

```
Option A = email1@domain.com,email2@domain.com
Option B = email3@domain.com,email4@domain.com

```

In my Notifications template, I have then added an if..then..else check to detect which values (as a string) have been submitted, for this Field.

```
<tr>
    <th>{field:fieldname:label}</th>
    <td>{if field:fieldname:value == "email1@domain.com,email2@domain.com"}Option A{if:else}Option B{/if}</td>
</tr>

```

So far, in testing, this has proven successful. It's a bit clunky because if you change the destination email addresses on the form Field, you have to remember to edit them in the if..then..else statement too.

---
Tags: solspace-freeform, notification, dynamic
---


# Question
Title: Simple Registration losing field data on submission error
I'm having an issue with an EE2.11.6 site running Simple Registration 1.5.1.

We have a multi-field registration form on the site (using Simple Registration) and when a user fills in the form (and say they the form produces an error page saying username already taken etc) on reload of the form/registration page it wipes all the form data.

The form script is as follows:

```
{exp:simple_registration:form
return='community{if segment_2}/{segment_2}{/if}'
skip_success_message='y'
name="register"}

    <div class="unit1 header">
        <h3>{membership_form_title}</h3>{!-- SNIPPET --}
        <p>{membership_form_text}</p>{!-- SNIPPET --}
    </div>

    <ul class="errorTxt"></ul>

    <div class="unit1">
        <div class="unit4">
            <p><label for="firstname"><strong>First name</strong></label></p>
        </div>
        <div class="unit3-4">
            <p><input type="text" name="firstname" id="firstname" /></p>
        </div>
    </div>

    <div class="unit1">
        <div class="unit4">
            <p><label for="lastname"><strong>Last name</strong></label></p>
        </div>
        <div class="unit3-4">
            <p><input type="text" name="lastname" id="lastname" /></p>
        </div>
    </div>

    <div class="unit1">
        <div class="unit4">
            <p><label for="organisation"><strong>Organisation</strong></label></p>
        </div>
        <div class="unit3-4">
            <p><input type="text" name="organisation" id="organisation" /></p>
        </div>
    </div>

    <div class="unit1">
        <div class="unit4">
            <p><label for="email"><strong>Email</strong></label></p>
        </div>
        <div class="unit3-4">
            <p><input type="text" name="email" id="email" /></p>
        </div>
    </div>

    <div class="unit1">
        <div class="unit4">
            <p><label for="telephone"><strong>Telephone</strong></label></p>
        </div>
        <div class="unit3-4">
            <p><input type="text" name="telephone" id="telephone" /></p>
        </div>
    </div>

    <div class="unit1">
        <div class="unit4">
            <p><label for="where-did-you-hear-about-us"><strong>Where Did You Hear About Us</strong></label></p>
        </div>
        <div class="unit3-4">
            {where-did-you-hear-field}
        </div>
    </div>

    <div class="unit1">
        <div class="unit4">
            <p><label for="research-area"><strong>Area of interest</strong></label></p>
        </div>
        <div class="unit3-4">
            {research-area-field}
        </div>
    </div>

    <div class="unit1">
        <div class="unit4">
            <p><label for="country"><strong>Country</strong></label></p>
        </div>
        <div class="unit3-4">
            {country-list}
        </div>
    </div>

    <div class="unit1">
        <div class="unit4">
            <p><label for="password"><strong>Password</strong></label></p>
        </div>
        <div class="unit3-4">
            <p><input type="password" name="password" id="password"/></p>
        </div>
    </div>

    <div class="unit1">
        <div class="unit4">
            <p><label for="password_confirm"><strong>Confirm password</strong></label></p>
        </div>
        <div class="unit3-4">
            <p><input type="password" name="password_confirm" id="password_confirm"/></p>
        </div>
    </div>

    <div class="unit1">

        <br />

        <div class="unit4">
        <p><label for="where-did-you-hear"></label></p>
        </div>

        <div class="unit3-4" style="font-size:.95em;line-height:150%;">

            We would like to keep you informed with the latest news, data and innovations from the neuroscience and clinical trial community. We'll always treat your contact information with great care and will never allow other companies to access your information for marketing purposes.

            <br /><br />

            Please let us know if you would like us to contact you or not by selecting one of the options below.

        </div>

        <div class="unit4">
        <p><label for="where-did-you-hear"></label></p>
        </div>
        <div class="unit3-4">
            <ul style="list-style:none; padding:0;" class="opt_in">
                <li>
                    <input name="opt-in" id="freeform_opt-in_1" value="yes" type="radio">
                    <label for="freeform_opt-in_1" style="color:#000">Yes please, I would like to stay up to date with the neuroscience research and clinical trial communities.</label>
                </li>
                <div class="clearfix"></div>
                <li>
                    <input name="opt-in" id="freeform_opt-in_2" value="no" type="radio">
                    <label for="freeform_opt-in_2" style="color:#000">No thanks, I don't want to hear about the latest news, scientific data and technology innovations.</label>
                </li>
            </ul>
        </div>

    </div>

    <div class="unit1">
        <div class="unit4">

        </div>
        <div class="unit3-4">
            <p>
                <input type="submit" class="submitButton" name="Submit" id="Submit" value="Submit" />
            </p>
        </div>
    </div>
{/exp:simple_registration:form}

```

If anyone has any ideas on this it would be a great help!

Many thanks in advance :-)

Regards

Karl

# Answer
I think you should try by adding `value=""` attribute into template tags. So, it will keep your existing data into form as it is.

```
{exp:simple_registration:form return='community{if segment_2}/{segment_2}{/if}' skip_success_message='y' name="register"}
<div class="unit1 header">
    <h3>{membership_form_title}</h3>{!-- SNIPPET --}
    <p>{membership_form_text}</p>{!-- SNIPPET --}
</div>

<ul class="errorTxt"></ul>

<div class="unit1">
    <div class="unit4">
        <p><label for="firstname"><strong>First name</strong></label></p>
    </div>
    <div class="unit3-4">
        <p><input type="text" name="firstname" id="firstname" value="{firstname}" /></p>
    </div>
</div>

<div class="unit1">
    <div class="unit4">
        <p><label for="lastname"><strong>Last name</strong></label></p>
    </div>
    <div class="unit3-4">
        <p><input type="text" name="lastname" id="lastname" value="{lastname}" /></p>
    </div>
</div>

<div class="unit1">
    <div class="unit4">
        <p><label for="organisation"><strong>Organisation</strong></label></p>
    </div>
    <div class="unit3-4">
        <p><input type="text" name="organisation" id="organisation" value="{organisation}" /></p>
    </div>
</div>

<div class="unit1">
    <div class="unit4">
        <p><label for="email"><strong>Email</strong></label></p>
    </div>
    <div class="unit3-4">
        <p><input type="text" name="email" id="email" value="{email}" /></p>
    </div>
</div>

<div class="unit1">
    <div class="unit4">
        <p><label for="telephone"><strong>Telephone</strong></label></p>
    </div>
    <div class="unit3-4">
        <p><input type="text" name="telephone" id="telephone" value="{telephone}" /></p>
    </div>
</div>

<div class="unit1">
    <div class="unit4">
        <p><label for="where-did-you-hear-about-us"><strong>Where Did You Hear About Us</strong></label></p>
    </div>
    <div class="unit3-4">
        {where-did-you-hear-field}
    </div>
</div>

<div class="unit1">
    <div class="unit4">
        <p><label for="research-area"><strong>Area of interest</strong></label></p>
    </div>
    <div class="unit3-4">
        {research-area-field}
    </div>
</div>

<div class="unit1">
    <div class="unit4">
        <p><label for="country"><strong>Country</strong></label></p>
    </div>
    <div class="unit3-4">
        {country-list}
    </div>
</div>

<div class="unit1">
    <div class="unit4">
        <p><label for="password"><strong>Password</strong></label></p>
    </div>
    <div class="unit3-4">
        <p><input type="password" name="password" id="password"/></p>
    </div>
</div>

<div class="unit1">
    <div class="unit4">
        <p><label for="password_confirm"><strong>Confirm password</strong></label></p>
    </div>
    <div class="unit3-4">
        <p><input type="password" name="password_confirm" id="password_confirm"/></p>
    </div>
</div>

<div class="unit1">
    <br />
    <div class="unit4">
        <p><label for="where-did-you-hear"></label></p>
    </div>

    <div class="unit3-4" style="font-size:.95em;line-height:150%;">
        We would like to keep you informed with the latest news, data and innovations from the neuroscience and clinical trial community. We'll always treat your contact information with great care and will never allow other companies to access your information for marketing purposes.
        <br /><br />
        Please let us know if you would like us to contact you or not by selecting one of the options below.
    </div>

    <div class="unit4">
        <p><label for="where-did-you-hear"></label></p>
    </div>
    <div class="unit3-4">
        <ul style="list-style:none; padding:0;" class="opt_in">
            <li>
                <input name="opt-in" id="freeform_opt-in_1" value="yes" type="radio">
                <label for="freeform_opt-in_1" style="color:#000">Yes please, I would like to stay up to date with the neuroscience research and clinical trial communities.</label>
            </li>
            <div class="clearfix"></div>
            <li>
                <input name="opt-in" id="freeform_opt-in_2" value="no" type="radio">
                <label for="freeform_opt-in_2" style="color:#000">No thanks, I don't want to hear about the latest news, scientific data and technology innovations.</label>
            </li>
        </ul>
    </div>

</div>

<div class="unit1">
    <div class="unit4">

    </div>
    <div class="unit3-4">
        <p>
            <input type="submit" class="submitButton" name="Submit" id="Submit" value="Submit" />
        </p>
    </div>
</div>
{/exp:simple_registration:form}

```

Ideally it should works if plugin code follows **EE standards**. *But I didn't use this plugin ever*.

I suggest you to use **Smart Members PRO** plugin for `Login` and `Registration`. I am biggest fan of this plugin. It gives all necessary things in very simple way which requires to make member section(Login, Registration, Update profile, Forgot password, Reset-profile, Login with Social Media etc). It is the **KING** of Member section.
> 0 votes

---
Tags: simple-registration
---


# Question
Title: how to redirect from website.com/index to website.com
For example, visitor types `www.website.com/index`. I want to remove `index` and show this url `www.website.com`

In `.htaccess` wrote

`RedirectMatch 301 /index https://www.website.com`

As result instead of `https://www.website.com` get `https:///www.website.com/?index` with 404 error.

Please advice what is the correct way to redirect.

**Some solution.**

Did it not in `.htaccess`, but in php file.

This works

```
if( trim($_SERVER['REQUEST_URI']) == '/index' ){
header('Location: https://www.domain.com', true, 301 );
exit();
}

```

but may be some better solution?

# Answer
You probably can find all you need in the ExpressionEngine documentation which discusses this issue and provides some sample code.
> 3 votes

---
Tags: htaccess, redirection
---


# Question
Title: How to get article count with a single entry view
I want to get the current article count with a single article view. So I've I'm currently viewing the fifth of ten articles, it will output '5'.

If I do this:

```
{exp:channel:entries channel="articles" sort="asc" limit="1"}

{count}

{/exp:channel:entries}

```

This always evaluates to 1, as it's the single entry view.

I've tried {absolute\_count} but this provides the same result.

Any ideas, I'm open to using {query} tags but I can't work it out.

# Answer
Have you tried including 'Dynamic="no"' ie

```
{exp:channel:entries channel="articles" sort="asc" limit="1" dynamic="no"}

```

https://docs.expressionengine.com/v3/channel/channel\_entries.html#dynamic
> 0 votes

# Answer
There is no built in way to do this.

You could, however, do this by calling an embed that you pass the entry ID to, loop through all the articles - and when the entry id of the loop matches the embedded entry id, then you have your count. Keep in mind that the more entries in the channel, the more overhead you'll have looping through them all.

So...your single entry template would look something like the following...

```
{exp:channel:entries channel="articles" limit="1"}
    {embed="embeds/_get-entry-count" entry_id="{entry_id}"}
{/exp:channel:entries}

```

Then, in your embed...

```
{exp:channel:entries channel="articles" sort="asc"}
    {if entry_id == embed:entry_id}
        {count}
    {/if}
{/exp:channel:entries}

```
> 0 votes

---
Tags: count
---


title: Structure Listing - ridiculous padding

text:
# Question
Title: Structure Listing - ridiculous padding
I've been asked to resolve an issue on an EE 2.7.3 site with Structure 3.3.14

I didn't build this site and will be recommending an upgrade, however that is not an immediate option.

On the structure page the entire tree has ridiculous amounts of padding between entries. There are no errors in the console. See screenshot.

\********** EDIT \*********

Turned on structure debug but there is nothing to debug.

# Answer
Often times, this can actually be caused by a different add-on (and often extension). I would recommend backing up the database, and then disabling all other add-ons one by one until you track down what is causing it.
> 0 votes

---
Tags: ee2, structure
---


# Question
Title: Strategy to remove malware from EE install
A client's host has reported Malware present in a EE 3 install. I've not found anything myself, but I wondered if anyone has a strategy to deal with this. I was thinking I should upgrade to the latest version, but is it a good idea to ask the host to roll back the installation to an instance before the Malware was reported first?

# Answer
With EE3 it is possible to completely replace the EE system files easily enough - so if you think the malware has got into the EE install itself this would be a good thing to do: if the EE3 installation is not at the latest version it would be good practice to update to that at the same time. Instructions on how to do this here.

Another best-practice (if not done already) is to move the EE system folder out of the public\_html folder (or your equivalent). Instructions on how to do this here.

However it is much more likely that the malware has not compromised the EE installation itself and is hooked in via changes to supporting files - so check your `index.php` and `admin.php` files (best practice is to replace these with clean copies from an EE install modified as required to suit your setup) and restore clean copies of any javascript files you are using from source.

HTH
> 0 votes

---
Tags: ee3
---


title: moved websites to a different server

text:
# Question
Title: moved websites to a different server
I have moved a website that uses ExpressionEngine to a different server, however all the images appear to be missing and if I go to update something it says the path is invalid.

I just spotted another error as I was going through the migration documentation.

Can anyone advise on how do I fix this, I am new to ExpressionEngine and CodeIgniter

# Answer
> 2 votes
An EE configuration needs to know both the URL of the site and the local path to the webroot folder within the server you are using to operate.

If you have changed servers then it is likely that the local path to the webroot folder will have changed, and as a result EE operations that rely on accessing files stored below that webroot folder (such as images) will fail until you provide the correct path.

There are good instructions on how to move an EE2 installation from one server to another here.

HTH

# Answer
> 0 votes
webroot folder

The answer above is probabaly right

My image folder is know, yet I would not have the foggiest idea what the webroot folder is.

Maybe the server can show you. Also if you use transmit or another upload device to upload your files, that has to be configured with the webroot folder

---
Tags: codeigniter, server-migration
---


title: Using a Template Variable in a Model

text:
# Question
Title: Using a Template Variable in a Model
I'd like to use a template variable {product\_minimum\_order\_value} in a product model. Channel fields are accessible in template code using {django\_syntax}, however I would like to use them in the models without sending them as form data.

Is Expression Engine able to do this without relying on the horrific mess of an alternative I've posted below:

```
SELECT title, field_id_118
AS 'product_minimum_order_value'
FROM exp_channel_titles t
INNER JOIN exp_channel_data d
ON d.entry_id = t.entry_id
WHERE d.entry_id = 82;`

```

# Answer
If you are in a model (Any backend PHP file). You can do something like,

```
$data = ee('Model')->get('ChannelEntry', "82")->fields('title', 'field_id_118')->first();
$product_minimum_order_value = "";
if($data)
{
    $product_minimum_order_value = $data->field_id_118;
    unset($data);
}

```
> 1 votes

---
Tags: channel-entries, template-partials
---


title: Images have disappeared

text:
# Question
Title: Images have disappeared
Using ExpressionEngine v2.9.2 - Build Date: 20141004 - © Copyright 2003 - 2016 EllisLab, Inc.

All images have disappeared from our website: www.wordworks.jp I am guessing that a broken link to the Expression Engine database is to blame.

If you know how to fix this, please tell me how. Am willing to pay to get this sorted out ASAP.

# Answer
All your images point to http://wordworks.**ehclients.com/images/** but there is a server error (Server not found). I suppose that is the problem.
> 1 votes

# Answer
A field that might come in handy is "URL of Upload Directory" in the area:

Content \> Files \> File Upload Preferences \> (your image folder)

I'd also check on "Server Path to Upload Directory". This begins with a slash, e.g., "/www/website/images/uploads"
> 0 votes

---
Tags: channel-entries
---


title: Can you use Reactjs with ee?

text:
# Question
Title: Can you use Reactjs with ee?
I am new to EE (also coding so might seem naive) and was wondering if there is any way to connect my ReactJS project, that i created with create-react-app, with EE. create-react-app docs here: https://github.com/facebook/create-react-app

I have been looking around but not too many examples with React.

Would it be possible by using CMS as an API (with an add-on?) where I would fetch the data in the React app and if this is a viable way to go about it, how would I go about doing it?

My version of EE is v4.3.6 React version is v16.6.1

Thanks

# Answer
Using EE as a content API is not possible as far as I know. The only API EE provides is an interface to add, update, delete entries.

A workaround could be found here by just outputting JSON: How to make templates output JSON? but this is still not that flexible and dynamic and gets complicated when working with 3rd party and custom add-ons.

We thought about to implement the content API ourself and just use EE as content creation. But actually, we stick to the approach to use a real headless CMS.
> 0 votes

---
Tags: add-on, ee, api
---


title: wygwam error after move of server

text:
# Question
Title: wygwam error after move of server
I am new to ExpressEngine. One of my clients has a website built in EE by another developer. We have just moved the site to a new server, and now we are getting the following errors, if anyone can help that will be great.

Current version is ExpressionEngine 2.5.3

A PHP Error was encountered Severity: 8192 Message: Non-static method Wygwam\_helper::replace\_page\_tags() should not be called statically, assuming $this from incompatible context Filename: wygwam/ft.wygwam.php Line Number: 562

A PHP Error was encountered Severity: 8192 Message: Non-static method Wygwam\_helper::replace\_page\_tags() should not be called statically, assuming $this from incompatible context Filename: wygwam/ft.wygwam.php Line Number: 562

A PHP Error was encountered Severity: 8192 Message: Non-static method Wygwam\_helper::replace\_page\_tags() should not be called statically, assuming $this from incompatible context Filename: wygwam/ft.wygwam.php Line Number: 562

A PHP Error was encountered Severity: 8192 Message: Non-static method Wygwam\_helper::replace\_page\_tags() should not be called statically, assuming $this from incompatible context Filename: wygwam/ft.wygwam.php Line Number: 562

A PHP Error was encountered Severity: 8192 Message: Non-static method Wygwam\_helper::replace\_page\_tags() should not be called statically, assuming $this from incompatible context Filename: wygwam/ft.wygwam.php Line Number: 562

A PHP Error was encountered Severity: 8192 Message: Non-static method Wygwam\_helper::replace\_page\_tags() should not be called statically, assuming $this from incompatible context Filename: wygwam/ft.wygwam.php Line Number: 562

A PHP Error was encountered Severity: 8192 Message: Non-static method Trunchtml::usage() should not be called statically, assuming $this from incompatible context Filename: trunchtml/pi.trunchtml.php Line Number: 37

A PHP Error was encountered Severity: Warning Message: Cannot modify header information - headers already sent by (output started at /home/affinityassetfin/public\_html/system/codeigniter/system/core/Exceptions.php:170) Filename: core/Common.php Line Number: 409

Many thanks Shuka

# Answer
> 1 votes
This is probably being caused by the new server running a newer version of php: I would start by checking what version the old and new server have.

If they are different, you can either try to revert the new server back to the version on the original server, or update the EE installation to a newer version.

If you go for updating EE, look in the EE2 version changelog for the version you need to update to for compatibility.

Big milestones:

* php 5.2.4 - EE 2.6.0
* php 5.3.0 - EE 2.10.3
* php 7.0 - EE 2.11.0
* php 7.1 - EE 2.11.9 (the final version)

As you update through EE2 versions you probably will also need to update some of the installed add-ons.

HTH

---
Tags: wygwam, php
---


# Question
Title: Issue with custom fieldtype using shared form field
I am working on a custom fieldtype which essentially displays a select dropdown with some custom options. To keep in line with EE's styles I'm trying to use their shared form field to get it to display with their rich select dropdown field view.

The issue arises when this is added to a Fluid field. When it's first added to the Fluid field the options are populated, but you're unable to click the dropdown to display them (inspector tools verifies the options actually are there in the `.field-drop-choices` div. However, you're able to save the channel entry and when you go back to edit it you're then able to click the dropdown to display the option list.

This is my current `display_field()` method:

```
public function display_field($data)
{
    ee()->javascript->output('
        FluidField.on("dropdown", "add", function(element){
            Dropdown.renderFields(element);
        });
    ');

    ee()->lang->loadfile('fieldtype_name');

    $forms = $this->get_forms();

    if(empty($forms))
    {
        return '<div class="alert inline warn"><p>'.lang('error_message').'</p></div>';
    }
    else
    {
        return ee('View')->make('ee:_shared/form/field')->render(array(
            'field_name' => $this->field_name,
            'field' => array(
                'type' => 'dropdown',
                'choices' => $forms,
                'value' => $data
            ),
            'grid' => FALSE
        ));
    }
}

```

Is there something I'm missing to get this to start working immediately when added?

# Answer
Turns out I just needed this block to reference *my own fieldtype name* instead of the EE fieldtype of "dropdown". So instead of this:

```
ee()->javascript->output('
    FluidField.on("dropdown", "add", function(element){
        Dropdown.renderFields(element);
    });
');

```

It should be this:

```
ee()->javascript->output('
    FluidField.on("my_fieldtype_name", "add", function(element){
        Dropdown.renderFields(element);
    });
');

```
> 0 votes

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


# Question
Title: "Thumbnail could not be created for the image." Error
I've recently migrated a site, and now when uploading pictures through the file manager in Wygwaym images large enough to require a thumbnail cannot be uploaded, very small images, however, can be. I've verified that the \_thumbs directory exists, and has the correct permission. As noted in some old EE Forum threads, I've also ensured that the server user that created the folder and the one the site runs as are the same.

Any thoughts?

# Answer
I was able to fix a similar problem on a different site.

First, make sure the thumbnail directory has write permissions. The command I used was something like "chmod -R 777 expressionengine/cache"

Second, take a look at the Image Resizing Preferences in the admin:

1. Go to Admin-\> System Administration-\> Image Resizing Preferences
2. Set Image Resizing Protocol to ImageMagick.
3. Set the Image Converter Path to the location of the ImageMagick binary. You can find the path by running "which convert" on the server command line. If it doesn't show a path, then then you need to install ImageMagick on the server. In my case the path was "/usr/bin" but another common location for it is "/usr/local/bin".

I hope this helps.
> 3 votes

# Answer
Make sure the directories are web-user writable and are owned by the systems' webuser. Check the ownership of files uploaded through the control panel to images - often it's a `www-data:www-data` pair.
> 2 votes

# Answer
Could be you need to increase the limits for PHP to allow enough memory to create the thumbs.

Have you tried amending php.ini?
> 2 votes

# Answer
I had this problem and what fixed it for me was changing the Image Resizing Protocol to GD2 (it was set to ImageMagick, which probably was not installed on this server). Image Resizing Protocol (in EE3.5) is in Settings \> Content and Design.

So in other words, make sure the Image Resizing Protocol is set to what is installed on your server.
> 1 votes

---
Tags: wygwam, file-uploads, file-manager
---


# Question
Title: Is there any good solution for Facebook login with EE4 / EE5 in 2018? [YES !]
It's all in the title. Threads about logging users in EE with a facebook account seem to date from the last decade or so.

Is there any good solution for Facebook login with EE4 / EE5 in 2018 ?

**\[ YES! \] 2019 UPDATE**

We used Social Sign In from reinos.nl and it's worth every penny. Bonus points for the developer who implemented several feature requests very quickly (MSM support and multiple return URLs).

# Answer
> 1 votes
I have not used it but I did stumble across "Smart Members PRO" on devotee https://devot-ee.com/add-ons/smart-members-pro

---
Tags: members, login, facebook, social
---


# Question
Title: HOW TO SERVE CERTAIN ADS TO MOBILE DEVICES
WE ARE A RESPONSIVE DESIGN I template for all sizes. Yet we are switching up out ads, and want to serve one set of ads for a desktop and laptop and 1 type for mobile devices. How do i go about doing this?

Thank you

# Answer
A simple solution would be to install the useful Mo'variables add-on - which provides an `{if is_mobile}` conditional flag. You could use this to determine what your template does for mobile vs. desktop.

HTH
> 0 votes

# Answer
You can also do this in CSS with Bootstrap. Example:

```
<div class="d-none d-lg-block d-xl-none">
Visible only on large viewport
</div>

<div class="d-block d-sm-none">
Visible only on extra small viewport
</div>

```

More at https://getbootstrap.com/docs/4.1/utilities/display/.
> 0 votes

---
Tags: ee2
---


title: Must have add-ons

text:
# Question
Title: Must have add-ons
I know this is a peer project related question but what are your must have add-ons? Which add-ons are you using in all your project especially for EE4.X

Thanks

# Answer
> 0 votes
Well it is not fixed that some addons you must have to develop EE website. But if you want then below are the addons of EE which usually I used.

* BBD Chopper (Chopper takes your entry's content and whittles it down to a more manageable size. It strips the HTML and limits the excerpts by character count, word count or cutoff marker.)
* CE Image (CE Image is an image manipulation tool for use in your ExpressionEngine templates.)
* Deeploy Helper (Manage paths and URLs more easily with Deeploy Helper.)
* Freeform Pro (Freeform is the most powerful form building add-on for ExpressionEngine. It gives you full control to create simple or complex multi-page forms, as well as connect your forms to many popular API integrations.)
* Low Search (Low Search is used to search any content on your website. To integrate Global Site Search or specific search functionality.)
* SEO Lite (SEO Lite is the easiest way to make sure the title-tag is output on all pages on your site: one global embed / snippet and you're done. SEO Lite is a very lightweight module which will add a SEO tab to your publish page.)
* Wygwam (Wygwam’s WYSIWYG editor is based on the powerful and accessible CKEditor 4, which we’ve custom-tuned to work exceptionally well with ExpressionEngine.)

These are the most usable addons of EE. I think all EE developers are using these addons. Also these are very famous addons in EE's world.

# Answer
> 0 votes
I don't have any "must have" addons, and have built a fair few EE sites that use no 3rd party addons at all.

That said I use 3rd party addons where native EE functionality either can't do what I need it to do, or they make things easier for site owners.

If I do use 3rd party addons there are a few that regularly crop up:

Low Variables - great for managing miscellaneous content like phone numbers, micro copy, social media URL's etc. It also works well for front end settings like switching things on/off!

WYGWAM - for when you need an enhanced WYSIWYG editor, the best bit is that you can control formatting buttons per custom field.

Freeform - if you need to store form submissions, you can use Channel Form to store submissions but that can overwhelm your entries listings.

# Answer
> 0 votes
I echo earlier comments about add-ons not being required to build an EE4 site, but there are some add-ons that I think are worth including in any base build. They are (alphabetically ordered):

* Caddis Math \- to do simple mathematical operations within templates
* Mo'Variables \- a useful collection of additional system / global variables
* Stash \- Complex to use, but handy mechanism for temporary storage within / across templates (and some other things) - but increasingly becoming less necessary as EE4 builds in similar features
* Caddis Streeng \- Handy string manipulations - need perhaps being replaced by EE4 variable modifiers, but still does many things that variable modifiers cannot :)
* URL Helper \- a Swiss army knife of utilities to access and manipulate URL slugs

There are some other add-ons that are exceptional and often are useful, but not always required (and / or other ways of doing these things exist):

* CE Image \- Still works under EE4 but long in need of an update or replacement; provides ability to perform customised manipulation of images within templates.
* GWCode Categories or Category Construct \- Handy tools to work with category information within templates (EE4 compatible version of GW Categories can be found via second posting here)
* Low Reorder \- Allows for creation of dynamic lists (e.g. based on channels, categories, search terms etc.) that then can be re-ordered arbitrarily - surprisingly useful
* Low Search \- Provides fine-grain access / control of search within EE

Finally, although not strictly necessary, you might also want to consider adding a more complete Rich Text Editor than ships with EE4, I use Wyvern.

HTH

# Answer
> 0 votes
EE4 (presumably also EE5) is so well-packed, out of the box I don't need anything.

However, if using forms, FreeForm Pro is fantastic. I'd happily shell out the $ for this if I'm doing anything more than, say, a basic contact form.

# Answer
> 0 votes
Thanks all for your advice/comments..
Actually, i often use these Addons

* Low variables for multilingual site and miscellaneous content.
* Channel Images for image manipulation (maybe i could use EE4 for that but i need different kind of cropping..)
* Antenna for video implementation
* DataGrab to import data from RSS and/or custom json file i generate from other website)
* WYGWAM .
* PDF Press for few website..
* FreeFrom when i need file upload
* Snaptcha to avoid too many spam..
* Expresso Store when i need complex ecommerce solution

That's a lot, i know and sometime i wish i could do it without any Addons because when it's time to Upgrade it can be ?%@%$&@..

---
Tags: add-on, ee4, addons
---


title: Expresso Store CP Menu

text:
# Question
Title: Expresso Store CP Menu
The system does not appear to have created a CP menu option to get to the store. Currently I am having to go through Developer, Add ons, Store to see the store dashboard. Is there a way I can create this button manually?

# Answer
You could create a button... In EE3 to EE5, Setting -\> Menu manager -\> Manage your menuset -\> Add menu item -\> Single Link to your addon-link (you have to copy - paste from the address bar).
> 0 votes

---
Tags: expresso-store
---


# Question
Title: On Form submit save values to cookie to repopulate form again - FreeForm
EE 2.9.2 FreeForm 4.2.0

I have a somewhat large form where the client expects users to submit it multiple times per visit. They would like to have 8 of the fields be pre-populated after the first submission.

I'm thinking this needs to be done with cookies but am unsure of how to get the cookies set using the info entered into the the form. Any thoughts on how best to achieve this?

Have looked at cookie addons, but not sure if they will work or if I should approach this with javascript/jquery.

# Answer
> 1 votes
You'll have to write an extension which uses the freeform\_module\_insert\_end hook to save the cookie (or cookies, depending - cookie size *is* an issue, so maybe one cookie per field?).

Something like:

```
function freeform_module_insert_end($field_input_data, $entry_id, $form_id, $this)
{
    $expires = ee()->localize->now + 3600;
    ee()->input->set_cookie('freeform_default_name', $field_input_data['name'], $expires);
    ee()->input->set_cookie('freeform_default_email', $field_input_data['email'], $expires);
    ee()->input->set_cookie('freeform_default_phone', $field_input_data['phone'], $expires);
}

```

Then you can use any cookie add-on - Mo' Variables is a good one - to get your cookie when building your form:

```
<input type="text" name="name" value="{cookie:exp_freeform_default_name}" />

```

(Note that when setting cookies via the EE Input class, the `exp_` prefix is added automatically to your cookie name.)

# Answer
> 0 votes
Or just use the native channel:form tag instead. Save the first time and then use the edit function to load all the data.

---
Tags: solspace-freeform, jquery, javascript
---


title: help with an error was encountered

text:
# Question
Title: help with an error was encountered
we are using expression engine and recently found that after creating a user that we can no longer log into the admin, when logging in we get the following: An error was encountered, unable to load the requested class: services\_json. EE version 292, using Zoo Flexible Admin.

Any suggestions?

# Answer
> 1 votes
Try disabling add-ons in the config.php file. And try login again. The problem come from Zoo visitor add-on.

---
Tags: error
---


title: Assets Field within Structure Entries

text:
# Question
Title: Assets Field within Structure Entries
I'm running into a problem with Assets & Structure Entries 1.3.4 & 1.2.8 — effectively it boils down to the fact that my Assets field only returns the filename, not the entire folder path.

Here's a couple of examples:

```
{exp:channel:entries channel="staff"}
  {staff_photo} - returns /ee-uploads/images/staff/filename.jpg
{/exp:channel:entries}

```

That works as expected, however if I need to do this within Structure Entries:

```
{exp:structure_entries depth="1" parent="9"}
  {staff_photo} - returns filename.jpg but not the full path
  {staff_photo:url} - returns nothing just the tag
{/exp:structure_entries}

```

I've also tried adding parse inward to this tag:

```
{exp:structure_entries depth="1" parent="9" parse="inward"}
  {staff_photo} - returns filename.jpg but not the full path
  {staff_photo:url} - returns nothing just the tag
{/exp:structure_entries}

```

However I get the exact same result with or without `parse="inward"`. Does anyone have any ideas I'm really stuck here. It's worth noting that this problem doesn't arise when using the build in Structure tag of `exp:structure:entries` but I need access to the {current\_page} variable available within the Structure Entries plugin as well as a couple of other features. Any help would be really appreciated at this point.

ExpressionEngine: 2.6.1 / Assets: 2.1.3 / Structure 3.3.10 / Structure Entries 1.3.4

Thanks!

EDIT: It's worth noting that when I add the parse inward tag I do get this error:

```
  Severity: Notice

  Message: Undefined property: Assets_ft::$row

  Filename: assets/ft.assets.php

  Line Number: 1094

```

# Answer
> 1 votes
the issue is that Structure Entries doesn't parse the newer variable references (e.g. {staff\_photo:url}) and it only parses EE file paths:

```
$this->EE->typography->parse_file_paths($output);

```

Alas the add-on is very old and tries to manually parse each row and each fieldtype it supports (only aimed at supporting Playa and Matrix originally).

Apologies for this suggestion as this is a fudge fix, but try

```
{exp:structure_entries depth="1" parent="9"}
  {exp:assets:files filename="{staff_photo}"}{url_huge}{/exp:assets:files}
{/exp:structure_entries}

```

Ref: http://docs.pixelandtonic.com/assets/templating/module/files.html

Failing that: https://github.com/rsanchez/parse\_file\_paths

# Answer
> 1 votes
I have added an updated version of parse\_file\_paths by rsanchez as a fork which now will work in EE 3.x and up.

All I did was to add the addon.setup.php file to the zip file with the appropriate fields filled in. The original code still works like a champ!

This works very well with the Query module. It takes the raw results containing {filedir\_X} and expands that into the actual file path, using a routine already in the typography.php library in EE but for some reason that is not used by the query module by default. This little addon makes up for that.

# Answer
> 0 votes
In case anyone else is still stuck on this, I was able to solve this using Peter's solution, with a slight variation on the assets:files syntax:

```
{exp:structure_entries depth="1" parent="9"}
  {exp:assets:files folder="*" keywords="{staff_photo}" recursive="yes"}
    {url}
  {/exp:assets:files}
{/exp:structure_entries}

```

---
Tags: assets, structure, parse-order, related-entries
---


# Question
Title: File directory doesn't parse correctly in Seg2Cat
I'm seeing an issue in Low Seg2Cat where the {last\_segment\_category\_image} variable seems to not be parsing the file directory & is returning the following: {filedir\_10}gaf-logo.png. I am using {last\_segment\_category\_description} just after it & it is displaying correctly. Am I using the Category image tag incorrectly. or might there be something else going on here? I'm on EE4.1.2

Thanks. Russ

# Answer
> 3 votes
File paths are only parsed in the Category Image field, not in the Category Description field, and only if the Parse File Paths setting is set to Yes.

# Answer
> 0 votes
You can possibly use this little utility-addon to parse the {filedir\_x} into the full path.

I have added an updated version of parse\_file\_paths by rsanchez as a fork which now will work in EE 3.x and up.

All I did was to add the addon.setup.php file to the zip file with the appropriate fields filled in. The original code still works like a champ!

This works very well with the Query module. It takes the raw results containing {filedir\_X} and expands that into the actual file path, using a routine already in the typography.php library in EE but for some reason that is not used by the query module by default. This little addon makes up for that.

---
Tags: categories, low-seg2cat, ee4
---


title: Mollie payment gateway for Cartthrob

text:
# Question
Title: Mollie payment gateway for Cartthrob
I am currently setting up a site with cartthrob, and we need the mollie gateway for payments. Is this available?

# Answer
> 0 votes
It doesn't exist out of the box, but it's definitely doable via a custom gateway integration. There are more details about that here: https://www.cartthrob.com/docs/developers/payment\_gateways/index.html

---
Tags: cartthrob, payment-gateway
---


title: Reading Time Language

text:
# Question
Title: Reading Time Language
I installed the Reading Time module from: https://github.com/EllisLab/Reading-Time

But there is a problem. It outputs the time based on the EE language config text as: **is about 5 minutes**

Or **is 1 one minute**

This a problem on pages with different languages. Is there a way to force a different language on the variable or the template page? EE can use different language files but how do I specify this for visitors that are not logged in? I need to force to use a different locale on specific templates or the exp variable.

# Answer
That plugin is not built to be multi-language-friendly, so you'd need to modify it to match the currently-loaded locale (based on whichever method you've chosen to set the current language).
> 0 votes

---
Tags: multi-language, addons, localization
---


title: update custom member field value

text:
# Question
Title: update custom member field value
I have what I think is a simple and straight forward goal. I want to update a custom member field.

Here is the scenario.

Users will be offered to browse our web site for free for 15 days.

When they register (the have to register for me to get their email address) they can choose to activate the 15 day trial by submitting a form on the site.

I want to form to set the value of a custom member field to the current date plus 15 days. I also want to set another custom field to the value of "yes" so that I know that this registered user has used the trial...the user can only use the trial once.

Do I need an addin to set the value of custom member fields? What is the best way to accomplish this?

Thanks in advance.

# Answer
> 0 votes
You definitely could do what you are trying to do using custom member fields, but depending on what else you plan to do on your site it might make sense to create a separate channel specifically to capture member information - for example linking the two together by using the member short name to name the matching entry in the member information channel. Using a separate channel is helpful in two ways:

* You get access to the full range of EE fields (member fields are limited to just a few types)
* You can access the member data fields more easily within templates - any / all of the tools that work with Channel Entry type data can be deployed

Another solution is to install a member add-on - such as User \- which provides a similar approach to the 'member information channel' but with a few more bells and whistles attached, though these are quite expensive for what you get.

HTH

---
Tags: custom-fields
---


title: Shared Form Saving Issues

text:
# Question
Title: Shared Form Saving Issues
I am trying to create my own settings form (EE5) using the documentation, but when i am using the function settings\_form() & save\_settings() and calling the "return ee('View')-\>make('my\_extension:index')-\>render($vars);" it will not save. It displays correctly and submits the form but doesn't save. When I run the settings() function it works fine, but I need to create some custom areas. Anyone experiencing similar issues with it not saving.

# Answer
The `save_settings()` method doesn't do anything with your settings data simply by existing - you need to process the submission yourself. From the docs:

> Use it to process the data sent and put it into the `exp_extensions` database table. Remember that the data put into the database is a serialized array, so handle it appropriately.

The easiest way to do this is using the existing Extension model, which abstracts a lot of that work for you:

```
$model = ee('Model')->get('Extension')
    ->filter('class', ucfirst(get_class($this)))
    ->first();

$my_settings = array(
    'foo' => ee('Request')->post('foo'),
    'bar' => ee('Request')->post('bar')
);

$model->settings = $my_settings;
$model->save();

```

(Since the `settings` property of the `Extension` model is set to be serialized data, you only have to assign an array to it - the serialization will happen in the model.)
> 0 votes

---
Tags: error, settings, saving
---


# Question
Title: How to achieve without nested channel:entries tags
I'm hoping someone can suggest an elegant solution to this. I sometimes need to have the result that a channel:entries loop inside a channel:categories loop can provide. A simple example would be:

`

{exp:channel:categories channel="main" style="linear"}

{category_name}

{exp:channel:entries channel="main" category="{category_id}"}

{title}

{/exp:channel:entries}

{/exp:channel:categories}

`

This sort of approach allows for categories to be added/removed on the fly without having to alter the template, but I am aware that such nesting can be bad for performance. What is the better way to do this?

One user has suggested using the category\_archive tag but since that tag can only grab title or url\_title content from entries it would not permit something like this:

`

{exp:channel:categories channel="courses" style="linear"}

{category_name}

 Course Title
 Course ID
 # Days
 Description
 Price

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

 {title}
 {course_code}
 {course_duration}
 {course_blurb}
 {price}

{/exp:channel:entries}
{/exp:channel:categories}

`

Please note that in the above example {course\_code}, {course\_duration}, {course\_blurb} and {price} are all existing entry fields.

# Answer
I'm pretty sure that you want to be using the Category Archives tag:

https://docs.expressionengine.com/latest/channel/category\_archive.html

This should allow you to achieve your desired result with less of a performance hit. I think the tag was made to do exactly what you are looking to do.
> 0 votes

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


# Question
Title: DB connection refused - credentials exposed
So suddenly I get a "Connection refused" to the MySql database on my site which is running ExpressionEngine 3.5.2 in a shared environment. Fine...

...but the stack trace, when expanded, shows the database name, user and PASSWORD!

You can the see the error message here: http://www.huntee.se/db\_error.jpg

Now this error screen looks like Codeigniter or EE. Is this really possible??

How do I make sure this doesn't happen again?

Regards, Matts

# Answer
> 1 votes
This is a comment really, but I do not have enough rep to add comments.

Have you tried using '127.0.0.1' as the db host rather than 'localhost'?

---
Tags: ee3, codeigniter, database-error, mysqli
---


# Question
Title: Files displaying in File Manager even though they don't exist
I must have at some point manually deleted images via FTP in my image file directories.

In the file manager, even after 'syncing' the directory, those files that no longer exist are still displayed. If I try to delete the rows, it shows an error:

```
File /var/sites/domain.com/public_html/images/uploads/galleries/filename.jpg does not exist.

```

How can I remove these?

# Answer
Have you tried 'sync'ing'? I believe this updates the database with the actual content of folders (and creates any manipulations that may exist).
> 1 votes

---
Tags: file-manager
---


title: Expresso Store 4.1 invoice unpaid

text:
# Question
Title: Expresso Store 4.1 invoice unpaid
We use EE4 and Store 4.1. For the time being costumer get the goods with an invoice. We use payment gateway "Manual".

I have two questions:

"Manual" stores an order in the backend as paid (Paid? Yes). But we would need it stored "no" (unpaid). Anything we can do?

How difficult is it to make a payment gateway named "Invoice" (or in German "Rechnung")? Maybe out of the files of "Manual"?

Thanks for some advices.

# Answer
> 0 votes
> "Manual" stores an order in the backend as paid (Paid? Yes). But we would need it stored "no" (unpaid). Anything we can do?

Right now, modifying the "Credit Card Payment Method" setting to "authorize only" should cause these to show as "unpaid". That might not be OK if you're also taking credit card payments. We might update this behavior in a future update to un-link them.

> How difficult is it to make a payment gateway named "Invoice" (or in German "Rechnung")? Maybe out of the files of "Manual"?

Very easy! You can use manual and just update the class name, file name, and description. This is also a good way to start: https://github.com/devdemon/store\_check.

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


# Question
Title: Expresso Store 2.5.1 (EE2) checkout/tax query
Is it possible to show prices inclusive of tax at checkout with this version of Store?

At present, there doesn't seem to be any tags to show inclusive prices in the basket/checkout and if we try to apply these via a plugin (mulitplying via the tax rate) the calculations are out, I guess by the rounding that is taking place after tax is applied.

For example, client wants to show the following:

Items listing unit price inc tax, quantity and total line price inc tax (before discount) Subtotal of basket inclusive of tax Discount as applies to subtotal Total after discount Shipping costs Total after shipping

Anybody know if the above is at all possible?

Cole

# Answer
Have you seen the variable options listed here: https://www.exp-resso.com/docs/checkout\_tag.html#order\_details

That probably has what you need!
> 0 votes

---
Tags: expresso-store, checkout, tax
---


# Question
Title: Expresso Store add text area for customer to add details per product
How can I add a text area to product so a customer can add some content to submit with the order. Ideally only on certain products. Kind of like if you want to have a product engraved the customer could add a message in the add to cart form.

It would be nice to have this product dynamic so it doesn't appear on all products.

# Answer
If the text area is attached to the order as a whole, use Custom Order fields.

If the text area is attached to individual products, use a custom modifier or modifier built into the product.
> 0 votes

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


# Question
Title: Fatal error EE::clean() - Discussion Forum
Fatal error: Call to undefined method EE::clean() in /system/expressionengine/modules/forum/mod.forum\_core.php on line 6427

```
$temp['answer'] = ee('Security/XSS')->clean($val);

```

Any pointers?

Using: Discussion Forum v3.1.22 EE v2.11.9

# Answer
> 1 votes
Checked the documentation and found that the correct code is

```
$temp['answer'] = ee('Security/XSS')->security->xss_clean($val);

```

Ref: https://docs.expressionengine.com/v2/development/guidelines/security.html

---
Tags: ee2, forum, discussion
---


title: Sanitise low search keywords

text:
# Question
Title: Sanitise low search keywords
What's a good method for stripping HTML from our site search? I've found that it's possible to inject HTML directly into our page like this:

```
https://website.co.uk?keywords="<svg/onload%3Dconfirm(//)>

```

The page source then looks like this:

# Answer
I posted the same question here and got a fix. We were using `{get:keywords}` when we should have been using `{low_search_keywords}`. That tag sanitises HTML for you. Hope that helps someone...
> 0 votes

---
Tags: search, low-search, strip-html
---


# Question
Title: How to allow content authors to add icons to links?
Does anybody allow their content authors to add icons to links? If so, how do you do this? I'm considering the best approaches.

I allow them to make links, and to make those links into buttons (the "Styles" menu of WYGWAM has button options when a link is selected, adding the "btn" classes), but I don't yet know of a good way to also allow icon selection. I currently do it by hand with the tag. But if I can make it easy on content authors to do this, all the better.

Will be using EE5/latest Font Awesome.

# Answer
> 1 votes
How far are you capable and willing to go? One method is to create a plugin for CKEditor:

https://stackoverflow.com/questions/1957156/how-to-add-a-custom-button-to-the-toolbar-that-calls-a-javascript-function

I've done something like this a few times to add functionality to Wygwam fields. If you choose this route, you'll need to tell Wygwam to load your custom `style.js` file, and you'll need to install your plugin into the core CKEditor files yourself.

Setting a custom `styles.js` file:
https://eeharbor.com/wygwam/documentation/style\_set

Where to install plugins for CKEditor (which Wygwam uses): `{your_web_root}/themes/user/wygwam/lib/ckeditor/plugins`

Based on the SE link I provided, you may be able to add a simple button by just creating your custom `styles.js` file and applying it (quoting code from an answer in the link provided):

```
editor = CKEDITOR.replace('container'); // bind editor

editor.addCommand("mySimpleCommand", { // create named command
    exec: function(edt) {
        alert(edt.getData());
    }
});

editor.ui.addButton('SuperButton', { // add new button and bind our command
    label: "Click me",
    command: 'mySimpleCommand',
    toolbar: 'insert',
    icon: 'https://avatars1.githubusercontent.com/u/5500999?v=2&s=16'
});

```

So create your `styles.js` file, add code like above, and set your Wygwam field to use that `styles.js` file.

---
Tags: links, fontawesome
---


# Question
Title: Defining variables inside a template in EE 2.10.1
I can't find a way to define a variable in a EE 2.10.1 Template file. I need to define a variable gv\_desc only in some templates.

There are some references but no one works:

```
{global_var:gv_desc="bla bla"}

{assign_variable:gv_desc="12"}

```

To use in template:

```
<meta name='description' content='{if
io_desc}{gv_desc}{if:else}{meta_description}{/if}' />

```

# Answer
> 1 votes
There are two ways you can do this within EE, and others that use add-ons that extend EE's capabilities.

The easiest way is probably to define your variable as a global variable - which you do from the Template Manager page. Instructions on how to do this here. It is straightforward - you go to the Template Variable page in the Control Panel, create a new template variable, give it a value (in the Control Panel interface) and then you can access this value in templates by simply requesting the value using a tag.

The second option is to use a Layout Variable \- this allows you to create a variable that you can assign a value to during template processing. You define your variable using a simple tag based system

```
{layout:set name="someName" value="someValue}

```

or

```
{layout:set name="someName"}someValue{/layout:set}

```

You can then access the value elsewhere by simply calling the value using a tag

```
{layout:someName}

```

The only complication with layout variables is that they only get created when a template layout is passed on to a second layout template - you define the layout variables in one template, and then can access them in any other template that follows that one in the layout chain. Sounds complicated, but once you get the hang of it it is pretty easy going.

To go down the add-on route, you might want to check out CE-Variables which provides powerful and easy to use variable features, but is EE2 only. There are others, including Stash and Low Variables \- but these are typically both more powerful and harder to use in practice (because they do much more than just offer local variables) - though both Stash and Low Variables do work with EE3 and onwards.

HTH

# Answer
> 0 votes
I used CE-Variables as suggested by @jcogs.eecms to handle variables.

Than I modified the plugin because any method like IF, IS\_EMPTY, NOT\_EMPTY returns an encoded variable instead the clean content.

```
public function not_empty_alt()
    {
        $tagdata = $this->EE->TMPL->tagdata;

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

        if ( ! isset ( $this->EE->config->_global_vars[$name] ) )
        {
            return $alt; // $this->EE->TMPL->no_results();
        }

        $temp = $this->EE->config->_global_vars[$name];

        return empty( $temp ) ? $alt : $temp;
    }

```

In the template file:

To output gv\_desc var:

```
{exp:ce_vars:set gv_desc="Lorem Ipsum"}

{exp:ce_vars:not_empty_io_alt name="gv_desc" alt="Nope"}

```

To output the alternative:

```
{exp:ce_vars:set gv_desc=""} <!-- or nothing -->

{exp:ce_vars:not_empty_io_alt name="gv_desc" alt="Nope"}

```

---
Tags: ee2, templates, template-scripting
---


# Question
Title: How to reset password with email being setup
I'm using expression engine 2.0 and email is not set up. I need to reset the password but the application requires an email to be sent out.

Is there a way to reset the password without email? I'd like to just get the reset link/token and not try and encrypt and insert a password by hand. Any sug

# Answer
Request a reset code on the website. This will create a reset code and the next step will be to retrieve the reset code from the database.

Find your memeber\_id searching for username or email in

```
SELECT *
FROM exp_members;

```

Find the reset code in the

```
SELECT member_id, resetcode
FROM exp_reset_password
WHERE member_id = <your_member_id>

```

Navigate to this link using the resetcode found in exp\_reset\_password table.

```
http://localhost/system/index.php?S=0&D=cp&C=login&M=reset_password&resetcode=<reset_code>

```
> 1 votes

---
Tags: forgot-password
---


# Question
Title: How do I delete a page and then redirect the URL to a new URL?
Hoping you could all help a little, had a look around https://docs.expressionengine.com/v2/ but could not find much of an answer.

I've just inherited a website currently on expression engine v2.10.1 and while I don't really know anything about expression engine or the CP I can see the set up is a bit of a mess. There are a bunch of unused old pages that are still live and the site needs a good spring clean, I've found out how to unpublish them but would obviously like to redirect them instead.

I researched around and found a .htaccess file (12 actually but only 1 with content) and tried to add a line into the # Redirects area

Redirect 301 http://company.com/old-page http://company.com/new-page

This does not seem to be working, any lesson or links to a missed duplicate answer would be greatly appreciated!

Steve

# Answer
> 1 votes
If you use the htaccess.. use the one on the root it should work. If you change the Status of the unused pages to Closed.. the pages shouldn't show up.. But if there's links to theses pages you will get a 404 or a redirection.

# Answer
> 1 votes
There are a few ways to do it... one as **Benoit L** mentioned, and I will throw up an example - if you happen to use Apache or LightSpeed webserver, this should work... the other way is through ExpressionEngine pages/templates itself (easiest way). Of course the more you know of the basics in the way ExpressionEngine works, the more sense this will make to you.

A single htaccess file, actually named .htaccess (with the "." prepending the name of the file) will override any webserver config files, this is why it exists. There should be only one named with the "." (period) in front of it.

# USING HTACCESS FILES

A redirect from http://this\_site.tld/old\_content/this\_page to http://this\_site.tld/new\_content/this\_page could look like this:

```
# These will probably already exist in your .htaccess
# file and should only exist one time.
RewriteEngine On
RewriteBase /

# actual redirect example
RewriteRule ^old\_content\/this\_page$ "https\:\/\/this\_site\.tld\/new\_content\/this\_page" [R=301,L]

```

This is for a 301 redirect (permanently moved).

# THE EXPRESSIONENGINE ALTERNATIVE

Alternatively you can handle this with EE as well. By redirecting entries, template groups, or both. It depends how many levels deep the existing page is. I will try to cover as many as I can think of off the top of my head. Starting simple and moving to slightly more complex scenarios.

## Redirect a Single Entry to a Different Channel/ Template Group

### template\_group/entry\_url

Using the same example urls as above, you want to move the entry titled **this\_page** from the template group (channel) **old\_content** to **new\_content**. This method means that the actual template file **old\_content/index** is what is used to render your content.

To redirect a **single** entry from this template group, would be done in one of two ways.

**Actual Files**: Going this route you would need to create an actual file for each redirected entry. In this case you would create the file called **this\_page** from within the **old\_content** template group. In this file you add the code to redirect this particular entry.

FILE: **old\_content/this\_page**

```
{redirect="new_content/this_page" status_code="301"}

```

Simple, right? Here's another way to achieve the same thing...

**ExpressionEngine Conditionals**: Going this route, you would use EE's {if} conditional statements to redirect the url from within the **index** template itself.

FILE: **old\_content/index**

```
{if segment_2 == "this_page"}
    {redirect="new_content/this_page" status_code="301"}
{/if}

```

Cool... also pretty easy, but neither are the most efficient way to do it.

SO, if you wanted to move all entries to the new channel (this makes the most sense on many different levels)...

## Redirect ALL Entries to a Different Channel/Template Group

This is the easiest and most efficient method, but only good in the event you want to redirect **all** entries out of **old\_content** into **new\_content**.

FILE: **old\_content/index**

```
{if segment_2}
    {redirect="new_content/{segment_2}" status_code="301"}
{/if}

```

Awesome... all entries would redirect with 3 lines of code (or 1 line if you write it as such).

Okay... Typically I see entries that go three or more levels deep (each represented by a url segment) - for example consider the url http://this\_site.tld/hot\_topics/article/this\_story \- the url is 3 segments deep and uses a unique template file called **article** that exists in the **hot\_topic** template group. The **this\_story** is the dynamically generated **{url\_title}** and exists as **{segment\_3}**.

In this scenario, the template group is **hot\_topics**, perhaps the **hot\_topics/index** file exists to show a collection of your latest articles under this channel, so you decide to use another template to render your entire article - so you add the **article** template inside the **hot\_topics** channel.

After some website restructuring you wish to redirect all of those entries to another channel (let's say the name of this channel is simply **topics**). The actual rendering template in this case will be called **entry**.

First you need to have created the **entry** template within the channel titled **topics**.

FILE: **hot\_topics/article**

```
{if segment_3}
    {redirect="topics/entry/{segment_3}" status_code="301"}
{/if}

```

I could literally go on and on with specific examples. But I think you will need a nap after reading and trying to absorb this much at once, especially if you are new to EE. If you need more specific info, I'll be happy to help where I can.

Good luck.

# Answer
> 0 votes
You can do redirection in your .htaccess file or in the httpd.conf file within where your website is defined. In your syntax it looked like:

```
Redirect http://www.website1.com/page1 http://www.website2.com/page2

```

I typically do a root-relative link as my first website, so this is worth trying if that's not working:

```
Redirect /page1 http://www.website2.com/page2

```

Once you get that working, you can get fancier with RedirectMatch (https://httpd.apache.org/docs/2.4/mod/mod\_alias.html#redirectmatch) to save time if you have multiple but similar pages.

---
Tags: redirection
---


# Question
Title: Sort by views but limit to last 30 days?
I am counting views per entry, and I have a 'Most Popular' section on the homepage that shows the most popular entries using

orderby="view\_count\_one"

I am finding this list tends to be the oldest entries, since they have been around so long they have the most views.

Is there away to either:

* divide the views by number of days active and sort on that or
* only show the last 30 days?

Any ideas?

Thx!

Added: I tried display\_by="day" limit="30" but that lists all entries in 30 days and kills my entry limit breaking the page layout. I am currenty showing 7 entries, and 30 is too much.

For example, I would need somethind like display\_by="day" day\_limit="30" limit="7" (I know that wont work ;) just example)

I also tried to set the start by date range by using:

localize-\>format\_date('%Y-%m-%d %H:%i', ee()-\>localize-\>now - 3600); ?\>

from PHP conditional inside EE conditional - parse order problem

but that brakes my page and throws an error about line 45 referring to ()

# Answer
Try this:

```
display_by="day" limit="30"

```

EE-docs for display-by-parameter

EDIT: It seems that the limit-parameter in the example above does NOT limit to 30 absolute days (and so will show entries from the last 30 days), but it will count days on which entries have been posted. So if you use limit="30" it will show all entries from the last 30 days on which entries have been posted.
> 1 votes

# Answer
For a link list, you can query the database directly for title and url\_title
(add some extra criteria to control returned data)

```
{exp:query sql="
  SELECT title, url_title, view_count_one
  FROM exp_channel_titles
  WHERE status != 'closed'
    AND entry_date > {current_time} - 2592000 /* 30 * 24 * 60 * 60 = 30 days */
    /* AND channel_id = xxx */
    /* AND view_count_one > 0 */
  ORDER BY view_count_one DESC
  LIMIT 7
"}
  <a href="/news/entry/{urltitle}">{title}</a> ({view_count_one})<br>
{/exp:query}

```

If you want full-fledged channel entries output (e.g. custom fields etc.),
you can select just the entry\_id's and pass the result to an embed.
The zero is just a quick way to close the series. e.g. `12, 34, 0`
otherwise you'ld have to use `{entry_id},` with `backspace=1`.

```
{embed="group/entriestemplate" which="{exp:query ...}{entry_id},{/exp:query} 0"}

<!-- embed -->
{exp:channel:entries entry_id="{embed:which}" ...}
...
{/exp:channel:entries}

```
> 0 votes

# Answer
Could you not just use the start\_on parameter and set the start date to 30 days prior to the current date?

https://ellislab.com/expressionengine/user-guide/add-ons/channel/channel\_entries.html#start-on
> 0 votes

# Answer
There are 4 options you have for tracking the views, view\_count\_one, view\_count\_two, view\_count\_three, view\_count\_four. Basically we use view\_count\_one for our purpose, so here we can use view\_count\_two or three or four for tracking the hits and then create a simple plugin which will refresh the count value to '0'. And use that plugin on any template and set template URL to the cron after every 30 days.

So that after every 30 days the track\_view\_two, three or four will be flush to 0 and you can simply use to show the entries orderby="view\_count\_two or \_three or \_four".

plugin code should be look like this: - public function view\_count\_four() { $qry = $this-\>EE-\>db-\>update('channel\_titles', array( 'view\_count\_two' =\> '0' ), array( 'channel\_id' =\> '21' ) ); } and when you show the data on any template, {exp:channel:entries channel="brands" track\_views="two" limit="10" orderby="view\_count\_two" dynamic="off" }
> 0 votes

---
Tags: orderby
---


title: Best text editor for EE5?

text:
# Question
Title: Best text editor for EE5?
I'm looking to build a site in EE5 and was wondering if I could get some text editor recommendations?

I've used WYGWAM with EE2 and enjoyed it.

The rich text editor with EE5 actually seems good, except I can't find a way to upload a file and make a link to it. Would I make my users first upload a file from File Manager, then link to it?

# Answer
> 4 votes
The RTE with EE5 is OK, but as you observe has some limitations regarding handling of images.

The alternatives are all add-ons that provide a wrapper to some other Rich Text Editor source.

My personal favourite is Wyvern, but all are good options.

HTH

---
Tags: richtext, ckeditor
---


# Question
Title: How to download Expression Engine version 3 and 4?
Please guide me how to download Expression Engine version 3 and 4.

# Answer
> 4 votes
There are at least two ways to get copies of EE 3 and 4.

`1)` Log in to https://expressionengine.com. If you have any EE purchases from this site before, you can go to your Purchases page and download the latest 2, 3, and 4 versions of EE.

`2)` Clone the git repository at https://github.com/ExpressionEngine/ExpressionEngine/. There is a `master-v3` and `master-v4` branch you can fetch and switch to.

---
Tags: ee2, ee3, php, ee
---


# Question
Title: problems updating store 4.0 to 4.1 in EE 5
the upgrades/updates always seem broken. The ’update” button in the CP never seems to process and recognize that the update is done. I’ve beein running v 3.1 on two sites since earlier this year.. As far as I can tell, they are fully updated to v 3.1, yet the CP still shows the “update to 3.1” button. And, now, the same thing on another install going from v 4.0 to v4.1.

Looking through the update notes, doesn’t appear to be any DB updates.

So, I’m also assuming the v4 \> v4.1 update is complete (all files are copied and the store seems to operate correctly). Just seems that the “update the version in the DB so we know what version we’re running” process is not working. Can I (should I) just increment the version numbers in the DB tables associated with Store?

# Answer
> 1 votes
This is just a display issue. As long as you have the latest files in place, you have the latest version and don't need to worry about the older version showing up there. We'll look to fix that in a future update.

---
Tags: expresso-store
---


title: Overview of add ons for EE5

text:
# Question
Title: Overview of add ons for EE5
I there an overview somewhere of available add ons for ExpressionEngine 5? Devot:ee doesn't seem to go further than EE4. But I see lost of them on the individual sites of developers.

# Answer
As a general rule of thumb: if it’s compatible with EE4, it’s compatible with EE5, too.

The jump from 4.3 to 5.0 was necessary to facilitate the change in license model, not because of breaking changes in EE’s APIs.
> 7 votes

---
Tags: addons
---


title: How do you increase page content?

text:
# Question
Title: How do you increase page content?
I am updating my Terms and Conditions page in the footer of my website and it won't let me add any more words in the back end. As if I have reached my page, word limit. How do I increase this?

# Answer
> 1 votes
Well, you should increase the **Maximum characters** limit from **Field Options** of your **textbox** field. By default it set to **256**. You can increase it according to your requirement.

# Answer
> 1 votes
Sounds like all you need to do is add a new field. EE supports a broad range of fields you can add to a channel - if currently you are adding text to a 'text' field it as has been noted limited normally to 256 characters. But there are other field options that support considerably more text - such as "Text Area" or "Rich Text Field".

All you would need to do to take advantage of this is modify the definition of the channel that holds your Terms and Conditions entry to include an additional field - easiest would be to add a 'Text Area' field. Then update your template for Terms and Conditions to output this field in place of the text field you are using currently (if that is indeed what you are doing) - just find the `{tag}` that outputs the text field currently being used and replace the content between the curly brackets with the short name of the new field. Finally, open the Terms and Conditions entry in your EE Control Panel and copy over the current text from the Text Field to the Text Area field, and add whatever extra text you need.

HTH

---
Tags: pages
---


title: Clone/duplicate EE4/EE5 entries

text:
# Question
Title: Clone/duplicate EE4/EE5 entries
I am looking for a way to clone channel entries with EE4/5.

There are posts mentioning MX Cloner and some others but they're very old and for EE2 only I think.

How could I go about it? Would it matter if the entries contain liquid fields?

**Is there a way to clone EE4/5 entries?**

# Answer
Short answer is no.

Long answer is also no. Whether anyone will come up with an add-on to do this I'm not sure, but without such your options are really limited: especially when you factor in things like fluid, grid or relationship fields the duplication process becomes really complicated. For some very simple cases you can duplicate fields by direct manipulation of the MySQL database entries, but in most real-world situations it is simply not practical. EE's way of storing data within its database has changed significantly since EE2 days, and I imagine there is no easy way to update MX Cloner - so your best bet probably is to open two browser windows side by side and cut / paste content and copy field definitions across that way.
> 1 votes

---
Tags: ee4
---


# Question
Title: Consent Variables - Can set but cannot read...
I am trying to get GDPR type consent to work on an EE5.1 site.

The methods are pretty much the same as the examples in the EE5 documentation.

Consent cookie is being set OK (I can see it appear in Chrome Inspector when a `consent_grant_url` button is pressed), but try as I might, I cannot get `{consent:ee:cookies_performance}` to pick up that a cookies has been set.

The setting code is

```
{exp:consent:form
    consent='ee:cookies_performance'
    form_id='cookieConsentForm'
    return='{current_uri}'
}
    <button type="submit" name="submit" class="btn btn-success" href="{consent_grant_url}">Accept</button>
    <button type="submit" name="submit" class="btn btn-outline-info" href="{consent_withdraw_url}">Decline</button>
{/exp:consent:form}

```

the reading code is

```
{if consent:ee:cookies_performance}
    Google Tracking Code snippet
{/if}

```

but this refuses to fire.

Quoting out the `{consent:ee:cookies_performance}` tag reveals it to be empty (which explains why conditional won't fire) - but I cannot work out why. I'm sure I'm missing something obvious... any ideas / suggestions would be hugely helpful.. Thanks! (EE5.1.0)

# Answer
> 0 votes
Solution turns out to be in the setting: some confusion in documentation about how to construct the setting code. But what worked was swapping to use the `exp:consent:requests` tag, and turning the form buttons into regular anchors. Why it worked ( and / or worked sort-of before) is a mystery - but posting here in case useful to others:

```
{if ! consent:has_responded:ee:cookies_performance}
<div class="container-fluid cookie-consent" id="cookieConsent">
    <div class="row">
        <div class="col-sm-10">
        {exp:consent:requests
            consent='ee:cookies_performance'
            }
            <h4>{consent_title}</h4>
            <p>{consent_request}</p>
        </div>
        <div class="col-sm-2 align-self-center text-center">
            <a class="btn btn-block btn-success" href="{consent_grant_url}">Accept</a>
            <a class="btn btn-block btn-outline-info" href="{consent_withdraw_url}">Decline</a>
        </div>
        {/exp:consent:requests}
    </div>
</div>
{/if}

```

---
Tags: cookies, ee5
---


# Question
Title: What are the difference between the Bloqs addon and the EE Fluid fields?
I have a question about the difference between the native EE Fluid fields and the Bloqs addon.

Both manage a collection of fields, but what are the advantages of Bloqs versus the native EE Fluid fields?

# Answer
I never used either of these but I think they do the same things. I guess the advantages of fluid field is "no-brainer" when it's time to update! Less add-on you have easier the updates are...
> 4 votes

---
Tags: fluid-field
---


# Question
Title: Search for multiple custom fields - EE 5.0.x
Hello everyone (Merry Christmas), I’m just using EE to create a small website. I can not understand how I can make filters for custom channel fields.

I have a channel “Properties” with fields {id\_immobile} type Number, {common} type String, {contract} type String and {type} type String. All have the Include check mark in the search.

I created a Form inspired by that in the documentation but I do not think is correct.

```
{exp:search:advanced_form channel="immobili" result_page="immobili/search"}
 <!--<input type="hidden" name="search_in" value="entries"/>-->
    <input type="hidden" name="where" value="word"/>
 <div class="form-group">
     <select class="form-control" name="keywords">
   <option selected disabled>Seleziona Contratto</option>
            <option value="Vendita">Vendita</option>
      <option value="Affitto">Affitto</option>
     </select>
   </div>
 <div class="form-group">
     <select class="form-control" name="">
   <option selected disabled>Seleziona un Comune</option>
            {exp:channel:entries channel="comuni"}
      <option value="{title}">{title}</option>
   {/exp:channel:entries}
     </select>
   </div>
        <div class='searchSubmit'>
                <input type='submit' value='Search' class='submit' />
        </div>

{/exp:search:advanced_form}

```

I would like the research to work based on choices. Example: only for a field if selected, or for more fields.

Thanks in advance

# Answer
The standard search features of EE do not support much refinement of the search itself beyond specifying which channel to search within.

If what you want to do is adjust what gets displayed once the search is complete, the only way to do this is to focus on the processing of the search results rather than the search request. So run the search using whatever terms / scope you can, and then when it comes to displaying the output only output entries that match your filtering criteria.

The output of search is handled using the search:search\_results tag. You need to pass the select options chosen to the search results page, and filter on these there.

HTH
> 1 votes

# Answer
The options are generated perfectly and work. My problem is to filter for the various Select. The select are Custom Fields of my own channel called Real Estate.

I want to create a search filter for the first Select OR second Select OR third Select.

**Example:** I select only Contract-\> Sale of the first Select, it must find all the Properties that have the custom field named {Contract}. Selecting Sale of the first select and an option of the second Select (Exp. Municipality-\> Italy), must find all the Properties that have the custom field named {Contract} and custom field named {Municipality}

I hope I have made my problem better understand this way.

Thanks for your help
> 0 votes

---
Tags: search, supersearch, ee5
---


title: Select with Field

text:
# Question
Title: Select with Field
I have a Select Dropdown field named Type belonging to a Channel. Inside I created a Value / Label menu.

**I would like to print the values in a Select in front-end.**

**Below I put my code that does NOT work.**

**From the documentation it seems to me that my code is correct.** **I forgot something?**

```
<div class="form-group">
    <label>Tipologia</label>
    <select class="form-control" name="tipologia">
        <option>Tutti i comuni</option>
        {field_name}
        <option value="{field_name}">{field_name}</option>
        {/field_name}
    </select>
</div>

```

Thanks for support.

# Answer
> 3 votes
You are using this inside a channel entry loop, correct? If not, you need to be.

And you might also try using the other field segements:

```
{exp:channel:entries
    channel="my_channel_with_select_field"
    limit="1"
    dynamic="no"
    entry_id="the_entry_id_of_the_entry_i_want_to_output"}

    {select_field_name}
    Field value : {select_field_name:value} <br/>
    Field label : {select_field_name:label}
    {/select_field_name}

{/exp:channel:entries}

```

Just to make sure you aren't confused, this will output the selected value for a specific entry in that channel. If you are looking to output multiple values selected for an entry, you need to use a Multiselect Dropdown, not a regular select. And lastly, if you are looking to output this in a form, and you want to output all options the field has regardless of any entry in the channel, you need to use the channel form tag to do so:

https://docs.expressionengine.com/latest/channel/channel\_form/index.html#other-channel-fields

---
Tags: custom-fields, channel-fields, ee5
---


title: How to get data from a hook?

text:
# Question
Title: How to get data from a hook?
How do I get the last "ID" (row) created after using the "channel\_form\_submit\_entry\_end" hook? Can the hook send me the "ID"? EE5

# Answer
> 1 votes
At the end of hook "channel\_form\_submit\_entry\_end" it is using the Channel Form Class so $obj-\>entry\['entry\_id'\] a class property which is not available.

Good news is you can use the method $obj-\>entry('entry\_id') to retrieve the entry which is one of available methods from Channel\_form\_lib

# Answer
> 0 votes
If you do a dump of the argument which that hooks accepts, you'll see it should contains the `entry_id`. I can't recall exactly what the structure looks like (it might just be `$obj->entry_id` or `$obj['entry_id']`), but do this to find out:

```
function channel_form_submit_entry_end($obj)
{
    exit(var_dump($obj));
}

```

---
Tags: extension, hook
---


# Question
Title: How do you get the parsed html of a page on the back end? (Within an Extension Using PHP)
How do you get the parsed HTML of a page on the back end? (Within an Extension Using PHP) EE5

# Answer
> 1 votes
Just in case someone else is looking for the answer: If after your extension is called you can rebuild the template using the following code

```
function your_function($obj){
$template_group = "template_group_name"; \\(string)
$template = "template_name"; \\(string)
ee()->uri->page_query_string = $obj->entry('entry_id');\\assign your own entry_id (int)
ee()->load->library('template', NULL, 'TMPL');
ee()->TMPL->fetch_and_parse($template_group, $template, FALSE);
$rendered = ee()->TMPL->parse_globals(ee()->TMPL->final_template);
echo $rendered;
}
```

Of course you can display it or set values how ever you want.

# Answer
> 1 votes
I believe you use this extension hook:

https://docs.expressionengine.com/latest/development/extension\_hooks/global/template/index.html#template-post-parse

**Edit**

Here is an example of how this could work. Set up your extension and register it to run this method on the hook:

```
public function my_template_post_parse_function($template, $is_partial, $site_id)
{
    return str_replace("<my-tag>", "My-tag's output!", $template);
}

```

Read over the documentation on extension development for more information on how to use extensions and hooks:

https://docs.expressionengine.com/latest/development/extensions.html

---
Tags: plugin, extension
---


# Question
Title: How to get submitted form to rendered format to email?
Let's say I have a form from channel "contact\_us" and it is submitted through template "index/contactus". How can I use the "channel\_form\_submit\_entry\_end" hook to collect the data and template put it together and have it ready to be sent for an email? Running EE5.

# Answer
> 0 votes
Just in case someone else is looking for the answer: If after your extension is called you can rebuild the template using the following code

```
function your_function($obj){
$template_group = "template_group_name"; \\(string)
$template = "template_name"; \\(string)
ee()->uri->page_query_string = $obj->entry('entry_id');\\assign your own entry_id (int)
ee()->load->library('template', NULL, 'TMPL');
ee()->TMPL->fetch_and_parse($template_group, $template, FALSE);
$rendered = ee()->TMPL->parse_globals(ee()->TMPL->final_template);
echo $rendered;
}
```

Of course you can display it or set values how ever you want.

---
Tags: safecracker, email, entry
---


# Question
Title: Multi Environment config/config.php - Staging not working
I've just updated a site from EE2.9.3 to 5.1.1 and am attempting to deploy to a staging location so my client can preview it.

I've added a switch statement to users/config/config.php in order to keep things working locally and on staging. Locally all works as expected. However on staging I get an error about database connections:

```
SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)
ee/legacy/database/drivers/mysqli/mysqli_connection.php:81

```

Here is my switch statement with real paths and user/password replaced

```
    switch (strtolower($_SERVER['HTTP_HOST'])) {

        // Live
        case 'livedomain.com' :

  // Live stuff here

        break;

        // staging
        case 'staging.com' :

  // Staging stuff here
     // local stuff here
  $config['cp_url'] = 'http://staging.com/admin.php';
  $config['database'] = array (
   'expressionengine' =>
   array (
    'hostname' => 'localhost',
    'password' => 'password123',
    //'user' => 'user123',
    'database' => 'dennis',
   ),
  );
  $config['site_url'] = 'http://staging.com/';
  $config['base_url'] = 'http://staging.com/';
  $config['base_path'] = 'path/to/public';
  $config['theme_folder_path'] = 'path/to/public/themes/';
  $config['theme_folder_url'] = 'http://staging.com/themes/';
  $config['new_version_check'] = 'n';

        break;

        // main local site
        case 'dennis.test' :

   // local stuff here
  $config['cp_url'] = 'http://dennis.test/admin.php';
  $config['database'] = array (
   'expressionengine' =>
   array (
    'hostname' => 'localhost',
    'password' => 'root',
    'database' => 'dennis',
   ),
  );
  $config['site_url'] = 'http://dennis.test/';
  $config['base_url'] = 'http://dennis.test/';
  $config['base_path'] = 'D:\sites\dennis-drenner';
  $config['theme_folder_path'] = 'D:\sites\dennis-drenner/themes/';
  $config['theme_folder_url'] = 'http://dennis.test/themes/';
  $config['new_version_check'] = 'y';

        break;

    }

```

I tried adding this `'user' => 'user123',` on staging but that didn't help. I"m not sure where to set the database user - it's not in local but connects correctly and I need to override that so it works on staging.

Please advise.

# Answer
The correct array key for the database user is `username` not `user`

```
$config['database'] = array (
   'expressionengine' =>
       array (
           'hostname' => 'localhost',
           'username' => 'username',
           'password' => 'root',
           'database' => 'dennis',
       )
);

```
> 3 votes

---
Tags: config, deployment
---


title: Channel form css overrides my css?

text:
# Question
Title: Channel form css overrides my css?
Channel form css overrides my css. Ruining the consistent layout across the site.

Is it supposed to be like that? How can I have my style on the submit button for example?

Thanks, L.

# Answer
> 2 votes
Simply apply greater significant specificity in your CSS rules that you want to lay on your form. This is a simple part of CSS. Here is an example:

```
// The forms theme
.form .button {
    color: red;
}

// Your button theme, adding greater specificity if needed
.button,
.my-page-body .form .button {
    color: blue;
}

```

This is really more of a CSS answer than EE answer.

You can set a class on your Channel Form using a param: https://docs.expressionengine.com/latest/channel/channel\_form/index.html#class
And just apply your styles to that class:

```
{exp:channel:form
    class="my-form-class"
    ...}

    <button class="button" />

{/exp:channel:form}

...

// Form styles
.my-form-class .button {
    color: blue;
}

```

Another option is to disable including EE form assets using a param on the Channel Form: https://docs.expressionengine.com/latest/channel/channel\_form/index.html#include-assets
This can be dicey if you are using complex fields in the Channel Form instead of simple text/text-area fields.

Any of these options could work for you; you'll need to be a lot more specific in your use case to recommend one option over another, and I doubt I covered all of them in this answer.

---
Tags: channel
---


title: Template class error in CP

text:
# Question
Title: Template class error in CP
Recently I upgraded an EE2 website to EE5. After upgrade, everything working very well except I am getting error while trying to edit/create a template from CP or from Template Manager -\> Template Settings. For error message, please see screenshot -

# Answer
So that is an `E_NOTICE` level warning, not a fatal error. You are seeing this because you either have debugging forced in your `index.php` for you Control Panel, have it hard-coded in your `config.php` file, or have it turned on in Output and Debugging in Control Panel.

If you still get a rendered page at `Template Manager -> Template Settings` past the notice and it isn't working, it is **because** you have debugging forced on. This is possibly causing the related rendered JavaScript assets to also have that notice, causing a broken JS asset to be loaded. Just one possibility.

I have noticed these issues in EE4 and EE5 when using the template manager, but they appear harmless, as `E_NOTICE` level warnings often are; most full application and their relevant technology stacks can output warnings and notices and log them as well, and be fully functional. Also remember that EE can run on a pretty wide range of PHP and MySQL versions, and that can be very relevant as to what warnings and notices you may get.

If you are truly concerned, contact EllisLab about this, but there is a good change they will tell you to turn off debugging and ignore this notice. You also shouldn't be running a production application with debugging on, ever.
> 0 votes

---
Tags: templates, ee2-upgrades
---


# Question
Title: Upgrade EE2 to EE3 : Internal Server Error
I have an EE 2.11.9 with only CE Image, Freeform, Stash, Deeploy Helper als Add-Ons that I want to Upgrade to EE 3.5.17.

I went forth and back several times, I even moved the site to a developer server as a copy where the same happens:

The site itself runs, but after typing the login information for the CP I get a Internal server error 500 on this template: /cp/login/authenticate.

The hosting provider has no clue nor have I one. I have checked a dozen of times and have had an EE fellow controlling if I was doing something wrong.

Can someone guide me into a direction where I might find a solution to this? I have spent now almost 2 days with this trouble.

Thank you.

Edit:

After setting debug to 1 in admin.php I get this error messages:

```
Notice
Trying to get property of non-object

ee/legacy/libraries/Session.php, line 369 hide details

    Severity: E_NOTICE

Notice
Trying to get property of non-object

ee/legacy/libraries/Session.php, line 369 show details

    Severity: E_NOTICE

Notice
Trying to get property of non-object

ee/legacy/libraries/Session.php, line 378 show details

    Severity: E_NOTICE

Notice
Trying to get property of non-object

ee/legacy/libraries/Session.php, line 401 show details

    Severity: E_NOTICE

Fatal error: Call to a member function getId() on null in /home/octave2d/public_html/_wernergusset/expconsole/ee/legacy/libraries/Session.php on line 401

```

Does this lead to some insights?

# Answer
> 1 votes
It sounds like you have an incomplete member record issue. EE2 was not very strict about the member model being complete; however, EE3/4/5 is much more strict and will hit fatal errors if a member record isn't complete (a member doesn't have a row in every database table they should have one in). I also believe the upgrade from EE1 to EE2 doesn't properly update member records, meaning old EE1 registered users will probably have incomplete member records especially if they've never updated their member in any way (preferences, date of birth, etc).

One of the easiest solutions is to just create a new Superadmin member, making sure to use the native member creation functionality and not any add-on's create-member functionality (such as Zoo Visitor or User). That should create a new and complete Superadmin member, and you should be able to log in after you upgrade with that new account.

If you have other users who also get this error when logging in to the Control Panel, this will be a similar issue. To work through this, you may have to look at all the member tables, and manually add rows for the `member_id`'s that don't have them where they should. This will avoid removing a content editor and having to deal with reassigning their Channel Entries to another author.

# Answer
> 0 votes
Did you move your index.php and admin.php from the old install or did you use the new index.php and admin? If you kept the old it might be setting your cp link to the wrong place. Try moving the new index.php and admin.php into the root directory.

---
Tags: upgrade, ee2-upgrades
---