title: import a CSV file into an entry?

text:
# Question
Title: import a CSV file into an entry?
I'm trying to import a CSV file of about 20 items with a number of columns. I was hoping i could import the file and have each of the rows in 1 entry (ie. each row DOES NOT get imported as a separate entry). Ultimately, I would like to output a template that displays the 1 entry and the rows of data associated with that entry.

I have purchased Solspaces Importer, but it appears to import each row as an entry. I really need the entire import to be 1 entry. I hope that's clear.

I will be importing CSV files on a continuous basis. Each import could range from 2 rows to 40rows. Again... Each import should be a single entry.

Any thoughts?

# Answer
Importer allows you to import data from a CSV file into entries, but as you mentioned, by default each CSV row will produce an entry.

How is your data for all rows going to be stored in one single entry?

1. You might want to consider saving the data in a Matrix field, which Importer supports: http://www.solspace.com/docs/importer/third\_party\_support/#pt\_matrix

CSV files are limited for this however, given that they are one-dimensional. If importing into a Matrix field, I would recommend using a JSON or XML file, which supports sub-nodes of data.
2. Alternatively, if you simply want all CSV cells on all rows to map to custom fields in your single entry, you could open up your CSV file in a text editor and do a general search & replace for linebreaks. This should make Importer recognize the data in the CSV file as one row, and therefore one entry.
3. Another strategy: if each CSV **column** needs to have all their data in a single entry custom field, you might be able to merge your column data in your spreadsheet editor, followed by exporting to CSV. This will also create one row of data, and therefore one entry, but the data in each custom field should be grouped by CSV column.

Hope that makes sense.
> 4 votes

# Answer
DataGrab will import to entries. Typically it will import each row as a new entry but there might be a way around that.

If you can email me at support@brandnewbox.co.uk with an example of what you are trying to do I'll see if I can help you set up DataGrab.
> 3 votes

# Answer
I believe Datagrab should do exactly that... it's been a few years since I've had to use it but it's a pretty powerful add-on.
> 2 votes

---
Tags: ee2, solspace
---


# Question
Title: New member registrations with large file uploads
I am using the Solspace User for new registrations and want to allow new registrations the ability to upload large files in the user registration form. I need to allow up to 6 large files, ie: 6 files up to 10mb each.

I thought about DevDemon's channel files as it allows for large uploads, but don't think it works with user registration forms.

Is there any other ideas to allow large file uploads in a User member registration form?

Maybe the only other option is to create a second SAEF using Channel files and get a member to be fill out the second form after their registration. (not ideal for me)

# Answer
> 2 votes
Right after registration, you can send your users to a SafeCracker form. The form could be on the same page as the registation form, with a segment to tell the template to display the SafeCracker form instead of the registration form.

Users can then upload their file through the SafeCracker form, and the author of the entry would be the logged in user.

As for the file size, make sure your upload\_max\_filesize setting in PHP is high enough to accept a 10 Mb file (this can typically be modified by editing php.ini), and that your EE upload directory also allows large file uploads. You can modify the file size limit in EE's File Manager in the Control Panel.

# Answer
> 3 votes
What about using one of the Channel/Member linking add-ons, such as Zoo Visitor or Profile:Edit? That way you combine member registration and creation of a linked channel entry (and hence the ability to have custom upload fields for each member).

---
Tags: members, solspace
---


title: Upload config amazone s3 not showing

text:
# Question
Title: Upload config amazone s3 not showing
Just installed the new Assets module and configured an amazone s3 location. However the location is not showing up in the assets module (upload files list).

When configured as a fieldtype I can select the directory (s3) to upload to during configuration. But while editing an entry I get a blank upload files modal.

# Answer
> 3 votes
You need to **Update Indexes** after adding the new S3 source.

---
Tags: assets
---


# Question
Title: Store: Hide modifiers section by default?
Just a very minor question but is there a way to have the modifiers panel contracted by default? Shipping an advanced panels both seem to be hidden by default and I'd like to do the same to modifiers to make things as clutter free and simple to use from a system administrator's point of view (they seem to get overwhelmed when they see so many open fields all at once when they only need price and SKU.

# Answer
It's not possible to customize the look of the Store product details field, without adding your own CSS to the control panel (or editing the Store view files).

One option you have if you need to do this is create an extension which uses the `cp_css_end` hook to add your own CSS to the control panel, which hides the fields you don't need.

Reference: https://expressionengine.stackexchange.com/a/5205/150
> 1 votes

---
Tags: add-on, expresso-store, fields
---


# Question
Title: Channel Entries Related Entries Filtering with Count
Lets say I have Channel A and B.

Channel A has a Field X which is a relationship to channel B.

Is there a way for the {exp:channel:entries} tag to get

1. only those Channel B entries that are referred by current entries in Channel A?
2. the number of entries in Channel A that are associated to each respective Channel B entries?

For example:

If Channel A has these entries

```
Entry 1, Relationship to Channel B entry 1
Entry 2, Relationship to Channel B entry 1
Entry 3, Relationship to Channel B entry 2

```

and Channel B has these entries

```
Entry 1, Foo
Entry 2, Bar
Entry 3, Test

```

then

No. 1 should return

```
Entry 1, Foo
Entry 2, Bar

```

No. 2 should return

```
Entry 1, Foo, Referred 2 times
Entry 2, Bar, Referred 1 time

```

# Answer
Playa's Parent & Children tags should do what you're looking for. They have documentation on converting a native Relationship field to a Playa field.
> 1 votes

---
Tags: channel-entries
---


# Question
Title: Need something like StructureFrame that includes listings as well as pages
Does anyone know of a way/existing fieldtype out there there that does exactly what StructureFrame does, but includes listings?

StructureFrame is a really neat way to link to content, but annoying that you can't access all of it!

# Answer
I usually use Playa or the native field type connected to whatever the listing channel is.
> 2 votes

---
Tags: structure
---


title: Excluding a Category

text:
# Question
Title: Excluding a Category
I am using ExpressionEngine 2.5.2

I have a website that includes a featured blog post at the top, as well as a news section that all of my blog posts in chronological order. When a blog post is featured at the top of my homepage, I would like it to be excluded from the list of blog posts in the news section. In order for it to show up in the featured space, I have created a category with an ID of 440 titled Featured Post. For the News section, I am using a the ExpressionEngine channel:entries tag and am using category parameter with the "not" variable in order to exclude posts with the category of Featured Post. However the featured post is still showing up in the news section. Can someone see anything I am doing wrong here?:

```
 {exp:channel:entries  channel="news" orderby="date"  limit="9" category="not 440"}
     <div class="holder">
        <a href="{post_url}">
             <img src="{post_image}" width="336" height="195" alt="Post Hero" />
        </a>
        <div class="info">
            <h3><a href="#">{title}</a></h3>
        </div>
     </div>
  {/exp:channel:entries}

```

# Answer
> 8 votes
This parameter is confusing, and has been the subject of much consternation. As per Travis' comment on the docs page:

> If an entry is in two categories, cat\_id 1 and cat\_id 2, and you ask for just entries with category="not 1", the entry will still show up in the output. This is because it *is* in category 2. This may not be the behavior you expect.

Also see this bug report, closed as "not a bug", as I suppose it is intended behaviour. There used to be a good feature request thread in the EL forums with ideas for implementing some sort of "cannot be in this category no mater what" parameter, but that forum section is now gone, and thus the feature request with it.

So, in other words, your code is working as intended.

I would suggest using a custom Status instead - it will work as you intend, and will be easier for your client to see at a glance which entry is featured that way from the Edit Entries screen as well.

# Answer
> 1 votes
Would http://ellislab.com/expressionengine/user-guide/modules/channel/channel\_entries.html#offset

> offset='1'

Do the job? Basically tell the display to ignore the first entry

# Answer
> 1 votes
There's probably a better way to do this, using Stash, but in an EE 1.x site where I had this problem, I created a variable to hold the entry\_id that needed skipping, and then excluded that entry from the entries call for the rest of the list.

There was some raw php involved, and an embed, iirc, to jump around some parse order issues.

# Answer
> 1 votes
Derek did a good job answering the question and also proposed a good solution, but to just to give a bit more information. I also asked this question on the old EE forums. My solution was to limit the categories to a certain group and then be sure only one category from that group was applied. So something along the lines of:

```
 {exp:channel:entries channel="news" orderby="date" limit="9" category="not 440" category_group="1"}

```

Obviously, this isn't perfect if you need multiple categories in the same group applied. Other suggestions on the previous thread were a custom field search and a custom query.

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


title: Login in issues - front end

text:
# Question
Title: Login in issues - front end
I have had some sporadic issues in my time with EE where a user just cannot login to the front end, it seems to be a case of initially it validates the login details, routes you to the intended page, and then by the time the user gets there, they are logged out and dealt with accordingly. I have had it myself, so i know its effected browsers that are fine of config, and passwords etc all correct.

I am now however experiencing the issue with a very important user, everything works for everyone else in every environment, and works in this case for the user in everyone but one browser (but the browser is not the problem)

Am sorry for the broadness of the question, it is finger in the air because that is exactly how i find it when it comes around. Am just hoping someone out there has experienced the same, and has an understanding of it that i have not managed to nail it to.

Have cleared caches both our end and theirs - in the past this has been the place to start.

# Answer
> 1 votes
Have you tried this suggestion from @Anna\_MediaGirl?

---
Tags: login
---


# Question
Title: Edit single posts in a channel via admin panel
> **Possible Duplicate:**
> Limit Channel Entry to 1?

I have a site where one section of the site is a list of Useful links. Rather than have the client create a new channel post that will only include Website name & URL as the two channel fields, I set up a matrix that they can add to so, that they can move entries up or down.

I have explained to them the set up, that they must go in and edit this entry rather than add new channel entries for this, but just to be safe I want to lock this channel so they can't post new entries, just edit an existing. The member group preferences only allow **edit & post**, not **edit only** so just wondering has anyone done something similar.

Or should I just change my set up to channel entries for each useful link and create a low reorder set to move them round.

# Answer
> 1 votes
In terms of "locking" the channel to prevent users publishing additional entries, removing the entry from the Publish menu is often enough to do the trick. There are two add-ons that can help with this: Single Entry or CP Menu Master (formerly "Hidden Channels").

There are some other nice approaches listed in this possible duplicate question:
Limit Channel Entry to 1?

# Answer
> 1 votes
If you switched to using Structure, you can set up an Assets channel to list existing entries under the Assets tab instead of listing channels with Add/Edit links. Then you can direct the client to edit the entry under the Assets tab.

---
Tags: members, channel-preferences
---


title: Returning Low Search Results using AJAX

text:
# Question
Title: Returning Low Search Results using AJAX
I am trying to pull in some Low Search results using AJAX. How can I pass a query to the result page without knowing the encrypted version of the keywords beforehand?

Here are some things I have tried.

I placed this on my result page in hopes that it would give me a URL I could use.

```
{exp:low_search:url
keywords="{segment_3}"
encode="no"
result_page="/my/result_page/"
}

```

The URL Tag spits out something like this:

```
http://mysite.com/?ACT=21&keywords=eyJjb2xsZWN0aW9uIjoiY3VzdG9tZXJfY29udHJhY3RzIiwibG9vc2VfZW5kcyI6InllcyIsInJlc3VsdF9wYWdlIjoiY29udHJhY3RzXC9zZWFyY2giLCJzZWFyY2hfbW9kZSI6ImFsbCIsImtleXdvcmRzIjoibHluIn0&result_page=%2Fmy%2Fresult_page%2F

```

I was hoping that it would not encode the keywords, and I would simply use a similar pattern for my AJAX call.

The URL it generates does not work as a stand-alone, therefor will not work for the AJAX call either. I have ruled out AJAX as being the problem, and come to the conclusion that I simply do not know how to pass keywords to Low Search without using the standard (non-js) form submit.

Any ideas?

Link to my question with Low.

# Answer
> 0 votes
I accepted Low's solution as correct, but I have implemented in this way:

I assumed my AJAX was good, because it worked just fine when submitting a URL that had already been encoded by Low Search. Instead of using POST method, I used GET method to send JSON `'keywords': 'my search term'`.

Here is a piece of the javascript puzzle stripped down for readability.

Here is what my result\_page template looks like. Keep in mind, I am posting this answer before it is completely ready to ship. I have not included proper JSON handling if there are no results returned.

I have tried to make this a plug n' play as possible, but it certainly won't be. Actually, it's likely this isn't the best solution. I will come back if I find something I did very wrong, or if there is a simpler solution, etc.

Please feel free to tear it apart if you can offer something better :)

# Answer
> 4 votes
The main problem here is this:

```
keywords="{segment_3}"

```

You probably don't have *keywords* in the third segment, but an entire encoded *query*. You're feeding that query as keywords to the URL tag, essentially encoding it *twice*.

If you use the URL tag and you want to work from an existing search action, use `query="{segement_3}"` to pass all the details from the existing query on to the URL. Then use any other parameters to override those.

For example, say you've searched for *foobar* using the Low Search form. That will redirect you to something like `domain.com/search/results/xxxxx`, where the segment 3 is the encoded query (*not just the keywords!*). Say you want to generate a link from that query to something else:

```
{exp:low_search:url
    query="{segment_3}"
    keywords="barfoo"
    result_page="other/template"
}

```

This will generate a URL like `domain.com/other/template/yyyyy`, using *barfoo* as keywords, but maintaining all other details given in the first query, like Collection, Search mode, etc. This link will not add the search to the log. To do that, add the `encode="no"` parameter:

```
{exp:low_search:url
    query="{segment_3}"
    keywords="barfoo"
    result_page="other/template"
    encode="no"
}

```

Which should give you something like `domain.com/?ACT=21&keywords=barfoo&result_page=other%2Ftemplate...`. This *will* add the search to the log.

# Answer
> 1 votes
*Low really is the best person to help you troubleshoot this but I'm guessing you're in a hurry, so in the meantime...*

Could you bounce your search queries off a template containing something like the above, and then use a redirect inside that to actually return the search results to your request?

```
{redirect="{exp:low_search:url keywords="{segment_3}" result_page="/my/result_page/"}"}

```

That way you'd get a predictable URL structure to target with your ajax request, even if you can't decode the query string.

If you look at the release notes for v2.0 it at least suggests that something like this should be possible, though I may well not have the syntax right:

> **2.0.0** Improved compatibility with Ajax form submissions and EE's native redirect method

---
Tags: javascript, ajax, low-search
---


# Question
Title: How do I track down a bug with a custom field?
This is related to an channel module php error I am getting. I've been able to determine that if I use **disable="custom\_fields"** the error goes away. On a backup copy of the site I've gone in and removed every addon via the control panel. However, the error persists and is once again eliminated by disabling custom\_fields.

My question is, what is my next step in tracking down the bug (or "bad data" as was described to me in my original post).

**This is the template that throws the error.**

```
{exp:channel:entries channel='member' status='not closed' dynamic='no' orderby="title" sort="asc" disable="member_data|trackbacks|pagination"}
    <li>{title}</li>
{/exp:channel:entries}

```

**This template does not throw the error.**

```
{exp:channel:entries channel='member' status='not closed' dynamic='no' orderby="title" sort="asc" disable="member_data|trackbacks|pagination|custom_fields"}
    <li>{title}</li>
{/exp:channel:entries}

```

# Answer
> 2 votes
Based on your referenced question, it looks like the problem is with a custom field that stores a file ("filename" and output buffer references).

If you can identify which add-on that is, you can drop some quick & dirty debug statements in its PHP. Things like:

```
echo 'got here'; exit;

```

moving that forward line by line until you reach the point where the error occurs. Or:

```
var_dump($some_addon_var); exit;

```

To output the variables the add-on is fetching data into. That might illuminate what the "bad data" is.

From what you've described, it seems like disabling the add-ons isn't taking effect if you have custom fields enabled. That sounds like a separate issue, but if you can tackle the add-on error, you can clean up the data.

**Update:** Noting that you've deleted add-ons, you'd need to reinstall the add-on that's working with files to troubleshoot based on these steps.

Have you tried looking at the entries directly? If you can determine which entry the error is coming from, you can use PHPMyAdmin, Navicat or Sequel Pro to browse the exp\_channel\_data table and peek in the fields. I'm not sure how much luck you'll have identifying "bad data" that way, but that's where you need to look.

# Answer
> 1 votes
Assuming the error is caused by a custom fieldtype (which maybe it is not, now that I see your updated question!)

One approach which will help identify the fieldtype that is causing issues:

Create a simplified template with a channel:entries loop that references each of the custom fields associated with that channel. Then comment out the custom fields in the template one by one until the error disappears.

So a pared-down template coupled with the process of elimination. This should give an indication which fieldtype is causing the error.

# Answer
> 1 votes
I've tracked the error down to a single entry. I did so by loading entries in opposite directions:

```
orderby="title" sort="asc" limit="xx"
orderby="title" sort="desc" limit="xx"

```

I did this until I reached a single entry and hit the php errors. At this point I did a search for that entry's title in the database. It came up with one entry in **exp\_channel\_data** (as expected), however in **exp\_channel\_titles** there were two instances with the same title. I removed the entry that was not associated with the entry data and all is loading as expected.

**The cause:** While I cannot be certain, my guess is that: we had several editors inputting data at the same time. This entry was inputted twice and one was subsequently deleted. For some reason the title row was not removed and caused the conflict. We are using Structure, so it could be a bug with Structure? I cannot be sure.

---
Tags: error, mysql
---


# Question
Title: How can I close comments on a mass scale?
Having just relaunched a site containing a decade of content, I'd like to close comments on everything over a couple years old.

I thought there was something built in, but either it's not there or I can't find it.

Is there an add-on? Or a simple sequel statement?

# Answer
There is a setting under **Admin → Channel Administration → Channels → Edit Preferences** \- under the **Comment Posting Preferences** header - for **Comment Expiration**.

Set a number of days there, and tick the box for "Update all existing comments with this setting" (which should more accurately read "existing *entries*").

To be clear this won't close all *comments*, but remove the *ability to comment* on all entries which fit the criteria. (Your question uses the phrase "close comments" but I'm pretty sure you don't actually want to *remove* the old comments?)
> 6 votes

# Answer
Given that the control panel for comments (Add-ons \> Modules \> Comments) is a little limited in its date filtering, and if you have lots and lots of comments it would be a chore, a query is probably the best route.

A query that would **close all comment entries** before Sat, 01 Jan 2011 00:00:00 GMT:

```
UPDATE exp_comments
SET status = 'c'
WHERE comment_date < 1293840000

```

OR...If what you meant was to **not *allow* new comments** on entries older than two years then here is a query to do that (*or just see @Derek's answer!*):

```
UPDATE exp_channel_titles
SET allow_comments = 'n'
WHERE entry_date < 1293840000

```

You can use Epoch Converter to get a Unix timestamp for your comment cut-off date.
> 6 votes

---
Tags: mysql, comments
---


# Question
Title: Thumbnail error when uploading after upgradeing to 2.5.5
**Error:** Thumbnail could not be created for the image. Please make sure the thumbnail directory is writable.

I've recently upgraded a client's site to v2.5.5 and they are now not able to upload images. I've verified all permissions are correct and I've also reviewed the EE Wizard details (no errors there either). They were successfully uploading images in the weeks prior to the upgrade.

Any idea what could be causing this?

* EE 2.5.5
* Windows 2008 Server
* PHP 5.3.10

# Answer
Figured this out today. We were using relative server and URL paths in the file upload preference settings. Example:

```
Server Path: /websites/domain.com/uploads/
URL: /uploads/

```

After changing them to absolute paths:

```
Server Path: E:/websites/domain.com/uploads/
URL: http://www.domain.com/uploads/

```

Everything works properly. We never had problems previously with the relative paths, though, so something must have changed in the latest version.
> 2 votes

---
Tags: file-uploads, file-manager, thumbnails, v2.5.5
---


# Question
Title: Assets date modal closes info screen w/o saving
This is specifically with the Date modal: when I (or the client) go to edit the file information date, we select a day -- and the moment the day selection happens, the file information popup closes without saving the information we'd typed in.

This behaviour seemed to start when we began creating sub-folders for our files, but I don't think that should have affected anything.

Using Assets 2.0.3 on EE 2.5.5

This behaviour shows up both in my Mac Chrome browser and my client's PC (didn't ask her what browser, but I'm going to say she's using IE).

# Answer
A day later and now I can reproduce it - not quite sure why I couldn't yesterday. Reporting this as a bug now. Thank you Lea!

\[Edit\] Last edit: this bug is now fixed in Assets 2.0.4. (Release Notes). Thank you!
> 1 votes

---
Tags: assets, pixelandtonic
---


# Question
Title: Can I get a Structure page’s position in relation to its siblings?
Is there a method for getting a Structure page’s position in relation to its siblings via Global Variable, etc.? I’m currently building a class management interface for a client, and instead of using Playa to create relationships to “parent” entries, I’m instead using Structure, for ease of use for the client. However, they want to take a tree such as this:

```
Unit Name

- Task Name
  - Segment Name
  - Segment Name

- Task Name
  - Segment Name
  - Segment Name

```

As a result, I want to be able to automatically add the task and segment's position in relation to its siblings, so that on the front end, I could display the following tree:

```
Unit Name

- Task A - Task Name
  - Segment A1 - Segment Name
  - Segment A2 - Segment Name

- Task B - Task Name
  - Segment B1 - Segment Name
  - Segment B2 - Segment Name

```

The line of thinking will be that the letter for the task will be converted using a string plugin, and then the Segment will use a number, appended to the Task’s letter.

# Answer
I had the crazy idea to assign entries to Structure pages so they could be associated with multiple pages like...Categories. Jack McDade helped with a Structure Categories plugin, and he ended up putting together some code that let me do Level 1, Level 2, etc cases so that I could format nested nav chunks distinctly. I can share that or point you to Jack if you'd like to go that route. Not sure it would do the loop, but Jack might be able to sort that out for you.

Clarification: Jack created some custom Structure tags for us that let us nest Structure tags at each level, to format nested output specifically for each level. I'm suggesting you book him to address your goals and enable you to work in a loop with custom output.
> 1 votes

---
Tags: structure, navigation
---


# Question
Title: Creating a related entry inline from another publish screen
I am planning to make a recipe channel (yes food/meal recipes).

This would require an ingredient list. I plan to create a matrix field with rows for each ingredient. This matrix would have a qualtity column (i.e "1 tblsp") and a ingredient column.

I wish for the ingredient field in the row to be a relationship selection (e.g playa) so that we can maintain a list of ingredients, and it also would allow us to see all recipes that use a particular ingredient. The reason why ingredients need their own channel is because many ingredients will have meta data around them because they are sponsored and may have a link associated where a person could buy that ingredient.

My question is:

How would you go about enabling people to create a NEW ingredient while building the recipe without breaking the workflow? Many times I expect the ingredient to exist but not until many recipes have been data entered.

I would love a modal inline safecracker form to popup to submit the ingredient entry but am not sure if playa has a js trigger for selecting a 'new' option in the playa list.

# Answer
> 2 votes
You could use the Instructions for your field to link to the Publish page for your Ingredients channel in a new window, but you would have to refresh the current entry page to see the new entry, which would lose any edits you made.

Maybe have a frame in the new window with a close button that triggers a save in the original window and then redirects back to the entry?

If you use Safecracker, you could do the new entry in a modal frame/lightbox and have more programmatic control over refreshing the original form.

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


# Question
Title: Can I use EE fieldnames in Freeform form tag?
This isn’t a code question - yet - but here’s a quick overview of my setup so that you have some context:

* EE 2.5.3
* Freeform 4.0.08

I have a template that includes a form. The template displays an individual person’s information, which is held in an EE channel entry (one entry per person). There are upwards of 20 people whose information is displayed via this particular template.

I would like the person whose information is currently displayed, to receive any notifications that a user may send in using the form on the page. I have an EE channel field, {lo\_email}. As long as the Freeform tag is contained within the exp:channel:entries tag, can I use that fieldname in the Freeform tag, to target the person receiving notifications from the form? Example:

```
{exp:freeform:form admin_notify="{lo_email}"}

```

(I haven’t tried this yet - but this needs to get done quickly, so I thought I’d ask if this is possible before doing some template restructuring on this site that I’ve inherited.)

# Answer
Absolutely, this should work. I've done this frequently on a more complex scale, using channel entries to offer customizable Freeform forms for clients.
> 3 votes

---
Tags: solspace-freeform
---


title: How to Delete an Upload Destination?

text:
# Question
Title: How to Delete an Upload Destination?
I want to delete an empty upload destination in ExpressionEngine, but can't find the appropriate option. Would be grateful if someone knowledgeable could point out the button I should click to get rid of the upload destination I don't need.

# Answer
Just goto the Content menu \> Files \> File Upload Preferences

This will list the upload destinations. Then to the far right of the list, you will see a delete column, just click the Trash icon for the destination you want to delete.

This will delete the destination in EE but not the folder containing the files.
> 4 votes

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


# Question
Title: Stash Get not getting, but Stash Set output="yes" shows data?
I'm having a bit of an issue in repurposing a functioning template of mine. I have a `{exp:stash:set}` and `{stash:get tag}`, both of which worked on the previous template, but on this new template which is on a Structure page one segment deeper, I seem to be having problems with the `{exp:stash:get}` not returning anything, though the set tag works just fine with `output='yes'` set.

The code in question:

```
{exp:stash:set name="segment_entry" type='snippet' parse_tags="yes"}
  {exp:playa:parents url_title="{freebie_6}" channel="segment_discussions"}
    {entry_id}
  {/exp:playa:parents}
{/exp:stash:set}

{exp:channel:entries
    channel="segment_discussions"
    disable="categories|category_fields|member_data|pagination|trackbacks"
    limit="1"
    entry_id="{exp:stash:get name='segment_entry' type='snippet'}"
    parse="inward"
  }

```

I’ve tested to see if the problem was the get tag being inside of the `{exp:channel:entries}` tag, but unfortunately, that doesn't seem to have any effect. Is there anything else I’m missing that could cause this to no longer function? channel name obviously is correct, as I previously mentioned that `output='yes'` was working just fine.

For reference, here is the whole template, with content of other switchee cases removed:

```
{if logged_out}{redirect="account/login"}{/if}
{if group_id == '4'}{redirect="account/pending"}{/if}

{exp:switchee variable="{freebie_4}" parse="inward"}
  {case default="yes"}
  [[Unrelated Content]]
  {/case}

  {case value="discussion"}
    {switchee variable="{freebie_5}" parse="inward"}
      {case value="thread"}
        {embed="embeds/_header"}

        {exp:stash:set name="segment_entry" type='snippet' parse_tags="yes"}
          {exp:playa:parents url_title="{freebie_6}" channel="segment_discussions"}
            {entry_id}
          {/exp:playa:parents}
        {/exp:stash:set}

        {exp:channel:entries
            channel="segment_discussions"
            disable="categories|category_fields|member_data|pagination|trackbacks"
            limit="1"
            entry_id="{exp:stash:get name='segment_entry' type='snippet'}"
            parse="inward"
          }

            <section class="unit">

            {embed="unit/_navigation"}

            </section>

            <section class="discussion">

              <div class="main-content">

                <header>

                  <h3>DISCUSSION: {title}</h3>

                  <h4>{comment_total} Comment{if comment_total <> 1}s{/if}</h4>

                </header>

                <article>

                  {segment_discussion_body}
                  {exp:channel_files:files entry_id="{entry_id}"}
                    {if file:count == "1"}<ul>{/if}
                    <li>{file:title}: <a href="{file:url}">{file:filename} ({file:filesize})</a></li>
                    {if file:count == file:total}</ul>{/if}
                  {/exp:channel_files:files}
                </article>

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

              <div class="discussion-items">

              </div> <!-- discussion-items -->

            </section>

        {embed="embeds/_footer"}
      {/case}
    {/switchee}
  {/case}
{/exp:switchee}

```

# Answer
So the grand and magnificent Mark Croxton let me know that the problem in this example is my use of line breaks, which are being passed into the parameter values and choking EE. I removed them from the template, but he also said that either `{exp:stash:set}` or `{exp:stash:get}` could have the paramater `trim="yes"` added to it to clear out the extra whitespace.

In the end, collapsing it to one line fixed it all.
> 2 votes

---
Tags: stash, playa, switchee, freebie
---


title: Editor (DevDemon) h1 Button

text:
# Question
Title: Editor (DevDemon) h1 Button
I want to have `p, h1, h2, h3, h4, h5` Buttons in the Editor by DevDemon.

How do I do this? Do I really need to hack some php or js files?

I enabled "Formating Tags" in Advanced Settings. But these Tag Buttons still don't show up.

# Answer
It looks like they have some half-finished docs on adding buttons programatically ... you should really contact their support to clarify this.
> 2 votes

# Answer
Okay, shame on me. The solution is so simple:

DevDemon Support pointed out, that all the Text Formating options are in the «pilcrow sign» Button:
> 2 votes

---
Tags: redactor, editor
---


# Question
Title: I don't want users to enter {title} field
My channel has a few required fields. I want to use those required field to dynamically build the `{title}` instead of having the user enter it. Is there a way for me to, say, user `{first_name}` and `{last_name}` (the required fields of my Channel) as the title?

# Answer
> 9 votes
You can use MX Title Control or Title Master to do this.

Title Master specifically lists the scenario you describe as an example:

> If you have a channel with people in it, it is annoying to have to enter a Title when it is the same information you will enter for the First and Last Name fields. Here is a quick example of templates you could use. Title - {last\_name}, {first\_name} = Brown, John URL Title - {first\_name} {last\_name} = john\_brown

# Answer
> 3 votes
Is there an entry being submitted from front end (not from control panel)? if so I think you are using safecraker. In this case you can use dynamic\_title parameter and can pass value like dynamic\_title="{first\_name} {last\_name}".

# Answer
> 0 votes
You could just make the field a hidden form field and use javascript to update when they enter in their first and last name?

---
Tags: channel-entries
---


title: Login User without a password

text:
# Question
Title: Login User without a password
So I'm attempting to create a small plugin/module where I can log in a user with the need to have a password, login with Facebook basically (Yes, I know there is a plugin that does all this).

I was looking at this thread -\> Can't programmatically log member in

Is all that I need to do to log a person in, is to call the create\_new\_session() function?

I can't seem to find any decent documentation on this. Any help or references would be appreciated.

# Answer
You can take a look at code how ExpressionEngine does it from the Control Panel.

See the function do\_login\_as\_member within the file expressionengine/controllers/cp/members.php

Hope, it would help you lot.
> 0 votes

---
Tags: login, plugin, sessions
---


# Question
Title: Any idea on how to debugg this "Developer log" alert message?
> **Possible Duplicate:**
> How can I find out which add-on is sending a message to the developer log?

I have this message in my Developer log about some Add-on using "login\_form()" function. When I search through all my Add-ons this function is nowhere to be seen :)

Any ideas how I remove this message? Keeps popin' up every 2-3 day.

Also it's complaining on "row 0"? :)

Thanks all!

Here's a screenshot of error: https://i.stack.imgur.com/vPEuO.jpg

# Answer
This error is an absolute pain, debugging it is not easy at least in my experience. What addons do you have running, that maybe a better way to tackle this. In particular we are interested in anything that hasn't had an update in the last 12 months or so.
> 0 votes

# Answer
I got this error in EE 2x with the addon - Backup - Thomas Myer (worked fine in EE 1x) and simply switched to Backup Pro.

```
2 Reviews
Rating - 3.388 Votes
23 Favs

```
> 0 votes

---
Tags: developer-log
---


# Question
Title: How to display ONLY entries that have at a particular field present (like image)
How can I display entries that only have a particular field completed.

In my case I am displaying all entries but would like to exclude any entries that have no image field completed. The image field is a matrix field.

Thanks Sinan

# Answer
You can use the search parameter.

```
{exp:channel:entries search:image_custom_field_name="not IS_EMPTY" ...}
  ...
{/exp:channel:entries}

```

This will return entries where the image custom field has been filled in.
> 9 votes

---
Tags: channel-entries, matrix, conditionals
---


# Question
Title: Is There Anyway to Select a Primary Related Item in Playa?
We were using Solspace's Related Entries before switching to Pixel & Tonic's Playa after an upgrade to EE2. Related Entries had an option to designate a 'primary entry' of the related entries. We used code, like below, to select a single record out of the related items for 'showcasing':

```
{exp:related_entries:entries main_only="yes"}

    <div class="primary">
    <div class="must-read"></div>

    <h3 class="title"><a href="{if series_title_link !=""}{series_title_link}{if:else}{comment_url_title_auto_path}{/if}" title="{title}">{title}</a></h3>

    {!-- Updated: 5 May 2012, Stylistic Change to Read More --}
    <p>{exp:word_limit total="30"}{summary}{/exp:word_limit}</p><p class="readmore"><a href="{series_title_link}" title="Read More">Read Now »</a></p></div>
    </div>
    <hr />

{/exp:related_entries:entries}

```

Is there any method to do this in Playa? or would I need to create a second Playa field, where just a single related item is added?

# Answer
> 5 votes
If you do not specify orderby and sort parameters on the playa tags, the order in which they are displayed is the one in which they are displayed in the drop panes interface in the CP.

Code

```
{exp:channel:entries channel="mainchannel" limit="1"}

    ... entry stuff ...

    {exp:playa:children channel="relatedchannel" status="open"}

        {!-- Capture the first item in the playa drop pane interface --}
        {if count == 1}
            <h3>Related items</h3>
            <div class="must-read">
                <h4>{title}</h4>
                ... related entry stuff ...
            </div>
        {if:else}
            {!-- Capture the rest of the items in the playa drop pane interface --}
            <div class="normal">
                <h4>{title}</h4>
                ... related entry stuff ...
            </div>
        {/if}

        {if no_results}<p>nothing to see here, move on.</p>{/if}

    {/exp:playa:children}

{/exp:channel:entries}

```

# Answer
> 1 votes
Could you use the order in which the items are presented in the playa field as the determining factor? the first item for example gets featured? This assumes you don't need that order represented in some other fashion.

---
Tags: playa, relationships
---


# Question
Title: Matrix file uploads, only first file being uploaded
I am trying to customise a matrix field, for safecracker use, to customise the look of file (image) uploads.

I have the following code http://jsfiddle.net/sanxL/ in my safecracker form, and it seems to produce the rows correctly, however when i send the form, only the first field has the attached file (photos in this case)

Anything obvious wrong here?

# Answer
> 2 votes
Not too worry, found out what I was doing wrong! Forgot to include the hidden `<input type="hidden" name="walk_images[row_order][]"
value="row_new_0">` within the div that was being recreated.

All good now.

---
Tags: safecracker, matrix
---


# Question
Title: URL errors of URI submitted has disallowed characters
In google webmaster tools i seem to be getting of 503 pages and other errors The website is old. Mainly from old url's that don't exist anymore.

For example page.com/meubels?page=75&%24Version=1&%24Path=%2F =\> returns *"Disallowed Key Characters."*

Another url error is the following: page.com/brands/brand%3Fpage=1?page=1 =\> returns *"The URI you submitted has disallowed characters."*

Related Invalid Get Data was solved here.

Is it possible to have a 301 redirect to such url's through htaccess or any other way to redirect visitor's to the correct pages in staid of having them stuck on old url's with error pages.

Thanks

# Answer
> 1 votes
The reason you're getting the "disallowed characters" messages is that EE doesn't allow some characters (such as `%`) in URLs as a security measure.

You can certainly catch these before they get to EE using `.htaccess` \- but how you'd go about redirecting is all dependent on how the old URLs relate to the new ones (what shared or identifying information they have).

If the URLs don't have any key shared info that will allow you to write a proper redirect pattern, you could aways collect every offending URL and put in a manual redirect for each:

```
Redirect /meubels?page=75&%24Version=1&%24Path=%2F http://page.com/meubels/the-new-page

```

---
Tags: url, htaccess
---


# Question
Title: Wygwam Module: Browse server button hidden
For member groups other than Super Admin, the "browse server" button is hidden when trying to import an image into the content area while editing.

I've tried turning on all member group options...changing the File Browser for Wigwam between CKFinder and EE Manager, no luck.

Running EE 2.4.0 - would the upgrade fix it?

Any other solutions or things to try welcome. Would rather not make everyone a Super Admin.

# Answer
> 1 votes
The setting you need to adjust is on the **File Upload Preferences** page. Look for "Restrict file uploading to select member groups" at the bottom.

**CP LOCATION**
Content ‣ Files ‣ File Upload Preferences

---
Tags: members, file-uploads, wygwam
---


# Question
Title: How to best store simple transactional data
I'm adding a simple transactional element to a client site to allow their users to pay a bill online by completing a simple form with a payment amount and a bill reference. Payment will be handled by a payment gateway via a POST.

Simples.

However I'm unsure what the best practice might be in terms of storing this data on the EE side.

In the past I've used the Solspace Freeform module to capture the data, re-display it on a confirmation page and then use that to POST the data to the payment gateway.

One other option is to use a SAEF to submit the data as an entry and do much the same after that.

Which to do... the benefit of using entries is that they are more flexible - the disadvantage is they cannot trigger a notification email to the user and/or client but that can be handled with a simple plug-in if required.

I'm interested to know how others have handled this in the past. Specifically in a scenario like this where an e-commerce module would be complete overkill and the Simple Commerce module isn't an option.

# Answer
If you have a method of storing and posting the appropriate data with Safecracker, and all you are worried about is the notification emails, you should have a look at ObjectiveHTML's Postmaster. You can set up emails for almost any event.
> 2 votes

# Answer
**Non-Freeform/Safecracker:**

Simple post-processing of a Safecracker form can be accomplished by setting its redirect URL to be a PHP-enabled template, doing the notification email (or other transactions) in PHP, and then setting a redirect in PHP to the real post-submit page/destination. If PHP is running on output, you can work with segment variables to get EE entries as needed, and run PHP functions on the output of the channel:entries tag. You can fetch your data with EE, and then work with it in PHP.

If you can accomplish the notification email (or other transactions) purely using EE tags with an add-on, you can do this as well. The idea is to establish a post-processor template that handles the notification or transaction, and then redirect from there to your real confirmation page.

**Freeform:**

Freeform also has a post submit hook that we've leveraged with custom extensions to submit to APIs using PHP/cURL. Our most common use of this has been to submit data to Salesforce after a user has submitted a form using Freeform. Freeform captures the user submit in the CP and sends a notification email, while the extension submits that data behind the scenes to the Salesforce database.
> 0 votes

# Answer
We do this with ExpressionEngine Channels, the Tell-a-Friend Form (for the confirmation email to user and client designated staff). We also have Mandrill in place, so we can track the transactional emails. The system works very well. This was set-up pre-PostMaster.

We are considering adding PostMaster to the mix, mostly to remove that half second display when the Tell-a-Friend module is sending the confirmation email. But otherwise, it was simple to set-up, fairly easy to secure, and has worked like a charm for 5+ years.
> 0 votes

---
Tags: commerce
---


# Question
Title: Changing the url structure of established site?
Just a quick question regarding the URL (template) structures in expression engine.

I have an established site that has been live for almost a year. I was brand new to EE when I set up and therefore I am finding better ways of building the site all the time.

I have a template group and set of templates like so

```
template_group/template/

walks/find/
walks/findwalk/
walks/view/
walks/search/

```

obviously `walks/view/` is is my single entry template.

`walks/find/` is my main listing template. This includes a list of all the latest entries, together with a search box.

`walks/findwalk/` is exactly the same as the `find` template, but it displays results from categories, so the url ends up something like `walks/findwalk/category/(catergoryname)`

`walks/search/` is the same again, except it contains my search results.

I know, not very DRY, but I was new.

So I am looking at simplifying it slightly and condensing the templates down. The way I see it, I would be quite happy to have single page view separate, and a single template for the listing page.

I have just started using Switchee, and I think this would be good here.

Ideally my listing template would be `walks/find/` which, by using switchee, would check for `{segment_3}`

```
walks/find/search
walks/find/category
walks/find/

```

So that's fine. Nicer URL's, less templates. However, I am a bit unsure as to how this will effect my current search results in search engines.

By far, the url thats hit on most is `walks/find/`, so that will stay the same, but then nearly all the next most hit urls are: `walks/findwalk/category/(category_name)`

What will happen to these results in google? Is there a way to ensure the links stay active?

Sorry for the long post!

**EDIT:**

Just realised I'm not even using the index template within the template group, so i could clean these urls up a bit further but dropping the need for `find` altogether.

```
walks/search
walks/category
walks/
walks/(entry_title)

```

This would look a lot better. Just wondering if there is a way to drop the `category` at all? This would mean i could get `walks/category_name/entry_title` which would look better still!

# Answer
> 5 votes
You'll want to add 301 redirects to your .htaccess file, with the old URLs mapped to the new URLs.

You can parameterize those redirects, so you can match on `/walks/findwalk/category/[value]` and have it insert that value in your new URL structure.

You'll want to Google '301 redirects htaccess' for pointers. I've also found Perishable Press to be a good htaccess resource in the past.

Specifying 301 (permanent) redirects will instruct Google to update its index, with the new URL as the permanent, new location for that content.

**Updated:** If you want to omit the `/category/` segment, you'll need conditionals to catch the other segments and handle those. If one of those cases is not met, you can assume a category ID or category url\_title, and branch your logic to present results accordingly. At that point you're using your index template as a router, and routing the request to embed templates based on the values on the URL. You would need to do a lookup on segment\_2 to see if there were any entry matches. If not, you'd need to bounce to an embedded template to look up category matches for segment\_2.

Maybe just use a word other than 'category' for segment\_2 rather than complicate your templates?

**Updated:** As suggested in the comments, Detour Pro looks like it will cover all of the 301 redirect goals, though I haven't personally used it.

---
Tags: url, seo, switchee
---


title: No CP Theme after upgrade to EE 2x

text:
# Question
Title: No CP Theme after upgrade to EE 2x
After upgrading from EE 1.8 to EE2, my CP theme no longer works. I double-checked paths, I tried moving my cp\_themes folder to the system folder. No luck. Any thoughts?

# Answer
This is a path issue. That's the only reason a theme goes away. I suggest rechecking all the paths and moving your cp\_themes folder back to where its original location. One of the paths is wrong.
> 1 votes

# Answer
My site was residing on a sub-domain. However, when copying the files and directories from the live site an .htaccess rule was forcing www on my subdomain (www.dev.domain.com vs dev.domain.com). Solved! Thanks for your help
> 0 votes

---
Tags: ee2-upgrades, cp-themes
---


# Question
Title: Store module: How to update cart quantity without submitting the cart?
Given this design http://cl.ly/image/2J2k0p2f451Z where the user updates the quantity and clicks the "update" link/button, how do I go about updating the individual item quantity without actually submitting the cart and placing the order? I assume some hacky JavaScript can take care of it, but it seems like there should be a server side process for this.

# Answer
> 3 votes
The easiest way would be to add `<input type="submit" name="update_cart" value="Update Cart" />` to your template and then add a bit of jQuery to bind the update link to the newly created update button (which you would want to hide to keep your current design).

As long as your submit button isn't called `submit`, `commit` (both of which submit the order), `empty_cart` (which empties the cart) or `next` (which updates the cart and redirects the customer to the url specified in your `next_url` parameter), Store will simply update the cart quantities and redirect you to the current page.

This allows you to have both "Continue to Checkout" and "Update Totals" buttons on the same form, which both update the cart but redirect the customer to different locations. This can be seen in the `checkout.html` example template which ships with Store:

```
<div class="form-actions">
    <input type="submit" name="update_cart" value="Update Totals" class="btn" />
    <input type="submit" name="empty_cart" value="Empty Cart" class="btn btn-danger" />
    <input type="submit" name="next" value="Continue to Billing Details" class="btn btn-primary" />
</div>

```

---
Tags: expresso-store
---


# Question
Title: Database Error When Adding Entry With Multisite Manager
I have recently set up a second site using Multisite Manager with ExpressionEngine 2.5.2. I got everything working smoothly on my local environment, however, when I try to add entries through ExpressionEngine to my production server, I get the following database errors

```
A Database Error Occurred
Error Number: 1054

Unknown column 'field_id_147' in 'field list'

INSERT INTO `exp_channel_data` (`entry_id`, `channel_id`, `site_id`, `field_id_147`, `field_id_148`, `field_id_149`, `field_id_150`, `field_id_151`, `field_id_152`, `field_id_153`, `field_id_154`, `field_id_155`, `field_id_156`, `field_id_157`, `field_id_159`, `field_id_165`, `field_id_166`, `field_id_162`, `field_id_160`, `field_id_158`, `field_id_161`, `field_ft_147`, `field_ft_148`, `field_ft_149`, `field_ft_150`, `field_ft_151`, `field_ft_152`, `field_ft_153`, `field_ft_154`, `field_ft_155`, `field_ft_156`, `field_ft_157`, `field_ft_158`, `field_ft_159`, `field_ft_165`, `field_ft_166`, `field_ft_161`, `field_ft_162`, `field_ft_160`, `field_id_1`, `field_id_2`, `field_id_3`, `field_id_4`, `field_id_5`, `field_id_6`, `field_id_7`, `field_id_8`, `field_id_9`, `field_id_10`, `field_id_11`, `field_id_12`, `field_id_13`, `field_id_14`, `field_id_15`, `field_id_16`, `field_id_17`, `field_id_18`, `field_id_19`, `field_id_20`, `field_id_21`, `field_id_22`, `field_id_23`, `field_id_24`, `field_id_25`, `field_id_26`, `field_id_27`, `field_id_28`, `field_id_29`, `field_id_30`, `field_id_31`, `field_id_32`, `field_id_33`, `field_id_34`, `field_id_35`, `field_id_36`, `field_id_37`, `field_id_38`, `field_id_39`, `field_id_40`, `field_id_41`, `field_id_42`, `field_id_43`, `field_id_44`, `field_id_45`, `field_id_46`, `field_id_47`, `field_id_48`, `field_id_49`, `field_id_50`, `field_id_51`, `field_id_52`, `field_id_53`, `field_id_54`, `field_id_55`, `field_id_56`, `field_id_57`, `field_id_58`, `field_id_59`, `field_id_60`, `field_id_61`, `field_id_62`, `field_id_64`, `field_id_65`, `field_id_66`, `field_id_67`, `field_id_68`, `field_id_69`, `field_id_70`, `field_id_71`, `field_id_72`, `field_id_73`, `field_id_74`, `field_id_75`, `field_id_76`, `field_id_77`, `field_id_78`, `field_id_79`, `field_id_80`, `field_id_81`, `field_id_82`, `field_id_83`, `field_id_84`, `field_id_85`, `field_id_86`, `field_id_87`, `field_id_88`, `field_id_89`, `field_id_90`, `field_id_91`, `field_id_92`, `field_id_93`, `field_id_94`, `field_id_95`, `field_id_96`, `field_id_97`, `field_id_98`, `field_id_99`, `field_id_100`, `field_id_101`, `field_id_102`, `field_id_103`, `field_id_104`, `field_id_105`, `field_id_106`, `field_id_107`, `field_id_108`, `field_id_110`, `field_id_111`, `field_id_112`, `field_id_113`, `field_id_114`, `field_id_115`, `field_id_116`, `field_id_117`, `field_id_118`, `field_id_119`, `field_id_120`, `field_id_121`, `field_id_122`, `field_id_123`, `field_id_124`, `field_id_125`, `field_id_126`, `field_id_127`, `field_id_128`, `field_id_129`, `field_id_130`, `field_id_131`, `field_id_132`, `field_id_133`, `field_id_134`, `field_id_135`, `field_id_136`, `field_id_137`, `field_id_138`, `field_id_163`, `field_id_164`) VALUES (140, '20', '2', '', 0, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '')

Filename: libraries/api/Api_channel_entries.php

Line Number: 1831

```

If I create the column 'field\_id\_147' in 'field list' in my database, when i go to create an entry in ExpressionEngine, the error returns with a higher number (field\_id\_148, field\_id\_149, etc.)

Any ideas as to what's happening here or any way I can fix it?

*Originally I was having a similar issue on my local environment (question posted here), but solved the issue by replacing my system folder with a working copy from another computer. I'd prefer to not do that, considering this is no longer my local environment and I run into the issue of all of my live sites being affected.*

# Answer
Whenever **adding** something to your site, you'll typically want to start with Production, and then copy your Production database down to dev. If you're installing modules, core or add-on, and those are creating new database tables or columns, you've only made those database schema changes in the environment where you clicked "Enable" - Dev in your case.

My typical workflow for any add-on to an existing site is:

1. Drop the add-on files into my site locally/in dev.
2. Push that to git.
3. Deploy to the live server.
4. Log in to the live server's Control Panel.
5. Install the add-on there.
6. Mysqldump the Production db, pull it down, and import that locally.

In the case of Multi-Site Manager, the module files already existed on Production.

Only at that point am I ready to start using the add-on or module in my dev environment.

This goes for new channel fields or channels as well. If the site's live, I add the fields I need on Production before starting dev, and grab a dump of the Production DB to use locally. It's always a one-way flow, and there are never inconsistencies.

I think your best option at this point, now that you've deployed the updated files to Production, would be to install the module using your Production CP, **NOT** to start creating database columns manually. Let Multi-Site Manager do its thing.

The only portion of your EE app that's portable is your add-on & template files. You can move those back and forth and they can work with anything installed. If your site is live, always consider your Production DB the master and the point of origin for installations/updates. Sometimes you need to do a dry-run in dev, which is fine. But consider that a test run, document the steps you took, and reproduce those steps on Production. Then pull your Production DB down to work with the latest data.

And back up your Production DB before following any steps prescribed here :)
> 1 votes

---
Tags: database, multi-site-manager, error
---


# Question
Title: What hook should I use that executes before a channel entries tag is parsed?
Suppose I have a template with a channel entries tag on it. I need to execute an extension method during a hook that runs before the channel entries query takes place. It doesn't matter what parameters are passed to the hook, I just need to execute some logic any time entries are going to be queried.

# Answer
It sounds like the channel\_entries\_row hook would do it? http://ellislab.com/expressionengine/user-guide/development/extension\_hooks/module/channel/index.html#channel-entries-row
> 1 votes

# Answer
We should make a feature request. I need a hook that runs before the query is ran too. To my knowledge, such hook does not exist.
> 1 votes

---
Tags: extension, hook
---


# Question
Title: {count} is counting entries I don't want it to
Basic functionality I'm looking for has to do with counting the results from a reverse\_related\_entries pair while excluding certain categories. I'm hitting a wall. We have multiple locations and each location has their own audio and video files which are related to a specific subject called "series." Each location is a category and I only want to show AND count entries in one category and related to the series.

`{exp:channel:entries channel="sermon_series" limit="1" dynamic="no"}`

````
<!-- display some information about the series -->
<h1>{title}</h1>
{sermon_series_description}

<hr>

<!-- call up any child of the sermon series, sort them by date ascending -->
{reverse_related_entries channel="sermons" orderby="date" sort="asc" dynamic="off"}
    {if '{categories}{category_id}{/categories}'== "1915"}

        <!-- display some info about each sermon -->
        <h2>Part {count} - {title}</h2><br>
        <p><a href="{sermon_notes}">Sermon Notes</a></p>

        <hr>
    {/if}
{/reverse_related_entries}{/exp:channel:entries}

````

You can see what I'm trying to accomplish here: http://dev.ncctk.com/media/sermons/this-little-light-of-mine. You'll notice the {count} variable produces 1, 4, and 5. I've tried using a PHP increment as well, but the same thing happens as it loops through even the entries that don't meet the conditional.

# Answer
> 2 votes
Well, `{count}` is working as intended. It counts the entries returned by the tag - not entries within your conditional statement.

Unfortunately, `{reverse_related_entries}` is very limited in how it can be used (e.g., no category filter) - ostensibly for performance reasons.

Doing a PHP count in your template should work, so long as PHP is set to *output* and you increment your variable within your conditional statement. But a good alternative here is to use Playa instead of a stock Relationship field. Then you can use `{exp:playa:parents}`, which allows all the filtering you can normally apply to a Channel Entries tag (e.g., `category="1915"`).

# Answer
> 1 votes
I pretty much exclusively use Pixel & Tonic's Playa addon for relationships. It's capable of handling more parameters than the `reverse_related_entries` tag. I would recommend this method since it does not require you to filter through an unknown number of incorrect results to get what you're looking for.

However, it's not the only way to accomplish what you're trying to do. The problem is that the `count` tag doesn't care if it's wrapped in a conditional, so it's also counting the entries that don't match your category criteria.

You could try Stash's `set_list` and `get_list` to build the results you need. I believe `get_list`'s `count` variable would then be accurate.

As a last resort, I suppose you could also try a single embed (with some performance tradeoff and ugly code). Something like this untested example:

```
{embed="your_embed" entry_id='{reverse_related_entries channel="sermons" orderby="date" sort="asc" dynamic="off"}{categories}{if category_id == "1915"}{entry_id}|{/if}{/categories}{/reverse_related_entries}'}

```

Then, in your\_embed, get `{embed:entry_id}` and put it in an `entries` tag's `entry_id` parameter.

When you tried the PHP increment, was it still incorrect when incrementing it inside the conditional?

tl;dr (in order of preference): 1. Playa 2. Stash's set\_list, get\_list 3. Enabling PHP in a template 4. embed

---
Tags: categories, conditionals, reverse-related-entries
---


title: How to log errors in ExpressionEngine?

text:
# Question
Title: How to log errors in ExpressionEngine?
I am new to working with ExpressionEngine, so this may be an easy answer. I am getting 500 errors and can't seem to find any ExpressionEngine log files. How can I log errors in ExpressionEngine?

# Answer
Hi @Andrew error 500s are server errors. To my knowledge EE does not log such errors. You would need to request/access the logs from your host provider. Here's some info on where to access the logs if you're hosting locally using MAMP.

The specific server logs you'd want to look at would be the Apache logs, Access and Error which can ofter be located in the (/var/log/httpd/access or /var/log/httpd/error) directories. You may also want to check /var/log/messages as well.

A common reason for 500 errors is the PHP memory\_limit set too low. Here's how you might fix that.

Another idea might be to run the server wizard to rule out any incompatibilities there.

Finally, if only parts of the site are throwing 500s you might want to try turning on debugging. You can do so in the CP under Admin -\> System Administration - \> Output and debugging or manually by adding the following to your system/expressionengine/config/config.php file:

$config\['debug'\] = "1";
> 5 votes

---
Tags: error
---


# Question
Title: How to format currency in the templates?
Is there a native way to do this? Or must I use an add-on like: http://devot-ee.com/add-ons/price-format?

# Answer
> 2 votes
There's no native EE way to do it.

If you're using an e-commerce add-on like Store there are built in methods to format currency.

Otherwise, that add-on looks like it will do exactly what you need.

---
Tags: templates
---


# Question
Title: Custom Member's Channel Entries Defaulting To "Closed" Status
I created a member group and gave that group permission to add/edit a particular Channel. Whenever a new entry is made by a user in that member group, the status is set to "Closed." I looked at the Channel settings and the default status is set to "Open". When I make entries as a Super Admin, the status is set to "Open."

What do I need to do so that the member group's entries are set to Open?

# Answer
Check if that channel is assigned a status group from CP -\> Admin -\> Channel Administration -\> Channels -\> Edit Group Assignments.

Here make sure that you have selected a status "Status Groups".
> 15 votes

---
Tags: channel-entries, members
---


# Question
Title: Is ExpressionEngine Right for iPhone App Development
I am in the process of deciding if ExpressionEngine can be used for a project where I am creating both a website and a native iPhone App.

I would need cron background worker jobs, to pull data with JSON, Geocoding, and Ad Tracking. Also API integration with Urban Airship would be a plus?

I know there are mods from researching Devot-ee.com that may work but I don't know to what extent.

Has anyone attempted this? I don't what to get too far into development only to find EE won't work for this.

Thanks for your time.

# Answer
You should regard ExpressionEngine as a delivery mechanism for web content. You can use its templates to output any format of content or data you want, including JSON. You can use PHP within templates for server-side processing, or write your own plugins/extensions in PHP to output data.

You can schedule cron jobs on the server to import data directly into the database, using your own tables or directly into EE's channel\_title and channel\_data schema.

I used ExpressionEngine as a backend to Flash website once, populating AMF output.

So, yes, ExpressionEngine would be very suitable to provide the web-based backend that the iPhone app would consume. It can output anything, and provide a user-friendly control panel for your project's admins.

Whether you use EE, another system, or custom develop the backend, you should consider that EE will work for this, but how can you maximize your efforts? Are there sufficient add-ons that accomplish goals that you can minimize development time? If custom development using a different framework or just PHP is in your skillset, can you optimize the application by housing your custom logic in your own EE add-ons?

EE will work. It's more a question of where you can leverage 1) expertise and 2) already-developed tools to optimize your efforts.
> 5 votes

# Answer
ExpressionEngine can certainly be used for things like this, but I wouldn't go down that path.

Why? Because to do things like display your channel and entry data as JSON, with even a moderate amount of customization, you will end up writing custom PHP and your own database queries. At the point where your site is more than 50% custom PHP vs ExpressionEngine templates, it's going to be easier to just write your backend from scratch (in PHP, or whatever else).

The only exception I would make to this is if you already had an existing website with content in ExpressionEngine. In that case it's much easier to work with what you have (and what your content editors know how to use). You would only need to write some methods to pull data from your existing content. But if you're starting from scratch, and you have the ability/expertise to write a fully custom backend, then it will probably make your life easier in the long run to do so.
> 2 votes

---
Tags: ee2, database
---


# Question
Title: Getting SuperSearch and GWCode to play together nicely
Using Solspace SuperSearch I want to search by category (and keyword), and have the categories list on the result page remember which checkboxes I selected.

It works great when I am looping through the channel entries tag like so:

```
{exp:channel:categories parent_only="yes"}
{exp:super_search:variables}
    <li>
        {category_name}
        <input
            type="checkbox"
            value="{category_url_title}"
            name="category[]"
            {if super_search_category_{category_url_title}} checked="checked"{/if} />
    </li>
{/exp:super_search:variables}
{/exp:channel:categories}

```

I would like to use GWCcode Categories to have greater control however. When I do, I run into parse order issues and the `checked="checked"` does not render:

```
{exp:gwcode_categories depth="0" max_depth="1" style="linear"}
{exp:super_search:variables}
    <li>
        {cat_name}
        <input
            type="checkbox"
            value="{cat_url_title}"
            name="category[]"
            {if super_search_category_{cat_url_title}} checked="checked"{/if} />
    </li>
{/exp:super_search:variables}
{/exp:gwcode_categories}

```

Has anyone had the same problem and gotten these two addons to work together? Any alternative methods come to mind that give me this functionality?

**EDIT:** minor syntax error in code, see comments

# Answer
Try adding `parse="inward"` to the GWCode tag. It's a plugin tag instead of a module tag, so it will try to parse inner tags first, unless you add the `parse="inward"` parameter.
> 1 votes

---
Tags: parse-order, supersearch, gwcode-categories
---


# Question
Title: Focus Lab Config (bootstrap) working with MSM - still problems
OK, first question on SE so bear with me. I'm trying to setup an older site (after going through the EE2 upgrade process) on a virtual private server the client has running WHM and cPanel. The sites have been running for quite a while, including ecommerce and as such each site/domain has their own cPanel for managing unique SSL's (and thus unique IP addresses). In this case then, I'm not really in a position to change the setup for the server's directory structure and I'm attempting to get this setup from that point of view.

Ref: https://github.com/focuslabllc/ee-master-config/issues/12#issuecomment-11874743

```
/home/account1
    /_templates
        /default_site
    /config
    /public_html
        index.php
        admin.php
    /system
    /third_party
/home/account2
    /_templates
        /site2
    /public_html
        index.php
        admin.php
/home/account3
    /_templates
        /site3
    /public_html
        index.php
        admin.php

```

Now I have checked out the referenced GIST (https://gist.github.com/d27570a3e52bdf656f54) for trying to make Focus Lab Config work with MSM, with mixed results, but my main concern comes down to the fact that the paths are being set based on the URL being accessed. This is all fine and good if you're accessing the website from the front end using it's assigned URL, but if you use the site switcher within the EE control panel, it all falls apart.

e.g. I log into the default sites admin (http://site1.com/admin.php). All path references for template directories, upload preferences, system assets are correct for that site. Now if I switch to site2, my URL still begins with 'site1.com' so any uploads while editing site2 from the same URL will result in the incorrect paths being used.

So this is essentially where I'm at, and wondering if smarter heads here can assist in getting a final solution. My thinking at this stage, is that I need to be able to set a variable for the main server directory (in my case above it might be '/home/' which could be derived from the location of '$\_SERVER\['DOCUMENT\_ROOT'\]'. The next is the ability to assign an account directory for each of the sites in the MSM (exp\_sites) that can then be set as a conditional on the config depending on which site is being viewed within any or all of the possible EE control panels that could be logged into. I'm not sure if the config.master.php is reloaded each time a page is refreshed.

And there you have it. A problem without a solution and not enough expertise in my own head to solve. Any and all help would be appreciated.

Regards Brendan

BTW, in the config.php and database.php files, I updated the reference to the config master using 'APPPATH' rather than '$\_SERVER\['DOCUMENT\_ROOT'\]'.

```
/**
 * Require the Focus Lab, LLC Master Config file
 */
require APPPATH . '/../../config/config.master.php';

```

# Answer
> 1 votes
This isn't going to be much help but i ended up hard coding paths in after hitting multiple problems. MSM seems very tricky to set up like this, pity.

---
Tags: multi-site-manager, config, focus-lab-master-config, bootstrap
---


title: How do I view the parsed RSS output?

text:
# Question
Title: How do I view the parsed RSS output?
It's probably a dumb question, but it doesn't matter what browser I open my podcast rss feed in it doesn't show any content. The feed validates in a validator, but I just want to be able to see the code without have to go to a validator to get it.

The link is: http://dev.ncctk.com/feeds/lynden-sermon-audio

# Answer
Did you try viewing the source code in your browser?
> 3 votes

---
Tags: templates, rss
---


# Question
Title: Accessing Master Config environment names within templates
I'm using Focus Lab's brilliant Master Config https://github.com/focuslabllc/ee-master-config but wondered if it is possible to use the ENV constant in a template?

Something like this?

```
{if ENV == 'staging'}Show this.{/if}

```

Thank you.

# Answer
> 4 votes
You can use `{global:env}` and `{global:env_full}` by default. To add in extra variables see the `$master_global` array in config.master.php.

---
Tags: conditionals, focus-lab-master-config
---


title: Output jQuery value in EE tag

text:
# Question
Title: Output jQuery value in EE tag
I want to output the width of the window in a tag. So for example:

`{exp:resolution:width}
 {width}
{/exp:resolution:width}`

Where {width} would display the width from my jQuery.

`$(window).resize(function() {
var width = $(window).width();
$(".test").text(width);
});`

The problem I have, is I can't figure out how to get my jQuery output into the tag.

This is what I have currently:

`$this->load->library('javascript');`

````
    $width = $this->EE->javascript->output(array(
        '$(window).resize(function() {
            var width = $(window).width();
            $(".test").text(width);
         });'
    ));

    $tagdata = $this->EE->TMPL->tagdata;

    /* Create Tags*/
    $data = array(
        "test" => $width,
    );

    $variables = array();
    $variables[] = $data;

    /* Output Tags */
    return $this->EE->TMPL->parse_variables($tagdata, $variables);

````

Also, is there a way to have the tag updated every time the window is resized?

Thanks

# Answer
Your EE tag can only output the jQuery snippet. It cannot run jQuery server-side and produce the width value for you to use.

The jQuery snippet will run in the browser when the page loads, after the EE tag has rendered.

You cannot gain access to a jQuery/client-side value in server-side code before the page has been rendered. You should just keep this in client-side jQuery and adapt based on the width value using jQuery.

MX Mobile Detect may be what you're looking for to use in your template. I've used that for width-based conditional output.
> 5 votes

# Answer
You won't be able to do this.

jQuery happens on the client side and your EE tags are parsed on the server side.

The EE tags are, therefore, already parsed before you are able to do anything with jQuery.

Whatever you are trying to achieve may be possible via a different route but not this way.
> 3 votes

# Answer
Like others have said - you can't do this. The page is already rendered by the time the JavaScript runs.

You may be able to detect for mobile devices though, if that's what you're ultimately trying to do. There are a bunch of add-ons that could help you with this.

They mostly function something like this:

```
{if mobile}
  Show mobile content.
{if:else}
  Show regular content.
{/if}

```
> 2 votes

---
Tags: plugin
---


title: Turn off Message Pages after login?

text:
# Question
Title: Turn off Message Pages after login?
Is there any way to 'turn off' the Message pages that briefly show after a login, logout, etc.?

# Answer
If you're only concerned about system messages associated with *login and registration*, **FreeMember** is a great add-on and does away with them entirely.

There won't be any flashes of "You are now logged in" etc, and it will also display any error messages inline.
> 2 votes

# Answer
I don't believe. However, you can use a addon like **Custom System Messages** to customize those templates

> Custom System Messages provides an alternative to the the Specialty Templates for ExpressionEngine. All ExpressionEngine messages, regardless of type or severity, are filtered through the same group of templates, which are only editable within the Control Panel. If you use Subversion or Git to version your templates, the Specialty Template are left out. On top of this fact the Specialty Templates do not not parse other template tags, so embedding other templates, or using tags from third party add-ons do not work... until now.
> 4 votes

# Answer
I think, you should use Login Redirect add-on.
> 1 votes

---
Tags: templates, system-messages
---


# Question
Title: Store module: How to update product modifier from the cart page?
This is sort of related to Store module: How to update cart quantity without submitting the cart? but I don't want to update that question b/c it is still relevant to other people. It turns out my issue is that our store uses price modifiers for the "quantity." So people order 1 item, but it might come in 500, 1000, 1500, or 2000. Instead of changing the item\_qty field on the cart page, I need to be able to change a price modifier instead. This is what my template looks like thus far, and it sort of works, but instead of updating the existing item it just adds an entirely new item to the cart.

A simplified version of my cart template:

```
{exp:store:checkout next="cart/confirm" return="cart/ORDER_HASH"}
    {!-- This seems to be the only way to get the full list of available
    modifiers in this tag :( --}
    {modifiers}
        {if modifier_name == "Quantity" OR modifier_name == "quantity"}
            {embed="cart/_product-modifiers"
                entry_id="{entry_id}"
                key="{key}"
                option_id="{option_id}"
                modifier_id="{modifier_id}"}
        {/if}
    {/modifiers}

    {!-- Quantity is determined by the modifier since its a fixed amount, so set to 1
    here so the product is actually added to the cart --}
    <input type="hidden" name="item_qty[{key}]" value="1" />

    <button type="submit" name="update_cart" class="item-quantity-update" value="Update Cart">Update Cart</button>
{/exp:store:checkout}

```

And the cart/\_product-modifiers template to render this dropdown http://cl.ly/image/0e0Q0q391I0s:

```
{exp:store:product entry_id="{embed:entry_id}"}

    {modifiers}
        <select name="item[{embed:key}][modifiers_{embed:modifier_id}]">
            {modifier_options}
                <option value="{option_id}" {if "{embed:option_id}" == "{option_id}"}selected="selected"{/if}>{option_name}</option>
            {/modifier_options}
        </select>
    {/modifiers}

{/exp:store:product}

```

# Answer
> 3 votes
Based on Adrian's suggestion, and my thoughts before seeing his response I used one of Store's hooks to modify the product modifiers when the cart is updated. Its also crucial to update the product sku and the mod\_values array. When those are updated in the store\_cart\_update\_start hook it will trigger Store to swap the item entirely (b/c each modifier is a separate sku) and update all the prices accordingly.

This is what the embed code was changed to:

```
{exp:store:product
    entry_id="{embed:entry_id}"
    disable_form="yes"
    disable_javascript="yes"}

    {modifiers}
        {if modifier_name == "Quantity" OR modifier_name == "quantity"}
            <select name="update_modifier[{embed:key}][{embed:modifier_id}]">
                {modifier_options}
                    <option value="{option_id}__{option_name}__{option_sku}" {if "{embed:option_id}" == "{option_id}"}selected="selected"{/if}>
                        {option_name}{if price_mod_val} ({price_mod}) {/if}
                    </option>
                {/modifier_options}
            </select>
        {/if}
    {/modifiers}

{/exp:store:product}

```

Notice that the select name is a custom value I made up and has nothing to do with Store. The hook used to modify it is as follows:

```
public function store_cart_update_start($cart, $update_data)
{
    // Only if submitted via the cart page.
    // This hook is called when an item is added to the cart as well... we don't
    // want to do anything to the item at that point.
    if ( ! ($updates = $this->EE->input->post('update_modifier')))
    {
        return $cart;
    }

    foreach ($updates as $update_item_key => $update_data)
    {
        foreach ($cart['items'] as $item_key => $item)
        {
            if ($item_key == $update_item_key)
            {
                foreach ($item['modifiers'] as $modifier_key => $modifier_data)
                {
                    foreach ($modifier_data as $name => $value)
                    {
                        if ($name == 'modifier_id' AND isset($update_data[$value]))
                        {
                            $parts = explode('__', $update_data[$value]);

                            $option_id = $parts[0];
                            $modifier_value = $parts[1];
                            $new_sku = isset($parts[2]) ? $parts[2] : $item['sku'];

                            $cart['items'][$item_key]['sku'] = $new_sku;
                            $cart['items'][$item_key]['modifiers'][$modifier_key]['option_id'] = $option_id;
                            $cart['items'][$item_key]['modifiers'][$modifier_key]['modifier_value'] = $modifier_value;

                            $modifier_id = $cart['items'][$item_key]['modifiers'][$modifier_key]['modifier_id'];
                            $cart['items'][$item_key]['mod_values'][$modifier_id] = $option_id;
                        }
                    }
                }
            }
        }
    }

    return $cart;
}

```

This hook gets called when an item is added to the cart, and when an update\_cart submit button is clicked. This hook updates the cart\['items'\] array that is saved in the cart with the new values.

# Answer
> 2 votes
As mentioned in my comment, if your prices are linearly related to your quantity, then it would be much easier to template the `item_qty` as a select menu:

```
<select name="item_qty">
    <option value="500">500</option>
    <option value="500">1000</option>
    <option value="500">2000</option>
</select>

```

That way, everything would work as Store expects (updating the quantity would change the price, and adding new items would increment the existing quantity in the cart).

The underlying issue you are running into here is that Store treats any products with different modifiers as separate line items in your cart (for example if you add a Red Shirt and Blue Shirt to your cart, it would not make sense to merge them into a single line item on the invoice). That is why when you try to update the "modifier", it adds a new line item to the cart.

There is currently no way to update items once they are in the cart, except the quantity (other than going directly to the database). Therefore if you really need customers to change item modifiers once they reach the checkout stage, you have two options:

* Write an extension with a custom form action URL, which edits the cart directly in the database (this is easier than it sounds, you can use our cart library to recalculate everything once you change the modifiers), or
* Remove the existing product and add a new product. This would require some javascript to make two sequential form submissions seem like a single step to the customer, because the checkout form and product form have different action URLs.

---
Tags: expresso-store
---


# Question
Title: Remove Custom Button from the Control Panel Menu
I've created some menu buttons I no longer need, and want to remove them from the top menu of my ExpressionEngine control panel. Could someone please teach me how to do that?

Thank you!

# Answer
When you go to "My Account" in Control Panel you can see "Main Menu Manager" link under "Customize Control Panel". Follow that link and you'll see the list of your buttons. To delete a button, clear its name and submit the form.
> 7 votes

# Answer
Zoo Flexible Admin has been one of my default add-ons when I set up EE just for this purpose. I typically move most of EE's menus & tabs under an "ExpressionEngine" tab, and then curate which tabs are available to the client.

You can apply those changes to Member Groups instead of setting them up as custom tabs per member
> 0 votes

---
Tags: control-panel
---


title: Postmaster Issues

text:
# Question
Title: Postmaster Issues
I recently purchased postmaster and unable to create a new parcel, when I try to save a parcel it loads the EE control panel home page.

EE 2.5.2
Postmaster 1.2.0

I also woud like to not that the "preview" pans, loads my control panel home page too.

# Answer
It may be related to how your site directory is setup relative to where you are accessing the CP from - see this support thread on devot:ee. Justin claims he'll be fixing this in a future release.
> 2 votes

---
Tags: postmaster
---


# Question
Title: Asset Thumbs disappear after Better Workflow Preview
Assets 2.0.1, EE 2.5.3, BWF 1.5.1, Matrix 2.5.2

When previewing changes to a Better Workflow managed entry, after closing the preview window the page is refreshed. Assets thumbnails are not refreshed with the rest of the page when inside a matrix.

Asset image thumbnails in standalone fields *are* refreshed.

Before preview:

After preview:

# Answer
> 2 votes
This was due to the way how BWF processes Matrix rows (or rather, how Matrix initialises them to be compatible with BWF) and the row IDs were being shuffled around.

Obviously, we'll release a new version very soon that fixes these bugs, but, if it's really burning and you can't wait, then feel free to open third\_party/assets/views/thumbview/files.php and change the line 15 to this:

```
$file_class = 'assets-file-'.$max_thumb_width.'x'.$max_thumb_height.'-'.$file->file_id();

```

That should fix this for you.

# Answer
> 1 votes
I've been working on a similar issue this week for my Pic Puller fieldtype. Some of what I've been doing might help you out.

I'm not sure how Assets generates its thumbnails, but if its accomplished via JS like I do them with my fieldtype, it may be the same issue I had.

After previewing with BWF my fields within a Matrix had lost their JS functions so no previews were generated.

I ended up altering the Pic Puller fieldtype's JS to listen for the "previewClose" event that BWF broadcasts when it closes it's preview pane and generating the preview images that way.

The callback is here in the Better Workflow docs, look here: http://betterworkflow.electricputty.co.uk/api/#advanced-callbacks

Does that get you closer to a solution?

# Answer
> 0 votes
There is a known conflict between assets and better workflow that their developers have been aware of for some time. Hopefully, it will be resolved soon!

# Answer
> 0 votes
Last update: this bug fix has been incorporated into Assets (Release Notes). Thank you!

---
Tags: matrix, assets, better-workflow
---


# Question
Title: How do you safely delete file directory references with Assets 2 installed?
I moved most of my images to an S3 source and the migration went well. However I left a couple of images lurking in the old 'filesystem' folders (and thus the associated references)

When I then deleted my old File Upload Preferences references, and then visited a Publish page, I got a PHP exception error with `unknown_source` referred.

It appears that when Assets still has references to old folders in the DB, and those folders are deleted, it throws an exception.

Any way around this?

# Answer
> 0 votes
This is fixed in the latest versions of Assets ( now up to 2.0.4)

# Answer
> 0 votes
It's probably remnants left in the DB related to the old file directory paths.

Dig into the database to see where the Assets data is stored. It's probably in its own table and will be named accordingly. Look for data cells which contain the file upload tag `{filedir_1}` or {filedir\_2} or whatever the number is... The full data will look similar to `{filedir_1}/imagename.png`. The {filedir\_1} part is linking back to the old file directory path used in your File Upload Preferences.

Once you've confirmed that this is indeed the issue, then you'll need to decide what to do from there. You can build a query to remove this part of the data or you can clear all those cells...

If you need help with the query, post the details into a new questions.

---
Tags: assets
---


# Question
Title: Assets not showing the correct upload directory
I just upgraded to Assets 2.0 on EE 2.5.3. Installation went smoothly.

However my upload locations aren't acting correctly from within Assets.

My folder structure looks like this:

```
system
html
  assets
  docs
  images
  minified
  themes

```

`html/assets` and `html/docs` are both set up as upload directories in EE.

I'm using Master Config to set them. But even looking through the CP I can see they are correct. The server path is correct and the Upload Directory URL is absolute, not relative.

But the Assets file browser shows the folder structure of both directories as if they were pointed at the `html` folder. (see screenshot)

Thanks

# Answer
> 5 votes
Okay here is what I did to get this working correctly. This by no means solves the initial problem but it does get you up and running again.

I basically did what Brandon suggested in his comment—about setting the server paths directly and bypassing the config file. I did this before I ran the module updater or any indexing, so that none of those extra, unwanted, files were added into the exp\_assets\_files table.

**Steps**

1. Backup your current database just in case this doesn't work for you and you want to get back to here.
2. Restore the database that you backed up in the very first place before all this happened. (You did backup right?). Make sure you delete all tables from the current db and don't just replace them, you want to start clean.
3. If you are using `config['upload_preferences']` array in your config file comment that out.
4. Disable the RogEE Show Me My Assets! if you have it installed.(Don't think this has anything to do with the issues but just to be safe.)
5. Go to file upload preferences and set those manually and update them. Check to make sure they are actually updated, if not you will probably still have something referencing them in a config file.
6. Run the module updater
7. Go to the assets module and update your indexes.
8. Un-comment the `config['upload_preferences']` you comment out in step 3.

That process worked for me. Hope it helps you.

# Answer
> 1 votes
This should no longer be a problem in the latest version of Assets. (Release Notes). Thank you!

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


# Question
Title: BetterWorkflow preview throws PHP warnings
ExpressionEngine 2.5.3, Assets 2.0.

I also have a ticket into ElectricPutty's support but they suggested that since Assets is supported natively by BWF now, that I post it here.

When previewing changes to a BWF managed entry, the following PHP warnings are shown in the preview modal:

> A PHP Error was encountered Severity: Warning
>
> Message: trim() expects parameter 1 to be string, array given
>
> Filename: libraries/Functions.php
>
> Line Number: 2711
>
> A PHP Error was encountered Severity: Warning
>
> Message: trim() expects parameter 1 to be string, array given
>
> Filename: libraries/Functions.php
>
> Line Number: 2711
>
> A PHP Error was encountered Severity: Warning
>
> Message: Cannot modify header information - headers already sent by (output started at /Volumes/Macintosh \>HD/Users/iso100/Sites/pbsmartsuite/public\_html/\_system/codeigniter/system/core/Exceptions.php:170)
>
> Filename: core/Common.php
>
> Line Number: 412

If I save the draft and try to visit the same entry again to edit it, I get a blank page with only this error:

> Fatal error: Call to a member function file\_id() on a non-object in /Volumes/Macintosh HD/Users/iso100/Sites/pbsmartsuite/public\_html/third\_party/assets/views/thumbview/files.php on line 15

# Answer
We'll have an official release out for this shortly, but in the meantime, open up system/expressionengine/third\_party/assets/ft.assets.php.

Your line 523 should look like:

```
foreach ($data as $file_id)
{
    try
    {
        $vars['files'][] = $this->EE->assets_lib->get_file_by_id($file_id);
    }
    catch (Exception $exception)
    {
        // nothing much to do except move on
    }
}

```

Change it to this and you should be golden:

```
foreach ($data as $file_id)
{
    if (!empty($file_id))
    {
        $file = $this->EE->assets_lib->get_file_by_id($file_id);

        if ($file !== FALSE)
        {
            $vars['files'][] = $file;
        }
    }
}

```
> 4 votes

# Answer
It turns out this was essentially an issue with how the inline preview function in BetterWorkflow functions. I just finished a screen share session with Rob Hodges and the way we resolved the errors was by changing conditional tests on Assets fields from:

```
{if ov_product_logo_image}

```

to:

```
{if '{ov_product_logo_image}' != ''}

```

I don't know all the details but I'll let Rob comment on the details if he chooses to do so.

Thanks for the help everyone!
> 2 votes

# Answer
We're up to 2.0.4 and this should no longer be showing up as an issue for you guys. Release Notes here. Thank you!
> 0 votes

---
Tags: error, assets, better-workflow
---