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

Inserting a new row in exp_member_fields

Development and Programming

Manoj Thomas's avatar
Manoj Thomas
185 posts
16 years ago
Manoj Thomas's avatar Manoj Thomas

Hello everyone,

I’m in the process of writing an extension that creates a new member profile field when a particular weblog entry is published. I’ve got the sql statements working for the most part, but when I view the profile fields in the EE CP the field ID is ‘0’ for the newly created fields. When I check my db table, though, the IDs are correct. It seems as though they only don’t display correctly in the CP.

Anybody have any suggestions? Here’s the code I’m using:

$DB->query("INSERT INTO exp_member_fields (m_field_id, m_field_name, m_field_label, m_field_type, m_field_list_items, m_field_ta_rows, m_field_maxl, m_field_width, m_field_search, m_field_required, m_field_public, m_field_reg, m_field_fmt) VALUES (NULL, '$m_field_name', '$m_field_label', 'text', 'No', '10', '100', '100%', 'y', 'n', 'y', 'n', 'none')");
$DB->query("ALTER table exp_member_data add column m_field_id_{$DB->insert_id} text NOT NULL");

Any help is appreciated - thanks!

-Manoj

       
Manoj Thomas's avatar
Manoj Thomas
185 posts
16 years ago
Manoj Thomas's avatar Manoj Thomas

nevermind - I was confusing the id with the field order.

       

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.