Esempio n. 1
0
/**
 * Use wpmem_user_deactivated to set the user_status field to 2 using wp_update_user.
 *
 * @uses  wpmem_set_user_status
 * @param $user_id
 */
function wpmem_set_deactivated_user($user_id)
{
    wpmem_set_user_status($user_id, 2);
    return;
}
Esempio n. 2
0
File: core.php Progetto: pab44/pab44
/**
 * Inserts registration data from the native WP registration.
 *
 * @since 2.8.3
 * @since 3.1.1 Added new 3.1 field types and activate user support.
 *
 * @todo Compartmentalize file upload along with main register function.
 *
 * @global object $wpmem The WP-Members object class.
 * @param int $user_id The WP user ID.
 */
function wpmem_wp_reg_finalize($user_id)
{
    global $wpmem;
    $native_reg = isset($_POST['wp-submit']) && $_POST['wp-submit'] == esc_attr(__('Register')) ? true : false;
    $add_new = isset($_POST['action']) && $_POST['action'] == 'createuser' ? true : false;
    if ($native_reg || $add_new) {
        // Get any excluded meta fields.
        $exclude = wpmem_get_excluded_meta('register');
        foreach ($wpmem->fields as $meta) {
            if (isset($_POST[$meta[2]]) && !in_array($meta[2], $exclude) && 'file' != $meta[3] && 'image' != $meta[3]) {
                if ('multiselect' == $meta[3] || 'multicheckbox' == $meta[3]) {
                    $delimiter = isset($meta[8]) ? $meta[8] : '|';
                    $data = implode($delimiter, $_POST[$meta[2]]);
                } else {
                    $data = $_POST[$meta[2]];
                }
                update_user_meta($user_id, $meta[2], sanitize_text_field($data));
            }
        }
        // If moderated registration and activate is checked, set active flags.
        if (is_admin() && $add_new && 1 == $wpmem->mod_reg && isset($_POST['activate_user'])) {
            update_user_meta($user_id, 'active', 1);
            wpmem_set_user_status($user_id, 0);
        }
    }
    return;
}