We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Batch custom field update

Development and Programming

KPowell's avatar
KPowell
7 posts
17 years ago
KPowell's avatar KPowell

First of all, this is my first post here. I’ve been reading for a while and using a lot of tips.

That said, let’s get down to business.

A project I’m working on is starting to make itself into some kind of monster. We have a bunch of custom fields on multiple weblogs, categories, etc. that will need to be updated every once in a while. I’m currently working on an extension for just the weblog entries. I have it almost finished, but the wall I’m running into is what to do after they submit their changes. I’m currently using the following hooks:

edit_entries_extra_actions multi_edit_start

That adds the option to the edits page and lets me create my own form to edit just the fields. I noticed that the form action on the default multi_edit_form added “M=update_multi_entries” to the url, which would use the function by that name in cp.publish.php. The problem I’m seeing is that, in order to process the information the user updates, I would need to create a way to redirect to another function I write for processing. I have no idea what hook to use or if there is a way around it.

To put it in a nutshell: I don’t know the best way to process my custom multi_edit_form. If anyone has any ideas, then you will have my thanks.

       
Ryan M.'s avatar
Ryan M.
1,511 posts
16 years ago
Ryan M.'s avatar Ryan M.

Has this been addressed at all? I’m looking to write an extension that would add fields to the multi_edit page - but if it’s not documented how to process that, then I might get stuck real quick. Anyone ever added custom fields to the multi_edit form?

EllisLab, is there an example of why one might use this hook? It must be there for this sort of thing.

       
KPowell's avatar
KPowell
7 posts
16 years ago
KPowell's avatar KPowell

Attached is what I ended up doing. It doesn’t actually add to the multi-edit page, but rather creates it’s own multi-edit page.

There are probably plenty of bugs and it’s definitely not the most well-written code. It was, however, my first add-on that I wrote for expression engine, and it works for what I use it for.

Hopefully it helps someone else. Maybe if enough people are interested, I’ll go back and take a look at the code and make it a little prettier.

       
Ryan M.'s avatar
Ryan M.
1,511 posts
16 years ago
Ryan M.'s avatar Ryan M.

Thanks for sharing. It’s invaluable to be able to look at real examples rather than the very basic information that is contained in the docs.

       
Meirion's avatar
Meirion
127 posts
16 years ago
Meirion's avatar Meirion

KPowell, can you give some instructions how to use your extension?

I have added it, and selected some fields in its settings page - but don’t see what to do next?

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen

Wouldn’t mind to test this one out too to see how it does what it does but unfortunately when I try to go to my Extensions tab the whole page goes blank and nothing in the page source either. I have to take the extension out of the extensions folder in order to get the Extensions tab back again.

I have plenty of memory set as I am testing this on a localhost and have it ramped up fairly high for tests and such. Just wondering if anyone else had seen this problem and knew what it might be perhaps?

Best wishes,

Mark

       
Ryan M.'s avatar
Ryan M.
1,511 posts
16 years ago
Ryan M.'s avatar Ryan M.

Wow, this is a very interesting implementation - nothing like how I thought I would go about it if I were going to do something like this. Seems to work well, although, unless I’m not thinking this through fully, I might suggest flipping how the fields are now.

Instead of being able to make unlimited custom rows and selecting multiple fields from the full list of weblogs/fields (which, in my testing, was easy to make generate an error by selecting from multiple weblogs), I would think you’d list all the weblogs along the left (one row for each weblog) and then have a multi-select that has only the fields for that weblog.

Nice work!

       
Meirion's avatar
Meirion
127 posts
16 years ago
Meirion's avatar Meirion

Oh I see, it adds new rows to the dropdown field at the footer of the edit list page. You can then select multiple records from the edit list table, and be shown a page where you can edit a particular custom field for all those records at once.

       
fanderson's avatar
fanderson
883 posts
16 years ago
fanderson's avatar fanderson

Initially this looks like a great idea, however

Notice: Undefined index: field_related_to in /home1/editorsc/public_html/new/ecm/extensions/ext.idea_edit_multi_custom.php on line 896 Notice: Undefined index: field_related_orderby in /home1/editorsc/public_html/new/ecm/extensions/ext.idea_edit_multi_custom.php on line 907 Notice: Undefined variable: DB in /home1/editorsc/public_html/new/ecm/extensions/ext.idea_edit_multi_custom.php on line 911 Fatal error: Call to a member function escape_str() on a non-object in /home1/editorsc/public_html/new/ecm/extensions/ext.idea_edit_multi_custom.php on line 911

The reason this may be happening is due to the fact that the custom field I need to edit is actually a related entry field.

I hope there is a way to resolve this.

       
fanderson's avatar
fanderson
883 posts
16 years ago
fanderson's avatar fanderson

Just revisited this and it doesn’t select the field correctly at all. Too bad. I could really use this.

Any possibilities for a revision to fix the issues?

Thanks.

       
Blis Web Agency's avatar
Blis Web Agency
67 posts
15 years ago
Blis Web Agency's avatar Blis Web Agency

@KPowell - Just a quick congrats on the extension. Very handy! I noticed it doesn’t play very well with FF fields however which is a shame but by nevertheless still extremely useful. Thanks for sharing it with us.

       
Oxygen Smith's avatar
Oxygen Smith
120 posts
15 years ago
Oxygen Smith's avatar Oxygen Smith

I also have a “monster project” that this would be great for. Even if it just updated regular / non-FieldFrame fields. Right now, though, I can’t quite get it to even display/modify normal text fields properly, and I get the same errors that Forrest reported at the top of the edit page when the extension is running.

KPowell, what could we do to encourage you / free up some of your time to work on this? 😊

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.