Hot answers tagged

16

From the MySQL docs: "There is a hard limit of 4096 columns per table, but the effective maximum may be less for a given table." Keep in mind that each field uses two columns, one for field data, another for field type. So divide the maximum column limit by two, and then subtract 3 for the entry_id, site_id, and channel_id columns; which leave you with ...


15

The following should work: UPDATE exp_channels SET channel_auto_link_urls = 'n'; Backup your DB first though! Always better to be safe. Update: My answer assumes that you know about the Database Query Form. It's located in Tools » Data » SQL Manager » Database Query Form. Further Update: Removed backtick quotes from around table / ...


13

You can change the fieldtype to MEDIUMTEXT or LONGTEXT and it will work fine for your needs. But you need to be aware that that change will not be supported by EE and that future EE updates may alter the schema and of course could reset the fieldtype to TEXT. Reference - http://expressionengine.com/forums/viewthread/211174/


10

As far as I know ExpressionEngine will use one or the other, SHA1 or MD5 (I believe SHA1 is the default). In my test it actually worked to use either one when replacing the password, allowing me to login just fine in both cases. You can use MySQL to generate a new password hash for yourself. For example either SELECT SHA1('pass123') or SELECT MD5('pass123') ...


8

What you're referring to is the auto increment value in a table. You can change this by running the following query: ALTER TABLE mytable AUTO_INCREMENT = X ...where X is the next number you'd expect for your IDs. This is a database-level change and not something ExpressionEngine has as a "feature". Only make this change if you understand you might break ...


7

If the item uses the same field_group, you can generally switch channels via the edit menu. Go to the 'Edit' Menu, Select the Entry, while in the Entry, Select the Options Tab. The choice of channels you can move the item to is listed. See image. Additionally, if you were going to do it via query, you need to update multiple database tables: ...


7

The problem is that many developers don't know how to write compliant SQL statements - they're software developers who find themselves also filling the role of database developers. This problem crops up in many addons and was recently fixed in EE core code. For Assets v2.6 Change line 615 of ft.assets.php FROM: $sql = "SELECT DISTINCT a.source_type, a....


6

Change the field type to LONGTEXT to give yourself lots of room to grow with that field. LONGTEXT will store 4,294,967,295 bytes of data which is approximately ~4GB. Should be plenty.


6

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 < ...


6

This is because all “id” columns in EE are set to AUTO_INCREMENT in MySQL. Expressionengine is never explicitly choosing what the next member/entry/etc.’s ID is going to be – MySQL assigns it automatically. MySQL stores the latest auto-increment value internally, and it won’t automatically drop it back when a row is deleted. Some tools like phpMyAdmin will ...


6

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 ...


5

Make sure you’re running the latest version of Matrix. Matrix 2.5 came with a pretty drastic performance boost. http://pixelandtonic.com/matrix/releasenotes


5

This will definitely require a module. I recommend taking a look into the developer documentation to get a feel for this. I wouldn't write any code to do what you want without a plugin or module. It's not too difficult to get started. http://ellislab.com/expressionengine/user-guide/development/index.html You can use Pkg.io to make your life easier. This ...


5

I know you sorted this out, but for others who may wind up here looking for details: Say you have an entry with an entry_id of 10. That entry's channel has a Relationship field with a field_id of 20. While editing that entry, you choose a child entry from your Relationship field, which has an entry_id of 50. You'll end up with these values in your ...


5

Yes, that is the correct way to do it. To clarify this for others, you will need to open up PHPMyAdmin, or any other SQL client which will let you run SQL queries directly. You can also go to Tools > Data > SQL Manager > Database Query Form in the ExpressionEngine control panel. Then run this query, replacing 30000 with the order ID you want to assign to ...


5

UPDATE Since you would probably prefer to truly just move an existing category to a new group (and not create new ones and reassign entries as outlined below), this SQL is all you would need: UPDATE exp_categories SET group_id = X WHERE cat_id = Y OR parent_id = Y X = new category group Y = parent category that you want to move to new group The OR ...


5

My answer assumes you are for example trying to pull channel data manually. I'm not entirely sure of the OOP / Foreign key part of the question. First you need to understand the exp_channel_titles and exp_channel_data tables. I will only go into the information that's relevant for basic database interaction. exp_channel_titles contains the basic entry ...


5

I believe this is what you're looking for: SELECT exp_channel_data.entry_id AS entry_id, exp_channel_titles.title AS title, exp_channel_titles.url_title AS url_title, GROUP_CONCAT(cp.cat_id SEPARATOR '|') AS categories FROM exp_channel_data LEFT JOIN exp_channel_titles ON exp_channel_titles.entry_id = exp_channel_data.entry_id LEFT JOIN exp_category_posts ...


4

If displaying, one option could be to use the Nice Date plugin by low http://gotolow.com/addons/low-nice-date/docs which will displays date given a formatting.


4

What's Going Wrong You've already spotted the problem but here's a quick explanation of why the error is occurring. If you enable pagination EE1's query module will issue two queries - one calculates the total number of results sans-pagination and the other issues the query itself with an additional LIMIT parameter. The total results query is generated by ...


4

I think you would need a subquery to make this happen select cd.field_id_XX as first_name, cd.field_id_XX as middle_name, cd.field_id_XX as last_name, cd.field_id_XX as suffix, ct.author_id as member_id from exp_channel_data as `cd` left join exp_channel_titles as `ct` on cd.entry_id = ct.entry_id where cd.channel_id = "XX" and (select count(*) FROM ...


4

That should be as simple as this, using the correct channel_id: Update exp_channel_data set field_id_46 = concat(field_id_41, '|', field_id_42) where channel_id = 1 For the Maps table, it's something like this: Insert into exp_mx_google_map (entry_id, lat, long, some_example_field) Select entry_id, field_id_41, field_id_42, 'Some example value' from ...


4

This should cover it. SELECT field_id_49 as 'First Name', field_id_50 as 'Last Name', field_id_51 as 'Email', field_id_56 as 'Date of Birth', field_id_53 as 'Occupation', field_id_52 as 'Gender', field_id_57 as 'Address', field_id_58 as 'Address 2', field_id_59 as 'City', field_id_60 as 'Postal Code', field_id_54 ...


4

You can use the channel fields api to get the field names: ee()->load->library('api'); ee()->api->instantiate('channel_fields'); $fields = ee()->api_channel_fields->fetch_custom_channel_fields(); //change 1 to your site_id if using MSM $quantity_field_id = $fields['custom_channel_fields'][1]['your_quantity_field_name']; $sql .= "picd....


4

You can do this by developing your add-on as a module rather than a plugin since only modules can use EE actions. (See the EE docs for an explanation of the difference between the types of add-on.) More info on EE actions here. Essentially, you need to develop a module to perform your desired action, then call the associated ACT URL (e.g. http://example....


4

You can make a module - like Steve advice. Use Yeoman ExpressionEngine Add-On generator to simplify developing process. On server you will need to setup cron with wget: execute cronjob every day at 3am 00 03 * * * wget http://example.com/index.php?ACT=XX&task_id=1 Or if you want something really quick and simple: Create a special template with some ...


3

You have to update the exp_channel_titles table too.


3

First thought was we'd add a config var for the MySQL port as per the CodeIngiter docs $db['default']['port'] = 5432 but that didn't work instead we had to change the hostname to $db['expressionengine']['hostname'] = "mysqldbinstance.hostname.com:4703";


3

To get a total of all occurrences across all comments: SELECT SUM(LENGTH(comment) - LENGTH(REPLACE(comment, '?', ''))) AS occurrences FROM exp_comments To get the count for each comment in a query result: SELECT LENGTH(comment) - LENGTH(REPLACE(comment, '?', '')) AS occurrences FROM exp_comments (MySQL doesn't have a specific function for this, but I ...


3

You should never have to reinstall addons locally if you are pulling files/DB from production properly. If you are having this problem, the issue is most likely related to how you are doing the migration. I'd suggest your errors are caused by your exported SQL not including DROP TABLE and you aren't manually dropping the tables in the DB before your import. ...


Only top voted, non community-wiki answers of a minimum length are eligible