示例#1
0
function wp_eMember_handle_wp_user_registration($user_id)
{
    $emember_config = Emember_Config::getInstance();
    $emem_when_wp = $emember_config->getValue('eMember_enable_emem_when_wp');
    $default_level = $emember_config->getValue('eMember_emem_when_wp_default_level');
    $default_acstatus = $emember_config->getValue('eMember_emem_when_wp_default_acstatus');
    if (!$emem_when_wp) {
        return;
    }
    if (empty($default_level)) {
        return;
    }
    $user_info = get_userdata($user_id);
    if (emember_username_exists($user_info->user_login)) {
        eMember_log_debug("eMember user account with this username already exists! No new account will be created for this user.", true);
        return;
    }
    $fields = array();
    $fields['user_name'] = $user_info->user_login;
    $fields['password'] = $user_info->user_pass;
    $fields['email'] = $user_info->user_email;
    $fields['first_name'] = $user_info->first_name;
    $fields['last_name'] = $user_info->last_name;
    $fields['membership_level'] = $default_level;
    $fields['member_since'] = date('Y-m-d');
    $fields['account_state'] = $default_acstatus;
    $fields['subscription_starts'] = date('Y-m-d');
    create_new_emember_user($fields);
}
示例#2
0
function __wp_eMember_add($row)
{
    $user_info = get_userdata($row['ID']);
    $user_cap = is_array($user_info->wp_capabilities) ? array_keys($user_info->wp_capabilities) : array();
    $fields = array();
    $fields['user_name'] = $user_info->user_login;
    $fields['first_name'] = $user_info->user_firstname;
    $fields['last_name'] = $user_info->user_lastname;
    $fields['password'] = $user_info->user_pass;
    $fields['member_since'] = date('Y-m-d H:i:s');
    $fields['membership_level'] = $row['membership_level'];
    //$fields['initial_membership_level'] = $row['membership_level'];
    $fields['account_state'] = $row['account_state'];
    $fields['email'] = $user_info->user_email;
    $fields['address_street'] = '';
    $fields['address_city'] = '';
    $fields['address_state'] = '';
    $fields['address_zipcode'] = '';
    $fields['country'] = '';
    $fields['gender'] = 'not specified';
    $fields['referrer'] = '';
    $fields['last_accessed_from_ip'] = get_real_ip_addr();
    $fields['subscription_starts'] = $row['subscription_starts'];
    $fields['extra_info'] = '';
    if (isset($row['preserve_wp_role'])) {
        $fields['flags'] = 1;
    } else {
        $fields['flags'] = 0;
        if ($row['account_state'] === 'active' && !in_array('administrator', $user_cap)) {
            update_wp_user_Role($row['ID'], $row['membership_level']);
        }
    }
    $user_exists = emember_username_exists($fields['user_name']);
    if ($user_exists) {
        return dbAccess::update(WP_EMEMBER_MEMBERS_TABLE_NAME, 'member_id = ' . $user_exists, $fields);
    } else {
        //Insert a new user in emember
        eMember_log_debug("Importing the WP User into eMember system", true);
        return dbAccess::insert(WP_EMEMBER_MEMBERS_TABLE_NAME, $fields);
        /*             * * Signup the member to Autoresponder List (Autoresponder integration) ** */
        $membership_level_id = $fields['membership_level'];
        $firstname = isset($fields['first_name']) ? $fields['first_name'] : "";
        $lastname = isset($fields['last_name']) ? $fields['last_name'] : "";
        $emailaddress = $fields['email'];
        eMember_level_specific_autoresponder_signup($membership_level_id, $firstname, $lastname, $emailaddress);
        eMember_global_autoresponder_signup($firstname, $lastname, $emailaddress);
        /*             * * end of autoresponder integration ** */
    }
}
示例#3
0
 function user_unavail($user)
 {
     return emember_wp_username_exists($user) || emember_username_exists($user) ? true : false;
 }
示例#4
0
文件: create.php 项目: phupx/genco
    echo "Error!\n";
    echo "Missing mandatory field. Email, first name and last name must be present!\n";
    eMember_log_debug('Missing mandatory field. Email, first name and last name must be present...', false);
    exit;
}
//mandatory data
$email = strip_tags($_REQUEST['email']);
$first_name = strip_tags($_REQUEST['first_name']);
$last_name = strip_tags($_REQUEST['last_name']);
//optional data
$username = strip_tags($_REQUEST['username']);
$password = strip_tags($_REQUEST['password']);
$membership_level_name = strip_tags($_REQUEST['membership_level_name']);
$membership_level_id = strip_tags($_REQUEST['membership_level_id']);
eMember_log_debug('Received data:' . $email . '|' . $first_name . '|' . $last_name . '|' . $membership_level_name . '|' . $membership_level_id . '|' . $username . '|' . $password, true);
if (emember_wp_username_exists($username) || emember_username_exists($username)) {
    echo "Error!\n";
    echo "Username already in use.";
    eMember_log_debug('That username is already in use', false);
    exit;
}
if (emember_wp_email_exists($email) || emember_email_exists($email)) {
    echo "Error!\n";
    echo "Email address already exists.";
    eMember_log_debug('Email address already used...', false);
    exit;
}
if (is_blocked_email($email)) {
    echo "Error!\n";
    echo "Email address entered is forbidden..";
    eMember_log_debug("Forbidden email address used...", false);