Getting users email at registration?
This user has been denied support. This user has been denied support.
// Disallow direct access to this file for security reasons
    die("Direct initialization of this file is not allowed.");

//$plugins->add_hook("member_do_register_end", "add_fields");
$plugins->add_hook("datahandler_user_validate", "add_fields");

function add_fields(&$data) {
    global $mybb;

    //$input = $mybb->get_input('profile_fields');
    $fname = $mybb->input["profile_fields"]['fid4'];
    $lname = $mybb->input["profile_fields"]['fid5'];
    $gender = $mybb->input['profile_fields']['fid6'];
    $ssn = $mybb->input['profile_fields']['fid7'];
    $number = $mybb->input['profile_fields']['fid8'];
    $street = $mybb->input['profile_fields']['fid9'];
    $zip = $mybb->input['profile_fields']['fid13'];
    $city = $mybb->input['profile_fields']['fid14'];

As you can see I'm reading data entered in the custom registration fields when a user is trying to register so I can check the fields before letting them register. 
However, I want to get the email they're trying to use as well, the email isn't a custom registration field so I don't know how to get it. 

Anyone that can help me?

This refers to the email. The $data->data array contains all the inputs passed by the user upon registration. $mybb->input (which is not sanitized!) should be also replaced by $data->data['profile_fields'] which is sanitized as an array by MyBB routines.
[Image: fSGNVQj.png]

Forum Jump:

Users browsing this thread: 1 Guest(s)