Extension hook: member_member_register.
I’m trying to manipulate the text being submitted to a custom member field during member registration. Here’s the function in an extension I’ve written:
function splitmember ($data)
{
global $FNS;
if ( isset( $_POST['m_field_id_1'] ) AND $_POST['m_field_id_1'] != '' )
{
$ecountry = split(",",$_POST['m_field_id_1']);
$fcountry = trim($ecountry[3]);
$_POST['m_field_id_1'] = $fcountry;
$EXT->end_script = TRUE;
}
}m_field_id_1 is the name of the custom field in question; however, nothing is happening and no errors reported. I’m wondering if it’s not included in the $data parameter?
Well you’re accessing the $_POST array directly, and aren’t using $data at all, but that’s not of consequence. You need to look at the code surrounding the hook to get an understanding of the flow of the application. The member data is already inserted before that hook is called, so altering the $_POST data will have no effect on what happens to the database. Now if instead you were using the ‘member_member_register_start’ hook, then your modification of the $_POST data would have effect, as that hook executes prior to the database insertion of the new member.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.