Hi as mentioned here I’m currently working on an extension to modify weblog entry data before it gets inserted into the database.
What I need to do is populate a custom field with the entry title before it’s inserted/updated to the database. (original discussion and reasoning here). Basically I need to populate a custom_field with the entry title and can’t rely on the client to do it so I need to automate the process.
I thought this would be easy.
Something along the lines of:
$_POST['my_custom_field'] = $_POST['title'];
But alas! The custom field does not use the name I gave it! It uses it’s own naming convention. A print_r of the $_POST variable returns:
Array
(
[weblog_id] => 26
[entry_id] =>
[entry_date] => 2008-08-14 12:38 PM
[expiration_date] =>
[comment_expiration_date] =>
[author_id] => 1
[new_weblog] => 26
[status] => open
[allow_comments] => y
[dst_enabled] => y
[trackback_urls] =>
[pages_uri] => /example/pages/uri/
[pages_template_id] => 86
[title] => sfdgfd
[url_title] => sfdgfd
[submit] => Submit
[mode] => normal
[field_id_34] => asdfsadf
[field_ft_34] => xhtml
[field_id_108] =>
asdfadsf
[field_ft_108] => xhtml
[field_id_109] =>
asdfsadf
[field_ft_109] => xhtml
[field_id_324] =>
[field_ft_324] => none
[field_id_329] => 92
[field_id_333] =>
[field_ft_333] => none
[field_id_334] =>
[field_ft_334] => none
[field_id_111] =>
[field_id_110] =>
)
So my question is, how do I know / or how can I find out what which custom field to update. To rephrase; how do I find out what custom fields a weblog has and what their internal names are?
Alternatively can anyone suggest a better way to achieve the same result?
Thanks in advance.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.