当前位置: 首页>>代码示例>>PHP>>正文


PHP wpmem_get_excluded_meta函数代码示例

本文整理汇总了PHP中wpmem_get_excluded_meta函数的典型用法代码示例。如果您正苦于以下问题:PHP wpmem_get_excluded_meta函数的具体用法?PHP wpmem_get_excluded_meta怎么用?PHP wpmem_get_excluded_meta使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wpmem_get_excluded_meta函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: wpmem_do_wp_newuser_form

/**
 * Appends WP-Members registration fields to Users > Add New User screen.
 *
 * @since 2.9.0
 */
function wpmem_do_wp_newuser_form()
{
    global $wpmem;
    echo '<table class="form-table"><tbody>';
    $wpmem_fields = $wpmem->fields;
    //get_option( 'wpmembers_fields' );
    $exclude = wpmem_get_excluded_meta('register');
    foreach ($wpmem_fields as $field) {
        if ($field[6] == 'n' && !in_array($field[2], $exclude)) {
            $req = $field[5] == 'y' ? ' <span class="description">' . __('(required)') . '</span>' : '';
            echo '<tr>
				<th scope="row">
					<label for="' . $field[2] . '">' . __($field[1], 'wp-members') . $req . '</label>
				</th>
				<td>';
            // determine the field type and generate accordingly.
            switch ($field[3]) {
                case 'select':
                    $val = isset($_POST[$field[2]]) ? $_POST[$field[2]] : '';
                    echo wpmem_create_formfield($field[2], $field[3], $field[7], $val);
                    break;
                case 'textarea':
                    echo '<textarea name="' . $field[2] . '" id="' . $field[2] . '" class="textarea">';
                    echo isset($_POST[$field[2]]) ? esc_textarea($_POST[$field[2]]) : '';
                    echo '</textarea>';
                    break;
                case 'checkbox':
                    $val = isset($_POST[$field[2]]) ? $_POST[$field[2]] : '';
                    $val = !$_POST && $field[8] == 'y' ? $field[7] : $val;
                    echo wpmem_create_formfield($field[2], $field[3], $field[7], $val);
                    break;
                default:
                    echo '<input type="' . $field[3] . '" name="' . $field[2] . '" id="' . $field[2] . '" class="input" value="';
                    echo isset($_POST[$field[2]]) ? esc_attr($_POST[$field[2]]) : '';
                    echo '" size="25" />';
                    break;
            }
            echo '</td>
				</tr>';
        }
    }
    echo '</tbody></table>';
}
开发者ID:scottnkerr,项目名称:eeco,代码行数:48,代码来源:wp-registration.php

示例2: wpmem_notify_admin

/**
 * Builds the email for admin notification of new user registration.
 *
 * @since 2.3
 *
 * @uses wp_mail
 *
 * @param int   $user_id
 * @param array $wpmem_fields
 * @param array $field_data
 */
function wpmem_notify_admin( $user_id, $wpmem_fields, $field_data = null ) {

	global $wpmem;

	// WP default user fields.
	$wp_user_fields = array(
		'user_login',
		'user_nicename',
		'user_url',
		'user_registered',
		'display_name',
		'first_name',
		'last_name',
		'nickname',
		'description',
	);

	// Get the user data.
	$user = get_userdata( $user_id );
	
	// Get the email stored values.
	$arr  = get_option( 'wpmembers_email_notify' );

	// Userdata for default shortcodes.
	$arr['user_id']       = $user_id;
	$arr['user_login']    = stripslashes( $user->user_login );
	$arr['user_email']    = stripslashes( $user->user_email );
	$arr['blogname']      = wp_specialchars_decode( get_option ( 'blogname' ), ENT_QUOTES );
	$arr['user_ip']       = get_user_meta( $user_id, 'wpmem_reg_ip', true );
	$arr['reg_link']      = esc_url( get_user_meta( $user_id, 'wpmem_reg_url', true ) );
	$arr['act_link']      = get_bloginfo ( 'wpurl' ) . "/wp-admin/user-edit.php?user_id=".$user_id;
	$arr['exp_type']      = ( defined( 'WPMEM_EXP_MODULE' ) && $wpmem->use_exp == 1 ) ? get_user_meta( $user_id, 'exp_type', true ) : '';
	$arr['exp_date']      = ( defined( 'WPMEM_EXP_MODULE' ) && $wpmem->use_exp == 1 ) ? get_user_meta( $user_id, 'expires',  true ) : '';
	$arr['do_shortcodes'] = true;
	$arr['add_footer']    = true;
	$arr['disable']       = false;

	// Builds an array of the user data fields.
	$field_arr = array();
	foreach ( $wpmem_fields as $meta ) {
		if ( $meta[4] == 'y' ) {
			$name = $meta[1];
			if ( ! in_array( $meta[2], wpmem_get_excluded_meta( 'email' ) ) ) {
				if ( ( $meta[2] != 'user_email' ) && ( $meta[2] != 'password' ) ) {
					if ( $meta[2] == 'user_url' ) {
						$val = esc_url( $user->user_url );
					} elseif ( in_array( $meta[2], $wp_user_fields ) ) {
						$val = esc_html( $user->$meta[2] );
					} else {
						$val = esc_html( get_user_meta( $user_id, $meta[2], true ) );
					}
					$field_arr[ $name ] = $val;
				}
			}
		}
	}
	$arr['field_arr'] = $field_arr;

	// Apply filters (if set) for the sending email address.
	global $wpmem_mail_from, $wpmem_mail_from_name;
	add_filter( 'wp_mail_from',      'wpmem_mail_from'      );
	add_filter( 'wp_mail_from_name', 'wpmem_mail_from_name' );
	$default_header = ( $wpmem_mail_from && $wpmem_mail_from_name ) ? 'From: ' . $wpmem_mail_from_name . ' <' . $wpmem_mail_from . '>' : '';

	/**
	 * Filters the email headers.
	 *
	 * @since 2.7.4
	 *
	 * @param mixed  $default_header The email headers (default = null).
	 * @param string $toggle         Toggle to determine what email is being generated (newreg|newmod|appmod|repass|admin).
	 */
	$arr['headers'] = apply_filters( 'wpmem_email_headers', $default_header, 'admin' );

	// Handle backward compatibility for customizations that may call the email function directly.
	if ( ! $wpmem_fields ) {
		$wpmem_fields = $wpmem->fields; //get_option( 'wpmembers_fields' );
	}

	/**
	 * Filters the address the admin notification is sent to.
	 *
	 * @since 2.7.5
	 *
	 * @param string The email address of the admin to send to.
	 */
	$arr['admin_email'] = apply_filters( 'wpmem_notify_addr', get_option( 'admin_email' ) );

	/**
//.........这里部分代码省略.........
开发者ID:verbazend,项目名称:AWFA,代码行数:101,代码来源:email.php

示例3: wpmem_admin_update

/**
 * Updates WP-Members fields from the WP user profile screen.
 *
 * @since 2.1
 */
function wpmem_admin_update()
{
    global $wpmem;
    $user_id = $_REQUEST['user_id'];
    $wpmem_fields = $wpmem->fields;
    // get_option( 'wpmembers_fields' );
    /**
     * Fires before the user profile is updated.
     *
     * @since 2.9.2
     *
     * @param int   $user_id      The user ID.
     * @param array $wpmem_fields Array of the custom fields.
     */
    do_action('wpmem_admin_pre_user_update', $user_id, $wpmem_fields);
    $fields = array();
    $chk_pass = false;
    foreach ($wpmem_fields as $meta) {
        if ($meta[6] == "n" && $meta[3] != 'password' && $meta[3] != 'checkbox') {
            isset($_POST[$meta[2]]) ? $fields[$meta[2]] = $_POST[$meta[2]] : false;
        } elseif ($meta[2] == 'password' && $meta[4] == 'y') {
            $chk_pass = true;
        } elseif ($meta[3] == 'checkbox') {
            $fields[$meta[2]] = isset($_POST[$meta[2]]) ? $_POST[$meta[2]] : '';
        }
    }
    /**
     * Filter the submitted field values for backend profile update.
     *
     * @since 2.8.2
     *
     * @param array $fields An array of the posted form values.
     * @param int   $user_id The ID of the user being updated.
     */
    $fields = apply_filters('wpmem_admin_profile_update', $fields, $user_id);
    // Get any excluded meta fields.
    $exclude = wpmem_get_excluded_meta('admin-profile');
    foreach ($fields as $key => $val) {
        if (!in_array($key, $exclude)) {
            update_user_meta($user_id, $key, $val);
        }
    }
    if ($wpmem->mod_reg == 1) {
        $wpmem_activate_user = isset($_POST['activate_user']) == '' ? -1 : $_POST['activate_user'];
        if ($wpmem_activate_user == 1) {
            wpmem_a_activate_user($user_id, $chk_pass);
        } elseif ($wpmem_activate_user == 0) {
            wpmem_a_deactivate_user($user_id);
        }
    }
    defined('WPMEM_EXP_MODULE') && $wpmem->use_exp == 1 ? wpmem_a_extend_user($user_id) : '';
    /**
     * Fires after the user profile is updated.
     *
     * @since 2.9.2
     *
     * @param int $user_id The user ID.
     */
    do_action('wpmem_admin_after_user_update', $user_id);
    return;
}
开发者ID:Geragamer,项目名称:hatalmas-project,代码行数:66,代码来源:user-profile.php

示例4: wpmem_registration


//.........这里部分代码省略.........
              * value can be filtered with wpmem_register_data
              */
             $fields['user_nicename'] = isset($_POST['user_nicename']) ? sanitize_title($_POST['user_nicename']) : $fields['username'];
             $fields['display_name'] = isset($_POST['display_name']) ? sanitize_user($_POST['display_name']) : $fields['username'];
             $fields['nickname'] = isset($_POST['nickname']) ? sanitize_user($_POST['nickname']) : $fields['username'];
             /**
              * Filter registration data after validation before data insertion.
              *
              * @since 2.8.2
              *
              * @param array $fields An array of the registration field data.
              */
             $fields = apply_filters('wpmem_register_data', $fields);
             /**
              * Fires before any insertion/emails.
              *
              * This action is the final step in pre registering a user. This
              * can be used for attaching custom validation to the registration
              * process. It cannot be used for changing any user registration
              * data. Use the wpmem_register_data filter for that.
              *
              * @since 2.7.2
              *
              * @param array $fields The user's submitted registration data.
              */
             do_action('wpmem_pre_register_data', $fields);
             // if the _pre_register_data hook sends back an error message
             if ($wpmem_themsg) {
                 return $wpmem_themsg;
             }
             // main new user fields are ready
             $new_user_fields = array('user_pass' => $fields['password'], 'user_login' => $fields['username'], 'user_nicename' => $fields['user_nicename'], 'user_email' => $fields['user_email'], 'display_name' => $fields['display_name'], 'nickname' => $fields['nickname'], 'user_registered' => $fields['user_registered'], 'role' => $fields['user_role']);
             // get any excluded meta fields
             $excluded_meta = wpmem_get_excluded_meta('register');
             // user_url, first_name, last_name, description, jabber, aim, yim
             $new_user_fields_meta = array('user_url', 'first_name', 'last_name', 'description', 'jabber', 'aim', 'yim');
             foreach ($wpmem_fields as $meta) {
                 if (in_array($meta[2], $new_user_fields_meta)) {
                     if ($meta[4] == 'y' && !in_array($meta[2], $excluded_meta)) {
                         $new_user_fields[$meta[2]] = $fields[$meta[2]];
                     }
                 }
             }
             // inserts to wp_users table
             $fields['ID'] = wp_insert_user($new_user_fields);
             // set remaining fields to wp_usermeta table
             foreach ($wpmem_fields as $meta) {
                 // if the field is not excluded, update accordingly
                 if (!in_array($meta[2], $excluded_meta) && !in_array($meta[2], $new_user_fields_meta)) {
                     if ($meta[4] == 'y' && $meta[2] != 'user_email') {
                         update_user_meta($fields['ID'], $meta[2], $fields[$meta[2]]);
                     }
                 }
             }
             // capture IP address of user at registration
             update_user_meta($fields['ID'], 'wpmem_reg_ip', $fields['wpmem_reg_ip']);
             // store the registration url
             update_user_meta($fields['ID'], 'wpmem_reg_url', $fields['wpmem_reg_url']);
             // set user expiration, if used
             if (WPMEM_USE_EXP == 1 && WPMEM_MOD_REG != 1) {
                 wpmem_set_exp($fields['ID']);
             }
             /**
              * Fires after user insertion but before email.
              *
              * @since 2.7.2
开发者ID:koopmant,项目名称:Mens-site,代码行数:67,代码来源:wp-members-register.php

示例5: wpmem_registration


//.........这里部分代码省略.........
              */
             $fields['user_nicename'] = isset($_POST['user_nicename']) ? sanitize_title($_POST['user_nicename']) : $fields['username'];
             $fields['display_name'] = isset($_POST['display_name']) ? sanitize_user($_POST['display_name']) : $fields['username'];
             $fields['nickname'] = isset($_POST['nickname']) ? sanitize_user($_POST['nickname']) : $fields['username'];
             /**
              * Filter registration data after validation before data insertion.
              *
              * @since 2.8.2
              *
              * @param array  $fields An array of the registration field data.
              * @param string $toggle A switch to indicate the action (new|edit).
              */
             $fields = apply_filters('wpmem_register_data', $fields, 'new');
             /**
              * Fires before any insertion/emails.
              *
              * This action is the final step in pre registering a user. This
              * can be used for attaching custom validation to the registration
              * process. It cannot be used for changing any user registration
              * data. Use the wpmem_register_data filter for that.
              *
              * @since 2.7.2
              *
              * @param array $fields The user's submitted registration data.
              */
             do_action('wpmem_pre_register_data', $fields);
             // If the _pre_register_data hook sends back an error message.
             if ($wpmem_themsg) {
                 return $wpmem_themsg;
             }
             // Main new user fields are ready.
             $new_user_fields = array('user_pass' => $fields['password'], 'user_login' => $fields['username'], 'user_nicename' => $fields['user_nicename'], 'user_email' => $fields['user_email'], 'display_name' => $fields['display_name'], 'nickname' => $fields['nickname'], 'user_registered' => $fields['user_registered'], 'role' => $fields['user_role']);
             // Get any excluded meta fields.
             $excluded_meta = wpmem_get_excluded_meta('register');
             // Fields for wp_insert_user: user_url, first_name, last_name, description, jabber, aim, yim.
             $new_user_fields_meta = array('user_url', 'first_name', 'last_name', 'description', 'jabber', 'aim', 'yim');
             foreach ($wpmem_fields as $meta) {
                 if (in_array($meta[2], $new_user_fields_meta)) {
                     if ($meta[4] == 'y' && !in_array($meta[2], $excluded_meta)) {
                         $new_user_fields[$meta[2]] = $fields[$meta[2]];
                     }
                 }
             }
             // Inserts to wp_users table.
             $fields['ID'] = wp_insert_user($new_user_fields);
             // Set remaining fields to wp_usermeta table.
             foreach ($wpmem_fields as $meta) {
                 // If the field is not excluded, update accordingly.
                 if (!in_array($meta[2], $excluded_meta) && !in_array($meta[2], $new_user_fields_meta)) {
                     if ($meta[4] == 'y' && $meta[2] != 'user_email') {
                         update_user_meta($fields['ID'], $meta[2], $fields[$meta[2]]);
                     }
                 }
             }
             // Capture IP address of user at registration.
             update_user_meta($fields['ID'], 'wpmem_reg_ip', $fields['wpmem_reg_ip']);
             // Store the registration url.
             update_user_meta($fields['ID'], 'wpmem_reg_url', $fields['wpmem_reg_url']);
             // Set user expiration, if used.
             if ($wpmem->use_exp == 1 && $wpmem->mod_reg != 1) {
                 wpmem_set_exp($fields['ID']);
             }
             /**
              * Fires after user insertion but before email.
              *
              * @since 2.7.2
开发者ID:scottnkerr,项目名称:eeco,代码行数:67,代码来源:register.php

示例6: wpmem_notify_admin

 /**
  * Builds the email for admin notification of new user registration.
  *
  * @since 2.3
  *
  * @global object $wpmem                The WP_Members object.
  * @global string $wpmem_mail_from      The email from address.
  * @global string $wpmem_mail_from_name The email from name.
  * @param  int    $user_ID              The User's ID.
  * @param  array  $wpmem_fields         Array of the WP-Members fields (defaults to null).
  * @param  array  $fields               Array of the registration data (defaults to null).
  */
 function wpmem_notify_admin($user_id, $wpmem_fields, $field_data = null)
 {
     global $wpmem;
     // WP default user fields.
     $wp_user_fields = array('user_login', 'user_nicename', 'user_url', 'user_registered', 'display_name', 'first_name', 'last_name', 'nickname', 'description');
     // Get the user data.
     $user = get_userdata($user_id);
     // Get the email stored values.
     $arr = get_option('wpmembers_email_notify');
     // Userdata for default shortcodes.
     $arr['user_id'] = $user_id;
     $arr['user_login'] = stripslashes($user->user_login);
     $arr['user_email'] = stripslashes($user->user_email);
     $arr['blogname'] = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
     $arr['user_ip'] = is_array($field_data) ? $field_data['wpmem_reg_ip'] : get_user_meta($user_id, 'wpmem_reg_ip', true);
     $arr['reg_link'] = esc_url(get_user_meta($user_id, 'wpmem_reg_url', true));
     $arr['act_link'] = esc_url(add_query_arg('user_id', $user_id, get_admin_url('', 'user-edit.php')));
     $arr['exp_type'] = defined('WPMEM_EXP_MODULE') && $wpmem->use_exp == 1 ? get_user_meta($user_id, 'exp_type', true) : '';
     $arr['exp_date'] = defined('WPMEM_EXP_MODULE') && $wpmem->use_exp == 1 ? get_user_meta($user_id, 'expires', true) : '';
     $arr['do_shortcodes'] = true;
     $arr['add_footer'] = true;
     $arr['footer'] = get_option('wpmembers_email_footer');
     $arr['disable'] = false;
     // Builds an array of the user data fields.
     $field_arr = array();
     foreach ($wpmem_fields as $field) {
         if ($field[4] == 'y') {
             $meta_key = $field[2];
             if (!in_array($meta_key, wpmem_get_excluded_meta('email'))) {
                 if ($meta_key != 'user_email' && $meta_key != 'password') {
                     if ($meta_key == 'user_url') {
                         $val = esc_url($user->user_url);
                     } elseif (in_array($meta_key, $wp_user_fields)) {
                         $val = esc_html($user->{$meta_key});
                     } elseif ('file' == $field[3] || 'image' == $field[3]) {
                         $val = wp_get_attachment_url(get_user_meta($user_id, $meta_key, true));
                     } else {
                         $val = is_array($field_data) ? esc_html($field_data[$meta_key]) : esc_html(get_user_meta($user_id, $meta_key, true));
                     }
                     $field_arr[$field[1]] = $val;
                 }
             }
         }
     }
     $arr['field_arr'] = $field_arr;
     // Apply filters (if set) for the sending email address.
     $default_header = $wpmem->email['from'] && $wpmem->email['from_name'] ? 'From: "' . $wpmem->email['from_name'] . '" <' . $wpmem->email['from'] . '>' : '';
     /** This filter is documented in email.php */
     $arr['headers'] = apply_filters('wpmem_email_headers', $default_header, 'admin');
     // Handle backward compatibility for customizations that may call the email function directly.
     if (!$wpmem_fields) {
         $wpmem_fields = $wpmem->fields;
     }
     /**
      * Filters the address the admin notification is sent to.
      *
      * @since 2.7.5
      *
      * @param string The email address of the admin to send to.
      */
     $arr['admin_email'] = apply_filters('wpmem_notify_addr', get_option('admin_email'));
     /**
      * Filter the email.
      *
      * This is a new and more powerful filter than was previously available for
      * emails. This new filter passes the email subject, body, user ID, and several
      * other settings and parameters for use in the filter function. It also passes
      * an array of the WP-Members fields, and an array of the posted registration
      * data from the register function.
      *
      * @since 2.9.8
      *
      * @param array $arr              An array containing email body, subject, user id, and additional settings.
      * @param array $wpmem_fields     An array of the WP-Members fields.
      * @param array $arr['field_arr'] An array of the posted registration data.
      */
     $arr = apply_filters('wpmem_notify_filter', $arr, $wpmem_fields, $field_data);
     // If emails are not disabled, continue the email process.
     if (!$arr['disable']) {
         // Split field_arr into field_str.
         $field_str = '';
         foreach ($arr['field_arr'] as $key => $val) {
             $field_str .= $key . ': ' . $val . "\r\n";
         }
         // Get the email footer if needed.
         $foot = $arr['add_footer'] ? $arr['footer'] : '';
         // If doing shortcode replacements.
         if ($arr['do_shortcodes']) {
//.........这里部分代码省略.........
开发者ID:pab44,项目名称:pab44,代码行数:101,代码来源:email.php

示例7: wpmem_wp_reg_finalize

/**
 * Inserts registration data from the native WP registration
 *
 * @since 2.8.3
 *
 * @param $user_id
 */
function wpmem_wp_reg_finalize($user_id)
{
    $native_reg = isset($_POST['wp-submit']) && $_POST['wp-submit'] == 'Register' ? true : false;
    $add_new = isset($_POST['action']) && $_POST['action'] == 'createuser' ? true : false;
    if ($native_reg || $add_new) {
        // get the fields
        $wpmem_fields = get_option('wpmembers_fields');
        // 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)) {
                update_user_meta($user_id, $meta[2], sanitize_text_field($_POST[$meta[2]]));
            }
        }
    }
    return;
}
开发者ID:Kylemurray25,项目名称:wmlmusicguide,代码行数:24,代码来源:wp-members-core.php

示例8: wpmem_profile_update

/**
 * updates WP-Members fields from the WP user profile screen
 *
 * @since 2.6.5
 *
 * @global int $user_id
 */
function wpmem_profile_update()
{
    global $user_id;
    // get the fields
    $wpmem_fields = get_option('wpmembers_fields');
    // get any excluded meta fields
    $exclude = wpmem_get_excluded_meta('user-profile');
    foreach ($wpmem_fields as $meta) {
        // if this is not an excluded meta field
        if (!in_array($meta[2], $exclude)) {
            // if the field is user editable,
            if ($meta[4] == "y" && $meta[6] == "n" && $meta[3] != 'password') {
                // check for required fields
                $chk = '';
                if ($meta[5] == "n" || !$meta[5]) {
                    $chk = 'ok';
                }
                if ($meta[5] == "y" && $_POST[$meta[2]] != '') {
                    $chk = 'ok';
                }
                // check for field value
                $field_val = isset($_POST[$meta[2]]) ? $_POST[$meta[2]] : '';
                if ($chk == 'ok') {
                    update_user_meta($user_id, $meta[2], $field_val);
                }
            }
        }
    }
}
开发者ID:koopmant,项目名称:Mens-site,代码行数:36,代码来源:users.php

示例9: wpmem_wp_reg_finalize

/**
 * 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;
}
开发者ID:pab44,项目名称:pab44,代码行数:38,代码来源:core.php

示例10: wpmem_wp_reg_finalize

/**
 * Inserts registration data from the native WP registration.
 *
 * @since 2.8.3
 *
 * @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.
        // @todo This needs to change to $wpmem->excluded_fields($tag).
        $exclude = wpmem_get_excluded_meta('register');
        foreach ($wpmem->fields as $meta) {
            if (isset($_POST[$meta[2]]) && !in_array($meta[2], $exclude)) {
                update_user_meta($user_id, $meta[2], sanitize_text_field($_POST[$meta[2]]));
            }
        }
    }
    return;
}
开发者ID:scottnkerr,项目名称:eeco,代码行数:26,代码来源:core.php

示例11: wpmem_notify_admin

 /**
  * Builds the email for admin notification of new user registration
  *
  * @since 2.3
  *
  * @uses wp_mail
  *
  * @param int $user_id
  * @param array $wpmem_fields
  */
 function wpmem_notify_admin($user_id, $wpmem_fields)
 {
     $wp_user_fields = array('user_login', 'user_nicename', 'user_url', 'user_registered', 'display_name', 'first_name', 'last_name', 'nickname', 'description');
     $user = get_userdata($user_id);
     $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
     $user_ip = get_user_meta($user_id, 'wpmem_reg_ip', true);
     $reg_link = esc_url(get_user_meta($user_id, 'wpmem_reg_url', true));
     $act_link = get_bloginfo('wpurl') . "/wp-admin/user-edit.php?user_id=" . $user_id;
     $exp_type = WPMEM_USE_EXP == 1 ? get_user_meta($user_id, 'exp_type', 'true') : '';
     $exp_date = WPMEM_USE_EXP == 1 ? get_user_meta($user_id, 'expires', 'true') : '';
     $field_str = '';
     foreach ($wpmem_fields as $meta) {
         if ($meta[4] == 'y') {
             $name = $meta[1];
             if (!in_array($meta[2], wpmem_get_excluded_meta('email'))) {
                 if ($meta[2] != 'user_email' && $meta[2] != 'password') {
                     if ($meta[2] == 'user_url') {
                         $val = esc_url($user->user_url);
                     } elseif (in_array($meta[2], $wp_user_fields)) {
                         $val = esc_html($user->{$meta}[2]);
                     } else {
                         $val = esc_html(get_user_meta($user_id, $meta[2], 'true'));
                     }
                     $field_str .= "{$name}: {$val} \r\n";
                 }
             }
         }
     }
     /** Setup default shortcodes */
     $shortcd = array('[blogname]', '[username]', '[email]', '[reglink]', '[exp-type]', '[exp-data]', '[user-ip]', '[activate-user]', '[fields]');
     $replace = array($blogname, $user->user_login, $user->user_email, $reg_link, $exp_type, $exp_date, $user_ip, $act_link, $field_str);
     /** create the custom field shortcodes */
     foreach ($wpmem_fields as $field) {
         $shortcd[] = '[' . $field[2] . ']';
         $replace[] = get_user_meta($user_id, $field[2], true);
     }
     $arr = get_option('wpmembers_email_notify');
     $subj = str_replace($shortcd, $replace, $arr['subj']);
     $body = str_replace($shortcd, $replace, $arr['body']);
     $foot = get_option('wpmembers_email_footer');
     $foot = str_replace($shortcd, $replace, $foot);
     $body .= "\r\n" . $foot;
     /**
      * Filters the admin notification email.
      *
      * @since 2.8.2
      *
      * @param string $body The admin notification email body.
      */
     $body = apply_filters('wpmem_email_notify', $body);
     /* Apply filters (if set) for the sending email address */
     add_filter('wp_mail_from', 'wpmem_mail_from');
     add_filter('wp_mail_from_name', 'wpmem_mail_from_name');
     /**
      * Filters the address the admin notification is sent to.
      *
      * @since 2.7.5
      *
      * @param string The email address of the admin to send to.
      */
     $admin_email = apply_filters('wpmem_notify_addr', get_option('admin_email'));
     /**
      * Filters the email headers.
      *
      * @since 2.7.4
      *
      * @param mixed The email headers (default = null).
      */
     $headers = apply_filters('wpmem_email_headers', '');
     /* Send the message */
     wp_mail($admin_email, stripslashes($subj), stripslashes($body), $headers);
 }
开发者ID:Kylemurray25,项目名称:wmlmusicguide,代码行数:82,代码来源:wp-members-email.php

示例12: wpmem_profile_update

/**
 * updates WP-Members fields from the WP user profile screen.
 *
 * @since 2.6.5
 *
 * @global int $user_id
 */
function wpmem_profile_update()
{
    global $wpmem, $user_id;
    // Get the fields.
    $wpmem_fields = $wpmem->fields;
    //get_option( 'wpmembers_fields' );
    // Get any excluded meta fields.
    $exclude = wpmem_get_excluded_meta('user-profile');
    foreach ($wpmem_fields as $meta) {
        // If this is not an excluded meta field.
        if (!in_array($meta[2], $exclude)) {
            // If the field is user editable.
            if ($meta[4] == "y" && $meta[6] == "n" && $meta[3] != 'password' && $meta[3] != 'file' && $meta[3] != 'image') {
                // Check for required fields.
                $chk = '';
                if ($meta[5] == "n" || !$meta[5]) {
                    $chk = 'ok';
                }
                if ($meta[5] == "y" && $_POST[$meta[2]] != '') {
                    $chk = 'ok';
                }
                // Check for field value.
                if ($meta[3] == 'multiselect' || $meta[3] == 'multicheckbox') {
                    $field_val = isset($_POST[$meta[2]]) ? implode('|', $_POST[$meta[2]]) : '';
                } else {
                    $field_val = isset($_POST[$meta[2]]) ? $_POST[$meta[2]] : '';
                }
                if ($chk == 'ok') {
                    update_user_meta($user_id, $meta[2], $field_val);
                }
            }
        }
    }
}
开发者ID:pab44,项目名称:pab44,代码行数:41,代码来源:users.php

示例13: wpmem_do_wp_newuser_form

/**
 * Appends WP-Members registration fields to Users > Add New User screen.
 *
 * @since 2.9.0
 * @since 3.1.1 Updated to support new (3.1.0) field types and user activation.
 */
function wpmem_do_wp_newuser_form()
{
    global $wpmem;
    echo '<table class="form-table"><tbody>';
    $wpmem_fields = $wpmem->fields;
    //get_option( 'wpmembers_fields' );
    $exclude = wpmem_get_excluded_meta('register');
    foreach ($wpmem_fields as $field) {
        $meta_key = $field[2];
        if ($field[6] == 'n' && !in_array($meta_key, $exclude)) {
            $req = $field[5] == 'y' ? ' <span class="description">' . __('(required)') . '</span>' : '';
            echo '<tr>
				<th scope="row">
					<label for="' . $meta_key . '">' . __($field[1], 'wp-members') . $req . '</label>
				</th>
				<td>';
            // determine the field type and generate accordingly.
            switch ($field[3]) {
                case 'select':
                    $val = isset($_POST[$meta_key]) ? $_POST[$meta_key] : '';
                    echo wpmem_create_formfield($meta_key, $field[3], $field[7], $val);
                    break;
                case 'textarea':
                    echo '<textarea name="' . $meta_key . '" id="' . $meta_key . '" class="textarea">';
                    echo isset($_POST[$meta_key]) ? esc_textarea($_POST[$meta_key]) : '';
                    echo '</textarea>';
                    break;
                case 'checkbox':
                    $val = isset($_POST[$meta_key]) ? $_POST[$meta_key] : '';
                    $val = !$_POST && $field[8] == 'y' ? $field[7] : $val;
                    echo wpmem_create_formfield($meta_key, $field[3], $field[7], $val);
                    break;
                case 'multiselect':
                case 'multicheckbox':
                case 'radio':
                    $valtochk = isset($_POST[$meta_key]) ? $_POST[$meta_key] : '';
                    $formfield_args = array('name' => $meta_key, 'type' => $field[3], 'value' => $field[7], 'compare' => $valtochk, 'required' => 'y' == $field[5] ? true : false);
                    if ('multicheckbox' == $field[3] || 'multiselect' == $field[3]) {
                        $formfield_args['delimiter'] = isset($field[8]) ? $field[8] : '|';
                    }
                    echo $wpmem->forms->create_form_field($formfield_args);
                    break;
                case 'file':
                case 'image':
                    break;
                default:
                    echo '<input type="' . $field[3] . '" name="' . $meta_key . '" id="' . $meta_key . '" class="input" value="';
                    echo isset($_POST[$meta_key]) ? esc_attr($_POST[$meta_key]) : '';
                    echo '" size="25" />';
                    break;
            }
            echo '</td>
				</tr>';
        }
    }
    // If moderated registration is enabled, add checkbox to set user as active.
    if (1 == $wpmem->mod_reg) {
        echo '<tr>
				<th scope="row">
					<label for="activate_user">' . __('Activate this user?', 'wp-members') . '</label>
				</th>
				<td>' . $wpmem->forms->create_form_field(array('name' => 'activate_user', 'type' => 'checkbox', 'value' => 1, 'compare' => '')) . '</td>
			  </tr>';
    }
    echo '</tbody></table>';
}
开发者ID:pab44,项目名称:pab44,代码行数:72,代码来源:wp-registration.php


注:本文中的wpmem_get_excluded_meta函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。