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

Custom Fields

Development and Programming

viewcreative's avatar
viewcreative
116 posts
about 17 years ago
viewcreative's avatar viewcreative

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.

       

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.