title: Settings for a module

text:
# Question
Title: Settings for a module
I have created a module the generates a form, validates submissions, saves the data in a table that the module creates on install and then integrates with a 3rd party system. This all works great but I would now like to add some settings to the module but there is no settings column for modules. So what would be the best way to add settings for the module that can changed in the control panel?

# Answer
> 1 votes
For modules, you just go ahead and create your own DB table that stores your module settings. So just like you create your modules main table for storing data submitted from your form when you install it, also create a table for your modules settings (something like `exp_my_module_name_settings`).

Follow the documentation for creating Control Panel pages for your module, and just create a form page that submits to itself (and have the method in the back-end update your settings table on POST).

https://docs.expressionengine.com/latest/development/modules.html#the-control-panel-file-mcpmodule\_namephp

Yes, extensions have settings built into the the `exp_extensions` table, but they are meant to be simpler and just inject new logic via hooks. Modules are considered a whole new addition to your CMS, so think of a module more like a complete software package. You handle your module settings in its own table.

---
Tags: add-on, module, extension, settings
---


# Question
Title: Dynamically switch between includes - how?
I have two includes - one which essentially displays a tab with a date, and another which has two tabs with two dates. Basically: Includes/include\_one & Includes/include\_two.

All working fine but these are needed to be dynamic and choosable from the CP by the user who is not able to edit the templates to change this.

How would you go about this?

# Answer
The most direct route for a user that is restricted from editing templates would be a flag somewhere they can access.

You'll need to add more details to your question, but one thought that works is to add a field to a channel that they can turn on or off. For example, if this is related to one single page that has one entry driving it, you could add the field to that channel and just switch on that field like so:

```
{exp:channel:entries
    channel="my_channel"
    entry_id="123"
    limit="1"}

    {if my_switch_field}
        {embed="includes/include_one"}
    {if:else}
        {embed="includes/include_two"}
    {/if}

    {!-- rest of the template here --}

{/exp:channel:entries}

```

If this isn't one entry but more of a global setting, you can also create a `Settings` channel, create a single entry in it, and add fields to that channel that function like site-wide settings. Then you can add the flag field to that channel give the user access to that channel.

If this doesn't help, please add some more details to your question that give us more insight on your problem.
> 2 votes

---
Tags: control-panel, dynamic
---


# Question
Title: MSM Will only load sub-site homepage, everything else 404's?
I Have a MSM site setup, and am also using Structure.

The sub-site domains looks like: mymainsite.com/sub-site

The sub-site homepage loads just fine, but I cannot get to any pages after that - aka mymainsite.com/sub-site/anything gives me a 404.

I set up a template to try and see what's going on, and here's what I've found so far:

* Entries from the Main Site seem to load fine.
* Entries from the Sub Site 404
* The site="" parameter does not seem to work with the structure nav tag.

Here's what I have for testing:

```
<p>Site: {site_name}</p>
<p>Breadcrumbs: {exp:structure:breadcrumb}</p>
<p>This NAV: {exp:structure:nav site="sub_site"}</p>
<p>Main Site NAV: {exp:structure:nav site="main_site"}</p>
<p>Structure Page URL: {structure:page:url}</p>
<p>Structure Page URI: {structure:page:uri}</p>
<p>Structure Child IDs: {structure:child_ids}</p>
<p>Structure Entry ID: {structure:top:entry_id}</p>
<h2>TEST Entries:</h2><br>
{exp:channel:entries site="sub_site"}
<p>{title} - {page_url} - {entry_id}</p>
<p><a href="{page_uri}">{page_uri}</a></p>
{/exp:channel:entries}

```

The output I get from http://mymainsite.com:

> Site: \[Correct Site Name\]
> Breadcrumbs: \[BLANK\]
> This NAV: \[Correct, Nav for Main Site\]
> Main Site NAV: \[Correct\]
> Structure Page URL: \[BLANK\]
> Structure Page URI: \[BLANK\]
> Structure Child IDs: \[BLANK\]
> Structure Entry ID: \[BLANK\]
> TEST Entries: \[BLANK\]

The output I get from http://mymainsite.com/sub-site: *(404 template)*

> Site: \[Correct Site Name\]
> Breadcrumbs: Home \> Here (home link is correct)
> This NAV: \[Correct Nav for Sub Site, **BUT WRONG URLs, do not have /sub-site segment**\]
> Main Site NAV: \[WRONG - shows nav for Sub Site\]
> Structure Page URL: \[Correct\]
> Structure Page URI: / **(should be /sub-site ?)**
> Structure Child IDs: \[BLANK\]
> Structure Entry ID: \[BLANK\]
> TEST Entries: Homepage (incorrect - url is to the main site's homepage)

The output I get from http://mymainsite.com/page:

> Site: \[Correct Site Name\]
> Breadcrumbs: \[BLANK\]
> This NAV: \[Correct, Nav for Main Site\]
> Main Site NAV: \[Correct\]
> Structure Page URL: \[correct\]
> Structure Page URI: \[correct\]
> Structure Child IDs: \[BLANK\]
> Structure Entry ID: \[correct\]
> TEST Entries: \[BLANK\]

The output I get from http://mymainsite.com/sub-site/page: *(404 template)*

> Site: \[WRONG - Main Site Name\]
> Breadcrumbs: \[BLANK\]
> This NAV: \[WRONG - Shows for Main Site\]
> Main Site NAV: \[Correct\]
> Structure Page URL: \[BLANK\]
> Structure Page URI: \[BLANK\]
> Structure Child IDs: \[BLANK\]
> Structure Entry ID: \[BLANK\]
> TEST Entries: \[Correct\] - Lists all structure pages that exist under the Sub Site, correct {page\_url} & {page\_uri}, **BUT the links all 404**.

So the main issues I'm seeing is that the structure nav tag is not outputting the correct paths for the sub-site URLs as well. They're missing the /sub-site segment.

Any ideas what could possibly be going wrong here, or what I'm missing? I only have an htaccess file set up under the root, which contains:

```
<IfModule mod_rewrite.c>

    Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /

    # Removes index.php from ExpressionEngine URLs
    RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
    RewriteCond %{REQUEST_URI} !/system/.* [NC]
    RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]

    # Directs all EE web requests through the site index file
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php?/$1 [L,QSA]

</IfModule>

```

My directories are as follows:

Root -
\- Main Site (is in root)
\- images
\- skin
\- sub-site
\- sub-site
\- sub-site
System

Thanks for any insight!

# Answer
You are not directing sub-site requests to your `mymainsite.com/sub-site/index.php` file, so a URI like this: `mymainsite.com/sub-site/page` is being rendered by your main `mymainsite.com/index.php` file, so it's being loaded by your main site.

In your main `.htaccess` file, you have to direct sub-site requests to the right bootstrap `index.php`.

So, your main `.htaccess` could look something like this:

```
RewriteCond %{REQUEST_URI} ^/sub-site [NC]
RewriteCond %{REQUEST_FILENAME} !sub-site/
RewriteRule ^(.*)$ sub-site/index.php [L]

# Removes index.php from ExpressionEngine URLs
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteCond %{REQUEST_URI} !/system/.* [NC]
RewriteRule (.*?)index\.php/*(.*) /$1 [R=301,NE,L]

# Directs all EE web requests through the site index file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L,QSA]

```

and you could add an `.htaccess` file to your sub-site folder that removes the `index.php`:

```
# Removes index.php from ExpressionEngine URLs
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteCond %{REQUEST_URI} !/system/.* [NC]
RewriteRule sub-site/index\.php/*(.*) sub-site/$1 [R=301,NE,L]

```

This is example is very untested, and I'm kinda asleep right now so my `.htaccess` foo is weak, but you get the point. If you monkey with it a bit (or Google around for the right rules) you should get it up and running.

Also, for your `mymainsite.com/sub-site` results, this part:

```
This NAV: [Correct Nav for Sub Site, BUT WRONG URLs, do not have /sub-site segment]

```

You must not have your settings correct in your sub-site `index.php` file. Review the MSM settings you must set in your sub-site `index.php` files and that should fix it:

https://docs.expressionengine.com/latest/msm/overview.html

So something like this should live near the top of `sub-site/index.php`

```
$assign_to_config['site_name'] = 'sub_site_shortname';
$assign_to_config['cp_url']    = 'http://mymainsite.com/system';
$assign_to_config['site_url']  = 'http://mymainsite.com/sub-site';

$system_path = '../system/';

```

I'm pretty out of it right now but this should get you pointed in the right direction. I haven't worked an MSM installation that used sub-folders instead of separate domains or sub-domains in a long time so I don't have any `.htaccess` files I can reference at hand, but your `.htaccess` file setup is a prime culprit of the misbehavior.
> 1 votes

---
Tags: multi-site-manager, structure
---


title: Moving "templates" folder in EE5

text:
# Question
Title: Moving "templates" folder in EE5
Do you have any alternatives for "tmpl\_file\_basepath" used in EE2 (it looks like this function has been deleted from EE3 version)? I wish to move "templates" folder above root but cannot find any solution yet.

Thanks.

# Answer
> 3 votes
There are clear instructions on how to move not just the templates but the whole of the system folder above the HTML root in the EE documentation.

HTH

---
Tags: templates, ee, ee5
---


title: Calendar Tag Full Day of the Month

text:
# Question
Title: Calendar Tag Full Day of the Month
EE 5.2.2

Quite a simple question: In the EE calendar tag, instead of showing `{day_number}`, I'd like something like `{day_of_week}`. So rather than showing '5' I want my calendar to show 'Thursday, 5' -- so the day of the week and the number as well.

Am I missing something from the docs? I've tried doing `{date format="{format}"}` with no luck. This seems like it would be a common feature.

**EDIT** I ended up solving this issue using php but it's probably still useful to have the answer if someone knows how to do with with the calendar tag functionality.

# Answer
> 0 votes
The information you need is in the documentation - here.

The tag parameter is pretty simple to use - I think you would end up with something like this:

`{date_variable format="%l, %j %F %Y"}`

which would give an output something like **Thursday, 5 January 2019**

HTH

---
Tags: date, calendar, date-format, calendar-events
---


# Question
Title: Channel Videos - Display if video exists
Confused as to why this does not work (EE5).

I have a Channel Videos field named {p\_vids}.
In my template, within the channel:entries I have the below, but it doesn't display the video/code. (Displays fine without the 'if' conditional)

```
{if p_vids}

<section class="section">
    <div class="container">
      <div class="row">
        <div class="col-12">
          <h3 class="text-center">Videos</h3>
        </div>
        <div class="col-12">
          <div class="row">
            {exp:channel_videos:videos entry_id="{entry_id}"}
            <div class="col-md-10 col-lg-4">
              <div class="vid">{video:embed_code}
                <h6 class="title">{video:title}</h6>
              </div>
            </div>
            {/exp:channel_videos:videos}
          </div>
        </div>
      </div>
    </div>
  </section>

{/if}

```

I cannot use/have the {if video:no\_videos} within the channel\_videos tag since there is the entire layout outside of that - which I Do Not want displaying unless a video(s) is/are added.

What am I missing? Any help is appreciated.

# Answer
Solution (provided by eeharbor) was to use the below 'if' statement.

```
{if '{exp:channel_videos:videos entry_id="{entry_id}" limit="1"}{video:total}{/exp:channel_videos:videos}' != ''}

code

{/if}

```
> 0 votes

# Answer
You should use `{if video:no_videos}` inside the Channel Videos tag for no results. So, you should try your code in below manner.

```
{exp:channel:entries channel="your_channel_name"}
<div>
    {exp:channel_videos:videos entry_id="{entry_id}"}

    {if video:no_videos}
    <p>Sorry, no videos found!!!</p>
    {/if}

    <div>{video:embed_code}
        <h6>{video:title}</h6>
    </div>

    {/exp:channel_videos:videos}
</div>
{/exp:channel:entries}

```

HTH
> 0 votes

---
Tags: conditionals, ee5, channel-videos, eeharbor
---


title: Freeform replacement in EE5

text:
# Question
Title: Freeform replacement in EE5
Looking for a Freeform replacement for EE5 - as I understand it Freeform (my usual go-to) is now a commercial add-on so looking for a replacement/equivalent solution. Does not need tons of complex functionality - just basic fields and an anti-Spam Captcha capability.

What is the - free - add-on of choice here?

# Answer
I am not aware of a free alternative for the freeform add-on.

A simpler alternative would be to use FormGrab from brandnewbox which currently is free, but appears to be licensed as a commercial product - which provides the ability to turn regular HTML forms into ones that talk to the EE database.

FormGrab does not have a captcha module built in, but although not free if you want this you are much better off spending USD29 on a copy of snaptcha \- a very simple to use add-on that provides good spam protection without any visible captcha fields.

HTH
> 0 votes

# Answer
There is also the *Express* edition of Freeform, which allows for 1 simpler form with a lot of the advanced functionality available to it. It's not free, but it's $49 compared to $99 for the *Lite* edition. :)
> 0 votes

# Answer
You can use forms with basic EE functionality, like Channel Form.

https://docs.expressionengine.com/latest/channels/channel-form/overview.html

Basically create a channel, then allow users on your website to add/edit to it, using forms.

If it's a contact form you're looking for, EE also has a native solution.

https://docs.expressionengine.com/latest/add-ons/email.html

You could use reCAPTCHA for free as anti-spam.

https://www.google.com/recaptcha/intro/v3.html

FreeForm Pro combines all of that conveniently, but if you're looking to save money and your needs are minimal, you can use those other methods.
> 0 votes

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


title: Getting Channel Entry Data With AJAX

text:
# Question
Title: Getting Channel Entry Data With AJAX
EE 5.2.2

I am making an app that lists channel entries in a template. Some of the data in these entries could be very substantial so I would like to only call that data if/when the user chooses. The way I would like to do this is by running an ajax query that will pass the id of that entry and return the requested field data for it.

Does EE have any helpful built-in functionality that can handle something like this? If not I'm assuming I will have to create a plugin action id to query the data using php.

Thank you.

# Answer
There are answers both complex and simple, really depending on your actual use case.

This simple answer is just to AJAX in a template that does what you want. There is no reason you can't have a template that looks like this:

```
template: my_template_group/ajax_entry.html
accessed url: my_template_group/ajax_entry/100
template content:

{exp:channel:entries
    entry_id="{segment_3}"
    limit="1"}
    {if no_results}{redirect="404"}{/if}
    <div class="ajaxed-content">
        <h1>
            {title}
        </h1>
        <p>
            {my_custom_field}
        </p>
    </div>
{/exp:channel:entries}

```

And just AJAX that template in, then all of your logic will be in the JavaScript in your main listing template.

Now if you need something that is more akin to an API for Channel Entries, you are looking at crafting your own plugin/module. I can't tell if you specifically want to select certain fields to return or just need something simple. If your use case is small, you could just have 5 or so special templates like the one above and just AJAX the template you need when you need it.

And if you want, you can make a template return JSON or XML and consume the data that way if you need to do special stuff with it in JavaScript after it's been pulled in.
> 1 votes

---
Tags: channel-entries, query, ajax, entry
---


# Question
Title: Relationship Field Conditional Not Working
EE 5.2.2

I have a `homepage` channel with a primary entry that handles a bunch of stuff on the homepage. One of the things it has is a relationship field called `featured movie` that can have just one of any entries in the `movie` channel set to it.

What I am trying to do in my template is

1. check if there is a featured movie set and then
2. check if that featured movie has a video id set to it. If it does, display a carousel with an image *and* a YouTube embed, if not just show the image.

Here's how the section looks.

```
    {exp:channel:entries channel="homepage" limit="1"}
        {if featured_movie}
            <div class="series_program_section w-16">
                <div class="w-8">
                    <h2>Featured</h2>
                    <a href="/calendar/movie/{featured_movie:url_title}" style="text-decoration: none;">
                        <h3>{featured_movie:title}</h3>
                        <div class="links_container">
                            <a href="/calendar/movie/{featured_movie:url_title}">Explore this movie</a>
                        </div>
                    </a>
                </div>
                <div class="w-8">
                {if featured_movie:video_id != ''}
                    <section class="carousel">
                        <div class="owl-example owl-carousel">
                            <div class="item">
                                <img class="main_image" src="{featured_movie:image}" alt="{featured_movie:title} image">
                            </div>
                            <div class="item">
                                <iframe width="100%" height="315" src="https://www.youtube.com/embed/{featured_movie:video_id}" frameborder="1" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"></iframe>
                            </div>
                        </div>
                    </section>
                    {if:else}
                            <img class="main_image" src="{featured_movie:image}" alt="{featured_movie:title} image">
                    {/if}
                </div>
            </div>
        {/if}
    {/exp:channel:entries}

```

To me, this looks like it should work just fine. But what's happening is that `{if featured_movie:video_id != ''}` is always returning false even when there is a `video_id` set. I have tested this by putting `{featured_movie:video_id}` before the conditional and watching the id render on the page but not return the code for when that condition is true.

I've tried other options for the conditional such as `{if featured_movie:video_id:count == 1}` and `{if featured_movie:video_id:no_results}` and none of them seems to work.

What am I missing? Is there some special way of doing conditionals for the fields in a relationship entry?

# Answer
> 3 votes
Although it is technically less efficient, you should try embedding it to render as a tag in the conditional like so:

```
{if '{featured_movie:video_id}' != ''}

```

Try that. As in the docs, if it isn't working as expected, you should try this route. You can read up more here:

https://docs.expressionengine.com/latest/templates/conditionals.html#embedding-tags

It is at least kind-of documented now, but for years us EE folks knew it as a secret trick for when conditionals are acting wonky.

---
Tags: channel-entries, templates, conditionals, relationships
---


# Question
Title: Issue with database.php either being overriden on cached on ee2 site migration
Trying to get an old site up & running on a new server (EE 2)

Have changed the credentials in database.php to one for the new MySQL db.

However, the site errors with "Failed to connect to MySQL: Access denied for user 'OLDUSER'@'localhost' (using password: YES) "

with 'olduser' being the previous MySQL account before database.php was edited.

So it looks like it's cached somewhere, or is being overridden elsewhere.

I've searched for this username in the php files and can't see it anywhere else so am a little stumped.

Could anyone give me any pointers?

TIA.

# Answer
> 0 votes
When moving servers, did you blanket copy files like the `php.ini` file and the Apache virtual hosts files? It could be an environment variable set in either of those places.

Look at your `index.php` files and also look for some form of `config.php` in your web-root and config folder.

Stuff like https://github.com/focuslabllc/ee-master-config (and other vendor configuration systems) exists in some installs, especially back in EE2 days, so you have to look a bit deeper. The reason I'm guessing it could be an environment variable is because you searched your code base for the username and it didn't show up, but if your database credentials were set as environment variables they might show up in config file looking like this:

```
$db['expressionengine']['username'] = getenv('DB_USERNAME');

```

So searching your codebase for that username might be fruitless.

# Answer
> 0 votes
Many thanks for you input.

After a good steer from a web dev colleague, who pointed out that as admin.php was working, the database must be connecting and the error was being generated elsewhere.

So I searched the dump of the DB itself and found the old credentials in a page that was itself stored in the DB.

So we're working now... why it was set up like that I don't really know, but there you go.

---
Tags: ee2
---


title: Creating user datasets when logged in

text:
# Question
Title: Creating user datasets when logged in
Did any of you encounter a situation where the solution is as follows:

* A logged in user able to do the following
* To create datasets on the fly. For e.g. 2019 - June - Shopping list - Fruits - \[Apples.pdf, Bananas.doc, Oranges.txt, Pineapples.json, Raspberries.rtf\]
* Apples, Bananas, etc can be any file type.
* They can store these datasets as a table in the database
* They are able to manage these datasets (Create-Read-Update-Delete)

# Answer
> 1 votes
I don't know if this is exactly what you're after, but you can use the plugin Shortlist to let visitors tag channel entries and then collect them into a list.

https://eeharbor.com/shortlist

---
Tags: database, ee, users, custom-data
---


# Question
Title: Getting a true base url when sharing a system folder
This is a little difficult to explain, but let me try.

I've built a portal site with three separate domains that share the same system folder. So the portal\_domain uses "./system/" and the other child domains are housed in subdirectories, so portal\_domain/child\_domain/ uses "../system/".

I built it this way, so members could log into one central system and manage content on three separate sites without having to jump from one system to another.

It works great, except for one thing. I'd like to make some redirects based off the url you are using, but it doesn't matter what the base url is, the system only sees the current\_url as the base.

I want to be able to say if you go to a child domain, redirect to a custom home page for that child domain, but I can't find any way to target that.

```
If you visit the portal domain http://portal-domain.com
the code {current_url} yields http://portal-domain.com

And if you visit the child domain https://child-domain
the code {current_url} still yields http://portal-domain.com

```

Is there any way around this?

# Answer
> 0 votes
You could try building your own domain based on what is in the browser rather than what EE is currently serving. One way to do this might be to build something using tags available from the very handy URL Helper add-on.

This add-on provides a tag `{host}` which according to the documentation gives `Your domain name, e.g. localhost, site.com`. So might be worth trying this to create your links, with suitable slugs appended to give a path to your respective home pages.

HTH

---
Tags: url
---


# Question
Title: Submitting Files With {exp:channel:form}
EE 5.2.2

I'm using the `{exp:channel:form}` tag to create an order reporting feature that will save a generated report as an EE channel entry.

The feature currently has a form that accepts parameters, submits those to an Amazon API, and returns the result (XML report for orders) as a JSON object. If the object is received successfully then the old form is hidden and a new form is shown. This form is a `{exp:channel:form}` tag.

I've been able to get this tag to submit an entry to the channel with a title that is generated based on the previously submitted parameters, and that works fine. I also have two links that show along with the new form as a part of the result of this query: a link to view the new file and a link to download it (these are both done using the JavaScript Blob object, and both of them are working:

```
var file = new Blob([text], {type: type});
a.attr('href', URL.createObjectURL(file));
a.attr('download', name + '.txt');
v.attr('href', URL.createObjectURL(file));
t.attr('value', name);

```

The problem I'm having *now* is this: how to save this new file in a input (preferably hidden) that can be submitted to the channel along with the title?

I have these two docs open: this one and this one. I'm not quite sure how to interpret this, though. They both have this as an example:

```
<input type="file" name="my_field_name" />
<input type="hidden" name="my_field_name_directory" value="1" />
<input type="hidden" name="my_field_name_hidden_file" value="{my_field_name}{file_name}{/my_field_name}" />

```

What I have in my form is this:

```
{exp:channel:form channel="order_reports" return="/{my_index}"}
    <a href="" id="download_link">Download File</a>
    <a href="" id="view_link" target="_blank">View File</a>
    <input type="hidden" name="title">
    <input type="file" name="my_field_name" />
    <input type="hidden" name="my_field_name_directory" value="1" />
    <input type="hidden" name="my_field_name_hidden_file" value="{file}{title}{/file}" />
    <input type="submit" value="Save">
{/exp:channel:form}

```

Now, I'm obviously not doing this right, but I'm not entirely sure how to interpret the documentation. And I'd ideally like to put this new file into a hidden input so the user doesn't have to go through another step to save the file to the channel, so if there's some way that I could put my Blob object into an input as a .txt file, the same way I'm doing it with my two links, that would be perfect.

Thanks for any help and/or clarification.

# Answer
I had similar trouble with a file field in Channel Forms, can you confirm the value for the name=“my\_field\_name\_directory” input is the file directory number?
> 0 votes

---
Tags: channel-entries, safecracker, forms
---


# Question
Title: Simple Contact form returning "Forbidden (403) CSRF verification failed. Request aborted." on submission
I have set up a simple contact form on a new installation of Expression Engine 5.2. Email module is installed. This submits ok on localhost but on the server I am getting hit with the titular error.

My code:

```
                    {exp:email:contact_form recipients=my@email.com" charset="utf-8" form_class="iwd-standard-form"}

                    <fieldset class="iwd-fieldset-contained">
                        <legend>Your contact details</legend>
                        <div class="iwd-form-row">
                            <div class="iwd-form-labels">
                                <label for="name">*Name:</label>
                            </div>
                            <div class="iwd-form-controls">
                                <input name="name" placeholder="Your name" type="text">
                            </div>
                        </div>
                        <div class="iwd-form-row">
                            <div class="iwd-form-labels">
                                <label for="from">*Email:</label>
                            </div>
                            <div class="iwd-form-controls">
                                <input name="from" placeholder="Your email" type="text" value="" />
                            </div>
                        </div>
                    </fieldset>
                    <fieldset class="iwd-fieldset-contained">
                        <legend>Leave us a message</legend>
                        <div class="iwd-form-row">
                            <div class="iwd-form-labels">
                                <label for="message">Message:</label>
                            </div>
                            <div class="iwd-form-controls">
                                <textarea name="message" placeholder="Enter message" style="height:200px"></textarea>
                            </div>
                        </div>
                    </fieldset>

                    <fieldset class="iwd-fieldset-uncontained">

                        <div class="iwd-form-row center">
                            <input type="hidden" name="csrf_token" value="{csrf_token}">
                            <button id="form-submit" type="submit" class="iwd-button submit-form">Submit</button>
                        </div>
                    </fieldset>

                {/exp:email:contact_form}

```

# Answer
OK, I just solved this. I've got 2 urls, one redirects to the other.

Base path was set wrong in URL and path settings (set to the redirecting url)

Works fine once I updated the settings.
> 1 votes

---
Tags: ee5, email-contact-form
---


title: MSM 2nd Site Problems

text:
# Question
Title: MSM 2nd Site Problems
I just updated an EE v2.x single site to EE v5.24. The update went fine and the primary site is working as it should. I then enabled MSM and setup a second site.

Note: Both sites are setup under subdomains.

The second site's index page is blank no matter what I do. I have verified the correct info in the 2nd site's admin.php & index.php. Also, when I try to access the CP using the 2nd site's URL, I get the following error:

Parse error: syntax error, unexpected '\[' in /nfs/c11/h03/mnt/196778/domains/sanborns.thedesigncore.com/html/engine/ee/EllisLab/ExpressionEngine/Boot/boot.php on line 70

I also noticed that when I try to change the Default Base URL for the 2nd site in the URL & Path Settings to the 2nd site's subdomain, it keeps switching it back to the 1st site's subdomain.

Any help is appreciated.

# Answer
When a system setting doesn't update (or rather reverts when you try to update it) that suggests the variable is being set somewhere else.

Most likely way to do this is via system configuration override settings.

Have a look in your site's config.php file (`system/user/config/config.php`) - if you have migrated from EE2.x then it is possible that the original system was using some manual over-rides for system variables. AFAIK the upgrade process leaves any non-standard config entries in the config.php file - so these may have been carried over with the update. It might be that one or more of these legacy overrides is causing confusion to EE.

HTH
> 0 votes

# Answer
Figured it out. On my server when a new domain is setup, it defaults to an older version of PHP. So the first domain was running PHP7, but the second was running PHP5.

Switching the second domain to PHP7 fixed everything.
> 0 votes

---
Tags: multi-site-manager
---


# Question
Title: Custom Datepicker (Datedropper.js) with Channel Form Grid & Date Fields
I have run into an issue I cannot figure out.

The situation is I have a Channel Form that has a bunch of Grid field types on with a date field. The issue is I would like to use this (datedropper) JS datepicker for each date field inside the grid. I am able to get it to fire if the page loads with an existing row but if I click to add a row the date dropdown will not fire.

I have tried every variation of `include_assets/include_jquery/datepicker` in the parameters.

Here is the sample code:

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

<script
  src="https://code.jquery.com/jquery-1.12.4.min.js"
  integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ="
  crossorigin="anonymous"></script>

{exp:channel:form channel="members" author_id="CURRENT_USER" limit="1" return="profile/{segment_2}" url_title="id{snp_member_username}"}

{field:standard_grid_field_with_date_inside}

{/exp:channel:form}

<script src="assets/script/datedropper.pro.min.js"></script>
<script>
  $(document).ready(function(){
    $( "input[rel='date-picker']" ).addClass("datedropper");
    $( "input[rel='date-picker']" ).addClass("datedropper-init");
    $( "input[rel='date-picker']" ).attr("data-dd-theme", "tallypop-datedropper");
    $( "input[rel='date-picker']" ).attr("data-dd-event-selector", "click");
  });
</script>
<script>
$(document).ready(function(){
  $('.datedropper').dateDropper({
    eventSelector:'click',
    large: true
  });
});
</script>

```

Any direction would be huge!

EDIT: I should've given my EE build. Here it is: 5.2.2

# Answer
> 0 votes
Thanks to the help of Robin & Jordan part of the EE support team this is solved. I was told that there's a really really long story about how the native datepicker works, and it boiled down to me needing to not disable it in the form settings - but then disable the behavior via the js. Hope this helps.

**Check out the code with Jordan's notes:**

```
    $(document).ready(function() {
    // Bind the window load event once the document is ready
    // This makes sure the code below is executed last, after all other document.readys
    // so that the old datepicker events are removed after they have been added.
    $(window).bind("load", function() {

        console.log('Init');

        // Remove the old datepicker events from the input
        $('input[rel="date-picker"]').each(function(index, el) {
            $(el).off()
        });

         // Add a datedropper to each date grid field
        // This is called when the page loads and when new items are added
        Grid.bind("date", "display", function(newField)
        {
            // Remove any events just in case
            $(newField).off()

            // Get the input that is inside of the new grid item
            var input = $('input', newField);
            // Init the datepicker
            input.dateDropper();

            console.log('Display Grid Field', input);
        });

    });
});

```

# Answer
> 0 votes
Channel Formloads it's own Jquery so you loading it as well may cause conflicts.

You can disable it from loading and use your own version, see https://docs.expressionengine.com/latest/channels/channel-form/overview.html#include\_jquery

---
Tags: safecracker, grid, date
---


# Question
Title: How to delete template variables, template partials, templates completely in EE5?
Templates, partials and template variables are automatically stored as files since EE4. But they are also stored in the database (in the tables exp\_global\_variables, exp\_templates, exp\_snippets - note that the table-names still refer to the old identifiers from EE2: Snippets, Global Variables).

If you delete e.g. the file of a template variable via ftp the variable will be recreated (using the the according entry in the DB). So the right way is to delete the template variable via the Control Panel -\> Templates.

I had a serious issue with a template variable that recreated itself infinitely because its name was too long (reported here on Github). This variable still is shown in the CP, in the DB and as file. I don't dare to delete it via the the CP because I fear that the infinite loop will run again.

How can I delete this template variable completely, safe and forever? I am thinking the best way would be deleting first the according entry in the database and then deleting the file via ftp.

Thanks for any contribution!

# Answer
> 0 votes
I'd turn on debugging, then add and delete a template variable (in the CP), paying attention to all the SQL DELETE statements. Then basically duplicate those for your use.

---
Tags: templates, ee4, ee5, template-partials
---


# Question
Title: Fetch entries grouped on custom field value, randomised within each group
Using EE v2.8.1

I need to display a list of entries, split into 4 groups, the entries should be randomised within each group (entries are grouped on a custom field value, which can be between 1 and 4).

All entries need to be displayed. They also need to be paginated, 9 entries at a time (this is done using Ajax).

They should be presented in order of group:

```
  group 4 entries (randomised)
  group 3 entries (randomised)
  group 2 entries (randomised)
  group 1 entries (randomised)

```

Groups may contain any number of entries.

I'm using stash but I can't think of a way to fetch only those entries that are to be displayed on a page, the only method I can think of is to fetch the whole list.

# Answer
> 0 votes
This was a lot easier than I thought, I was ordering by 2 fields, the group field and then title, I removed title and the list is ordered correctly just by group and orders for the entire record set even though I'm paginating.

(Ordering by 2 fields seems to force the sorting to be only within each page, not for the entire recordset.)

I then create 4 stash lists grouped by partner level.

# Answer
> 0 votes
Not so clear from your question what you plan to do - specifically is the plan to show just one entry in each group at a time and repeat the four group entries over and over, or show all the entries in group 1 first, and then all the entries in group 2... etc.?

Either way, one way you could do this is to put each group of entries (or just the pagingated sub-set for each group) into a layout variable array and then recall these in whatever format / sequence you want.

Also usually helpful to state what version of EE you are using.

Storing layout variables is quite efficient, can work nicely with the template debug in EE 5, and usually less confusing to implement than `stash` equivalents, as the parsing of the variables is done consistently at the point were template processing transfers to the next template in the layout sequence.

The documentation for layout variables in the latest EE5 documentation is much improved over earlier versions, and should be enough if you are not already familiar with the approach. If you need some guidance on how to code this up, provide a bit more information about what actually you are trying to generate and maybe it will be possible to give you some example ideas.

---
Tags: channel-entries, stash, random
---


# Question
Title: How to display Related Elements and Hubspot Call to Action items on a page
I'm working on an ExpressionEngine website that someone else built and trying to figure out how to make some edits.

When editing an entry, there are lists of Related Elements and Hubspot Call to Action items which I can add or remove from the page by clicking the left/right arrows.

In the template for the same entry, I see this: {display\_related\_elements}

However, when I go to the list of functions, I don't see anything called display\_related\_elements. So perhaps the template is trying to call a function that doesn't exist. In any event, the Related Elements do not display.

All I want to do is display Related Elements and Hubspot Call to Action items on my page. Is there a built-in function for this in ExpressionEngine or do I need to write my own database query?

Thank you!

# Answer
From your description it looks like you are working with what is called a Relationship field.

Check the documentation, but I suspect what is going on is that the template designer called the relationship field **display\_related\_elements** which you would access within a template using the tag `{display_related_elements}` \- this would explain why you cannot find this tag in documentation for EE.

Relationship fields are pretty straight forward to work with but if you have any problems post back here, I'm sure you'd get good answers to any specific questions.

PS - it is always helpful to include info in questions here about what version of EE you are working with.
> 1 votes

---
Tags: related-entries
---


# Question
Title: Convert Content Elements field to Fluid field
I am in process of upgrading EE2 site to EE5.

One of the fields is Content Elements, and since it does not seems to be available for EE3/4/5, I'm thinking that best approach would be to convent it to Fluid field.

Has anyone went through the process before? Maybe there is some script that can be used? If not, what would be the best approach here (other than manually copy/pasting each entry)

# Answer
I have done this sort of migration a couple of times and it is doable but not straightforward. Broadly you have to first get your old site to dump out the content of the field for each entry concerned in a format you can work with (i.e. some kind of structured file) and then create an appropriately capable fluid field and write some SQL to insert this information into your database using the new fluid field definition.

Because the fluid field is relatively new there are no utility add-ons available to make this process easier, and so you have to construct your approach to processing this as a custom exercise.

Whether it is worth the effort depends very much upon how many entries you are seeking to migrate... and how complex each entry is likely to be.

So, in summary, doable but non trivial.

HTH
> 2 votes

---
Tags: upgrade, content-elements, fluid-field
---


# Question
Title: How can I use stash->parse in my extension
I'm writing an addon which can take an EE template, replace some variables and then *crucially* parse the EE tags in it and then email it.

I was hoping stash:parse might come to my rescue after a day of poking around various addons code and other options.

So here's what I want to do:

```
echo "Template following process 1: $msg_body<br>";

  if ( ! class_exists('Stash'))
  {
      include_once PATH_THIRD . 'stash/mod.stash.php';
  }

  $stash = new Stash(TRUE); // instantiate with initialising

  $params = array(
   'process' => 'inline',
   'parse_depth' => 5
  );

  $parsed_string = $stash->parse($params, $msg_body);

  echo "Template following process 2: $parsed_string<br>";

  return $parsed_string;

```

This all seems to work - $msg\_body is my template ready to parse. It contains a channel entries tag, which even when I make it as basic as possible, still gives the following error:

```
Error

The following tag has a syntax error:

{exp:channel:entries}

Please correct the syntax in your template.

```

The template code is \[code\]{entry\_id} {exp:channel:entries channel="clients" entry\_id="18813" status="not closed" } {title} {/exp:channel:entries}\[/code\]

So unless I've missed something obvious, there isn't a syntax error here.

It seems like this should work, especially as the parse example includes a channel entries tag (https://github.com/croxton/Stash/wiki/{exp:stash:parse})

I put together a quick function in my module called "test\_stash" which DOES work.

```
    function test_stash(){
    if ( ! class_exists('Stash'))
    {
        include_once PATH_THIRD . 'stash/mod.stash.php';
    }

    $msg_body = '

```

{exp:channel:entries channel="clients" entry\_id="18813" status="not closed" } {title} {/exp:channel:entries}';

```
    $stash = new Stash(TRUE); // instantiate with initialising

    $params = array(
        'process' => 'inline',
        'parse_depth' => 5
    );

    $parsed_string = $stash->parse($params, $msg_body);

    echo $parsed_string;

}

```

So it seems like the issue is with parsing the tag in my EXTENSION. Is there anything about this which could be causing an issue?

The extension fires on channel\_form\_submit\_entry\_end.

Any help/advice appreciated. Thanks.

# Answer
> 1 votes
Quick update - having looked at what causes this error, I found that if I call

```
ee()->TMPL->fetch_addons();

```

in my extension before I call stash-\>parse, it works fine without an issue. Hope this helps someone.

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


# Question
Title: Upgrading EE 2.11.9 to 3.5.10 - unable to update to Tagger 4.0.0 from DevDemon
I'm trying to upgrade a site from EE2.11.9 to 3.5.10 and during the process, upgrading DevDemon's Tagger from v3.2.1 to 4.0.0 but getting this issue when trying to upgrade:

Exception Caught No such method filter. ee/EllisLab/ExpressionEngine/Library/Mixin/Manager.php:143

I have seen that other folks also have this problem: Upgrading EE 2.11.9 to 3.5.6 - problems updating Tagger from DevDemon

Please help DevDemon

# Answer
> 4 votes
I solved this issue just by uninstalling the addon and installing it again in admin panel. Without upgrading.

# Answer
> 0 votes
This is really old, but for those who need to upgrade sites running EE2 to newer versions with Tagger, this worked for me.

**Note: uninstalling Tagger and reinstalling it from the Add-on Manager does work, but it will erase all of your existing tags. To prevent this from happening, follow the steps below.**

This is assuming Tagger is on version 3.2.1. Right after moving the EE3 files over and before running the update step, copy over the files for Tagger 4.0.0.

In tagger/upd.tagger.php, there is this code:

```
$module = $module = ee('Model')->make('Module', array(
    'module_name', ucfirst($this->module_name),
)->first();

```

Update these lines to the following:

```
$module = ee('Model')->make('Module', array(
    'module_name', ucfirst($this->module_name),
));

```

After the EE update step, go to the Add-On Manager and click "Update to 4.0.0" next to Tagger in the list.

---
Tags: devdemon, devdemon-tagger, tagger
---


title: adding a variable to a partial template

text:
# Question
Title: adding a variable to a partial template
I am using creating template parts (header, footer) but would like to know how I can add a variable, a body class to individual templates.

I see people are using stash but is there another way to set a variable on a per-page basis.

Thanks

# Answer
> 3 votes
The easier and faster way to do this is using Preload Text Replacements and snippets.

Snippets are parsed before Preload Text Replacements. So you can put them inside snippets.

Let me show you an example.

This is part of a snippet called `doctype-and-styles-snip`:

```
{preload_replace:pre-rootclass=""}<!doctype html>
<html class="no-js no-jquery {if segment_1 == ""}home{/if} {pre-rootclass}">
<head>
[...]

```

I put the `CLASS` on `HTML` instead of `BODY`, but the principle is the same. The `{preload_replace:pre-rootclass=""}` is intended to remove the unused `CLASS`.

On templates, you can use something like this:

```
{doctype-and-styles-snip}
{exp:channel:entries limit='1' require_entry='yes' disable='pagination' [...]}
<title>{title} - {site_name}</title>
{header-snip}
[...]

```

When you need a custom class, just add a `preload_replace` before the snippet. For example, this is a 404 page:

```
{preload_replace:pre-rootclass="404"}{doctype-and-styles-snip}
<title>Not found - {site_name}</title>
<meta name="robots" content="noindex,follow,noarchive" />
<meta name="description" content="not found" />
{header-snip}
[...]

```

This way, you can have custom classnames per page avoiding embeds and stash.

# Answer
> 0 votes
Just wanted to add another way round this which might be helpful:

You could do something like this if you wanted to use the partial in lots of places but maybe change its styling a little depending on template (without use of conditionals).

In the template:

```
{preload_replace:pre_s_block_class='template_specific_class'}
{s_block}

```

In the snippet {s\_block}:

```
<div class="{pre_s_block_class}">
... content ...
</div>

```

---
Tags: variable, template-partials
---


title: Make a channel private

text:
# Question
Title: Make a channel private
Is it possible in out of the box Expression Engine to make a channel private and viewable only by the administrators member group?

# Answer
> 1 votes
Yes.

Two parts to this - not clear from your posting.

To make a channel that only a private group can access from the control panel:

* First create the channel you want to make private. Then click on the Members button and work through the member groups that you do not wish to be able to have access to the channel and de-select it from the "Allowed Channels" selector (which is the last one as you scroll down).
* Second, head over to the group(s) you do want to have access and just check that the channel is selected for those groups.

To make a channel only visible to users from a particular group in your public site, add this kind of conditional to your template:

```
{if logged_in_group_id == "xxx"}
... template tags to show channel to your group with group ID xxx
{/if}

```

That's it. Easy!

HTH

---
Tags: channel
---


# Question
Title: Passing Arguments To Class Method Using EE Template
**\[EDIT: I was able to answer my question. Answer posted below.\]**

EE 5.2.4

I have a class that will query an API using item ID and return data for that item.

I am aware that this structure:

```
{exp:my_class:my_method}

```

will return the value for this:

```
class My_class {

  function my_method () {

    // content

  }
}

```

However, what I need to do is pass an argument to the class method for each entry within a channel, like this:

```
{exp:channel:entries channel='products'}
    {exp:my_class:my_method arguments='{product_asin}'}
{/exp:channel:entries}

```

would return a value from the class method for each product entry:

```
class My_class {

  function my_method ($asin) {

    // query api based on $asin values passed from the template

  }
}

```

It's quite possible I'm missing something in this part in the docs, as they are quite elaborate regarding add-on classes and methods, so I'm hoping someone will just know from experience how to do something like `{exp:my_class:my_method arguments='{product_asin}'}`.

Thanks!

# Answer
> 1 votes
I have found the answer to this.

In the template:

```
{exp:my_class:my_method asin='{product_asin}'}

```

In the class:

```
class My_class {

  function my_method () {

    $asin = ee()->TMPL->fetch_param('asin');
    return 'my asin is: ' . $asin;

  }

}

```

On the frontend this renders:

```
my asin is: [product asin]

```

So what you have to do is define your parameter in the template `asin='{product_asin}'` and then fetch it in your method `$asin = ee()->TMPL->fetch_param('asin');`.

Thanks, ***me***. Oh, you're welcome!

---
Tags: templates, add-on, custom-classes
---


# Question
Title: 500 server error installing ExpressionEngine 5.2.4 (MAMP Pro)
I downloaded ExpressionEngine and moved files to my local server (Mamp Pro). I can see/enter /admin.php but after hitting the Install button it takes about 30 seconds and the process aborts with a server error on this URL http://my-site.local:8888/admin.php?C=wizard&M=do\_install&language=english

The apache log says

```
[Thu Jul 04 17:15:07 2019] [error] [client ::1] FastCGI: comm with server "/Applications/MAMP/fcgi-bin/php7.0.33.fcgi" aborted: idle timeout (30 sec), referer: http://my-site.local:8888/admin.php
[Thu Jul 04 17:15:07 2019] [error] [client ::1] FastCGI: incomplete headers (0 bytes) received from server "/Applications/MAMP/fcgi-bin/php7.0.33.fcgi", referer: http://my-site.local:8888/admin.php

```

The DB is completely empty, so I guess nothing really happens. There are no entries in the PHP log.

I tried different PHP version (7.0 and 7.2) and different browsers. Before I tested with the ee\_wirzard and saw everything green.

The mysql server doesn't run on the default port, but I can't enter the mysql host or a port anywhere. Perhaps this is the problem?

# Answer
> 0 votes
I would set everything (ports) to default before giving up on it. I am using MAMP Pro (version 5.3(17956)) on Mojave with ExpressionEngine versions 3.5.17 and various versions of ExpressionEngine 5.x.

* "MySQL 5.7.25 is configured to use port 3306"
* Php version (default) 7.2.14

Oh yea, so is this MAMP Pro 5 for Mac or MAMAP Pro 4 for Windows? I use both, but I seem to have more issues in the Win version... could be though just that I am not quite as used to Win as Mac. And they are different versions for whatever reason.

---
Tags: install, error-500
---


title: $_SESSION Variable in EE

text:
# Question
Title: $_SESSION Variable in EE
**\[EDIT - I have posted the answer to my question below\]**

EE 5.2.4

I'm having issues trying to use `$_SESSION` in EE.

What I would like to do is save an Amazon cart ID in the `$_SESSION`. Working in regular PHP I'm familiar with this: `$_SESSION['cart_id'] = 1234`. However when I try to do this in EE I get errors and/or nothing happens.

I thought that *maybe* what I'm looking for is the cache-access functionality:

So in my class I have this `ee()->session->set_cache('amz_cart', 'id', $value);`, and in my view I'm trying to see what returns from this `ee()->session->cache('amz_cart', 'id');`.

Nothing returns with this. Can anyone point me in the right direction?

Thanks!

# Answer
> 1 votes
Well, you can use `flashdata` to achieve your requirement. For this please follow below syntax.

**To set the Flashdata:-**

```
ee()->session->set_flashdata('your_key', 'your_value');

```

**To get the Flashdata:-**

```
echo ee()->session->flashdata('your_key');

```

HTH

# Answer
> 0 votes
It appears as though I've answered my own question by trial and error.

In my class method I can set the value like this:

```
$_SESSION['amz_cart']['id'] = $value;

```

and in the template when I want to access that value I have to do this:

```
<?php
    session_start();
    echo $_SESSION['amz_cart']['id'];
    session_write_close();
?>

```

I'm not sure why it works this way but it appears to be working for my needs for the time being.

I'm still interested in a more elegant or EE-based solution that will work the same way.

Thanks everybody!

---
Tags: templates, sessions, global-variables
---


title: Shell script for fresh EE install

text:
# Question
Title: Shell script for fresh EE install
Has anyone written a shell script to set all the default file/folder permissions on a new EE install?

# Answer
You can create .sh file and use below command to set permissions to folders.

```
chmod -Rvf 0777 folder_path/folder_name/

```
> 0 votes

# Answer
You can modify next scripts for your needs:

source

```
#!/bin/bash

# Find location of this script.
# This ensures that only files in the directory in
# which this script exists (recursively) are modified.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

# Set what the name of your expressionengine folders are.
SYSTEM="system"
IMAGES_DIR="public_html/images"
UPLOADS_DIR="public_html/files"

# Optionally ensure correct ownership on per environment basis.
#if [ "$DIR" = "/path/to/project/" ]; then
#   chown -R http.http "$DIR"
#fi

# Expressionengine specific permissions.
find "$DIR" -type d -print0 | xargs -0 chmod 0755
find "$DIR" -type f -print0 | xargs -0 chmod 0644
find "$DIR/$IMAGES_DIR/" -type d -print0 | xargs -0 chmod -R go+w
find "$DIR/$UPLOADS_DIR/" -type d -print0 | xargs -0 chmod -R go+w
chmod -R go+w "$DIR/$SYSTEM/user/templates"
chmod -R go+w "$DIR/$SYSTEM/user/cache"
chmod 0666 "$DIR/$SYSTEM/user/config/config.php"

# Permissions specific to the sitemap generator
# from http://www.xml-sitemaps.com/.
#chmod -R 0777 "$DIR/public_html/generator/data"
#chmod 0666 "$DIR/public_html/sitemap.xml"
#chmod 0666 "$DIR/public_html/ror.xml"
#chmod 0600 "$DIR/public_html/index.php"

# If laxative is being used, preserve executability
#if [ -e "$DIR/.db/lax" ]; then
#    chmod 0700 "$DIR/.db/lax"
#fi

# Make sure other shell scripts are executable too.
find "$DIR" -type f -name "*.sh" -print0 | xargs -0 chmod 700

```
> 0 votes

---
Tags: permissions, install
---


# Question
Title: Upgraded to EE 4.2.0 from EE 3.5.15 and now can't login
Upgraded to EE 4.2.0 from EE 3.5.15 and now can't login to the backend

# Answer
Generally it happens in EE4 when you have your ID row in **exp\_members** table but not in **exp\_member\_data** table. Can you make sure you have entry in both the table?
> 1 votes

# Answer
Try adding these lines on the bottom of your system/user/config/config.php file:

```
$config['cookie_prefix'] = '';
$config['cookie_path'] = '';
$config['cookie_domain'] = '';
$config['user_session_type'] = 'c';
$config['admin_session_type'] = 's';

```
> 1 votes

---
Tags: login
---


title: Upgrade to 3.5.17

text:
# Question
Title: Upgrade to 3.5.17
All went well during the upgrade process, and I can access my Control Panel no problem. I had disabled all Addons prior to the upgrade. Now when I go to my home page, it is blank. After enabling Debug, I get this:

Exception Caught Dependency Injection: Unregistered service "ee:Variables/Parser" ee/EllisLab/ExpressionEngine/Service/Dependency/InjectionContainer.php:184

Prior version was 2.5.5

How can I fix this?

# Answer
If you have not tried this already, move all the files / folders in the system/user/addons directory somewhere else and try opening your control panel. Removing the files from the addons directory prevents EE from loading these addons, and so while you may get some errors arising because it cannot find the addons it is looking for, you eliminate errors caused by incompatibilities in the add-ons found in that folder.

EE changed how addons work between EE2 and EE3, so EE2 addons will not work in EE3. Unfortunately, although EE could easily test for EE3 compatibility and not load those that are not compatible, it doesn't do this and attempts to load anything it finds in that directory: if there are issues of compatibility you find out via opaque errors instead. That seems to be what is happening in your current circumstance.

If you can get the EE CP to load with no add-ons in the addons folder, then start adding them back one at a time and see how you go - if you add one back and EE crashes, you know that there is an issue with that add-on and you'll have to fix it or work around it.

If you post a list of whatever addons you have in the addons folder under EE2, it will be possible to reply with whether or not there are EE3 compatible versions and so on.

HTH
> 0 votes

# Answer
FINALLY! I have upgraded all the way to 5.2.4. I took it step by step, backing up each successful install, along with the database, as I went. Going from EE3 to EE4 was the trickiest - for some reason, the members table was missing several columns. Were I not fluent in SQL, that would have been quite difficult to overcome, because I had to manually insert the columns. EE4 to EE5 had only one snag - I needed to update PHP to 5.6.

Now I get to re-learn EE all over again, plus the Multi Site Manager, which isn't playing nice yet.

Thank you for all your help!
> 0 votes

---
Tags: upgrade
---


title: Class Method Returning Array Tagdata

text:
# Question
Title: Class Method Returning Array Tagdata
EE 5.2.4

I'm trying to create an array that can be looped through as tagdata in the frontend template.

My method grabs results from an API query, identifies images from the result, assembles them into an array, and parses them into tagdata.

```
  function item_detail ()
  {

    $id = ee()->TMPL->fetch_param('id');
    $result = $this->query_product($id);

    $variables = array();

    foreach ($result['digital_assets'] as $asset) {
      if ($asset['asset_resource_type'] == 'image' ) {
        $variables[0]['images'][] = $asset['url'];
      }
    }

    return ee()->TMPL->parse_variables(ee()->TMPL->tagdata, $variables);

  }

```

This gives me an array that looks like this

```
Array
(
    [0] => Array
        (
            [images] => Array
                (
                    [0] => http://domain.com/image/1.jpg
                    [1] => http://domain.com/image/2.jpg
                    [2] => http://domain.com/image/3.jpg
                    [3] => http://domain.com/image/4.jpg
                    [4] => http://domain.com/image/5.jpg
                )
        )

)

```

I would like to be able to loop through this array in the template like this

```
{images}
    // value
{/images}

```

There must be a way to do this?

Thanks!

# Answer
I believe key should be name of variable. so instead of 0..1..2 it should be and array. Also, `parse_variables` use for loop. I belive you have single item and loop for sub item (images), You should return `parse_variables_row`. I have modified code a bit, that should work for you.

```
function item_detail()
{

    $id = ee()->TMPL->fetch_param('id');
    $result = $this->query_product($id);

    $prefix = ee()->TMPL->fetch_param('prefix');
    if($prefix == "") {
        $prefix = "images";
    }
    $variables = array();

    $cnt = 1;
    $total = 0;
    foreach ($result['digital_assets'] as $asset) {
        if ($asset['asset_resource_type'] == 'image' ) {
            $total++;
        }
    }
    foreach ($result['digital_assets'] as $asset) {
        if ($asset['asset_resource_type'] == 'image' ) {
            $variables['images'][] = array(
                $prefix . ':count' => $cnt++,
                $prefix . ':total_results' => $total,
                $prefix . ':image' => $asset['url'],
            );
        }
    }

    return ee()->TMPL->parse_variables_row(ee()->TMPL->tagdata, $variables);

}

```

Template code will look like this:

```
{exp:my_plugin_name:item_detail}
    {images}
        {images:count} - {images:total_results} - {images:image}<br>
    {/images}
{/exp:my_plugin_name:item_detail}

```

If you want to loop through EXP and not with sub variables, Code will be change a bit:

Plugin Code:

```
function item_detail()
{

    $id = ee()->TMPL->fetch_param('id');
    $result = $this->query_product($id);

    $prefix = ee()->TMPL->fetch_param('prefix');
    if($prefix == "") {
        $prefix = "images";
    }
    $variables = array();

    $cnt = 1;
    $total = 0;
    foreach ($result['digital_assets'] as $asset) {
        if ($asset['asset_resource_type'] == 'image' ) {
            $total++;
        }
    }

    if($total == 0) {
        return ee()->TMPL->no_results();
    }

    foreach ($result['digital_assets'] as $asset) {
        if ($asset['asset_resource_type'] == 'image' ) {
            $variables[] = array(
                $prefix . ':count' => $cnt++,
                $prefix . ':total_results' => $total,
                $prefix . ':image' => $asset['url'],
            );
        }
    }

    return ee()->TMPL->parse_variables(ee()->TMPL->tagdata, $variables);

}

```

Template Code:

```
{exp:my_plugin_name:item_detail}
    {if no_results} <p>NO DATA found!</p> {/if}
    {images:count} - {images:total_results} - {images:image}<br>
{/exp:my_plugin_name:item_detail}

```
> 1 votes

---
Tags: templates, tags, custom-classes
---


# Question
Title: Freeform Pro showing error when uploading File of 9MB. How can I increase the upload file in freeform?
When I upload file to expression engine Freeform Pro 4.2.5. It shows me error.

How can I increase the size of the file? Or what can occur

# Answer
> 2 votes
Does your php/apache config are set to accept large upload file ? Ex. upload\_max\_filesize and post\_max\_size = XXM Make sure they are larger than your file size..

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


# Question
Title: Displaying entries from two channels from same category on single-entry page
I have a channel called "offices" with a limited number of entries. Every entry is assigned to a different category from a Category Group called "office-categories". For instance the first entry is assigned to a category called "office-1".
I have another channel called "files" with unlimited entries assigned to categories from the same Category Group "office-categories".
In time a lot of entries will be assigned to the same category "office-1".
I cannot use the Relationship in the first channel because there are so many entries in the second channel that make difficult to find the ones that belong to a specific category.
In the single-entry page of the first channel I like to have the details of the first channel entry and all the entries (all the files) from the second channel that belongs to the same category "office-1". Can someone tell me if this can be done in EE and how? Thanks a lot

# Answer
> 0 votes
It might be that I have misunderstood your question, if so please clarify and I will try and improve the answer.

EE is well suited to doing just what (I think) you are trying to do - through its template system you can construct pages that have highly specific and unusual combinations of entries drawn from multiple channels.

Here are two ways you could achieve this outcome - there are many more I am sure.

1) you can take advantage of EE's option to nominate multiple channels in a **channel entries** call. So specify your category, the two channels, and your results will be all the entries across both channels that have that category. You can sort the output by `channel_short_name` \- so get your first channel entry out first (or last); you can also test each result to see which of the two channels it came from to adjust your layout / markup accordingly.

```
{exp:channel:entries channel="channel_1|channel_2" category="office-1" orderby="channel_short_name"}
{if count == "1"}
... do stuff on the first channel entry ...
{if:else}
... do stuff on the remaining entries
{/if}
{/exp:channel:entries}

```

2) simply call each channel separately within the same template - you can do this as often as you like within a template (there is an overhead in processing time for each call you make, so keep it down to a few if you can)

```
{exp:channel:entries channel="channel_1" category="office-1"}
... do stuff on the first channel entry ...
{/exp:channel:entries}

{exp:channel:entries channel="channel_2" category="office-1"}
... do stuff on the remaining entries
{/exp:channel:entries}

```

HTH

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


# Question
Title: Best way to add a note/comment to the CP Edit Entry interface?
I'd like to tell my user who is adding an entry via the CP to do something. This doesn't have to do with any field, it's simply an instruction on what to do next.

Specifically, I hide the "Photo" field because these users can't be trusted to upload a professional photo; instead they are supposed to contact an admin to add their photo.

This instruction can be inside the Edit Entry interface somewhere, or even on the next page, after Submit has been clicked.

Any recommended way to do this?

# Answer
> 1 votes
Did you try Publish Notes fieldtype? It allows you to add instructions to CP.

# Answer
> 1 votes
Probably the easiest way is to create an extension that is fired by these hooks:

https://docs.expressionengine.com/latest/development/extension-hooks/cp/css.html https://docs.expressionengine.com/latest/development/extension-hooks/cp/javascript.html

Then you can just inject JavaScript and CSS in to your Control Panel.

Here's an example of the two methods you could fire in your extension:

```
function add_cp_tweaks_css()
{
    $css .= file_get_contents(PATH_THIRD."my_cp_extension/css/cp.css");
    return ee()->extensions->last_call . "\n" . $css;
}

function add_cp_tweaks_js()
{
    $js .= file_get_contents(PATH_THIRD."my_cp_extension/js/cp.js");;
    return ee()->extensions->last_call . "\n" . $js;
}

```

Then in your CSS file and JavaScript file, just manipulate the DOM as necessary.

```
// cp.css
.my-message {
    font-weight: bold;
}

// cp.js
$(".t-0").prepend('<div class="my-message">You are not allowed to add pictures. Contact an admin.</div>');

```

Based on your use case, you'll need to probably want to add checks to make sure you only insert your JavaScript and CSS on Entry pages, and also want to check what user group the member is so you don't add the message to SuperAdmins or those who are allowed. So something like this:

```
$user_group_to_show_message = 10;

$referer = (array_key_exists('HTTP_REFERER',$_SERVER) ? $_SERVER['HTTP_REFERER'] : '');

// Check if we're on a publish page
preg_match('/.*publish\/(create|edit\/entry)\/([0-9]+).*/', $referer, $match);

if (array_key_exists(2,$match)
    && is_numeric($match[2])
    && ee()->session->userdata('group_id') === $user_group_to_show_message) {
    // We are on a Publish page, with the right user group to warn, go ahead and add CSS/JS
}

```

# Answer
> -1 votes
I believe the best approach would be to make a custom fieldtype, you could then include this in any channel form at will without any further programming. The fieldtype could just be a label/text with no input. https://docs.expressionengine.com/latest/development/fieldtypes.html

---
Tags: control-panel
---


title: Unable to create new publish layout

text:
# Question
Title: Unable to create new publish layout
Running EE 5.2.3 and trying to add a new Publish Layout for one of my channels. When I try to create or save the layout I get the following error:

The Super Admin group is already checked but it is read only and cannot be toggled. I can't move forward at all because of this.

Any help would be appreciated.

# Answer
> 1 votes
So after digging deeper I discovered that I could successfully create Publish Layouts for other channels, so I deleted the existing problematic layout and was able to create a new one. Problem solved.

---
Tags: channel, publish-layout
---


title: Memecached setup problems

text:
# Question
Title: Memecached setup problems
I have recently moved my site to EE5 and I am trying to setup memcached caching. My host has setup memcache and the php extension and its listed in php info. My hosts has given me these details

```
 array(
'host' => '/tmp/memcached.sock',
'port' => 11211,
'weight' => 1,
)

```

and I have added them to the config file like this

```
$config['memcached'] = array(
  array(
    'host' => 'tmp/memcached.sock',
    'port' => 11211,
    'weight' => 1,
  )
);

```

However, when I select 'Memcached' as my caching driver, EE displays the error message "Cannot connect to Memcached, using File driver instead".

I also saw in the EE docs that you add the server ip or local host to the host section but that didnt work either memecached config overrides

What is the correct syntax for my config file to get this to work?

# Answer
you have missed **/** before *tmp* folder in your config. So config will be like this:

```
$config['memcached'] = array(
  array(
    'host' => '/tmp/memcached.sock',
    'port' => '0',
    'weight' => 1,
  )
);

```
> 0 votes

---
Tags: cache
---


# Question
Title: Can Expresso Store limit the total order weight
I have set up my Expresso Store shipping method to calculate:

* Maximum Order Weight 100g / Base Rate 500 yen
* Maximum Order Weight 200g / Base Rate 600 yen

... up to 2000g

I am wondering if there is a way to limit the total order weight to 2000g?

# Answer
Store doesn't have a variable to get the total weight for an order otherwise you could use that, something like:

```
{exp:store:checkout}
    {if my_total_weight <= 2000}
      <button type="submit">Checkout</button>
    {if:else
       Order weight must be 2000 or less
    {/if}
{/exp:store:checkout}

```

My initial though is to use a maths plugin to total up the order weight then use that to show/hide the checkout button accordingly. https://devot-ee.com/add-ons/tally might work for you using something like my example above.
> 0 votes

---
Tags: expresso-store
---


title: Updating Membership Terms of Service

text:
# Question
Title: Updating Membership Terms of Service
EE 5.2.5

I'm trying to update the ToS message for member signups.

When a user goes to `domain.com/member/register` and sees this form:

In the docs it says you can change this at `Design --> Themes --> Member Profile Templates --> Default --> Registration Form` but I actually don't know what that means.

Is that a path in the admin panel? If so, I don't see any `Design` page or link anywhere. Is it in the file structure? If so, again, I don't see any `Design` directory.

Are the docs out of date or am I missing something?

# Answer
> 1 votes
It is in the Control Panel. If you don't see a design section, it means the user group your member is in doesn't have permission to see the Design section.

**EDIT**

Ahh, for some reason I thought you were using EE2. The area of the documentation you mention is out dated. I will provide the correct link to follow to create a copy of the built in templates so you can edit them freely:

https://docs.expressionengine.com/latest/member/index.html#member-profile-templates

Follow these instruction to copy the templates to your themes folder and then edit them how you see fit.

---
Tags: members, registration, themes, register
---


title: Channel Entries outputing wrong channel

text:
# Question
Title: Channel Entries outputing wrong channel
**EE 5.1.1**

On the home page of the site I am pulling in the latest 3 blog entries with this code:

```
{exp:channel:entries channel="blog" dynamic="no" limit="3"}
<!-- Post Item -->
<div>

    <div class="post-prev-title font-alt">
        <a href="{comment_url_title_auto_path}">{title}</a>
    </div>

</div>
<!-- End Post Item -->
{/exp:channel:entries}

```

However instead of the latest 3 blog entries I get one entry titled homepage, which is the most recent entry in the system.

Have triple checked that the channel name is correct and have `dynamic="no"` parameter set so would expect this to work correctly.

Please advise.

# Answer
Turns out it was user error.

I had the entire template wrapped in another channel entries tag. Once I took the news and made it an embed all was good.
> 0 votes

---
Tags: channel-entries
---


# Question
Title: Low search - match two grid fields (AND)?
I want to use low search to filter entries that matches two grid fields.

Example Grid:

```
first_name    age
John          14
Leon          15

```

When I submit a form where I search for first\_name=John and age between 10 and 20, I only want entries that contains grid rows that matches both John and the age (not OR).

Is this possible?

# Answer
Low Search does support searching for values that fall within ranges, but it looks like you would need to do a bit of template work to get it to work with your example. Check out the documentation here.

HTH
> 0 votes

---
Tags: low-search
---


# Question
Title: Upgrading EE from very old version to current
I have an inherited a very old EE multisite installation that is currently running on EE 2.11.3. Due to its old version of Bootstrap, it isn't even responsive. I was thinking about upgrading to the current, open-source version 5.2.4. I can only imagine how many things could potentially break such as the templates and/or add-ons.

Does anyone have experience upgrading from such an old version of EE and is it even advisable? Thanks for any insight you may have, I am completely new to the EE community.

# Answer
I've done several EE 2.X upgrades to 4.X and 5.X in the last few years, and on some pretty big sites to boot. It is non-trivial, but you can totally do it. Rather the retype a bunch of info, I laid out some strategies I've used successfully in this answer:

Upgrade a site from EE2 to EE5

If you have more specific questions, feel free to ask a new question or edit this one.
> 3 votes

---
Tags: ee, update
---


title: Entries tag search:fieldtype=""

text:
# Question
Title: Entries tag search:fieldtype=""
According to the EE doc, within a channel entries tag you can search a grid field as long as the field color is set to "yes" for Include in search.

I have bot he Grid field and the individual column set to yes, but don't get results when I definitely should. In the example below, there is a Grid titled "product\_application" and one of 3 fields with the title "partno".

```
{exp:channel:entries channel="models" search:partno="={segment_3}"}
    <p>{title}-</p>
{/exp:channel:entries}

```

Has anyone run into difficulties with this?

Russ

# Answer
To use `search` parameter in **Grid** you have to add `search` parameter in *grid fieldtype* not in Channel entries tag. You can get more information from below example. https://docs.expressionengine.com/latest/fieldtypes/grid.html#searchcolumn\_name

```
{grid_field search:partno="search_value"}
    {grid_field:your_grid_field}
{/grid_field}

```

I hope this will works for you. Thanks!
> 2 votes

---
Tags: search, grid, ee5
---


title: Automated entry url numbering

text:
# Question
Title: Automated entry url numbering
OK, EE2 used to do this, but it looks like it has been abandoned by default in EE5.

Before, in EE2, if you put in two entries with the same title, EE would adjust the later one, adding a 1 or a 2 automatically if it spotted another entry that had the same title url. This was very handy for recurring events, like monthly board meetings.

ie,

```
/monthly-board-meeting
/monthly-board-meeting-1
/monthly-board-meeting-2
/monthly-board-meeting-3

```

The later ones would automatically add a number to avoid url conlicts. Is there a way to do that with EE5??

# Answer
> 1 votes
This add-on Willow-Smart-URL-Title will increment the url\_title number (up to 10)

---
Tags: url, url-title
---


# Question
Title: Template partials within a template partial (is that OK?)
I have a template partial within another template partial. And that seems to work.

Is this a coincidence or correctly so?

If it is correct, where to stop with such a nesting? A partial that has a partial in a partial?

Thanks for some clarification.

# Answer
The amount of nesting possible is probably limited by your php environment. I created a recursive template partial called `tp_recurse` containing this code:

```
X {tp_recurse}

```

If I include it in a template the host for the EE instance appears to crash, but takes a while to do so: which suggests that the recursion is executing - which in turn suggests there is scope to nest template partials for quite a few levels I would expect.

HTH
> 0 votes

---
Tags: template-partials
---


# Question
Title: How to create form when second dropdown depends on the first dropdown selection
How to create form that options on second dropdown depends on the selection of the option on first dropdown? The problem is that I have 3 dropdowns and every dropdown depends on the previous one.

For example:

DROPDOWN #1 Options: England / Spain / Italy

DROPDOWN #2 Options: (if England is selected) Premier League / Championship / League One

(if Italy is selected) Serie A / Serie B

DROPDOWN #3 Options: (if Premier League is selected) Saturday / Sunday / Monday

.... ( I hope you get the point)

I tried using this code, but I couldn't find solution for including third or even fourth dropdown options.

```
<select data-target="1">
<option value="">-- Select --</option>

{exp:channel:entries channel="football" dynamic="no" category="22" status="not closed" disable="member_data"}

{country}
<option value="{item:label}">{item:label}</option>
{/country}

{/exp:channel:entries}

</select>

{exp:channel:entries channel="football" dynamic="no" status="not closed" disable="member_data" category="22"}

<select data-group="1" data-target="2" data-ref="{country}">

<option value="">-- Select --</option>
{league}
<option value="{item:label}">{item:label}</option>
{/league}

</select>

{/exp:channel:entries}

{exp:channel:entries channel="football" dynamic="no" status="not closed" disable="member_data" category="22" }

<select data-group="2" data-target="3" data-ref="{league}">

<option value="">-- Select --</option>
{game}
<option value="{game:date-time}">{game:date-time}</option>
{/game}

</select>

{/exp:channel:entries}

```

{game} - that's Grid field {country}, {league} - those are Checkbox fields

# Answer
There is no "native" way to do this in EE since the EE tags are all evaluated prior to the page being built - so once you can see the `select` tags on screen, EE has stopped its evaluation.

You could construct something that simulates the desired behaviour using multiple page loads (i.e. reload the page after each change to the select boxes) but it would be pretty slow / inefficient.

If you do not want to do it using page reloads to populate the second and third selects, you will have to do this using some combination of javascript and AJAX execution.

What you choose depends a bit on how large the possible options are for the second and third selects.

* If there are not so many, it might be easiest to dump all the possible option sets out (e.g. into a javascript array) on page load (and if the options depend on variable data get this info via a json element generated by EE template) and use javascript to populate the second and third options depending on what the selected item in first / second dropdown is.
* If there are many options such that loading them all into a json at start would be a penalty in page loading time, then you should grab them just when needed using AJAX calls to EE (triggered by javascript).

HTH
> 0 votes

---
Tags: grid, checkbox
---


# Question
Title: Can I make a multi-select custom member field?
It looks like you can only make a few custom member field types: Date, Text Input, Textarea, Select Dropdown, URL.

I need to have a multi-select field, such as checkboxes.

What's the best solution for this?

# Answer
The options for custom member fields are currently fairly limited. I believe that in time improvements to the member features of EE will appear, and possibly when they do this constraint will go away. Until then the most common solution is to set up a separate channel to hold member data that won't fit into the available member fields. You can set up the channel with all the fields you need, and include in the entry a field to capture the member id each entry relates to - then retrieve this information using the member ID as and when you need it.

HTH
> 1 votes

# Answer
You can go for Smart Members PRO which allows you to create custom members field like Date, Text Input, Textarea, Select Dropdown and many more. I hope this plugin will fulfils your all requirement of multi-select. Thanks!
> 1 votes

# Answer
Both good options, above. I did something perhaps creative, perhaps stupid, but definitely desperate: Because checkboxes are binary selections, I used a Select Dropdown for each "checkbox" with a Yes/No option. Works OK for a small amount.
> 1 votes

---
Tags: members, custom-fields
---


title: Where does EE define "Total Members?"

text:
# Question
Title: Where does EE define "Total Members?"
I just did an import of members into the EE database, populating exp\_members, exp\_member\_data, and exp\_member\_data\_field\_\* tables. Seems intuitive and worked.

But on the CP homepage, those members aren't being counted in the "Total Members" label.

Anyone know where this value is pulled from? Not the most important thing in the world, but it would be more elegant.

# Answer
> 0 votes
Turns out you must go to Developer \> Utilities \> Statistics and sync the "Members" row.

---
Tags: members
---


# Question
Title: Can I have a member field that admins use but the member can't see?
I have a situation where an admin wants to keep internal notes on members, but doesn't want the members to see their notes. Is there a way to do this?

# Answer
> 0 votes
I ended up modifying line 96 of /www/bbb/system/ee/EllisLab/ExpressionEngine/View/\_shared/form/fieldset.php to only display field, "Admin Comments," to a user if they were logged in the Super Admins group.

```
<div class="field-control <?php if ($setting['title'] == "Admin Comments" && ee()->session->userdata('group_id') !== 1) echo ' hidden ' ?> ">

```

---
Tags: members
---


# Question
Title: Channel entries entry_id parameter issue
EE2.8

If I reorder the IDs in the following entries tag the output order remains the same, why?

```
{exp:channel:entries
  entry_id="2680|396|"
}
  <p>{title}</p>
  <p>{entry_id}</p>

{/exp:channel:entries}

```

I can only get the order to change if one of the IDs are changed.

# Answer
you can use fixed\_order="3|5|10"
> 1 votes

---
Tags: entries
---


title: Checking if a plugin is installed

text:
# Question
Title: Checking if a plugin is installed
new user to ExpressionEngine here. I recently developed a plugin that I'm using to apply a filter to content, but I run into an issue when the plugin isn't installed. Is there a way to check if a plugin in installed and, if it is, apply the filter?

Right now, the syntax is similar to the following:

```
{exp:myFilter}
  {content}
{/exp:myFilter}

```

What I was looking for is something like this

```
{if pluginIsInstalled}
  {exp:myFilter}
    {content}
  {/exp:myFilter}
{elseif}
  {content}
{/if}

```

Thanks in advance!

# Answer
> 0 votes
There is no EE tag (that I am aware of at least) that will report installed plugins directly. However, if you know the **short\_name** of the plugin but you can get what you need using the `exp:query` tag thusly:

```
{exp:query
    sql="SELECT plugin_package
         FROM exp_plugins
         WHERE plugin_package = 'plugin_short_name_here';"
}
    {plugin_package}
{/exp:query}

```

This would return the **short\_name** of the plugin if the plugin is installed, and nothing if not. You can use this behaviour to drive your conditional.

So if the **short\_name** of your plugin is `cats_for_coding` then your code would possibly look like this:

```
{exp:query
    sql="SELECT plugin_package
         FROM exp_plugins
         WHERE plugin_package = 'cats_for_coding';"
}
    {if no_results}
        {content}
    {/if}
    {exp:cats_for_coding}
        {content}
    {/exp:cats_for_coding}
{/exp:query}

```

This works for **plugins** \- if you want to do the same for **modules** use `exp_modules` and `module_name` in the SQL.

HTH

# Answer
> 0 votes
if you use the template manager it'll provide feedback (on hover i believe) if a plugin isn't installed. this kind of logic typically doesn't have a place in the templates: the one coding templates should know wether a plugin is installed i guess

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


title: NSM error in in EE 5.2.6

text:
# Question
Title: NSM error in in EE 5.2.6
When I go to Channel Manager -\> Channels and click Edit (pen) I get this error.

*\> Unable to load requested field type file: ft.nsm\_morphine\_theme.php. Confirm the fieldtype file is located in the /system/user/addons/ directory*

I suppose this is from when I previously had Morphone theme in V2.

Anyone have a fix?

# Answer
I think you'll have to dive into your DB and remove all mentions of morphine in exp\_plugins, exp\_extentions etc
> 0 votes

---
Tags: fieldtype
---


# Question
Title: How do I set X-Frame-Options in config.php
I need to be able to display content from one EE site on another using an iFrame. By default X-Frame-Options for EE is set to "SAMEORIGIN". I know this is set in Core, so I don't want to do the override it there. I have tried doing the following in the config.php file:

```
$config['x_frame_options'] = 'ALLOW-FROM https://mysite.com/xyz'

```

If this is the correct way to do it, it is not working properly. Any insights?

# Answer
> 1 votes
EE has set default `x_frame_options` as `SAMEORIGIN`. You can change that from config but they don't allow you to set anything outside of there radar. You have limited options that is: `'DENY', 'SAMEORIGIN', 'NONE'`. See there core code in `/system/ee/legacy/libraries/Core.php`

```
 * Set iFrame Headers
 *
 * A security precaution to prevent iFraming of the site to protect
 * against clickjacking. By default we use SAMEORIGIN so that iframe
 * designs are still possible.
 *
 * @return      void
 */
private function setFrameHeaders()
{
        $frame_options = ee()->config->item('x_frame_options');
        $frame_options = strtoupper($frame_options);

        // if not specified or invalid value, default to SAMEORIGIN
        if ( ! in_array($frame_options, array('DENY', 'SAMEORIGIN', 'NONE')))
        {
                $frame_options = 'SAMEORIGIN';
        }

        if ($frame_options != 'NONE')
        {
                ee()->output->set_header('X-Frame-Options: '.$frame_options);
        }
}

```

Unfortunately, It is set by EE core, You cannot override it be htaccess. That means you have config set for 3 variables only. `$config['x_frame_options'] = "DENY";
$config['x_frame_options'] = "SAMEORIGIN"; // default
$config['x_frame_options'] = "NONE"; // Your choice to get things working`

I belive that set `x_frame_options` as `none` will make security glitch and not recommend it but its the only possible way with core. To get a proper solution, I will suggest to create a small plugin. If you don't know how to create a plugin, Just follow the steps:

1. Go to `/system/user/addons/` and create a folder named **set\_header**
2. Go to `set_header` folder and create 2 files. `addon.setup.php` and `pi.set_header.php`
3. Copy this code to `addon.setup.php`

```
<?php
return array(
    'author' => 'Amici Infotech',
    'author_url' => 'https://amiciinfotech.com',
    'description' => 'Set page Headers',
    'docs_url' => '#',
    'name' => 'Set page Headers',
    'settings_exist' => false,
    'version' => '1.0.0',
    'namespace'   => 'AmiciInfotech\Addons\Set_header',
);

```
4. Copy this code to `pi.set_header.php`

```
<?php
$plugin_info = array(
        'pi_name'           => 'Set page Headers',
        'pi_version'        => '1.0.0',
        'pi_author'         => 'Amici Infotech',
        'pi_description'    => 'Set page Headers',
        'pi_usage'          => set_header::usage()
    );

class Set_header
{

    function __construct()
    {
        /* Load EE Instance */
    }

    function xframe_options()
    {
        $domain = ee()->TMPL->fetch_param('domain');
        ee()->output->set_header("X-Frame-Options: allow-from " . $domain);
    }

    public static function usage()
    {
        ob_start();
        ?>Set PHP Headers<?php
        $buffer = ob_get_contents();
        ob_end_clean();

        return $buffer;
    }

}

```
5. Install Plugin **Set Header** from backend.
6. Write this code in any template file to allow xframe to that page.

```
{exp:set_header:xframe_options domain="mysite.com/xyz"}

```

# Answer
> 0 votes
I think that's best done in your .htaccess file

---
Tags: config, config-overrides
---


# Question
Title: Freeform form description in user notification emails
How do I add the form description to a user notification email template? I can't see a list of available variables in the documentation, but just about all other variables are listed on the side of the template editor in the CP. I tried {form\_description}, but that didn't work..

# Answer
> 2 votes
{form\_id} is available and you can use the {exp:freeform:form\_info} tag pair as all EE template tags are available now in Notifications as of Freeform 4.

http://www.solspace.com/docs/freeform/form\_info/

But you are correct, we are missing documentation on available variables for notifications. I have made a note for us to create them. Our apologies.

# Answer
> 0 votes
> Blockquote What about {freeform:description:FIELD\_NAME}? I can't seem to use the field description in my email notifications? – Third\_Hyperion Aug 17 '16 at 10:34

I have this issue too. Is this possible?

---
Tags: solspace-freeform
---


# Question
Title: Show Latest Channel Entries Under Single Entrey
I'm trying to show the latest 5 entries in a channel, when a user views an entry within the channel.

At the moment, the code will only show the info for the single entry in both sections. My code is below;

```
<div class="grid">
    <div class="col-2-3">
{exp:channel:entries
    channel="news"
    require_entry="yes"
}
        <h1>{title}</h1>
        {body}
{/exp:channel:entries}
    </div>
    <div class="col-1-3">
        <h2>Top News</h2>
        <ul class="news-headlines">
{exp:channel:entries
    channel="news"
    orderby="entry_date"
    sort="desc"
    limit="5"
}
            <li class="item">
                <h3><a href="{url_title_path=" ee/news-article"}">{title} </a> </h3>
                <p>{excerpt}</p>
            </li>
{/exp:channel:entries}
        </ul>
    </div>
</div>

```

# Answer
Add `dynamic="no"` to the channel entries tag.
> 2 votes

---
Tags: channel
---


# Question
Title: ExpressionEngine Control Panel SSL HTTPS Issue
I have an issue with the HTTPS header for the ExpressionEngine control panel where the JS is being disabled. It keeps generating error messages where HTTP is being loaded over HTTPS (see below):

```
Mixed Content: The page at 'https://domain.com/sitebox/?/cp/homepage' was loaded over HTTPS, but requested an insecure script 'http://domain.com/sitebox/?S=0&D=cp&C=javascript&M=combo_load&ui=core,widget,mouse,position,sortable,dialog,button&plugin=ee_interact.event,ee_broadcast.event,ee_notice,ee_txtarea,tablesorter,ee_toggle_all,nestable&file=react/react.min,react/react-dom.min,json2,underscore,cp/global_start,cp/form_validation,cp/sort_helper,cp/form_group,cp/modal_form,cp/confirm_remove,cp/fuzzy_filters,components/no_results,components/loading,components/filters,components/filterable,components/toggle,components/select_list,fields/select/select,fields/select/mutable_select,fields/dropdown/dropdown&v=1557994073'. This request has been blocked; the content must be served over HTTPS.
?/cp/homepage:1

Mixed Content: The page at 'https://domain.com/sitebox/?/cp/homepage' was loaded over HTTPS, but requested an insecure script 'http://domain.com/sitebox/?S=0&D=cp&C=javascript&M=combo_load&file=cp/global_end&v=1557994052'. This request has been blocked; the content must be served over HTTPS.

```

The base and site URLs have been updated to cater for HTTPS. Also, the SSL is being forced in the .htaccess file and the themes URL should pick up the protocol using the PHP rule below—

```
// Declaring site variables
$domain = $_SERVER['HTTP_HOST'];
$protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://';
$base_url = $protocol . $domain;

// Theme URL
$config['theme_folder_url'] =  $base_url . "/". $themes_folder;

```

The basic troubleshooting has been covered but not having much success.

Can anyone suggest a way around this please?

# Answer
> 0 votes
Your site will load those JavaScript assets from the Control Panel via the `cp_url` setting. Try setting that:

https://docs.expressionengine.com/latest/general/system-configuration-overrides.html#cp\_url

```
$config['cp_url'] = 'https://domain.com/sitebox/';

```

That may not be the exact one, but this isn't a themes path issue, it's a CP path issue. Also check it in your CP settings, as you can set it there as well.

# Answer
> 0 votes
I've had issues with loading js resources on every single EE project I've worked on (5 at this point) and every time I've had to contact the server host and have them whitelist an action in mod\_security. Check your network headers and see if you're getting any 500 status errors.

---
Tags: control-panel, htaccess, ssl, themes, js
---


# Question
Title: Stripe Strong Customer Authentication (SCA) and Expresso Store 1.6.4
I've looked around for answers to this but nothing's really come up. I understand that Stripe is implementing Strong Customer Authentication (SCA) in September 2019. I have a couple of legacy sites, that use much older versions of Expression Engine and Expresso Store. Can anyone provide some guidance on how I can continue to take payments on the site after September 2019? Upgrading the add-on isn't going to work in this case as everything was built such a long time ago, and it would mean a total rebuild.

Thanks!

# Answer
This isn't an answer to your Question, more of a comment but my rep isn't high enough yet :( however the guys at Foster Made who created Expresso Store posted this article which might be worth a read and could possibly help you. You can get in contact with them there too.

https://fostermade.co/blog/exp-resso-store-cartthrob-and-psd-2-strong-customer-authentication
> 0 votes

# Answer
The Cartthrob team (responsible for Expresso Store) replied to me very kindly, saying that they are planning a release that supports SCA requirements. They'd be able to adapt my legacy site (which can't be upgraded) for a fee too, which I think is more than fair.

The team directed me to this link — https://fostermade.co/blog/exp-resso-store-cartthrob-and-psd-2-strong-customer-authentication which answers a lot of questions.
> 0 votes

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


# Question
Title: Does native EE have good menuing options?
I've used Taxonomy or NavEE previously, but I'm now considering keeping it simple, if possible, and using native EE controls for menuing. Anybody have good solutions? That is, something for my content author to use to manage the menu that isn't hard-coded templates. Perhaps some way of utilizing categories (the only thing I know of that has hierarchy)?

# Answer
I found Structure works well, it allows the user to add and move around pages easily and gives you way to generate menus: http://buildwithstructure.com/
> 0 votes

---
Tags: navee, taxonomy, menu
---


# Question
Title: How to stop refreshing stashed append across page loads?
I'm trying a different approach to random ordering and pagination, as this approach seems doomed: (Paginating a random ordered list of tag:related\_entries)

I'm setting the list of IDs in order and then trying to use them in a fixed\_order parameter, which I believe will work with pagination:

```
{exp:stash:parse process="start"}
    {exp:tag:related_entries
        channel="things-to-do"
        disable="category_fields|member_data|trackbacks"
        status="open"
        dynamic="no"
        cache="no"
        orderby="random"
    }
        {exp:stash:append replace="no" name="viewed_ids" scope="user" save="yes"}{entry_id}|{/exp:stash:append}

    {/exp:tag:related_entries}

{/exp:stash:parse}

```

And trying to retrieve like this:

```
{exp:stash:set_list name="entries" parse_tags="yes" process="end"}
    {exp:channel:entries
        channel="channel_one"
        disable="category_fields|member_data|trackbacks"
        status="open"
        dynamic="no"
        cache="no"
        fixed_order="{stash:viewed_ids}"
        limit="3"
    }
        {stash:id}{entry_id}{/stash:id}
        {stash:title}{title}{/stash:title}

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

```

But it's not working quite right, viewed\_ids is getting refreshed every page load.

# Answer
> 0 votes
You could try moving the {exp:channel:entries} sections that shows your results to an embed and then putting a cache time for that embed file

---
Tags: stash
---