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


PHP wp_get_user_contact_methods函数代码示例

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


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

示例1: widget

 /**
  * widget function.
  *
  * @see WP_Widget
  * @access public
  * @param array $args
  * @param array $instance
  * @return void
  */
 function widget($args, $instance)
 {
     if ($this->get_cached_widget($args)) {
         return;
     }
     extract($args);
     global $post;
     $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
     $icon = isset($instance['icon']) ? $instance['icon'] : null;
     if ($icon) {
         $before_title = sprintf($before_title, 'ion-' . $icon);
     }
     ob_start();
     echo $before_widget;
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     $methods = wp_get_user_contact_methods();
     if (empty($methods)) {
         return;
     }
     $output = array();
     foreach ($methods as $method => $label) {
         $value = get_the_author_meta($method, $post->post_author);
         if ('' == $value) {
             continue;
         }
         $output[] = sprintf('<a href="%s" class="ion-social-%s">%s</a>', $value, $method, $label);
     }
     echo '<ul class="social-profiles"><li>' . implode('</li><li>', $output) . '</li></ul>';
     echo $after_widget;
     $content = ob_get_clean();
     echo apply_filters($this->widget_id, $content);
     $this->cache_widget($args, $content);
 }
开发者ID:GaryJones,项目名称:dockerfiles,代码行数:44,代码来源:class-widget-job_listing-social-profiles.php

示例2: wp_user_profiles_contact_metabox

/**
 * Render the contact metabox for user profile screen
 *
 * @since 0.1.0
 *
 * @param WP_User $user The WP_User object to be edited.
 */
function wp_user_profiles_contact_metabox($user = null)
{
    // Get methods
    $methods = wp_get_user_contact_methods($user);
    ?>

	<table class="form-table">

		<?php 
    foreach ($methods as $name => $desc) {
        ?>

			<tr class="user-<?php 
        echo esc_attr($name);
        ?>
-wrap">
				<th>
					<label for="<?php 
        echo esc_attr($name);
        ?>
">
						<?php 
        /**
         * Filter a user contactmethod label.
         *
         * The dynamic portion of the filter hook, `$name`, refers to
         * each of the keys in the contactmethods array.
         *
         * @since 2.9.0
         *
         * @param string $desc The translatable label for the contactmethod.
         */
        echo apply_filters("user_{$name}_label", $desc);
        ?>
					</label>
				</th>
				<td><input type="text" name="<?php 
        echo esc_attr($name);
        ?>
" id="<?php 
        echo esc_attr($name);
        ?>
" value="<?php 
        echo esc_attr($user->{$name});
        ?>
" class="regular-text" /></td>
			</tr>

		<?php 
    }
    ?>

	</table>

	<?php 
}
开发者ID:wir,项目名称:wp-user-profiles,代码行数:63,代码来源:options-contact.php

示例3: update_user_metadata

 public function update_user_metadata($null, $object_id, $meta_key, $meta_value, $prev_value)
 {
     // prevent BP last activity back-comp, SEE: http://wp.me/pLVLj-gc
     if (function_exists('buddypress') && 'last_activity' === $meta_key) {
         return TRUE;
     }
     if (array_key_exists($meta_key, wp_get_user_contact_methods($object_id))) {
         if (!$meta_value) {
             if (get_metadata('user', $object_id, $meta_key)) {
                 delete_metadata('user', $object_id, $meta_key);
             }
             return TRUE;
         }
     }
     return $null;
 }
开发者ID:geminorum,项目名称:gmember,代码行数:16,代码来源:cleanup.class.php

示例4: wp_user_profiles_add_profile_meta_boxes

/**
 * Add the default user profile metaboxes
 *
 * @since 0.1.0
 *
 * @param   string  $type
 * @param   mixed   $user
 */
function wp_user_profiles_add_profile_meta_boxes($type = '', $user = null)
{
    // Get types
    $types = wp_user_profiles_get_section_hooknames('profile');
    // Bail if not user metaboxes
    if (empty($user) || !in_array($type, $types, true)) {
        return;
    }
    // Name
    add_meta_box('name', _x('Name', 'users user-admin edit screen', 'wp-user-profiles'), 'wp_user_profiles_name_metabox', $type, 'normal', 'core');
    // About
    add_meta_box('about', _x('About', 'users user-admin edit screen', 'wp-user-profiles'), 'wp_user_profiles_about_metabox', $type, 'normal', 'core');
    // Contact, if methods are registered
    if (wp_get_user_contact_methods($user)) {
        add_meta_box('contact', _x('Contact', 'users user-admin edit screen', 'wp-user-profiles'), 'wp_user_profiles_contact_metabox', $type, 'normal', 'core');
    }
}
开发者ID:bradyvercher,项目名称:wp-user-profiles,代码行数:25,代码来源:metaboxes.php

示例5: widget

 /**
  * widget function.
  *
  * @see WP_Widget
  * @access public
  * @param array $args
  * @param array $instance
  * @return void
  */
 function widget($args, $instance)
 {
     if ($this->get_cached_widget($args)) {
         return;
     }
     extract($args);
     global $post;
     $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
     $icon = isset($instance['icon']) ? $instance['icon'] : null;
     if ($icon) {
         $before_title = sprintf($before_title, 'ion-' . $icon);
     }
     $methods = wp_get_user_contact_methods();
     $output = array();
     foreach ($methods as $method => $label) {
         if ('user' == listify_theme_mod('social-association')) {
             $value = get_the_author_meta($method, $post->post_author);
         } else {
             $value = get_post_meta($post->ID, '_company_' . $method, true);
         }
         if ('' == $value) {
             continue;
         }
         if ($value && !strstr($value, 'http:') && !strstr($value, 'https:')) {
             $value = 'http://' . $value;
         }
         $output[] = sprintf('<a href="%s" target="_blank" class="ion-social-%s">%s</a>', $value, $method, $label);
     }
     if (empty($methods) || empty($output)) {
         return;
     }
     ob_start();
     echo $before_widget;
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     do_action('listify_widget_job_listing_social_before');
     echo '<ul class="social-profiles"><li>' . implode('</li><li>', $output) . '</li></ul>';
     do_action('listify_widget_job_listing_social_after');
     echo $after_widget;
     $content = ob_get_clean();
     echo apply_filters($this->widget_id, $content);
     $this->cache_widget($args, $content);
 }
开发者ID:abdullahrahim,项目名称:shadighar,代码行数:53,代码来源:class-widget-job_listing-social-profiles.php

示例6: bbp_edit_user_contact_methods

/**
 * Return user contact methods Selectbox
 *
 * @since 2.0.0 bbPress (r2688)
 *
 * @uses _wp_get_user_contactmethods() To get the contact methods
 * @uses apply_filters() Calls 'bbp_edit_user_contact_methods' with the methods
 * @return string User contact methods
 */
function bbp_edit_user_contact_methods()
{
    // Get the core WordPress contact methods
    $contact_methods = wp_get_user_contact_methods(bbpress()->displayed_user);
    return apply_filters('bbp_edit_user_contact_methods', $contact_methods);
}
开发者ID:CompositeUK,项目名称:clone.bbPress,代码行数:15,代码来源:template.php

示例7: save

 function save()
 {
     register_setting('badgeos_obi_issuer_settings', 'badgeos_obi_issuer_public_evidence');
     register_setting('badgeos_obi_issuer_settings', 'badgeos_obi_issuer_css_bypass');
     register_setting('badgeos_obi_issuer_settings', 'badgeos_obi_issuer_alt_email');
     register_setting('badgeos_obi_issuer_settings', 'badgeos_obi_issuer_org_name');
     register_setting('badgeos_obi_issuer_settings', 'badgeos_obi_issuer_org_url');
     register_setting('badgeos_obi_issuer_settings', 'badgeos_obi_issuer_org_description');
     register_setting('badgeos_obi_issuer_settings', 'badgeos_obi_issuer_org_image');
     register_setting('badgeos_obi_issuer_settings', 'badgeos_obi_issuer_org_email');
     register_setting('badgeos_obi_issuer_settings', 'badgeos_obi_issuer_org_revocationList');
     // add your settings section
     add_settings_section('badgeos_obi_issuer_template-section-about', __('About', 'badgeos_obi_issuer'), array(&$this, 'badgeos_obi_issuer_settings_section_about'), 'badgeos_obi_issuer_template');
     add_settings_section('badgeos_obi_issuer_template-section', __('General Settings', 'badgeos_obi_issuer'), array(&$this, 'badgeos_obi_issuer_settings_section_general'), 'badgeos_obi_issuer_template');
     // add your setting's fields
     // add your setting's fields
     add_settings_field('badgeos_obi_issuer_alt_email', __('Alternative Email', 'badgeos_obi_issuer'), array(&$this, 'settings_field_input_select'), 'badgeos_obi_issuer_template', 'badgeos_obi_issuer_template-section', array('name' => 'badgeos_obi_issuer_alt_email', 'choices' => wp_get_user_contact_methods(), 'description' => __('Specify an optional additional email field if you would like users to be able to collect badges using a different address', 'badgeos_obi_issuer')));
     add_settings_field('badgeos_obi_issuer_public_evidence', __('Public evidence', 'badgeos_obi_issuer'), array(&$this, 'settings_field_input_radio'), 'badgeos_obi_issuer_template', 'badgeos_obi_issuer_template-section', array('name' => 'badgeos_obi_issuer_public_evidence', 'choices' => array('true' => 'Enable', 'false' => 'Disable'), 'description' => __('Enable or Disable public badge evidence for submissions', 'badgeos_obi_issuer')));
     add_settings_field('badgeos_obi_issuer_css_bypass', __('Plugin CSS', 'badgeos_obi_issuer'), array(&$this, 'settings_field_input_radio'), 'badgeos_obi_issuer_template', 'badgeos_obi_issuer_template-section', array('name' => 'badgeos_obi_issuer_css_bypass', 'choices' => array('true' => 'Enable', 'false' => 'Disable'), 'description' => __('Enable or Disable plugin CSS styling', 'badgeos_obi_issuer')));
     add_settings_section('badgeos_obi_issuer_template-section2', __('Issuer Organization Override', 'badgeos_obi_issuer'), array(&$this, 'badgeos_obi_issuer_settings_section_override'), 'badgeos_obi_issuer_template');
     add_settings_field('badgeos_obi_issuer_org_name', __('Name', 'badgeos_obi_issuer'), array(&$this, 'settings_field_input_text'), 'badgeos_obi_issuer_template', 'badgeos_obi_issuer_template-section2', array('name' => 'badgeos_obi_issuer_org_name', 'description' => __('The name of the issuing organization.', 'badgeos_obi_issuer')));
     add_settings_field('badgeos_obi_issuer_org_url', __('Url', 'badgeos_obi_issuer'), array(&$this, 'settings_field_input_text'), 'badgeos_obi_issuer_template', 'badgeos_obi_issuer_template-section2', array('name' => 'badgeos_obi_issuer_org_url', 'description' => __('URL of the institution', 'badgeos_obi_issuer')));
     add_settings_field('badgeos_obi_issuer_org_description', __('Description', 'badgeos_obi_issuer'), array(&$this, 'settings_field_input_textarea'), 'badgeos_obi_issuer_template', 'badgeos_obi_issuer_template-section2', array('name' => 'badgeos_obi_issuer_org_description', 'description' => __('A short description of the institution', 'badgeos_obi_issuer')));
     add_settings_field('badgeos_obi_issuer_org_image', __('Image', 'badgeos_obi_issuer'), array(&$this, 'settings_field_input_text'), 'badgeos_obi_issuer_template', 'badgeos_obi_issuer_template-section2', array('name' => 'badgeos_obi_issuer_org_image', 'description' => __('An image representing the institution', 'badgeos_obi_issuer')));
     add_settings_field('badgeos_obi_issuer_org_email', __('Email', 'badgeos_obi_issuer'), array(&$this, 'settings_field_input_text'), 'badgeos_obi_issuer_template', 'badgeos_obi_issuer_template-section2', array('name' => 'badgeos_obi_issuer_org_email', 'description' => __('Contact address for someone at the organization.', 'badgeos_obi_issuer')));
     add_settings_field('badgeos_obi_issuer_org_revocationList', __('Revocation List Url', 'badgeos_obi_issuer'), array(&$this, 'settings_field_input_text'), 'badgeos_obi_issuer_template', 'badgeos_obi_issuer_template-section2', array('name' => 'badgeos_obi_issuer_org_revocationList', 'description' => __('URL of the Badge Revocation List. The endpoint should be a JSON representation of an object where the keys are the uid a revoked badge assertion, and the values are the reason for revocation. This is only necessary for signed badges.', 'badgeos_obi_issuer')));
 }
开发者ID:geoffroigaron,项目名称:open-badges-issuer-addon,代码行数:27,代码来源:settings.php

示例8: get_user_id_contact_methods

 public static function get_user_id_contact_methods($user_id)
 {
     $user = get_user_by('id', $user_id);
     if (function_exists('wp_get_user_contact_methods')) {
         // since wp 3.7
         return wp_get_user_contact_methods($user);
     } else {
         $methods = array();
         if (get_site_option('initial_db_version') < 23588) {
             $methods = array('aim' => __('AIM'), 'yim' => __('Yahoo IM'), 'jabber' => __('Jabber / Google Talk'));
         }
         return apply_filters('user_contactmethods', $methods, $user);
     }
 }
开发者ID:sonvq,项目名称:passioninvestment,代码行数:14,代码来源:user.php

示例9: extra_get_author_contact_methods

function extra_get_author_contact_methods($user_id = 0)
{
    $user_id = !empty($user_id) ? $user_id : get_the_author_meta('ID');
    $author = get_userdata($user_id);
    $methods = array();
    foreach (wp_get_user_contact_methods($author) as $name => $desc) {
        if (!empty($author->{$name})) {
            $methods[$name] = array('slug' => $name, 'name' => $desc, 'url' => $author->{$name});
        }
    }
    return $methods;
}
开发者ID:rthburke,项目名称:fltHub,代码行数:12,代码来源:template-tags.php

示例10: _wp_get_user_contactmethods

/**
 * The old private function for setting up user contact methods.
 *
 * @since 2.9.0
 * @access private
 */
function _wp_get_user_contactmethods($user = null)
{
    return wp_get_user_contact_methods($user);
}
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:10,代码来源:user.php

示例11: register_fields

 /**
  * {@inheritdoc}
  */
 public function register_fields($wp_fields)
 {
     $this->register_control_types($wp_fields);
     ////////////////////////////
     // Core: Personal Options //
     ////////////////////////////
     $wp_fields->add_section($this->object_type, $this->id . '-personal-options', null, array('label' => __('Personal Options'), 'form' => $this->id));
     $field_args = array('sanitize_callback' => array($this, 'sanitize_rich_editing'), 'control' => array('type' => 'checkbox', 'section' => $this->id . '-personal-options', 'label' => __('Visual Editor'), 'description' => __('Disable the visual editor when writing'), 'capabilities_callback' => array($this, 'capability_is_subscriber_editing_profile'), 'checkbox_value' => 'false', 'internal' => true));
     $wp_fields->add_field($this->object_type, 'rich_editing', null, $field_args);
     $field_args = array('control' => array('type' => 'user-color-scheme', 'section' => $this->id . '-personal-options', 'label' => __('Admin Color Scheme'), 'description' => __('Disable the visual editor when writing'), 'capabilities_callback' => array($this, 'capability_has_color_scheme_control'), 'internal' => true));
     $wp_fields->add_field($this->object_type, 'admin_color', null, $field_args);
     $field_args = array('sanitize_callback' => array($this, 'sanitize_comment_shortcuts'), 'control' => array('type' => 'checkbox', 'section' => $this->id . '-personal-options', 'label' => __('Keyboard Shortcuts'), 'description' => __('Enable keyboard shortcuts for comment moderation.') . ' ' . __('<a href="https://codex.wordpress.org/Keyboard_Shortcuts" target="_blank">More information</a>'), 'capabilities_callback' => array($this, 'capability_is_subscriber_editing_profile'), 'checkbox_value' => 'true', 'internal' => true));
     $wp_fields->add_field($this->object_type, 'comment_shortcuts', null, $field_args);
     $field_args = array('sanitize_callback' => array($this, 'sanitize_admin_bar_front'), 'control' => array('type' => 'checkbox', 'section' => $this->id . '-personal-options', 'label' => __('Toolbar'), 'description' => __('Show Toolbar when viewing site'), 'checkbox_value' => 'true', 'internal' => true));
     $wp_fields->add_field($this->object_type, 'admin_bar_front', null, $field_args);
     ////////////////
     // Core: Name //
     ////////////////
     $wp_fields->add_section($this->object_type, $this->id . '-name', null, array('label' => __('Name'), 'form' => $this->id));
     $field_args = array('control' => array('type' => 'text', 'section' => $this->id . '-name', 'label' => __('Username'), 'description' => __('Usernames cannot be changed.'), 'input_attrs' => array('disabled' => 'disabled'), 'internal' => true));
     $wp_fields->add_field($this->object_type, 'user_login', null, $field_args);
     $field_args = array('control' => array('type' => 'user-role', 'section' => $this->id . '-name', 'label' => __('Role'), 'capabilities_callback' => array($this, 'capability_show_roles'), 'internal' => true));
     $wp_fields->add_field($this->object_type, 'role', null, $field_args);
     $field_args = array('value_callback' => array($this, 'value_is_super_admin'), 'control' => array('type' => 'user-super-admin', 'section' => $this->id . '-name', 'label' => __('Super Admin'), 'description' => __('Grant this user super admin privileges for the Network.'), 'capabilities_callback' => array($this, 'capability_can_grant_super_admin'), 'internal' => true));
     $wp_fields->add_field($this->object_type, 'super_admin', null, $field_args);
     $field_args = array('control' => array('type' => 'text', 'section' => $this->id . '-name', 'label' => __('First Name'), 'internal' => true));
     $wp_fields->add_field($this->object_type, 'first_name', null, $field_args);
     $field_args = array('control' => array('type' => 'text', 'section' => $this->id . '-name', 'label' => __('Last Name'), 'internal' => true));
     $wp_fields->add_field($this->object_type, 'last_name', null, $field_args);
     $field_args = array('control' => array('id' => 'nickname', 'type' => 'text', 'section' => $this->id . '-name', 'label' => __('Nickname'), 'description' => __('(required)'), 'internal' => true));
     $wp_fields->add_field($this->object_type, 'user_nickname', null, $field_args);
     $field_args = array('control' => array('type' => 'user-display-name', 'section' => $this->id . '-name', 'label' => __('Display name publicly as'), 'internal' => true));
     $wp_fields->add_field($this->object_type, 'display_name', null, $field_args);
     ////////////////////////
     // Core: Contact Info //
     ////////////////////////
     $wp_fields->add_section($this->object_type, $this->id . '-contact-info', null, array('label' => __('Contact Info'), 'form' => $this->id));
     $field_args = array('control' => array('id' => 'email', 'type' => 'user-email', 'section' => $this->id . '-contact-info', 'label' => __('E-mail'), 'description' => __('(required)'), 'internal' => true));
     $wp_fields->add_field($this->object_type, 'user_email', null, $field_args);
     $field_args = array('control' => array('type' => 'text', 'section' => $this->id . '-contact-info', 'label' => __('Website'), 'internal' => true));
     $wp_fields->add_field($this->object_type, 'user_url', null, $field_args);
     $contact_methods = wp_get_user_contact_methods();
     foreach ($contact_methods as $method => $label) {
         /**
          * Filter a user contactmethod label.
          *
          * The dynamic portion of the filter hook, `$name`, refers to
          * each of the keys in the contactmethods array.
          *
          * @since 2.9.0
          *
          * @param string $label The translatable label for the contactmethod.
          */
         $label = apply_filters("user_{$method}_label", $label);
         $field_args = array('control' => array('type' => 'text', 'section' => $this->id . '-contact-info', 'label' => $label, 'internal' => true));
         $wp_fields->add_field($this->object_type, $method, null, $field_args);
     }
     /////////////////
     // Core: About //
     /////////////////
     $about_title = __('About the user');
     if (defined('IS_PROFILE_PAGE') && IS_PROFILE_PAGE) {
         $about_title = __('About Yourself');
     }
     $wp_fields->add_section($this->object_type, $this->id . '-about', null, array('label' => $about_title, 'form' => $this->id));
     $field_args = array('control' => array('type' => 'textarea', 'section' => $this->id . '-about', 'label' => __('Biographical Info'), 'description' => __('Share a little biographical information to fill out your profile. This may be shown publicly.'), 'internal' => true));
     $wp_fields->add_field($this->object_type, 'description', null, $field_args);
     //////////////////////////////
     // Core: Account Management //
     //////////////////////////////
     $wp_fields->add_section($this->object_type, $this->id . '-account-management', null, array('label' => __('Account Management'), 'form' => $this->id, 'capabilities_callback' => array($this, 'capability_show_password_fields')));
     $field_args = array('control' => array('type' => 'user-password', 'section' => $this->id . '-account-management', 'label' => __('Password'), 'internal' => true));
     $wp_fields->add_field($this->object_type, 'user_pass', null, $field_args);
     $field_args = array('control' => array('type' => 'user-sessions', 'section' => $this->id . '-account-management', 'label' => __('Sessions'), 'internal' => true));
     // If password fields not shown, show Sessions under About
     // @todo Change which section this control is in if password fields not shown
     /*if ( ! $show_password_fields ) {
     			$field_args['control']['section'] = $this->id . '-about';
     		}*/
     $wp_fields->add_field($this->object_type, 'sessions', null, $field_args);
     // @todo Figure out how best to run actions after section
     //if ( defined( 'IS_PROFILE_PAGE' ) && IS_PROFILE_PAGE ) {
     /**
      * Fires after the 'About Yourself' settings table on the 'Your Profile' editing form.
      *
      * The action only fires if the current user is editing their own profile.
      *
      * @since 2.0.0
      *
      * @param WP_User $profileuser The current WP_User object.
      */
     //do_action( 'show_user_profile', $profileuser );
     //} else {
     /**
      * Fires after the 'About the User' settings table on the 'Edit User' form.
      *
      * @since 2.0.0
//.........这里部分代码省略.........
开发者ID:machouinard,项目名称:wordpress-fields-api,代码行数:101,代码来源:class-wp-fields-api-form-user-edit.php

示例12: register_controls

 /**
  * Register controls for User Profiles
  *
  * @todo Move out of wp-admin implementation
  */
 public function register_controls()
 {
     /**
      * @var $wp_fields WP_Fields_API
      */
     global $wp_fields;
     // Register control types
     $wp_fields->register_control_type('user-color-scheme', 'WP_Fields_API_Color_Scheme_Control');
     $wp_fields->register_control_type('user-role', 'WP_Fields_API_User_Role_Control');
     $wp_fields->register_control_type('user-super-admin', 'WP_Fields_API_User_Super_Admin_Control');
     $wp_fields->register_control_type('user-display-name', 'WP_Fields_API_User_Display_Name_Control');
     $wp_fields->register_control_type('user-email', 'WP_Fields_API_User_Email_Control');
     $wp_fields->register_control_type('user-password', 'WP_Fields_API_User_Password_Control');
     $wp_fields->register_control_type('user-sessions', 'WP_Fields_API_User_Sessions_Control');
     $wp_fields->register_control_type('user-capabilities', 'WP_Fields_API_User_Capabilities_Control');
     // Add Edit Profile screen
     $wp_fields->add_screen('user', 'edit-profile');
     ////////////////////////////
     // Core: Personal Options //
     ////////////////////////////
     $wp_fields->add_section('user', 'personal-options', 'edit-profile', array('title' => __('Personal Options')));
     // @todo Controls hidden if subscriber is editing their profile logic
     /*$user_can_edit = current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' );
     		$is_subscriber_editing_profile = ! ( IS_PROFILE_PAGE && ! $user_can_edit );*/
     $field_args = array('control' => array('type' => 'checkbox', 'section' => 'personal-options', 'label' => __('Visual Editor'), 'description' => __('Disable the visual editor when writing')));
     $wp_fields->add_field('user', 'rich_editing', 'edit-profile', $field_args);
     // @todo Control hidden if no admin css colors AND color scheme picker set
     // $has_color_scheme_control = ( count($_wp_admin_css_colors) > 1 && has_action('admin_color_scheme_picker') )
     $field_args = array('control' => array('type' => 'user-color-scheme', 'section' => 'personal-options', 'label' => __('Admin Color Scheme'), 'description' => __('Disable the visual editor when writing')));
     $wp_fields->add_field('user', 'admin_color', 'edit-profile', $field_args);
     $field_args = array('control' => array('type' => 'checkbox', 'section' => 'personal-options', 'label' => __('Keyboard Shortcuts'), 'description' => __('Enable keyboard shortcuts for comment moderation.') . ' ' . __('<a href="https://codex.wordpress.org/Keyboard_Shortcuts" target="_blank">More information</a>')));
     $wp_fields->add_field('user', 'comment_shortcuts', 'edit-profile', $field_args);
     $field_args = array('control' => array('type' => 'checkbox', 'section' => 'personal-options', 'label' => __('Toolbar'), 'description' => __('Show Toolbar when viewing site')));
     $wp_fields->add_field('user', 'admin_bar_front', 'edit-profile', $field_args);
     ////////////////
     // Core: Name //
     ////////////////
     $wp_fields->add_section('user', 'name', 'edit-profile', array('title' => __('Name')));
     $field_args = array('control' => array('type' => 'text', 'section' => 'name', 'label' => __('Username'), 'description' => __('Usernames cannot be changed.'), 'input_attrs' => array('disabled' => 'disabled')));
     $wp_fields->add_field('user', 'user_login', 'edit-profile', $field_args);
     // @todo Roles
     $can_change_roles = !IS_PROFILE_PAGE && !is_network_admin();
     $field_args = array('control' => array('type' => 'user-role', 'section' => 'name', 'label' => __('Role')));
     $wp_fields->add_field('user', 'user_login', 'edit-profile', $field_args);
     $field_args = array('control' => array('type' => 'user-super-admin', 'section' => 'name', 'label' => __('Super Admin'), 'description' => __('Grant this user super admin privileges for the Network.')));
     $wp_fields->add_field('user', 'super_admin', 'edit-profile', $field_args);
     $field_args = array('control' => array('type' => 'text', 'section' => 'name', 'label' => __('First Name')));
     $wp_fields->add_field('user', 'first_name', 'edit-profile', $field_args);
     $field_args = array('control' => array('type' => 'text', 'section' => 'name', 'label' => __('Last Name')));
     $wp_fields->add_field('user', 'last_name', 'edit-profile', $field_args);
     $field_args = array('control' => array('type' => 'text', 'section' => 'name', 'label' => __('Nickname'), 'description' => __('(required)')));
     $wp_fields->add_field('user', 'user_nickname', 'edit-profile', $field_args);
     $field_args = array('control' => array('type' => 'user-display-name', 'section' => 'name', 'label' => __('Display name publicly as')));
     $wp_fields->add_field('user', 'display_name', 'edit-profile', $field_args);
     ////////////////////////
     // Core: Contact Info //
     ////////////////////////
     $wp_fields->add_section('user', 'contact-info', 'edit-profile', array('title' => __('Contact Info')));
     $field_args = array('control' => array('type' => 'user-email', 'section' => 'contact-info', 'label' => __('E-mail'), 'description' => __('(required)')));
     $wp_fields->add_field('user', 'user_email', 'edit-profile', $field_args);
     $field_args = array('control' => array('type' => 'text', 'section' => 'contact-info', 'label' => __('Website')));
     $wp_fields->add_field('user', 'user_url', 'edit-profile', $field_args);
     // @todo Setup $profileuser correctly
     $profileuser = new stdClass();
     $contact_methods = wp_get_user_contact_methods($profileuser);
     foreach ($contact_methods as $method => $label) {
         /**
          * Filter a user contactmethod label.
          *
          * The dynamic portion of the filter hook, `$name`, refers to
          * each of the keys in the contactmethods array.
          *
          * @since 2.9.0
          *
          * @param string $label The translatable label for the contactmethod.
          */
         $label = apply_filters("user_{$method}_label", $label);
         $field_args = array('control' => array('type' => 'text', 'section' => 'contact-info', 'label' => $label));
         $wp_fields->add_field('user', $method, 'edit-profile', $field_args);
     }
     /////////////////
     // Core: About //
     /////////////////
     $about_title = __('About the user');
     if (IS_PROFILE_PAGE) {
         $about_title = __('About Yourself');
     }
     $wp_fields->add_section('user', 'about', 'edit-profile', array('title' => $about_title));
     $field_args = array('control' => array('type' => 'text', 'section' => 'about', 'label' => __('Biographical Info'), 'description' => __('Share a little biographical information to fill out your profile. This may be shown publicly.')));
     $wp_fields->add_field('user', 'description', 'edit-profile', $field_args);
     //////////////////////////////
     // Core: Account Management //
     //////////////////////////////
     /** This filter is documented in wp-admin/user-new.php */
     $show_password_fields = apply_filters('show_password_fields', true, $profileuser);
//.........这里部分代码省略.........
开发者ID:Idealien,项目名称:wordpress-fields-api,代码行数:101,代码来源:class-wp-fields-api-user-profile.php

示例13: build_available_user_contact_methods

 protected static function build_available_user_contact_methods()
 {
     return array_merge(array('email' => __('E-mail')), wp_get_user_contact_methods());
 }
开发者ID:a-ludi,项目名称:community-service-manager,代码行数:4,代码来源:class-csm-contact-methods.php

示例14: save_account_details

 /**
  * Save the password/account details and redirect back to the my account page.
  */
 public function save_account_details()
 {
     if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
         return;
     }
     if (empty($_POST['action']) || 'save_account_details' !== $_POST['action'] || empty($_POST['_wpnonce'])) {
         return;
     }
     wp_verify_nonce($_POST['_wpnonce'], 'bon_save_account_details');
     $update = true;
     $user = new stdClass();
     $user->ID = (int) get_current_user_id();
     $current_user = get_user_by('id', $user->ID);
     if ($user->ID <= 0) {
         return;
     }
     /* Name */
     $account_first_name = !empty($_POST['account_first_name']) ? sanitize_text_field($_POST['account_first_name']) : '';
     $account_last_name = !empty($_POST['account_last_name']) ? sanitize_text_field($_POST['account_last_name']) : '';
     $account_nickname = !empty($_POST['account_nickname']) ? sanitize_text_field($_POST['account_nickname']) : '';
     $account_display_name = !empty($_POST['account_display_name']) ? sanitize_text_field($_POST['account_display_name']) : '';
     /* Contact Info */
     $account_email = !empty($_POST['account_email']) ? sanitize_email($_POST['account_email']) : '';
     $account_url = !empty($_POST['account_url']) ? esc_url($_POST['account_url']) : '';
     $account_description = !empty($_POST['account_description']) ? esc_textarea($_POST['account_description']) : '';
     $pass1 = !empty($_POST['password_1']) ? $_POST['password_1'] : '';
     $pass2 = !empty($_POST['password_2']) ? $_POST['password_2'] : '';
     $user->first_name = $account_first_name;
     $user->last_name = $account_last_name;
     $user->nickname = $account_nickname;
     $user->display_name = $account_display_name;
     $user->user_email = $account_email;
     $user->user_url = $account_url;
     $user->description = $account_description;
     foreach (wp_get_user_contact_methods($user) as $name => $desc) {
         if (isset($_POST[$name])) {
             $user->{$name} = $_POST[$name];
         }
     }
     if ($pass1) {
         $user->user_pass = $pass1;
     }
     if (empty($account_first_name) || empty($account_last_name)) {
         bon_error_notice()->add('name_empty', __('Please enter your name.', 'bon'), 'error');
     }
     if (empty($account_email) || !is_email($account_email)) {
         bon_error_notice()->add('invalid_email', __('Please provide a valid email address.', 'bon'), 'error');
     } elseif (email_exists($account_email) && $account_email !== $current_user->user_email) {
         bon_error_notice()->add('email_exists', __('This email address is already registered.', 'bon'), 'error');
     }
     if (!empty($pass1) && empty($pass2)) {
         bon_error_notice()->add('password_mismatch', __('Please re-enter your password.', 'bon'), 'error');
     } elseif (!empty($pass1) && $pass1 !== $pass2) {
         bon_error_notice()->add('password_mismatch', __('Passwords do not match.', 'bon'), 'error');
     }
     $errors = bon_error_notice();
     $errors_message = $errors->get_error_messages();
     // Allow plugins to return their own errors.
     do_action_ref_array('user_profile_update_errors', array(&$errors, $update, &$user));
     if (empty($errors_message)) {
         wp_update_user($user);
         do_action('bon_save_account_details', $user->ID);
         wp_safe_redirect(add_query_arg('updated', 'true', $this->my_account_url()));
         exit;
     }
 }
开发者ID:VadimSid,项目名称:thinkgreek,代码行数:69,代码来源:class-bon-accounts.php

示例15: _e

			<p>
				<?php 
echo $current_user->description;
?>
			</p>
		</figcaption>
	</figure>

	<h4 class="bon-form-title"><?php 
_e('Contact Info', 'bon');
?>
</h4>

	<ul class="bon-account-social-contact">
		<?php 
foreach (wp_get_user_contact_methods($current_user) as $name => $desc) {
    ?>
			<?php 
    if (isset($current_user->{$name}) && !empty($current_user->{$name}) && class_exists('Bon_Toolkit_Widget_Social')) {
        ?>
				<li>
					<a href="<?php 
        echo esc_url($current_user->{$name});
        ?>
">
						<i class="bt-icon-<?php 
        echo $name;
        ?>
"></i>
					</a>
				</li>
开发者ID:VadimSid,项目名称:thinkgreek,代码行数:31,代码来源:my-account.php


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