# Question
Title: inline editing - how do you guys do this on the front-end?
I am applying a inline editing method that involves colorbox and the backend. below every entry there's a link that opens up an inline popup with the correspondent "edit entry" screen from the backend. it's very usable, and needs almost no additional programming.

but since we have safecracker there must be more evolved methods to do this? like "edit in place". anybody care to share?

cheers stefan

# Answer
> 1 votes
I use Safecracker to edit webpages on the frontend all the time. I find it useful to keep some editors away from the control panel, especially when all they need do is change some text or add an image. Safecracker File is OK for images. I've had problems adding images within text box areas, it depends on which file browser being used. You can do a lot of what can be done via backend CP but not everything.

I tend to open up a new page template with the Safecracker fields and pass the entry\_id via a segment\_X.

It can also be done using modal boxes to give a more inline feel, as you're already doing with backend, but can get tricky refreshing parent page to show the edits made, Javascript or Ajax should help here.

# Answer
> 1 votes
We've done the same as Samsull for custom applications built with ExpressionEngine, where we had a dashboard of information stored in entries, and "edit" links alongside content to edit that information.

We passed those edit URLs to a jQuery lightbox that would load a Safecracker form. You'll probably need to re-output some of the core entry fields, like URL Title, in hidden form fields, but you can limit the visible Safecracker form to just the content field you want the user to edit.

We would set the return URL of the Safecracker form to a particular page URL that just had some JavaScript in it. That JavaScript would close the lightbox and refresh the parent page, which would then display the updated content.

---
Tags: inline-editing
---


# Question
Title: Safecracker Registration: which Channel is Member associated with?
I'm using https://objectivehtml.com/safecracker-registration/. When users register on my site, the `channel` parameter is set different based on certain business rules. Is there a way for me to later on determine which Channel the current member was associated to?

One possible solution is to have a Channel field to store this particular information. Then I can use the Safecracker tag with Safecracker registration's `edit_member="yes"`, access the Channel data, store it in a Stash, then use it for whatever I need it later on. Seems clunky.

Suggestions?

# Answer
I can't say whether or not your approach can successfully be handled by SafeCracker Registration or any of the manage members in channel options. Mainly, because they are typically set-up to assume you will be placing members in a single channel.

That said, I can think of two options:

1. Use a single `members` channel, but different registration forms
2. Match each `members` channel to membership group in EE's Membership Manager

For the first option, yes, you channel could end up with a lot of fields in the backend, but you can only have and display the fields associated to a particular member group to them on the front end. It also means that if you had any shared fields, say like capturing gender, or birthday, you could search specifically in one place, as opposed to having: `gold_member_birthday`, `silver_member_birthday`, `platinum_member_birthday`.

With the second option, if it's doable, you can probably get close to what you want if you match channel names to membership groups. So in EE's Membership Manager, where member groups and permissions are controlled, you have the member groups: `gold`, `silver`, `platinum`.

Then in `channels` your channels are called either: `gold`, `silver`, `platinum` or `member-gold`, `member-silver`, `member-platinum`.

That way, there member\_group and related channel is part of the basic membership management.

The `member_group` would be visible in the list, and would match the designated channel.

Either way, I'd test, with just a small field set and SafeCracker Registration first. There maybe other issues with managing multiple member channels, but I'm not certain if anyone's has ever tried before, so it may work perfectly fine.
> 2 votes

# Answer
I have actually used Safecracker Registration to store members in different channels. The hardest part of this would be moving a member from 1 channel to the other. Safecracker has a number of limitations with this, and if your channels had different field groups that would impose another level of complexity. I have however used the same field group to give different members different access to various channels. But once a member was in a channel, they stayed there. (Even with unique fields as long as a member didn't move channels it should work. Although I might try to use Member Groups if possible.)

So if you need to move members to another channel, it may require an additional add-on. This is a limitation with Safecracker, so all the member modules using SC would all have issues too.

So... to figure out what channel a member belong to, I would just try to use the `{channel_id}` variable inside a Channel Entries loop. There are a number of ways to do it. I am somewhat confused as to why you would need the `edit_member` parameter just to determine to which channel a member belongs. So I am not sure where you a running into the "overkill" stuff with Stash. Stash is just used to workout limitations imposed by EE. It shouldn't be adding any bloat to your page.
> 2 votes

---
Tags: members, safecracker, safecracker-registration
---


# Question
Title: Long open/save for entries with 10-column Matrix fields
I am moving over a thread started on P&T's Get Satisfaction.

I am getting a MySQL timeout saving an entry that had a 10-column Matrix field and some 70 rows. Raising the MySQL limits fixes the immediate problem (we can save), but seems to point at a bigger underlying issue -- entries take a surprisingly long time to save and open, while showing relatively normal benchmarks in EE's debugging panel.

To isolate the problem, I set up a separate, fresh EE install with Matrix as my only plugin. I then created a single channel field with a Matrix of 10 text-only columns.

In this environment, an entry with a single Matrix with 100 rows took 47 seconds to save. However, an entry with 8 Matrix of 13 rows each (104 total rows) took 7 seconds to save. More interesting, the benchmarks for Loading Time, Total Execution Time, and Controller Execution Time were all very reasonable (0.2 to 0.4 or so).

I would like to keep these entries in a single Matrix table, if possible. Is this just an effect of saving a table with this many cells (and a natural limit of EE, Matrix, or MySQL). Or is there's something else at play?

Any insights?

# Answer
Good answer to this issue by Brandon over at the original GetSatisfaction entry: https://getsatisfaction.com/pixelandtonic/topics/error\_2006\_on\_submit

Thanks again, Brandon.
> 2 votes

# Answer
Make sure you’re running the latest version of Matrix. Matrix 2.5 came with a pretty drastic performance boost.

http://pixelandtonic.com/matrix/releasenotes
> 5 votes

---
Tags: add-on, matrix, mysql
---


title: Template files for Site 2 in MSM

text:
# Question
Title: Template files for Site 2 in MSM
Pretty basic question here, but this is my first MSM build.

What is the proper template path/location for Site 2 in MSM?

Should they be within the Site 2 file structure, or should they be with the default site file structure?

Currently, only `admin.php` and `index.php` exist within the site 2 file structure.

# Answer
> 3 votes
MSM should store everything about the site in the default site installation, except for the index.php & admin.php files in the 2nd site that route requests into the install.

You may be able to specify a different path for the template location within the Site 2 context in the CP, but all of your other paths (add-ons, etc) are going to point to the Site 1 install. Makes sense to keep all your code centralized and just see the template files in different subdirectories.

# Answer
> 3 votes
I think you can basically put them wherever you want so long as you set the appropriate template path.

You may want them stored under the "main" MSM installation or you may prefer, as I do, to keep them within each site's directory.

As an example I have an MSM installation running 8 sites and the directories are set up like so (missing out some of the directories for the sake of brevity);

```
htdocs
    'main' site
        index.php
        admin.php
        eesystem
            expressionengine
                templates
                    default_site (templates for the main site)
        images
        etc
    site2
        index.php
        admin.php
        templates
        images
    site3
        index.php
        admin.php
        templates
        images
    site4
        index.php
        admin.php
        templates
        images

and so on...

```

---
Tags: templates, multi-site-manager
---


# Question
Title: Logging into CP in EE 1.x after migration
I just inherited an EE 1.6.7 project. I'm attempting to log into /system in my local dev environment and each time I'm just redirected to the CP login page, which does not have any images or styles.

I remember from way back when that it's doing this because the Site URL & other paths don't match. I also remember (and was just reminded when I blew things up) that I can't modify these values in the database directly.

What's the solution to be able to log into the CP homepage in a different environment than what's stored in the database?

# Answer
I tried a number of different options to try to get this to work. Dug up a post on setting 1.6.7 to use dynamic URLs & paths to try to enable the CP in my local dev environment:

http://old.kennwilson.com/2007/11/configuring-expression-engine-for-multiple-servers

When I was still unable to log in, I ended up following this advice:

> Generally it helps to change admin part to session only or cookies only, I like session only but it seems some hosting companies have session encrypted and that can cause problems. Also, in Chrome I have extension for cookies, so I delete cookies when such things happen. And second problem I can have is when I do test, login to test without a problem, go to production, and cannot login or when I go from one client to another on another server only because I opened different CPs several times.
>
> Try that ... change session only or cookies and session to cookies only or vice versa, delete browser cache and try again OR of you do it several times and it does not work, wait for few minutes.

Simply clearing the cache & deleting cookies did not work. I had to change the following from:

```
$conf['admin_session_type'] = "c";

```

to:

```
$conf['admin_session_type'] = "s";

```

Then I was able to log in.
> 3 votes

# Answer
When this happens to me, I clear browser cache and add the following into my config file:

```
$conf['cookie_domain'] = "";
$conf['cookie_path'] = "";
$conf['cookie_prefix'] = "";
$conf['admin_session_type'] = "cs"

```
> 0 votes

---
Tags: control-panel, login, ee1
---


# Question
Title: P&T List: Information wrapped in quotes dropped on save
We are using P&T List for one of our channels. On save, all content wrapped in quotes is dropped.

So:

> "I like beautiful melodies telling me terrible things." ― Tom Waits

is saved as:

> — Tom Waits

Of note, placing a space before and after the quote mark keeps the full text, so:

> Clear the thistles and brambles, Whistle " Didn't He Ramble "

...will save as entered.

This is an issue especially since we are looking to enter dimensions in the P&T list field (like 3" x 4.25")

Of note, the issue appears intermittently, deleting content between quotation marks on roughly 80-85% of the saved entries, but leaving a lucky few to survive. As of yet, we haven't been able predict which ones are saved.

# Answer
> 2 votes
Try installing the GitHub version of the **Pixel & Tonic List field** which should fix this issue for you.

---
Tags: fieldtype
---


# Question
Title: Ajax call via external embedded javascript?
i want to load some images on a click event from an external loaded javascript. At the end of the template i manage my loaded scripts via modernizr load and yep nope. On click of some of the elements i want to load a html snippet with some ee related tags for the different channel entries.

The snippet look like this:

```
{exp:channel:entries channel="news" status="open" dynamic="off"}
<article class="close">
    <h2>{title} TEST</h2>
</article>
{/exp:channel:entries}

```

As i said i use jQuery to manipulate the dom, but i'm not able to start an ajax call like this

```
function loadSlider(element)
    {
        $(element).load("/system/expressionengine/templates/snippets/newswall_news.html");
    }

```

i get only an 403 error?

Tried it also as test to put the html snippet in the root folder, but the ee tags don't get parsed?

Any help on this would be great.

Peter

# Answer
> 4 votes
You're currently accessing the template from the wrong URL. EE writes URL's based off the template groups from the root of the site: `index.php/template_group/template_name`. If you're removing `index.php` from the URL, just remove it from the snippet below and this should work:

```
$(element).load("index.php/snippets/newswall_news");

```

---
Tags: ajax
---


# Question
Title: Get specific value without having to loop with db class
So I am trying to get a specific setting out of the database. And it seems that most of the CodeIgniter DB actions don't work in ExpressionEngine( http://ellislab.com/codeigniter/user-guide/database/results.html)

I am wanting to do something like this:

```
$facebook_id = $this->EE->db->some_db_function('table_name', array('column_name', 'value'));

```

And that would create a query like this:

```
Select column_name FROM table_name WHERE column_name=`value`;

```

Just in case there is any confusion, here is my actual code currently:

```
$query = $this->EE->db->get_where( 'fb_photo_settings', array('setting_name' => 'facebook_id') );

```

But that returns an object and I'm wanting to just run a query that returns just the value.

And it just returns the value in the field, not an object or an array just the value. Is there any way to do this. And if not - how can I use the result() type functions on the link above?

Thanks.

# Answer
To get a single value, you want to use the `row()` method on your `$query` object:

```
$this->EE->db->select('my_col');
$query = $this->EE->db->get_where( 'fb_photo_settings', array('setting_name' => 'facebook_id') );
$var = $query->row('my_col');

```

To get an object with a whole row:

```
$query = $this->EE->db->get_where( 'fb_photo_settings', array('setting_name' => 'facebook_id') );
$row = $query->result_array();

```

Always a good idea to check for the existence of results first though:

```
if($query->num_rows() > 0)
{
    // do stuff with $query
}

```

All of CodeIgniter's Active Record querying methods should work in EE. You can even load Database Forge to create and edit tables via `$this->EE->load->dbforge()`.
> 5 votes

---
Tags: database, module, query
---


# Question
Title: fetch_param when you only know a portion of the param name
I'm working on extending the external\_entries plugin to support a SQL LIKE clause, using the "searchlike" param that was mentioned here:

As and example if I wanted to find all rows of an external table in that had a date of 2013 I would use the param searchlike:date="2013%".

Is there a way to use `fetch_param` (or something akin to it) with a param name that you only know the beginning of?

# Answer
> 5 votes
The full array of tag params is stored at $EE-\>TMPL-\>tagparams. So you can grab them like so:

```
// Get the EE instance
$EE = get_instance();

// Get all of the current tag params
$all_params = $EE->TMPL->tagparams;

```

From there you can loop through and find all of the params that begin with “search:” like this:

```
// Find all of the search:xyz params
$search_params = array();

foreach ($all_params as $name => $value)
{
    // Does this param name start with "search:"?
    if (strncmp($name, 'search:', 7) === 0)
    {
        // Chop off "search:" and save it
        $search_target = substr($name, 7);
        $search_params[$search_target] = $value;
    }
}

```

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


# Question
Title: Updating a Playa select field in a Safecracker form
Here's my scenario: I've got 2 channels, accounts and leads. The leads channel has a playa field (single select) that relates to accounts. Then I have a safecracker form that allows users to create a new lead entry. Everything works fine.

However, the current workflow dictates that the account must already exist before a lead can be associated with it. The ideal solution would allow the user to either choose an existing account, or create a new one without leaving the page, and updating the playa field with the new account.

I managed to get halfway there by placing a link beside the playa field which fires a modal with another safecracker form for the account creation, and using ajax to refresh playa select field. After adding the account entry, the new entry shows up in the playa select field, but when I submit the lead form, the playa field isn't being saved to the entry.

Has anyone tackled a similar problem? I would love to hear your solution/s.

Thanks,

Fabian

# Answer
This may or may not be what you're looking for as I only really glanced at your question. I had a problem with playa fields in that I was using the wrong name on the select.

For example if your playa field name is lead\_account, rather than declaring your select with the name: lead\_account you specify it as lead\_account\[selections\]\[\]

Conor
> 3 votes

---
Tags: add-on, safecracker, playa
---


title: Information isn't updating & tracing

text:
# Question
Title: Information isn't updating & tracing
When submitting my form that stores my `facebook id` it is sent to the method `save_settings()`. No matter what I do I can't dump variables or echo them out to see what is being sent, so I think this is because it's not actually getting to the method for whatever reason. My form action params are:

```
index.php?S=32016fcb4a352c152f953d5a97d8efb6a290edfc&D=cp&&method=save_settings&method=save_settings

```

I'm wondering if having the double `&&` is an issue. Here are my URL vars controlling this:

```
public function __construct()
    {
        $this->EE =& get_instance();
        $this->_base_url = BASE . AMP . 'C=addons_modules'.AMP.'M=show_module_cp'.AMP.'module=facebook_photos';
        $this->EE->load->helper('text');
    }

```

And here is the form variable sent to the form

```
$data = array(
        'form_action' => $this->base_url . AMP . 'method=save_settings',
        'facebook_id' => $results->setting_value
    );

```

Thanks.

# Answer
Ok so I figured out the issues, my `form_action` variable was linking to `$this->base_url` instead of `$this->_base_url` that I had set at the beginning. This then sent the POST information to the correct path.

Then I was able to troubleshoot the PHP like I normally would by dumping variables out to see why the redirect wasn't working. The redirect wasn't working because of the necessary `AMP` after `BASE`.

Finally the database is updating as I put the full table name of `exp_fb_photo_settings` vs `fb_photo_settings` I was using in the dbforge function on the install script.

Thanks.
> 1 votes

---
Tags: php, database, module
---


# Question
Title: How do I set a conditional on Paginated pages?
I am trying to set a conditional on a navigation element using segmentation, and this works fine except when I hit the pagination stuff.

The pagination is in increments of 50 so I tried the following but it only works if the page is P50.

```
<ul>
<li><a {if segment_2 == "" OR segment_2 == "article" AND segment_2 >="P50"}class="active"{/if} href="{site_url}news/">Clean Energy News</a></li>
<li><a {if segment_2 == "releases"}class="active"{/if} href="{site_url}news/releases">News Releases</a></li>
<li><a {if segment_2 == "multimedia"}class="active"{/if}{if segment_2 == "photos"}class="active"{/if} href="{site_url}news/multimedia">Multimedia</a></li>
<li><a {if segment_2 == "archive"}class="active"{/if}href="{site_url}news/archive">News Archive</a></li>
</ul>

```

Is there a conditional I can put on segment\_2 that will work? Note that I have other nav elements that I don't want it to interfere with. Thanks!

# Answer
> 3 votes
Take a look at the **MD Detect Page Type** or **Switchee** addons.

# Answer
> 1 votes
For navigation, whether I am using an embed method or the template partials with Stash approach, I find it easier to pass a parameter specifying which section I want active rather than trying to detect it manually.

In my experience there is always an edge case requiring a more manual / granular approach that will defeat any automatic setup down the road.

**Embeds**

In main template

```
{embed="embeds/.header" active_nav="articles"}

```

In embedded template

```
<ul>
    <li><a{if embed:active_nav == "articles"} class="active"{/if} href="{site_url}articles/">Articles</a></li>
    <li><a{if embed:active_nav == "news"} class="active"{/if} href="{site_url}news/">News</a></li>
    ...
</ul>

```

**template partials**

In partial template

```
{embed="layouts/.main"}
{exp:stash:set_value name="active_nav" value="articles"}

```

In layout (.main) template

```
<ul>
    <li><a{if "{exp:stash:get name='active_nav'}" == "articles"} class="active"{/if} href="{site_url}articles/">Articles</a></li>
    <li><a{if "{exp:stash:get name='active_nav'}" == "news"} class="active"{/if} href="{site_url}news/">News</a></li>
    ...
</ul>

```

**Variant with body class only**

In partial template

```
{embed="layouts/.main"}
{exp:stash:set_value name="body_class" value="body_articles"}

```

In layout template

```
<body{if {exp:stash:not_empty name="body_class"}} class="{exp:stash:get name='body_class'}"{/if}>

<ul>
    <li class="articles"><a href="{site_url}articles/">Articles</a></li>
    <li class="news"><a href="{site_url}news/">News</a></li>
...
</ul>

```

in your CSS

```
.body_articles .articles > a
{
    do something
}

```

From the two add-ons mentioned by Anna, I would go down the switchee route

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

    {case value="#^P(\\d+)$#|''"}
        code if pagination page
    {/case}

    {case default="Yes"}
        code if not a pagination page
    {/case}

{/exp:switchee}

```

The advantage of switchee beeing that, if you have channel entries loops or anything heavy process-wise, it only get executed should the tested condition apply. Better for performance.

---
Tags: conditionals, navigation
---


# Question
Title: How can I allow directory access to public
I have a website with expressionengine. website struture is

/system

-- Codeigniter

---- system

-- expressionengine

/test

I have a folder test, I would like to make it accessible to public. I am not getting anything from htaccess.

How can I done it?

# Answer
> 2 votes
First - I'm presuming you're serving on a Unix system. You'll require either shell access to the directory or s/FTP access that can change owner and permission

You have to give the public Read Access on the folder and the files (via chmod). You also might want to make sure the owner of the files only ('chown') are your web-user (often something like www-data).

Remember - read only, not write access (which is also delete access).

Look at this brief tutorial from Dartmouth and get up to speed on how to open up permissions to your files, but seriously - use it with care. The wrong permissions and ownership can mean compromising your installation. Also, I would only allow access to a directory in the /images/uploads/ path - that's what it's intention is there for.

# Answer
> 0 votes
Public directory aren't really the realm of ExpressionEngine, that's a basic website question, which maybe more appropriate for Stackoverflow. That said, the general conditions for making a directory public is to make it *world writable* using permissions. World writable is consider `777` or `rwxrwxrwx` permissions.

Generally, your ISP will provide you some access to change permissions of files and directories within your public\_html folder. Most FTP applications also provide the opportunity to visually change permissions, so that you don't need to know the unix `chmod` command. Obviously, there can be security implications for making a folder world readable, generally you don't want to allow executable files in those directors, more like images, pdfs, etc.

---
Tags: htaccess
---


title: DevDemon module Tagger with Safecracker

text:
# Question
Title: DevDemon module Tagger with Safecracker
Have an issue with using DevDemons Tagger with Safecracker. Know this has been working before, so the syntax "should" be right.

Running EE 2.5.5 and TAGGER 3.0.6

The code (I totally stripped all css for testing) looks something like this on the site:

```
{exp:safecracker channel="patricks_blogg" include_jquery="yes"}
<label for="patricks_blogg_tags" class="clearfix">Taggar</label>
{field:patricks_blogg_tags}
{/exp:safecracker}

```

The error I get is:

```
Error Number: 1054

Unknown column 'ip_address' in 'where clause'

SELECT `hash` FROM (`exp_security_hashes`) WHERE `ip_address` = '80.217.184.33' AND `date` > UNIX_TIMESTAMP()-3600 LIMIT 1

Filename: third_party/tagger/libraries/tagger_helper.php

Line Number: 221

```

Any ideas?

# Answer
> 3 votes
We have resolved this error in the most recent update of Tagger. You can download it here:

http://www.devdemon.com/tagger/

Brad

# Answer
> 3 votes
You need to check for an update for Tagger. Looks like maybe you updated to either EE 2.5.4 or 2.5.5. Ellis Lab made some security changes which removed the IP address or moved it. But this caused a number of errors in various Add-Ons.

The last release of Tagger was before Ellis Lab released the security changes in EE 2.5.4 and EE 2.5.5. From Devot-ee it says Tagger 3.0.6 was last updated on November 20, 2012. Ellis Lab released EE 2.5.4 on the 18 Dec 2012 (it broke a number of Add-Ons), then they updated to EE 2.5.5 on 20 December 2012 for a date issue.

This means you need to contact DevDemon and find out if the plan to release a fix for Tagger soon. It's possible if you contact them via their support form they may send you a new build, that hasn't been officially released. It looks like the did for someone else based on the support forums.

---
Tags: safecracker
---


# Question
Title: Show a combined Solspace User and native Member entry count?
I have an existing DB with entries that have been assigned to authors via the native Members module as well as Solspace's User module.

Unfortunately, the User module doesn't take into account entries that have been assigned to a member via the native module when using the `exp:user:entries` loop — and the opposite is true as well, of course. This means that, on a user profile page, there's no way to get a list of entries using both assignments.

How can I get a list of results that includes both assignments?

Updated to say: the issue is entries with multiple authors. Some entries have User data (entries with multiple authors) and some don't. I may end up manually having to enter User data for all entries, but there are a few hundred.

(I'm guessing we might have to head into Query territory, which is just beyond my capabilities at the moment.)

# Answer
You are correct - when using the User Authors feature, all authorship data is stored in the `exp_user_authors` table.

This script should fill in the gaps in your User Authors table for you. Backup your database, create a new template, enable PHP on it, put this in it (replace `$channel_id` at the top with your actual `channel_id`), then load the template i your browser:

```
<?php

$this->EE =& get_instance();

$channel_id = 1;

$entries = $this->EE->db->query("
    SELECT entry_id, author_id, entry_date
    FROM exp_channel_titles
    WHERE channel_id = $channel_id
");
if($entries->num_rows() > 0)
{
    foreach($entries->result_array() as $entry)
    {
        extract($entry);
        // Make sure an author entry doesn't already exist
        $existing = $this->EE->db->query("
            SELECT entry_id
            FROM exp_user_authors
            WHERE entry_id = $entry_id
            AND author_id = $author_id
        ");
        if($existing->num_rows() == 0)
        {
            // No entry exists, so insert it
            $data = array(
                'author_id' => $author_id,
                'entry_date' => $entry_date,
                'entry_id' => $entry_id,
                'principal' => 'y'
            );
            $this->EE->db->query(
                $this->EE->db->insert_string('exp_user_authors', $data)
            );
        }
    }
}

?>

```
> 2 votes

---
Tags: add-on, members, query, solspace-user
---


# Question
Title: How do I increase the attachment size limitation and formats in Forums?
I am working with Forums 3.1.9 on EE 2.5.5 and have run into some limitations that should be modifiable.

1. Attachment file size: I see this note:

> Attachments Max Size: 75KB

How can I increase this?

1. Upload file type. If I try to upload a PDF for a Word document I get the following error:

> The filetype you are attempting to upload is not allowed.

I checked /config/mimes.php and both .doc and .pdf files are listed. Do the forums have a difference mimes controller?

Thanks!

# Answer
This **EE StackExchange question** will help you with your mime type issue.

---

You can adjust Forum attachment settings here:

> CP \> Modules \> Discussion Forum \> Forum Management \> Default Preferences \> Attachment Preferences.
> 1 votes

---
Tags: file-uploads, forum
---


# Question
Title: maintain logged-in status across sub-domains?
Is there a way to maintain logged-in status across sub-domains? I've tried adding a cookie prefix in config.php to no avail... not sure what else to try.

James

# Answer
It seems like you can set a "cookie\_domain" variable to the config.php. Just figured this out by having a quick look at expressionengine/core/EE\_Config.php around line 277. For cross sub domains persisting cookie, I believe your domain should be one of the seven special ones (http://wp.netscape.com/newsref/std/cookie\_spec.html). In short $config\['cookie\_domain'\] = ".yourdomain.com" would be worth a try!
> 5 votes

# Answer
You need to enable multi-site login via the `config.php` file. You add a statement like:

```
$config['multi_login_sites'] = "http://domain.org/|http://domain2.org/";

```

for each site/domain that they are logging into. Now the downside of this, is if you are logging them into a number of sites, the user will see a series of login flashes, from the EE successful login screen. I'm not certain if there is a way to remove that.

I know for the clients we've done this for, we reduced the multi-site logins to just the sites were people could place orders, submit forms, etc., as opposed to trying to login them into all sub sites at once.

If there are a lot of sites, and the user needs to be logged into all of them, then I recommend taking a look at this Stackoverflow question and response, on how sites like Facebook handle it.
> 3 votes

---
Tags: cookies, subdomain, authentication
---


title: Using Stash to Filter by Category

text:
# Question
Title: Using Stash to Filter by Category
I am trying to use stash to kill multiple queries to the same channel in multiple places in the site/page. This is my stash embed file called 'featured.html':

```
        {exp:channel:entries channel="homepage_featured_items" dynamic="no" show_expired_entries="yes" orderby="date" category='40|41|42|162' disable="member_data|category_fields|pagination"}
      {exp:stash:append_list name='featured_list'}
        {stash:this_category}{categories}{category_id}{/categories}{/stash:this_category}
        {stash:article}
          <article class="col_4 col left">
              <header>
                <h4><a href="{featured_item_link}">{featured_short_text}</a></h4>
              </header>
              <div class='article-content'>
                <p><a href="{featured_item_link}">{featured_short_description}</a></p>
              </div>
              {exp:ce_img:pair src="{featured_image_home}" width="220" height="150" crop="yes|center,top|0,0"}
                <img src="{made}" alt="{title}" width="{width}" height="{height}" />
              {/exp:ce_img:pair}
          </article>
         {/stash:article}
      {/exp:stash:append_list}
    {/exp:channel:entries}

```

And I would like to bring different categories in like so:

```
<div id="featured_home">
    {exp:stash:embed:featured}
    {!-- 40,41,42,162 --}
    {exp:stash:get_list name="featured_list"  match="#^.*40.*$#" against="this_category" limit="1"}
      {article}
    {/exp:stash:get_list}
  </div>

```

But for some reason I am getting nothing. I put output='yes' on my stash embed append\_list tag and I got all of the information I am looking for (albeit more articles than I wanted), but I can't call the context or the category. Ideally I would like to call these all over the page(s) of the site:

{exp:stash:get\_list name="featured\_list" match="#^.*40.*$#" against="this\_category" limit="1"} {exp:stash:get\_list name="featured\_list" match="#^.*41.*$#" against="this\_category" limit="1"} {exp:stash:get\_list name="featured\_list" match="#^.*42.*$#" against="this\_category" limit="1"} {exp:stash:get\_list name="featured\_list" match="#^.*162.*$#" against="this\_category" limit="1"}

Also, am I saving anything but multiple calls in this instance? Should I be looking for a context in this case?

# Answer
> 2 votes
OK, finally figured it out with much tweaking and changing elements. Since the output='yes' tag spit out the correct information for all articles, it was a matter of realising the embed was being triggered and not the get\_list tag. The parse order was not allowing the stash:append\_list tag to fire before the stash:get\_list tag. I simply put process='start' to subvert the parse order and it works perfectly.

```
{exp:stash:embed:featured process='start'}
    {!-- 40,41,42,162 --}
    {exp:stash:get_list name='featured_list' match="#^.*40.*$#" against="this_category" limit="1"}
      {article}
    {/exp:stash:get_list}
    {exp:stash:get_list name='featured_list' match="#^.*41.*$#" against="this_category" limit="1"}
      {article}
    {/exp:stash:get_list}
    {exp:stash:get_list name='featured_list' match="#^.*42.*$#" against="this_category" limit="1"}
      {article}
    {/exp:stash:get_list}
    {exp:stash:get_list name='featured_list' match="#^.*162.*$#" against="this_category" limit="1"}
      {article}
    {/exp:stash:get_list}

```

On the other note, the queries on the page went down by eight overall queries, which tells me that this is worth the effort in stashing this away. On a big site with a lot of traffic that's 8 less queries per page call that ever hit the database.

---
Tags: stash
---


# Question
Title: Channel entries not automatically filtered by language when using Transcribe
Hello fellow ExpressionEngineers,

I'm in the process of translating the website of one of my companies. It was made in french and I'm doing the english language translation. For that job, it seemed like the rather new EEHarbor's Transcribe module was fit for the job. I think I've got a pretty good understanding of how it should work. The problem is that I can't make it show the proper channel entries regarding the current language. It will always show all entries for the channel no matter if they are in french or in english.

To give you a little background, EE install is 2.5.5, and I'm not using a lot of modules/plugins : NSM Better Meta, NSM Morphine, NSM Live look, NSM Bootstrap, Wyvern, Low Seg2Cat, Detour, Entry Lottoree, Minimee. Nothing too fancy and all up to date.

Following is an example of one of my channel tags :

```
{exp:channel:entries channel="features_at_glance" dynamic="no" order_by="date" sort="asc" limit="4" {global:param_disable_default}}
<li>
<div class="inner">
<h4 style="background-image: url('{site_url}{feature_at_glance_icon}');">{title}</h4>
<p>{feature_at_glance_content}</p>
</div>
</li>
{/exp:channel:entries}

```

{global:param\_disable\_default} comes from NSM Bootstrap and is replaced by disable="categories|pagination|member\_data".

I have tried removing every params from the channel without any success. It's still showing every entries for the channel even if you are supposed to view the english version of the website.

Transcribe is configured like so:

Settings

* Default language: French
* Add language prefix to URL: Defined per language
* Transcribe enabled: yes

Languages

French has "add language prefix to URL" set to "no" while english has it set to "yes" (French being the default language, I obviously don't want it prefixed for SEO reasons).

Also, please note that I have also var dumped some var like language\_id in Transcribe source code to verify that the proper language was being used and I was able to confirm it was at least correctly detected.

Any ideas what I'm doing wrong?

Thanks!

# Answer
> 2 votes
I've finally figured out what was wrong :

First of all for Transcribe to correctly work it looks like, at least for my install, that the setting "Cache Dynamic Channel Queries?" from "Global Channel Preferences" must be set to "No".

Then you need to figure out the extensions that are using the "channel\_entries\_query\_result" (a search in the exp\_extensions table does help). In my case the EEHive Entry Lottery extensions was creating the problem. I have yet to figure out why...

# Answer
> 0 votes
It sounds like your channel short name may not be correct. Try a copy and paste to be sure the channel short name is correct.

---
Tags: channel-entries, extension, transcribe
---


# Question
Title: How can I prevent a {switch} tag from cycling unless a Switchee case or advanced conditional is true?
I have a channel entry loop that is outputting entries from three different channels. Entries from each channel are marked up differently, so I have a Switchee case with the value of `channel_short_name` to determine which channel the entry is in and then output the appropriate markup.

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

{case value="channel_one"}

... (Channel one markup)

{/case}

{case value="channel_two"}

... (Channel two markup)

{/case}

{case value="channel_three"}

... (Channel three markup)

{/case}

{/exp:switchee}

```

Within one channel, I need to have two different layouts (based on status) and cycle between classes. I'm trying to accomplish this by nesting another Switchee case using `status` as the value and `{switch}` to cycle classes.

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

{case value="channel_one"}

... (Channel one markup)

{/case}

{case value="channel_two"}

... (Channel two markup)

{/case}

{case value="channel_three"}

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

   {case value="Featured"}

   <div class="channel-three featured">
      <div class="{switch="class-a|class-b}"></div>
   </div>

   {/case}

   {case default="yes"}

   <div class="channel-three not-featured">
      <div class="{switch="class-one|class-two|class-three}"></div>
   </div>

   {/case}

   {/switchee}
{/case}

{/exp:switchee}

```

Finally, the issue I am having is the `{switch}` markup nested in Switchee seems to cycle on every entry, wether the case it is wrapped in is true or not.

The output is something like this.

```
<div class="channel-three featured">
   <div class="class-a"></div><!-- Expecting class-a -->
</div>

<div class="channel-three not-featured">
   <div class="class-two"></div><!-- Expecting class-one -->
</div>

<div class="channel-three featured">
   <div class="class-a></div><!-- Expecting class-b -->
</div>

```

Is `{switch}` working as expected? Is there a different approach I should take on this? Any other plugins I should try?

# Answer
This can probably be done on the CSS side of things also. Just set the class to something to identify the channel and use `nth-child(3n+0)` to style them differently.

http://www.w3schools.com/cssref/sel\_nth-child.asp
> 1 votes

---
Tags: add-on, conditionals, switch, advanced-conditionals
---


# Question
Title: Making a select-type custom profile field actually *required*
I am running a pair of sites using MSM and although I have a separate registration form for each site (i.e. different template, different URL), there is no way of actually linking a newly registered user to the site they registered for - as all new users end up in the same "Pending" list, regardless of which form they filled in.

This is one of the strange features of MSM, where some membership features are site-specific and others are not.

So, I want to create a required custom profile field that will force users to specify which of the two sites they want to join.

The simplest way to do this, it seemed to me, without forcing the user to write out the site name by hand, is to have a drop-down select menu:

Label: Which site? placeholder: \[select a site\] option1: site1 option2: site2

Unfortunately there seems to be no way to make select-type profile fields "required" as the system never perceives them as empty - even if I leave the placeholder position empty.

Can anyone suggest a way around this problem?

Or suggest an alternative way of linking new registrations to the site they have registered for?

(I know that I could have them placed automatically into a site-specific member group, but then you lose the ability to activate multiple users while sending an activation email - which you get when using the "Pending" list; something my client wants to keep).

Many thanks

Chris

# Answer
> 1 votes
Make it a hidden submit field, on each registration form, so that way the user doesn't have to complete it at all.

```
<input type="hidden" value="site1" name="site_name" />

```

Where `{site_name}` would match whatever field you decided to use.

**For example**, if you were using ExpressionEngine's built-in registration process or say Solspace's User that allows you to more readily customize those forms, then the actually field might be…

```
<input type="hidden" name="m_field_id_5" value="Site 1" class="input" maxlength="100" size="40" style="width:100%;" />

```

or

```
<input type="text" name="m_field_id_5" value="Site 1" class="input" maxlength="100" size="40" style="width:100%;" />

```

The first makes it a hidden field, the second, just a regular input field with a pre-filled value. The hidden field is better, since you don't need the user to modify the data.

But assuming you aren't placing members into channel data, like Profile:Edit, Zoo Visitor, and Safecraker Registration allow, then you'll need to look up the actual name of the member field. Despite their labels of say 'Organization' or 'Site Name', they generally have field names such as `m_field_id_5`, `m_field_id_6` etc.

---
Tags: members, multi-site-manager
---


# Question
Title: IS_FREELANCER errors on updating to 2.5.5
Getting this error when updating to 2.5.5 from 2.5.4:

```
A PHP Error was encountered
Severity: Notice
Message: Use of undefined constant IS_FREELANCER - assumed 'IS_FREELANCER'
Filename: core/EE_Config.php(197) : eval()'d code
Line Number: 1

```

I updated using the quick method via this blog post: http://ellislab.com/blog/entry/expressionengine-2.5.5-released

Do I need to set a config variable for IS\_FREELANCER in my config.php?

# Answer
I asked the Structure crew for some help and they supplied me with a hotfix for the issue. I believe it is built into the stable version now.
> 1 votes

---
Tags: updating
---


# Question
Title: Upgraded to Matrix 2.5.2, now getting white screens
Earlier today, I updated my site to Matrix 2.5.2 and now, I'm getting white screens on all sorts of channel entries that have a Matrix field.

I get white screens inside the CP when I edit an existing entry that has a Matrix field and also when I view that entry on the front-end.

I do **not** get white screens when I go to publish an entry in a channel with a Matrix field.

To verify that it was, indeed, Matrix causing the issue, I pulled up an entry that did not have a Matrix field. I then added a Matrix field to its channel, and got a white screen. Removing the Matrix field returned the normal, expected behavior.

FWIW, I am using ExpressionEngine v2.5.5 with 64M of memory in PHP.

# Answer
> 3 votes
Is it possible that you've uploaded the files and not visited Add-ons \> FieldTypes \> Matrix? You'll need to visit those fieldtype settings to run the database updates.

There is a GetSatisfaction question with some additional information on this, might need to re-enter the license key as well.

# Answer
> 0 votes
White screens in ExpressionEngine pretty much always mean there is a memory issue and I'm fairly sure this is the case for you after your upgrade. It sounds like you have large images stored in these Matrix rows. You can confirm that a memory error is the cause by looking at your PHP error log.

You can increase your php memory a couple ways depending on what your web host allows:

1. Increase the `memory_limit = 96M` variable in your php.ini file
2. Add `php_value memory_limit 96M` to your .htaccess file
3. Add `ini_set('memory_limit', '96M');` to your config.php file or the main matrix module file

You'll need to increase the memory number until the white screen goes away. Then I'd suggest reuploading images with smaller file sizes if this isn't a daunting task and reducing the memory back to your normal level.

---
Tags: add-on, matrix, white-screen-of-death
---


# Question
Title: Linking new member registrations to a specific site in MSM
This question is a parallel to this question

Making a select-type custom profile field actually \*required\*

but it seemed correct to separate the two aspects in two different questions.

I am running a pair of sites using MSM and, although I have a separate registration form for each site (i.e. different template, different URL), there is no way of actually linking a newly registered user to the site they registered for - as all new users end up in the same "Pending" list, regardless of which form they filled in.

This is one of the strange features of MSM, where some membership features are site-specific and others are not.

Is there anyway of linking new registrations to the site they have registered for?

I know that I could have them placed automatically into a site-specific member group, but then you lose the ability to activate multiple users while sending an activation email - which you get when using the "Pending" list; something my client wants to keep.

I have tried creating a custom profile input field and placing in the registration form as a hidden input field with its value fixed, but if the field is not configured as visible on the registration form, the system won't write the content in the database; and, if it is visible amongst my custom profile fields and is included in the form as a hidden input field, then it is effectively appearing twice.

Many thanks

Chris

# Answer
> 1 votes
To my knowledge, there is not a way to link the member to their member site while they are in pending status using EE's native code.

With that said, your approach of using a custom member field is the correct one. **Your other question** will help you figure our how to get this field correctly working in your registration field.

---
Tags: members, multi-site-manager
---


# Question
Title: 2x Playa single select in Safecracker form loaded via AJAX
I'm having trouble displaying two Playa single select fields in a SafeCracker form that is dynamically loaded via Ajax with jQuery. I have tried everything suggested in P&T's Get Satisfaction support area, but nothing's working.

Here is my case:

I have a channel named Orders and a channel named Traders. When I make a new order, I want to assign a Buying trader and Selling trader via a Playa field.

I have a **site/index** template that is loading **orders/\_orders** template via ajax.

In the **order/\_orders** template is a **exp:channel:entries** loop wit all my Orders. There is also a SafeCracker form around 3 checkboxes in each order.

Every order has an Edit button, that, when clicked, loads a SafeCracker form for that particular Order via Ajax. The template is: **orders/\_order-editForm/{entry\_id}**

The edit Order form containing the SafeCracker form holds two Playa single select fields which are embedded like this (one for Buyers and one for Sellers):

```
<select class="chzn-select" name="buyer_trader[selections][]" style="width:200px;">
{embed='orders/_order-buyer-dropdown' entry_id="{buyer_trader}{entry_id}{/buyer_trader}"}
</select>

```

and

```
<select class="chzn-select" name="seller_trader[selections][]" style="width:200px;">
{embed='orders/_order-seller-dropdown' entry_id="{seller_trader}{entry_id}{/seller_trader}"}
</select>

```

As you can see I'm embedding the entry\_id of the selected buyer and seller to set the corresponding buyer and seller as 'selected' in the select field inside the embedded template.

Inside the **orders/\_order-buyer-dropdown** and **orders/\_order-seller-dropdown** templates, I have the **exp:channel:entries** loop like this:

```
{exp:channel:entries channel="traders" dynamic="no" disable="categories|member_data|pagination"}
<option value="{entry_id}" {if "{entry_id}" == "{embed:entry_id}"}selected{/if}>
  {trader-name}
</option>
{/exp:channel:entries}

```

The issue is dat the selected Traders are not showing the right trader. The orders **Are** showing the correct trader. On submitting the forms everything **IS** working. And the correct Traders **Are** being submitted. The only issue (that I have been tackling for the past 3 days) is that when I want to edit an order, the select boxes are not showing the correct traders as 'selected'.

The only way I do get it to work is when I use **{field:buyer\_trader}** / **{field:seller\_trader}**, except I shows me the Playa styled version of the select box, and I don't want that.

What am I doing wrong?

# Answer
> 1 votes
If you just want to pass the selected entry ID, try using the `:child_ids` tag instead:

```
{embed="orders/_order-buyer-dropdown" entry_id="{buyer_trader:child_ids}"}

```

Also to reduce the chance of a template parse error, you should update the conditional in your dropdown embed templates to use the normal EE conditional syntax:

```
<option value="{entry_id}" {if entry_id == embed:entry_id}selected{/if}>

```

---
Tags: add-on, safecracker, playa
---


title: WYGWAM Field Blank

text:
# Question
Title: WYGWAM Field Blank
I have added a WYGWAM field but when I go to the publish page, the field does not load. Just a blank space (see image: http://cl.ly/M5jJ). When I inspect the page, I see the following error: coeditor.js - Type Issue 'null' is not an object (evaluating 'x.onLoad')

Anyone else run into this or have any idea how to resolve it? I have the following add-ons installed:

* CE Cache
* CE Image
* CE Img AWS
* Channel Files
* Channel Videos
* devot:ee Monitor
* Edit This
* EE Hive Hacksaw
* Hits
* Mountee
* Playa
* Tagger
* Template Variables
* TruncHTML
* Vz URL
* Wygwam

I also have an RTE field type (although not in use on the same publish page) which I'm trying to upgrade from. Thanks for taking a look.

# Answer
Re-uploading Channel Image's Wygwam plugin per their installation instructions as recommended by Brad Bell solved this.
> 3 votes

---
Tags: add-on, error, wygwam
---


title: WYGWAM PHP errors in CP after upgrade

text:
# Question
Title: WYGWAM PHP errors in CP after upgrade
```
A PHP Error was encountered
Severity: Notice
Message: Undefined index: config
Filename: wygwam/helper.php
Line Number: 535
A PHP Error was encountered
Severity: Notice
Message: Undefined index: config
Filename: wygwam/ft.wygwam.php
Line Number: 430

```

How can I resolve this?

I upgraded EE to 2.5.5 and Wygwam to 2.6.3. It is an MSM site.

The problem persists after visiting the settings page.

# Answer
> 1 votes
I think this should fix you up:

https://getsatisfaction.com/pixelandtonic/topics/undefined\_index\_config\_after\_upgrade#reply\_10005608

You'll need to re-save the Matrix field that contains your Wygwam field.

-Lisa

---
Tags: php, error, wygwam
---


title: Trouble setting up RSS

text:
# Question
Title: Trouble setting up RSS
Likely a new n00b question:

I'm having trouble getting my RSS setup and am hoping it's just something simple you can help me out with.

My RSS feed is coming out like this:

For some reason it's picking up the title correctly, but not the right field. Here's the HTML that I'm using

```
<channel>

<title><![CDATA[matt-steele.com Blog]]></title>
<link>{site_url}</link>
<description>{channel_description}</description>
<dc:language>{channel_language}</dc:language>
<dc:creator>{email}</dc:creator>
<dc:rights>Copyright {gmt_date format="%Y"}</dc:rights>
<dc:date>{gmt_date format="%Y-%m-%dT%H:%i:%s%Q"}</dc:date>
<admin:generatorAgent rdf:resource="http://expressionengine.com/" />

{exp:channel:entries channel="{blog}" limit="10" dynamic_start="on" disable="member_data|pagination" status="open"}
<item>
  <title>{exp:xml_encode}{title}{/exp:xml_encode}</title>
  <link>{title_permalink='blog'}</link>
  <guid>{title_permalink='blog'}#When:{gmt_entry_date format="%H:%i:%sZ"}</guid>
  <description><![CDATA[{blog_body}]]></description>
  <dc:subject>{exp:xml_encode}{categories backspace="1"}{category_name}, {/categories}{/exp:xml_encode}</dc:subject>
  <dc:date>{gmt_entry_date format="%Y-%m-%dT%H:%i:%s%Q"}</dc:date>
</item>
{/exp:channel:entries}

</channel>

```

Any advice would be appreciated.

The feed is at http://matt-steele.com/feed

# Answer
> 2 votes
Try changing `channel="{blog}"` to `channel="blog"` without the curly brackets.

Also, you can remove the `status="open"` parameter from your channel:entries tag. This is a default with the tag and doesn't need to be declared.

# Answer
> 3 votes
Take a look at the sample RSS feed provided by EllisLab, and you'll see that you're missing the outer RSS module tags as well as the required document declarations before your `<channel>` XML element.

```
{exp:rss:feed channel="blog"}
<?xml version="1.0" encoding="{encoding}"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
    xmlns:admin="http://webns.net/mvcb/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:content="http://purl.org/rss/1.0/modules/content/">

```

Then at the end:

```
</rss>
{/exp:rss:feed}

```

Also, you have `channel="{blog}"` in your Channel Entries tag parameters, when it should just be `channel="blog"` (you're specifying the blog name, not parsing a variable).

---
Tags: channel
---


title: Module tag pair not working

text:
# Question
Title: Module tag pair not working
I'm trying to create a module tag but it just isn't working, I'm following the Hello World tutorial at Ellis Lab. My module is installed and the MCP part is working. Here is my mod file:

```
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Facebook_Photos {

    public $return_data = "";

    // Constructor
    public function __construct()
    {
        $this->EE =& get_instance();
        $this->return_data = 'Hello World';
        return $this->return_data;
    }

    public function get_photos()
    {
        $this->return_data = 'Hello World';
    }
}

?>

```

Just in case here is my tag pair in my template (it's the only template that exists):

```
{exp:facebook_photos:get_photos}

```

I’m getting the following error from EE:

> The following tag cannot be processed:
>
> {exp:facebook\_photos:get\_photos}
>
> Please check that the ‘facebook\_photos’ module is installed and that ‘get\_photos’ is an available method of the module

# Answer
> 8 votes
The ‘p’ in your module’s class name must be lowercased.

From http://ellislab.com/expressionengine/user-guide/development/modules.html#the-core-module-file-mod-module-name-php:

> The Core Module file is used for outputting content via Templates and doing any processing that is required by both the Control Panel and any module tags contained in a template. **It includes a class with a name that matches the package (the first letter of the class name must be capitalized).**

# Answer
> 2 votes
Ok, finally got it - took me forever but now I can hopefully help someone else that runs into this.

I checked that my `mod.facebook_photos.php` had the method `get_photos` and that everything was spelled right and it was. So I thought I'd check if it was installed, it was - but at the same time it wasn't.

If you open `system/expressionengine/libraries/Template.php` and go to line `1224` you find the conditional that is causing the error. There I placed some debugging information:

```
echo 'Class Name: ' . $class_name . '<br/>';
echo 'Tag Data Class: <br/>';
var_dump($this->tag_data[$i]['class']);
echo '<br/>Modules: <br/>';
var_dump($this->modules);
echo '<br/>Module Data Class Name: <br/>';
var_dump($this->module_data[$class_name]);

```

Everything came back as expected except for the last one that threw a PHP error where it couldn't find that index. So I echoed out the `$class_name` and I received `Facebook_photos`. To my surprise on line `1205` you see the following:

```
$class_name = ucfirst($this->tag_data[$i]['class']);

```

So what I did was go to my `upd.facebook_photos.php` and renamed every place that Facebook\_Photos to Fbphotos (I removed the underscores to create a shorter namespace). I then renamed all file names and class names to match this new namespace making sure that the class names have the first letter uppercased (as that is what `ucfirst`) does.

Also, my tag pair had to change due to the new namespace - it now looks like this:

```
{exp:fbphotos:get_photos}

```

Now the `get_photos` method works as expected. Hope this helps someone else!

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


# Question
Title: Am I able to store my own module settings in an EE table?
I am writing a new module for ExpressionEngine and have a couple of settings that I want to store from the Facebook API. For example, if I wanted to store the Facebook ID and Albums they want to pull photos from do I need to store them in a custom DB table or is there a quick way to store settings, much like wp\_options in WordPress?

Also, I am new to writing modules and have found a couple tutorials but most are either, short and don't have an mcp - or they stop half-way through.

Thanks for the help.

# Answer
Most serious modules I know of create their own settings table. It's not ideal, but EE doesn't really offer any built in solutions for modules.

If your module has an extension, as Tom mentioned, you can use that to store a serialized array of settings. Alternatively, I know some modules add a `settings` column to the `exp_modules` table (obviously after checking it doesn't already exist) in their install script.

But in your case, it sounds like you would probably be better creating your own database tables anyway (always try to avoid giant serialized arrays if at all possible).
> 7 votes

# Answer
If you only have a few settings, the most common pattern for this is to use a companion extension for your module, as extensions get a built-in settings screen for "free", avoiding the need for a separate table.

As Adrian says though, the native extension settings are stored as a serialised array, so if you have a large amount of settings data a separate table is the way to go.
> 3 votes

# Answer
Depending on the intended purpose of your addon (internal vs public use etc) and the number of settings you'll need to store you might want to consider keeping your settings within the master config.php file or within a third\_party/myaddon/config.php file. If you need a user-friendly UI for the settings then it's probably not viable, but if not then creating a custom table could be overkill.

For example you could store and access an API key like this:

```
// Within system/expressionengine/config/config.php
$config['myaddon_apikey'] = 'xyz123';

```

Then within your addon:

```
if($this->EE->config->item('myaddon_apikey') !== FALSE)
{
    $apikey = $this->EE->config->item('myaddon_apikey');
}

```

This approach gives you the added benefit of being able to version your addon's config settings which is likely to be useful when it comes to deployment, configuring different environments and so on.
> 2 votes

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


title: theme_folder_url issue

text:
# Question
Title: theme_folder_url issue
Should be a quick one for the EE add-on devs out there.

Most add-ons do support having:

```
$config['path_third_themes']    = $base_path . "/assets/third_themes/";
$config['url_third_themes']     = $base_url . "/assets/third_themes/";

```

in the config file.

I've noticed that Field Editor and Redactee don't.

I popped open those add-ons to replace instances of theme\_folder\_url with url\_third\_themes but they still don't want to load the appropriate styling.

Any ideas?

Thanks, Steven

# Answer
> 4 votes
Can you copy/paste a code snippet?

Basically, what you have to do is search for theme\_folder\_url and replace it with url\_third\_themes - plus you also have to remember to drop the third\_party on the path.

so:

```
$this->EE->config->item('theme_folder_url').'third_party/field_editor/css/field_editor.css

```

becomes:

```
$this->EE->config->item('url_third_themes').'field_editor/css/field_editor.css

```

I have to do it on a lot of add-ons, which is mildly annoying as it should be sorted by now.

# Answer
> 2 votes
According the Core.php EE library, the config needs to be:

```
$config['theme_folder_url']     = $base_url . "/assets/third_themes/";

```

But latest versions of EE add the new third\_party themes var:

```
$config['url_third_themes']     = $base_url . "/assets/third_themes/";

```

But also keep in mind that EE will automatically append "third\_party" to this. So for example the final URL will be "example.com/assets/third\_themes/third\_party/redactee/".

**Changing folder structure for 100% compatibility**

If you want to make things compatible for addons that do and dont support the new variable you can structure your assets folder to the following:

```
/assets/themes/third_party/redactee/
/assets/themes/third_party/field_editor/

```

And then set both the config vars to the following:

```
$config['theme_folder_url']     = $base_url . "/assets/themes/";
$config['url_third_themes']     = $base_url . "/assets/themes/third_party/";

```

This should ensure all addons work with the new third\_party themes location, regardless of supporting the url\_third\_themes var.

**Note:** This solution will involve moving the EE CP theme folders into the assets folder as well, but thats the price you pay to ensure 100% compatibility without editing 3rd party addons.

# Answer
> 2 votes
For Field Editor you can add this:

`$this->theme_url = defined('URL_THIRD_THEMES') ? URL_THIRD_THEMES . '/field_editor/' : $this->EE->config->item('theme_folder_url') . 'third_party/field_editor/';`

inside the `public function __construct()` method.

And then swap out the instances of:

`$this->EE->config->item('theme_folder_url')` and `$this->EE->config->slash_item('theme_folder_url')`

for

`$this->theme_url`

don't forget `protected $theme_url;` somewhere after the start of the class itself.

For example on line 238 of mcp.field\_editor.php (v1.0.3) the following:

`$this->EE->cp->add_to_head('<link rel="stylesheet" href="'.$this->EE->config->item('theme_folder_url').'third_party/field_editor/css/field_editor.css" type="text/css" media="screen" />');`

would be changed to:

`$this->EE->cp->add_to_head('<link rel="stylesheet" href="' . $this->theme_url . 'css/field_editor.css" type="text/css" media="screen" />');`

Note: this is a bit rough and you'll have to work through each add-on accordingly though, probably something similar will need to happen for Redactee as well.

---
Tags: add-on, add-on-development, config, config-overrides
---


# Question
Title: SafeCracker, guests, and can_edit_other_entries
I have a SafeCracker form that will allow users to enter data about a trip. Users will not necessarily be logged in when submitting the form. For that I have set up a "Guest Posters" member group. That group contains a single "Guest Poster" user. That user's member\_id is used for the logged\_out\_member\_id parameter in SafeCracker.

That part all works fine.

Things fall apart when a user wants to edit a form submitted by somebody else. This can happen if, for example, an admin starts the form for a user and then hands it off to the user to complete the rest. In that scenario, if the user submits the form he sees the error: "You are not authorized to perform this action".

The error message originates because can\_edit\_other\_entries ("Can edit entries authored by others" in the control panel) is set to 'n' for logged out users. But since I have that value set to 'y' for the "Guest Posters" group, I would expect the form submission to succeed.

I've stared at this for too long. At this point I figure there are two possibilities: either the solution is obvious and Friday fatigue has blinded me; or this is a bug in EE.

Any suggestions?

# Answer
The "Guest Posters" group (and associated member) you are using as the author for your guest-submitted entries is simply a way for Safecracker to assign authorship to an entry from a logged-out user. No user is ever actually logged-in with that account, so the editing privileges you assign to it are not important.

The default "Guests" member group is the one which would need privileges to edit other authors' entries, since your guest users, even if they have previously submitted entries, still belong to the "Guests" member group (because they have not logged-in).
> 2 votes

---
Tags: safecracker
---


# Question
Title: Front end flashdata / system messaging without URL segments
I'd like to be able to display incidental messages on the front end, such as for 'thank-you' content and success/error messages after form submissions. However, I'd like to do this without polluting the URLs with extra segments... Is there a standard solution for this?

# Answer
Sure, cookies would be the way to go here if you don't want extra segments. Cookies Plus looks like it could make this easy for you (though there are some negative reviews ... no harm in giving it a shot of course, it would save you from writing this custom or adding PHP into your templates).

First, your form would redirect to **forms/submit/success**.

In that template you'd put:

```
{exp:cookie_plus:set name="flash_message" value="Your entry was submitted." seconds="10"}
{redirect="forms/submit"}

```

Then in your **forms/submit** template:

```
{exp:cookie_plus:get name="flash_message"}
{if cookie}
    <p class="message success">{cookie}</p>
{/if}
{/exp:cookie_plus:get}

```

You can get more elaborate if you want to conditionally check for different cookie names that represent different kinds of messages, etc.
> 2 votes

---
Tags: system-messages
---


# Question
Title: Can I use a conditional to match a string in a url segment?
The issue I’m coming up against is that a client’s site has a series of nested units, tasks and segments, and they want different conditionals run depending on the various segments. Now, I could use the url\_title to find each url segment’s channel, but that seems like I’d potentially have too much overhead. What I’d really like to do is use the channel preferences to prefix each url\_title with the channel name, and then in my conditional, query the segment in order to run various templates/changes/etc. Is there any decent way to accomplish this, or is this adding too much overhead, still?

# Answer
> 2 votes
You may also consider using Switchee

# Answer
> 2 votes
If you search for SurgerEE on devotee - you'll be able to use that to query based on regular expression.

https://github.com/dsurgeons/SurgerEE/wiki/String is the function. I've used it lots of times and to really useful.

Sorry for the brevity - on the iPad and mobile at the mo.

---
Tags: conditionals, segments, url-title
---


# Question
Title: using Stash to replace Matrix image slugs
Like most people, I was using NSM Transplant in tandem with Matrix to have {image\_1} etc within a WYSIWYG field like so http://vimeo.com/18661374

I've managed to achieve the same thing using a template partials approach, however, I'm working on a site just now that's been an upgrade from EE1 (which used LG Replace) and I have no desire to refactor the templates to template partials.

Is there a way I could achieve the same thing in the Vimeo video using Stash?

# Answer
> 7 votes
Try my answer on this question - works for me on a single template:

EE Code within channel entries

```
{exp:stash:set name="shortcode_inside_field" type="snippet"}
    <p>Hi there! It's important to set type="snippet" so that {shortcode_inside_field} will get automatically replaced with this sentence by the stash:parse tag later on.</p>
    ... now run all kinds of complicated EE tags here to generate the content of the shortcode (be sure to add parse_tags="yes") ....
{/exp:stash:set}

{exp:channel:entries}
    {exp:stash:parse process="end"}
        {custom_field_containing_shortcodes}
    {/exp:stash:parse}
{/exp:channel:entries}

```

... Also, make sure you're not using EE 2.5.3, since there's a bug affecting curly braces inside content entries (there's a hotfix for it if you can't upgrade to 2.5.5).

EDIT TO INCLUDE PROPER ANSWER!!

I've tested this code with Matrix, and it works for me:

```
    {exp:channel:entries}

        {gallery_matrix}
            {exp:stash:set type="snippet"}
                {stash:image_{row_count}}
                    <img src="{src}">
                {/stash:image_{row_count}}
            {/exp:stash:set}
        {/gallery_matrix}

        {exp:stash:parse process="end"}
            {cf_content_body}
        {/exp:stash:parse}

    {/exp:channel:entries}

```

There are two ways of doing this with Stash - either using that \_{row\_count} appendage, or using Stash's context parameter. Purists may prefer the latter, personally I prefer the former...

# Answer
> 2 votes
Check out this article by @tyssen: http://www.tyssendesign.com.au/articles/cms/more-stash-examples/ The 'shortcodes with Stash' examples should get you there.

There's also this thread on Devot-ee: http://devot-ee.com/add-ons/support/stash/viewthread/3013 which tries to solve a similar NSM transplant solution.

# Answer
> 1 votes
This is really an addendum to James' answer above; you can do the same thing without needing to use post-processing - this *may* overcome the problem of previewing within BWF that you encountered here: weird CE Image & Better Workflow issue

```
{exp:stash:parse parse_depth="2"}
    {exp:channel:entries}
        {gallery_matrix}
            {exp:stash:set type="snippet"}
                {stash:image_{row_count}}
                    <img src="{src}">
                {/stash:image_{row_count}}
            {/exp:stash:set}
        {/gallery_matrix}
        {exp:stash:set name="content_body"}{cf_content_body}{/exp:stash:set}
    {/exp:channel:entries}
{/exp:stash:parse}

{exp:stash:get name="content_body" parse_vars="yes"}

```

---
Tags: stash, matrix, wysiwyg, ce-image
---


# Question
Title: ExpressionEngine Safecracker Guest Thank you email
Is it possible after submitting a safecracker form to send a thank you email to the guest?

# Answer
I suggest you look at the Postmaster add-on \- it allows you to send fully-customizable email notifications after entries are submitted and/or edited (among other events).

(You'll have to make sure you collect the guest's email address as a custom field in your Safecracker form of course.)
> 2 votes

---
Tags: safecracker, email
---


# Question
Title: How do I supress the system email message or get it to appear inside my template?
I have designed a site that is mainly modals - so there is only index page and it is all driven by scripting. (Its an artistic site and the client wanted this look and feel).

I am finishing the contact form and want the system message that appears after submission to either go away completely or appear inside the contact modal - but its not its own html page...

Can i supress these system messages? Or how can I get the system message to appear inside my modal popup?

Thanks

# Answer
The easiest answer is to use an iFrame as @madebyhippo explains. Also, take a look at the **Custom System Messages** addon. This will move your system messages into regular EE templates so you'll have 100% control over the output.
> 1 votes

# Answer
I guess I have a different approach. For contact forms I always use Safecracker to store the data as channel entries. This way if an email isn't received, the contacts is readily available in a familiar place. With this method, there is no screen to worry about. You just redirect the user where you want, and you can even submit the form with AJAX if you want. This method always seems like the least amount of work, and uses first-party code to handle everything aside from the emails.

For emails, I use my Postmaster add-on to create custom templates and can send them to whomever I need, and at any specific instance. Postmaster is a commercial add-on, but it's designed to give you the flexibility not available inherently available in EE.

https://objectivehtml.com/articles/read/postmaster-v1.2
> 1 votes

# Answer
If you're using a modal form which supports iFrames - I suggest that you load your contact form into that and then when you post, target the iFrame and it'll load the system message in there.

Alternatively, Post the form via AJAX using jQuery and completely bypass the system message, allowing you to display your own message/response.
> 0 votes

---
Tags: forms
---


title: Bulk entry status change

text:
# Question
Title: Bulk entry status change
Is there a way to change the status of a number of entries at one time?

I know you can select a number of checkboxes and then edit all, but thats still time consuming if you have pages of entries. (In my case, many thousands)

# Answer
This query should work:

```
UPDATE exp_channel_titles t
SET t.status = 'pending'
WHERE t.status = 'open'
AND t.channel_id = 'x'

```

Change 'x' to your channel id.
> 8 votes

# Answer
If you have a specific list of entry\_ids you want to change, you can run a query like this with your entry\_ids separated by commas:

```
  UPDATE exp_channel_titles t
    SET t.status = 'pending'
    WHERE t.status = 'open'
    AND t.entry_id in (1,2,3,4)

```
> 3 votes

---
Tags: channel-entries, status, bulk
---


# Question
Title: Switching images based on product variation using Espresso
I'm using Expresso Store & Channel Images Modules and I want to change the image being shown based on the colour variation chosen by the customer. eg. when selecting the blue shoe a blue show image is shown, when selecting red a red shoe image is shown etc.

I'm sure I can work out a way to do this using a naming convention or such like, but I was hoping someone might be able to suggest a way to do this more natively.

Many thanks

# Answer
> 3 votes
I doubt there is way to do this natively. You'd need to look at a naming convention to match the variation name to the image as you noted and jQuery to do the switchout.

I have an example on **a non-Store site** that may help you get started. The image switch on this site happens when you click on the thumbnails at the bottom left of the product detail.

**This tutorial offers** another way of doing the swap with jQuery.

Here is another tutorial: **Swaping images in jquery on select dropdown action**

# Answer
> 2 votes
As Anna has mentioned there is not a way to do this by default with the Store tags. You would need to do it with jQuery to swap the images. I would recommend that you use the Modifier Variable Pair to output the `option_name` to create an element that you could link with your jQuery. You wouldn't want to use `option_id`as it would be unique for every modifier option in the system.

---
Tags: expresso-store, image, channel-images
---


# Question
Title: row_id Tag Parameter isn't working in Matrix field
I'm using Matrix, and the `row_id` tag parameter isn't working for me. At the moment I am on relying on the search Tag Parameter.

This doesn't work:

```
{technical_specifications row_id="1"}{spec_value}{/technical_specifications}

```

Whilst this works:

```
{technical_specifications search:spec_label="Width"}{spec_value}{/technical_specifications}

```

What am I doing wrong?

# Answer
Row IDs in Matrix are unique for the whole site, like entry IDs. So there only will ever be one row with a row\_id of '1' – the first row you ever created. If you’ve deleted that row, then no row exists with the ID '1' anymore.

If you just want to grab the first row, use `limit="1"` instead, which will limit the output to only the first row.

If you want to grab the second row, you would use `limit="1"` as well as `offset="1"`, etc..

Both of those parameters are documented on http://pixelandtonic.com/matrix/docs/templates.
> 8 votes

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


# Question
Title: Possible to download a folder of images as a zip file within Assets?
I'm using Assets 1.2.2. Is it possible to enable a client to download the contents of a file upload directory as a single zip file within Assets? If not, I'd welcome any other suggestions (or maybe it's a feature coming in Assets 2?) other than using FTP or the EE File Manager.

I've just looked into using EE File Manager and it allows you to select files (upto a page at a time) and download them as a zip file. Besides only being able to download one page at a time, the other reason I want to avoid this is that I don't want clients editing/deleting images via the File Manager (which might happen if they are given access to it).

# Answer
> 2 votes
This is currently not a feature of the Assets addon.

You could create your own functionality in a password protected EE template using **this tutorial** and a selectable list of the Assets directories.

---
Tags: add-on, assets
---


# Question
Title: How to create a form and insert form data to database in ExpressionEngine?
I am developing a website in ExpressionEngine and I am a newbie for ExpressionEngine and CodeIgniter.

I want to create a form on page and want to insert it data after submission to my customized table in ExpressionEngine .

I don't want to go deep in ExpressionEngine. I just want a form on page and when user submit the form all fields value insert into my custom table.

# Answer
This will definitely require a module. I recommend taking a look into the developer documentation to get a feel for this. I wouldn't write any code to do what you want without a plugin or module. It's not too difficult to get started.

http://ellislab.com/expressionengine/user-guide/development/index.html

You can use Pkg.io to make your life easier. This will create an installable module as a boilerplate automatically for you. So really, it's the least amount of effort to get a module up and running.

http://pkg.io/

Also, take a look at Base Form class, which is my library for making building front-end forms in EE easier. You can use my free add-on Authenticate as an example of how to use it. It has a lot of options already built-in.

https://github.com/objectivehtml/Base-Form

https://github.com/objectivehtml/Authenticate
> 5 votes

# Answer
It's actually possible to leverage some of the underlying framework directly in a template (by enabling PHP input parsing for that particular template obviously). It's obviously depending on what you intend to do. But, for example, I'm using that to display a form that once posted will either show a page with errors or send an e-mail (making use of the EE object and input, form\_validation and output library). If the form is not too complicated, this is probably a good way to make something fast. Let me know if you need any help.
> 1 votes

# Answer
If you don't want to "go deep into Expressionengine" and want a custom table with a form inserting data then there is nothing to stop you doing this alongside other EE driven content on the site. Simply create your form and necessary PHP script(s) as required. It's only if you wanted to insert the data into EE's tables that you'd need to consider how EE works.
> 1 votes

# Answer
Did you try http://devot-ee.com/add-ons/external-entries and External SAEF? Seems pretty straightforward. You can easily insert new entries in a table from an other database.
> 1 votes

# Answer
There are several "EE form add-ons" you may want to consider that do the PHP job for you, and essentially store all the data in their own tables as you stated is something you want to do. Each has their own advantages/disadvantages, depending on the use case.

The form add-ons I know of are:

FreeForm has certainly been around the longest, and recently underwent a major overhaul.
> 0 votes

# Answer
To break down the above answers FreeForm is great if you don't already have a database table created, and External Entries is great if you *do* already have a database table that you need to work with.
> 0 votes

---
Tags: safecracker, forms, mysql, solspace-freeform
---


# Question
Title: Can I change the appearance of the search box in expression engine?
Perhaps this is a noobish questions but, I am learning EE so here goes.

This is the code I have for my search box on my website.

```
{exp:search:simple_form channel="video_tutorials"}
        <p>
               <label for="keywords">Search:</label>
             <input type="text" name="keywords" id="keywords" value="" size="18" maxlength="100">
         </p>
    {/exp:search:simple_form}

```

I am wondering, is there a way I can change this appearance on my website. For instance I would like to display the word "search" inside of the input area where a user would enter their search text. I would also like to make the white box longer. Can someone point me in the right direction? Thank you so much!

# Answer
> 4 votes
This is quite simple, and why I prefer EE over other systems. It easily allows you to customize your markup anyway you want to. The `{exp:search:simple_form}` tag has two parameters to let you target and style the form with CSS (Docs). `form_id` & `form_css`.

Re: placeholder text for the input, you can add the `placeholder` HTML5 attribute to the form. If you want to support older browsers, you will need to do this with JS.

```
{exp:search:simple_form form_id="my_form" channel="video_tutorials"}
        <p>
               <label for="keywords">Search:</label>
             <input type="text" name="keywords" id="keywords" value="" size="18" maxlength="100" placeholder="Search...">
         </p>
{/exp:search:simple_form}

```

---
Tags: ee2, search, css
---


# Question
Title: Assets and XHR (Ajax) requests over https
I have our main site on a development server which does not have https enabled. Yet I'm noticing the following errors:

```
XMLHttpRequest cannot load https://staging.ginghamsburg.org/?ACT=28. Origin http://staging.ginghamsburg.org is not allowed by Access-Control-Allow-Origin.

```

My config file handles ssl via the following options:

```
if ($_SERVER['SERVER_PORT'] != 443) {
$config['site_url'] = "http://".$_SERVER['HTTP_HOST']."/";
} else {
$config['site_url'] = "https://".$_SERVER['HTTP_HOST']."/";
}

```

What seems to be happening as a result is that none of the folder contents or subfolders display in the Assets window.

# Answer
> 2 votes
Interesting...I added

```
if ($_SERVER['SERVER_PORT'] != 443) {
    $config['assets_site_url'] = "http://".$_SERVER['HTTP_HOST']."/";
} else {
    $config['assets_site_url'] = "https://".$_SERVER['HTTP_HOST']."/";
}

```

and it worked. I wonder why the override was needed?

Thanks Brandon!

---
Tags: ajax, assets
---


title: Search in Matrix Fields

text:
# Question
Title: Search in Matrix Fields
I am using simple search tag in EE, and for some reason, the search results don't show pages in which the search term is in Matrix fields. I do have those fields set to searchable in Matrix so I am very confused.

Here is my EE template form structure:

{exp:search:simple\_form channel="disability\_topics2" search\_in="everywhere" result\_page="/search" status="not closed" where="all" show\_expired="yes" show\_future\_entries="yes"} Search Site:
{/exp:search:simple\_form}

What can I do?

In the entry publish page I have a Wygwam field for the "main page content" and then a Matrix field with two text areas (which are set to searchable). However, when I do a search, it will pull up entries with search terms in the "main page content" field, but not the Matrix field.

I hope that makes sense.

Thanks!

Michael

# Answer
> 8 votes
Make sure the Matrix field itself is set to searchable as well as the appropriate Matrix columns (see screenshot).

If your column wasn’t set to Searchable already, you’ll need to re-save your entries for the change to take effect.

---
Tags: matrix
---


# Question
Title: What's the best EE Add-on for multipage / multistep forms?
I'm hoping to get some feedback from the community on what people's experiences have been with regard to setting up multipage (multistep) forms with these add-ons for a project I'm working on:

Key functionality I'm looking for is as follows:

* Ability to allow users to go "back" to previous steps
* Ability to ensure users cannot proceed to next step unless required fields are filled in
* Ability to use a Jquery form validation method (with form module as backup)
* Compatibility with Snaptcha
* Nice to have: show a summary of data submitted in all steps before final submission

*Disclaimer: It's ironic that I'm asking this question, because I just recently gave a recommendation in this SE thread about EE forms.*

# Answer
For really complex forms, I use SafeCracker.

It covers most of your requirements.

Users can go "back" to previous steps, as the entry is created as result of step 1, user can return to editing anytime they want.

Snaptcha (and other anti-spam techniques) are supported, of course.

For form validation, I'm using jQuery validation (built-in validation cannot be used, as the actual entry is split between several forms).

The summary can be shown anytime.

To have notification emailed at proper time, the entry can be submitted with 'Pending' or 'closed' status and changing status to 'open' at final step.
> 3 votes

# Answer
The guys at Focuslab have you covered with this article: http://focuslabllc.com/blog/form-building-add-ons-in-expressionengine

Lays out the major differences between the different form add-ons.
> 3 votes

# Answer
Solspace Freeform Pro does multi step forms and although I've never used this aspect of it, it's pretty good.
> 0 votes

---
Tags: forms
---


# Question
Title: User (member) specific site menu or hierarchy
This is kind of an open ended question, but has any one had any luck with creating a "member specific" navigation tree? I've looked into structure, taxonomy, and nav-ee but none seem to have the granularity of permissions I would need.

What I'm trying to achieve is that a member can login and create a "micro site" that would allow the following:

The member **can**:

* create new pages or edit existing pages (created by the member)
* create/manage a single multi-tier menu which controls the order and hierarchy of the micro-site pages.

The member **cannot**:

* View/edit other micro sites
* Add or edit pages outside of their micro-site
* Alter any other site menus.

Ideally I'd like to manage this through some kind of jQuery-esque list that allows for nesting/re-ordering etc. I know this is a bit of a tall order. 0.o I'm willing to hack some stuff together if need be, but I was wondering if there was an existing solution somewhat close to what I'm trying to achieve.

Any one else put together something like this?

# Answer
> 1 votes
Kara, We built a site kind of similar to this a couple of years back for an organisation.

In that case we used Structure and then http://devot-ee.com/add-ons/entry-access to restrict access to the entries. It was a pretty manual process though and no way to really create a micro-site automatically, they initially had to be setup by a general master account.

I believe that Taxonomy will also allow you define a 'per tree' access for member groups.

# Answer
> 0 votes
You're likely going to need some custom modules to do this. Structure is sort of designed for this sort of page structuring, but it doesn't work outside of the CP.

Also there is now way of automating the process without some custom extensions (eg: when creating the member, you want the default "root" page that all other pages descend from to be created automatically).

If you could get the the "root" page created, you could use Safe cracker to allow the member to create descendant pages once on that page. You could have a relationship field that you set using a hidden input on the page.

The problem would come when you want to order them. You would need an "order" text field added to the channel and then use a jQuery order plugin that submits to Safecracker behind the scenes - which is tricky to get right.

All in all, there are no existing addons that would let you achieve this quickly since you will need to go down a custom addon route.

Also this could be seen to fall under EE's restricted use licence whereby you are not allowed to:

> Use the Software as the basis of a hosted blogging service, or to provide hosting services to others.

Worth bearing in mind.

---
Tags: ee2, navigation
---


# Question
Title: How does one keep multiple EE-installs with lifted systemfolders on Mamp Pro
This first post of mine here at the EESE could perhaps be regarded as a Mamp-problem rather than an EE-thing. But I would very much like to hear from the EE-community on this since replies here probably are a lot more likely to be of use to me then replies elsewhere.

The EE-docs suggest moving the systemfolder above web root for security reasons. The documentation illustrates this:

So I guess in Mamp Pro it would look like this:

What I am trying to figure out is how do I keep multiple local EE-projects in my htdocs-folder, all with their 'elevated' system-folders above root and still manage to commit and push one project at the time AND the loose system-folder of that project?

Thanks! /David

---

Ooops! Not allowed...

### Images I am not allowed to post to illustrate my problem:

### Tags I meant to apply but was forbidden to:

* mamp
* systemfolder
* webroot
* beanstalk
* versioncontrol

# Answer
> 8 votes
I do this exact thing on my local machine and I have over 30 sites setup with it — so don't worry, it is perfectly doable! I have a MAMP Pro setup using Git & Beanstalk to handle VCS, code hosting and deployment.

In order to have the system folder above root, here is an example project folder structure that would work with the system folder moved above root:

```
site-1/
|--www/
|   |--images/
|   |--themes/
|   |--uploads/
|   |--index.php
|   |--admin.php
|--system/
|   |--codeigniter/
|   |--expressionengine/
|   |--index.html
|   |--index.php

```

> **Note:** I have used *www* as a folder name for the root site folder, but you should use whatever your hosting provider uses. This could be www, public\_html, htdocs etc.

So all has happened here is that the *system* has been moved upwards one level. Of course in order to do this you need to update the system path in *index.php* as per the EE Docs:

```
$system_path = '../system';

```

Then in MAMP Pro create a new host for this site (Server name "site-1" and set the "disk location" to the **site-1/www/** folder. If you are unsure about this, you can check out this example video or have a look at the MAMP Pro docs.

With the site up and running locally you can then commit the site to a git repository. I tend to always use the **site-1/** folder as the root of the git repository. That way it holds the system folder as well as the *www* folder.

Once it is in Git you can send your repo to Beanstalk and have Beanstalk deploy it for you. The trick here is to get beanstalk to deploy your files one folder higher than normal so that when it writes the files in the **www/** folder, they end up below your site root and can be viewed.

Once setup, you have the ease of use MAMP Pro along with the benefits of using Git & Beanstalk for deployments. You can then start adding multiple projects to your local htdocs folder and creating a new MAMP Host for each site. You'll end up with a collection of your projects all sat neatly beside each other:

```
site-1/
 |--www/
 |--system/
site-2/
 |--www/
 |--system/
site-3/
 |--www/
 |--system/

```

---
Tags: git
---


title: Setting up a donation button

text:
# Question
Title: Setting up a donation button
I want to have a donation button on my site and I was wondering if anyone had any experience using anything that they could suggest to use or not to use like paypal. I have seen some stuff I could buy and was wondering if I had to go this route or if there was a different route. I want something that would protect the people donating of course and not sure if there is something I need to add to provide an extra layer of protection or not. Thanks everyone for your suggestions.

# Answer
> 2 votes
This isn't really an EE question but it's an easy one...

Use Paypal buttons. Very easy to set up, just copy/paste the code Paypal generates into a template and you're done... unless there is a specific reason you don't want to use Paypal. Your question mentions something "like paypal" but doesn't say you don't want to use Paypal.

# Answer
> 1 votes
You can pretty much use whatever service you like. For many nonprofits, we rotate between: PayPal, Network for Good, JustGive, Razoo, and Amazon Donations and custom set-ups.

The biggest issue is how much you want to customize and control vs how quickly you want the user to be in and out of the process. Faster process means, the potential donor is less likely to abandon, services like PayPal, Network for Good, Razoo, JustGive work well, and people trust them (mostly). Some are more popular than others, so the trust level may vary.

Custom solutions are always the tricky component, because generally the nonprofit wants as much data as possible and the potential donor wants to give as little data as possible, so a direct conflict of interest to a degree.

You can use just a donate button and jump people to PayPal, or EE's Simple Commerce or Exp:resso's Store to handle donations if you expect to process a fair number of them. Something like Store will give you a dashboard to manage donations and better tracking capabilities even if people give anonymously.

But if you just need a simple, quick, 'Donate' or 'Donate Now' button, any of the services will do, because very little is handled in EE. Just the template that the button will go on and possible a pop-up or overlay button telling people that the transaction will be handled by whichever vendor you select.

---
Tags: ee2, ecommerce, paypal
---


title: Create tag pair variables

text:
# Question
Title: Create tag pair variables
I now have my module working like I need it to and my single tag pair calls the correct function. But I'm wanting to create a tag pair that is common in most modules/plugins. Here is the function I am calling:

```
function get_photos()
{
    $albums = unserialize( $this->get_setting_value( 'facebook_albums' ) );
    $limit = intval( $this->EE->TMPL->fetch_param('limit') );

    if( is_null( $limit ) || empty( $limit )  )
    {
        $limit = 50;
    }

    $layout = '';
    $i = 0;
    foreach( $albums as $album )
    {
        $photo_data = $this->get_facebook_graph_data( $album, 'photos' );
        foreach( $photo_data->data as $photo ) {
            if( $i === $limit )
            {
                break;
            }
            else {
                $layout .= sprintf( '<img src="%s" alt="%s" rel="" />', $photo->images[5]->source, @$photo->name );
            }
            $i++;
        }
    }

    return $layout;
}

```

I would like my tag pair to look like this:

```
{exp:fbphotos:get_photos}
   <img src="{source}" alt="{name} />
{/exp:fbphotos}

```

I'm not looking for someone to write all of the code, just a way to map the tags to values and create the loop. Thanks!

# Answer
The methods you want to use in order to have a tag pair is:

```
//To loop over multiple items with variables
//inside each (eg: looping through entries
$this->EE->TMPL->parse_variables($template, $data);

//To show a single item with multiple variables within it
$this->EE->TMPL->parse_variables_row($template, $data);

```

Most of the time you will use the **parse\_variables** method, since it allows you to loop through multiple items.

The first method uses a multidimensional array, which is looped through for each data in each cycle. The first argument of each is the template data between the tag pair, which in EE can always be retrieved by using: **$this-\>EE-\>TMPL-\>tagdata**

Both methods return the finished string, so you would use them in your example as follows:

```
function get_photos()
{
    $albums = unserialize( $this->get_setting_value( 'facebook_albums' ) );
    $limit = intval( $this->EE->TMPL->fetch_param('limit') );

    if( is_null( $limit ) || empty( $limit )  )
    {
        $limit = 50;
    }

    $layout = '';
    $i = 0;
    $data = array();
    foreach( $albums as $album )
    {
        $photo_data = $this->get_facebook_graph_data( $album, 'photos' );
        foreach( $photo_data->data as $photo ) {
            if( $i === $limit )
            {
                break;
            }
            else {
                //Build a multidimensional array, where each sub array
                //contains data for a single "loop"
                $data[] = array(
                    "source" => $photo->images[5]->source,
                    "name" => @$photo->name
                );
            }
            $i++;
        }
    }

    return $this->EE->TMPL->parse_variables($this->EE->TMPL->tagdata, $data);
}

```

In your template you can then use tag pairs:

```
{exp:fbphotos:get_photos}
   <img src="{source}" alt="{name} />
{/exp:fbphotos:get_photos}

```

**Update**

If you are unsure about how to use the EE Template Parser library ($this-\>EE-\>TMPL) checkout the official docs.
> 5 votes

---
Tags: php, module, tags, variable
---