Getting users email at registration?
#1
Exclamation 
This user has been denied support. This user has been denied support.
<?php
// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
    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?
Reply
#2
$data->data['email']

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]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)