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


PHP BP_XProfile_ProfileData类代码示例

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


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

示例1: edit_field_options_html

 /**
  * Output the edit field options HTML for this field type.
  *
  * BuddyPress considers a field's "options" to be, for example, the items in a selectbox.
  * These are stored separately in the database, and their templating is handled separately.
  *
  * This templating is separate from {@link BP_XProfile_Field_Type::edit_field_html()} because
  * it's also used in the wp-admin screens when creating new fields, and for backwards compatibility.
  *
  * Must be used inside the {@link bp_profile_fields()} template loop.
  *
  * @param array $args Optional. The arguments passed to {@link bp_the_profile_field_options()}.
  * 
  */
 public function edit_field_options_html(array $args = array())
 {
     $original_option_values = maybe_unserialize(BP_XProfile_ProfileData::get_value_byid($this->field_obj->id, $args['user_id']));
     if (!empty($_POST['field_' . $this->field_obj->id])) {
         $option_values = (array) $_POST['field_' . $this->field_obj->id];
         $option_values = array_map('sanitize_text_field', $option_values);
     } else {
         $option_values = (array) $original_option_values;
     }
     //member types list as array
     $options = self::get_roles();
     $selected = '';
     //$option_values = (array) $original_option_values;
     if (empty($option_values) || in_array('none', $option_values)) {
         $selected = ' selected="selected"';
     }
     $html = '<option value="" ' . $selected . ' >----' . '</option>';
     echo $html;
     foreach ($options as $role => $label) {
         $selected = '';
         // Run the allowed option name through the before_save filter, so we'll be sure to get a match
         $allowed_options = xprofile_sanitize_data_value_before_save($role, false, false);
         // First, check to see whether the user-entered value matches
         if (in_array($allowed_options, (array) $option_values)) {
             $selected = ' selected="selected"';
         }
         echo apply_filters('bp_get_the_profile_field_options_roles', '<option' . $selected . ' value="' . esc_attr(stripslashes($role)) . '">' . $label . '</option>', $role, $this->field_obj->id, $selected);
     }
 }
开发者ID:buddydev,项目名称:bp-pseudo-role-field,代码行数:43,代码来源:class-pseudo-role-field.php

示例2: profile_screen_admin

 /**
  * profile_screen_admin()
  * 
  * Filters option for 'Teacher', only admins are allowed to access it.
  */
 function profile_screen_admin($options)
 {
     for ($i = 0; $i < count($options); $i++) {
         if (!is_super_admin() && $options[$i]->name == __('Teacher', 'bpsp') && BP_XProfile_ProfileData::get_value_byid($options[$i]->parent_id) != __('Teacher', 'bpsp')) {
             unset($options[$i]);
         }
     }
     return array_merge($options);
 }
开发者ID:warinermedia,项目名称:buddypress-courseware,代码行数:14,代码来源:roles.class.php

示例3: test_bp_has_profile_meta_cache_update_meta_cache_false

 /**
  * @group bp_xprofile_update_meta_cache
  * @group bp_has_profile
  */
 public function test_bp_has_profile_meta_cache_update_meta_cache_false()
 {
     $u = $this->factory->user->create();
     $g = $this->factory->xprofile_group->create();
     $f = $this->factory->xprofile_field->create(array('field_group_id' => $g));
     $d = new BP_XProfile_ProfileData($f, $u);
     $d->user_id = $u;
     $d->field_id = $f;
     $d->value = 'foo';
     $d->last_updated = bp_core_current_time();
     $d->save();
     bp_xprofile_add_meta($g, 'group', 'group_foo', 'group_bar');
     bp_xprofile_add_meta($f, 'field', 'field_foo', 'field_bar');
     bp_xprofile_add_meta($d->id, 'data', 'data_foo', 'data_bar');
     // prime cache
     bp_has_profile(array('user_id' => $u, 'profile_group_id' => $g, 'update_meta_cache' => false));
     $this->assertFalse(wp_cache_get($g, 'xprofile_group_meta'));
     $this->assertFalse(wp_cache_get($f, 'xprofile_field_meta'));
     $this->assertFalse(wp_cache_get($d->id, 'xprofile_data_meta'));
 }
开发者ID:swissspidy,项目名称:BuddyPress,代码行数:24,代码来源:cache.php

示例4: edit_field_options_html

 /**
  * Output the edit field options HTML for this field type.
  *
  * BuddyPress considers a field's "options" to be, for example, the items in a selectbox.
  * These are stored separately in the database, and their templating is handled separately.
  *
  * This templating is separate from {@link BP_XProfile_Field_Type::edit_field_html()} because
  * it's also used in the wp-admin screens when creating new fields, and for backwards compatibility.
  *
  * Must be used inside the {@link bp_profile_fields()} template loop.
  *
  * @param array $args Optional. The arguments passed to {@link bp_the_profile_field_options()}.
  * 
  */
 public function edit_field_options_html(array $args = array())
 {
     $original_option_values = maybe_unserialize(BP_XProfile_ProfileData::get_value_byid($this->field_obj->id, $args['user_id']));
     if (!empty($_POST['field_' . $this->field_obj->id])) {
         $option_values = (array) $_POST['field_' . $this->field_obj->id];
         $option_values = array_map('sanitize_text_field', $option_values);
     } else {
         $option_values = (array) $original_option_values;
     }
     //member types list as array
     $options = self::get_member_types();
     //$option_values = (array) $original_option_values;
     if ($this->display_as_radio()) {
         $this->_edit_options_html_radio($option_values, $options);
     } else {
         $this->_edit_options_html($option_values, $options);
     }
 }
开发者ID:buddydev,项目名称:bp-xprofile-member-type-field,代码行数:32,代码来源:class-member-type-field.php

示例5: the_invite

 function the_invite()
 {
     global $group_id;
     $this->in_the_loop = true;
     $user_id = $this->next_invite();
     $this->invite = new stdClass();
     $this->invite->user = $this->invite_data[$user_id];
     // This method previously populated the user object with
     // BP_Core_User. We manually configure BP_Core_User data for
     // backward compatibility.
     if (bp_is_active('xprofile')) {
         $this->invite->user->profile_data = BP_XProfile_ProfileData::get_all_for_user($user_id);
     }
     $this->invite->user->avatar = bp_core_fetch_avatar(array('item_id' => $user_id, 'type' => 'full', 'alt' => sprintf(__('Avatar of %s', 'buddypress'), $this->invite->user->fullname)));
     $this->invite->user->avatar_thumb = bp_core_fetch_avatar(array('item_id' => $user_id, 'type' => 'thumb', 'alt' => sprintf(__('Avatar of %s', 'buddypress'), $this->invite->user->fullname)));
     $this->invite->user->avatar_mini = bp_core_fetch_avatar(array('item_id' => $user_id, 'type' => 'thumb', 'alt' => sprintf(__('Avatar of %s', 'buddypress'), $this->invite->user->fullname), 'width' => 30, 'height' => 30));
     $this->invite->user->email = $this->invite->user->user_email;
     $this->invite->user->user_url = bp_core_get_user_domain($user_id, $this->invite->user->user_nicename, $this->invite->user->user_login);
     $this->invite->user->user_link = "<a href='{$this->invite->user->user_url}' title='{$this->invite->user->fullname}'>{$this->invite->user->fullname}</a>";
     $this->invite->user->last_active = bp_core_get_last_activity($this->invite->user->last_activity, __('active %s', 'buddypress'));
     if (bp_is_active('groups')) {
         $total_groups = BP_Groups_Member::total_group_count($user_id);
         $this->invite->user->total_groups = sprintf(_n('%d group', '%d groups', $total_groups, 'buddypress'), $total_groups);
     }
     if (bp_is_active('friends')) {
         $this->invite->user->total_friends = BP_Friends_Friendship::total_friend_count($user_id);
     }
     if (bp_is_active('friends')) {
         $this->invite->user->total_friends = BP_Friends_Friendship::total_friend_count($user_id);
     }
     $this->invite->user->total_blogs = null;
     $this->invite->group_id = $group_id;
     // Globaled in bp_group_has_invites()
     if (0 == $this->current_invite) {
         // loop has just started
         do_action('loop_start');
     }
 }
开发者ID:kd5ytx,项目名称:Empirical-Wordpress,代码行数:38,代码来源:bp-groups-template.php

示例6: xprofile_remove_data

/**
 * When a user is deleted, we need to clean up the database and remove all the
 * profile data from each table. Also we need to clean anything up in the
 * usermeta table that this component uses.
 *
 * @package BuddyPress XProfile
 * @param int $user_id The ID of the deleted user
 */
function xprofile_remove_data($user_id)
{
    BP_XProfile_ProfileData::delete_data_for_user($user_id);
}
开发者ID:kosir,项目名称:thatcamp-org,代码行数:12,代码来源:bp-xprofile-functions.php

示例7: edit_field_options_html

 public function edit_field_options_html(array $args = array())
 {
     $options = $this->field_obj->get_children();
     $term_selected = BP_XProfile_ProfileData::get_value_byid($this->field_obj->id, $args['user_id']);
     $html = '';
     if ($options) {
         $taxonomy_selected = $options[0]->name;
         if (!empty($_POST['field_' . $this->field_obj->id])) {
             $new_term_selected = (int) $_POST['field_' . $this->field_obj->id];
             $term_selected = $term_selected != $new_term_selected ? $new_term_selected : $term_selected;
         }
         // Get terms of custom taxonomy selected.
         $terms = get_terms($taxonomy_selected, array('hide_empty' => false));
         if ($terms) {
             foreach ($terms as $term) {
                 $html .= sprintf('<option value="%s"%s>%s</option>', $term->term_id, $term_selected == $term->term_id ? ' selected="selected"' : '', $term->name);
             }
         }
     }
     echo apply_filters('bp_get_the_profile_field_select_custom_taxonomy', $html, $args['type'], $term_selected, $this->field_obj->id);
 }
开发者ID:baden03,项目名称:buddypress-xprofile-custom-fields-type,代码行数:21,代码来源:Bxcft_Field_Type_SelectCustomTaxonomy.php

示例8: bp_get_member_profile_data

/**
 * Get a piece of user profile data.
 *
 * When used in a bp_has_members() loop, this function will attempt
 * to fetch profile data cached in the template global. It is also safe
 * to use outside of the loop.
 *
 * @param array|string $args {
 *     Array of config parameters.
 *     @type string $field   Name of the profile field.
 *     @type int    $user_id ID of the user whose data is being fetched.
 *                           Defaults to the current member in the loop, or if not
 *                           present, to the currently displayed user.
 * }
 * @return string|bool Profile data if found, otherwise false.
 */
function bp_get_member_profile_data($args = '')
{
    global $members_template;
    if (!bp_is_active('xprofile')) {
        return false;
    }
    // Declare local variables.
    $data = false;
    // Guess at default $user_id.
    $default_user_id = 0;
    if (!empty($members_template->member->id)) {
        $default_user_id = $members_template->member->id;
    } elseif (bp_displayed_user_id()) {
        $default_user_id = bp_displayed_user_id();
    }
    $defaults = array('field' => false, 'user_id' => $default_user_id);
    $r = wp_parse_args($args, $defaults);
    // If we're in a members loop, get the data from the global.
    if (!empty($members_template->member->profile_data)) {
        $profile_data = $members_template->member->profile_data;
    }
    // Otherwise query for the data.
    if (empty($profile_data) && method_exists('BP_XProfile_ProfileData', 'get_all_for_user')) {
        $profile_data = BP_XProfile_ProfileData::get_all_for_user($r['user_id']);
    }
    // If we're in the members loop, but the profile data has not
    // been loaded into the global, cache it there for later use.
    if (!empty($members_template->member) && empty($members_template->member->profile_data)) {
        $members_template->member->profile_data = $profile_data;
    }
    // Get the data for the specific field requested.
    if (!empty($profile_data) && !empty($profile_data[$r['field']]['field_type']) && !empty($profile_data[$r['field']]['field_data'])) {
        $data = xprofile_format_profile_field($profile_data[$r['field']]['field_type'], $profile_data[$r['field']]['field_data']);
    }
    /**
     * Filters resulting piece of member profile data.
     *
     * @since 1.2.0
     *
     * @param string|bool $data Profile data if found, otherwise false.
     */
    return apply_filters('bp_get_member_profile_data', $data);
}
开发者ID:mawilliamson,项目名称:wordpress,代码行数:59,代码来源:bp-members-template.php

示例9: xprofile_extract_signup_meta

function xprofile_extract_signup_meta($user_id, $meta)
{
    // Extract signup meta fields to fill out profile
    $field_ids = $meta['xprofile_field_ids'];
    $field_ids = explode(',', $field_ids);
    // Loop through each bit of profile data and save it to profile.
    for ($i = 0; $i < count($field_ids); $i++) {
        if (empty($field_ids[$i])) {
            continue;
        }
        $field_value = $meta["field_{$field_ids[$i]}"];
        $field = new BP_XProfile_ProfileData();
        $field->user_id = $user_id;
        $field->value = $field_value;
        $field->field_id = $field_ids[$i];
        $field->last_updated = time();
        $field->save();
    }
    update_usermeta($user_id, 'last_activity', time());
}
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:20,代码来源:bp-xprofile-signup.php

示例10: get_profile_data

 /**
  * Fetch xprofile data for the current user.
  *
  * @see BP_XProfile_ProfileData::get_all_for_user() for description of
  *      return value.
  *
  * @return array See {@link BP_XProfile_Profile_Data::get_all_for_user()}.
  */
 public function get_profile_data()
 {
     return BP_XProfile_ProfileData::get_all_for_user($this->id);
 }
开发者ID:kosir,项目名称:thatcamp-org,代码行数:12,代码来源:class-bp-core-user.php

示例11: delete

 function delete()
 {
     global $wpdb, $bp;
     if (!$this->id || !$this->can_delete || $this->parent_id && $this->option_order == 1) {
         return false;
     }
     if (!$wpdb->query($wpdb->prepare("DELETE FROM {$bp->profile->table_name_fields} WHERE id = %d OR parent_id = %d", $this->id, $this->id))) {
         return false;
     }
     /* delete the data in the DB for this field */
     BP_XProfile_ProfileData::delete_for_field($this->id);
     return true;
 }
开发者ID:hornetalcala,项目名称:trunk,代码行数:13,代码来源:bp-xprofile-classes.php

示例12: get


//.........这里部分代码省略.........
     $in_sql = '';
     if (!empty($include_field_ids)) {
         $include_field_ids_cs = implode(',', array_map('intval', $include_field_ids));
         $in_sql = " AND id IN ({$include_field_ids_cs}) ";
     }
     // Fetch the fields.
     $field_ids = $wpdb->get_col("SELECT id FROM {$bp->profile->table_name_fields} WHERE group_id IN ( {$group_ids_in} ) AND parent_id = 0 {$exclude_fields_sql} {$in_sql} ORDER BY field_order");
     // Bail if no fields.
     if (empty($field_ids)) {
         return $groups;
     }
     $field_ids = array_map('intval', $field_ids);
     // Prime the field cache.
     $uncached_field_ids = bp_get_non_cached_ids($field_ids, 'bp_xprofile_fields');
     if (!empty($uncached_field_ids)) {
         $_uncached_field_ids = implode(',', array_map('intval', $uncached_field_ids));
         $uncached_fields = $wpdb->get_results("SELECT * FROM {$bp->profile->table_name_fields} WHERE id IN ({$_uncached_field_ids})");
         foreach ($uncached_fields as $uncached_field) {
             $fid = intval($uncached_field->id);
             wp_cache_set($fid, $uncached_field, 'bp_xprofile_fields');
         }
     }
     // Pull field objects from the cache.
     $fields = array();
     foreach ($field_ids as $field_id) {
         $fields[] = xprofile_get_field($field_id);
     }
     // Store field IDs for meta cache priming.
     $object_ids['field'] = $field_ids;
     // Maybe fetch field data.
     if (!empty($r['fetch_field_data'])) {
         // Get field data for user ID.
         if (!empty($field_ids) && !empty($r['user_id'])) {
             $field_data = BP_XProfile_ProfileData::get_data_for_user($r['user_id'], $field_ids);
         }
         // Remove data-less fields, if necessary.
         if (!empty($r['hide_empty_fields']) && !empty($field_ids) && !empty($field_data)) {
             // Loop through the results and find the fields that have data.
             foreach ((array) $field_data as $data) {
                 // Empty fields may contain a serialized empty array.
                 $maybe_value = maybe_unserialize($data->value);
                 // Valid field values of 0 or '0' get caught by empty(), so we have an extra check for these. See #BP5731.
                 if ((!empty($maybe_value) || '0' == $maybe_value) && false !== ($key = array_search($data->field_id, $field_ids))) {
                     // Fields that have data get removed from the list.
                     unset($field_ids[$key]);
                 }
             }
             // The remaining members of $field_ids are empty. Remove them.
             foreach ($fields as $field_key => $field) {
                 if (in_array($field->id, $field_ids)) {
                     unset($fields[$field_key]);
                 }
             }
             // Reset indexes.
             $fields = array_values($fields);
         }
         // Field data was found.
         if (!empty($fields) && !empty($field_data) && !is_wp_error($field_data)) {
             // Loop through fields.
             foreach ((array) $fields as $field_key => $field) {
                 // Loop through the data in each field.
                 foreach ((array) $field_data as $data) {
                     // Assign correct data value to the field.
                     if ($field->id == $data->field_id) {
                         $fields[$field_key]->data = new stdClass();
                         $fields[$field_key]->data->value = $data->value;
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:67,代码来源:class-bp-xprofile-group.php

示例13: edit_field_options_html

 public function edit_field_options_html(array $args = array())
 {
     $options = $this->field_obj->get_children();
     $checkbox_acceptance = maybe_unserialize(BP_XProfile_ProfileData::get_value_byid($this->field_obj->id, $args['user_id']));
     if (!empty($_POST['field_' . $this->field_obj->id])) {
         $new_checkbox_acceptance = $_POST['field_' . $this->field_obj->id];
         $checkbox_acceptance = $checkbox_acceptance != $new_checkbox_acceptance ? $new_checkbox_acceptance : $checkbox_acceptance;
     }
     $html = '<input type="checkbox" name="check_acc_' . bp_get_the_profile_field_input_name() . '" id="check_acc_' . bp_get_the_profile_field_input_name() . '"';
     if ($checkbox_acceptance == 1) {
         $html .= ' checked="checked"';
     }
     if (isset($args['required']) && $args['required']) {
         $html .= ' required="required" aria-required="true"';
     }
     $html .= ' value="1" /> ';
     $html .= '<input type="hidden" name="' . bp_get_the_profile_field_input_name() . '" id="' . bp_get_the_profile_field_input_name() . '"';
     if ($checkbox_acceptance == 1) {
         $html .= ' value="1" /> ';
     } else {
         $html .= ' value="0" /> ';
     }
     if ($options) {
         foreach ($options as $option) {
             $html .= rawurldecode($option->name);
         }
     }
     // Javascript.
     $html .= '
         <script>
             jQuery(document).ready(function() {
                 jQuery("#check_acc_' . bp_get_the_profile_field_input_name() . '").click(function() {
                     if (jQuery(this).is(":checked")) {
                         jQuery("#' . bp_get_the_profile_field_input_name() . '").val("1");
                     } else {
                         jQuery("#' . bp_get_the_profile_field_input_name() . '").val("0");
                     }
                 });
             });
         </script>
     ';
     echo apply_filters('bp_get_the_profile_field_checkbox_acceptance', $html, $args['type'], $this->field_obj->id, $checkbox_acceptance);
 }
开发者ID:baden03,项目名称:buddypress-xprofile-custom-fields-type,代码行数:43,代码来源:Bxcft_Field_Type_CheckboxAcceptance.php

示例14: edit_field_options_html

 public function edit_field_options_html(array $args = array())
 {
     $options = $this->field_obj->get_children();
     $posts_selected = maybe_unserialize(BP_XProfile_ProfileData::get_value_byid($this->field_obj->id, $args['user_id']));
     $html = '';
     if ($options) {
         $post_type_selected = $options[0]->name;
         if (!empty($_POST['field_' . $this->field_obj->id])) {
             $new_posts_selected = $_POST['field_' . $this->field_obj->id];
             $posts_selected = $posts_selected != $new_posts_selected ? $new_posts_selected : $posts_selected;
         }
         // Get posts of custom post type selected.
         $posts = new WP_Query(array('posts_per_page' => -1, 'post_type' => $post_type_selected, 'orderby' => 'title', 'order' => 'ASC'));
         if ($posts) {
             foreach ($posts->posts as $post) {
                 $html .= sprintf('<option value="%s"%s>%s</option>', $post->ID, !empty($posts_selected) && in_array($post->ID, $posts_selected) ? 'selected="selected"' : '', $post->post_title);
             }
         }
     }
     echo apply_filters('bp_get_the_profile_field_multiselect_custom_post_type', $html, $args['type'], $post_type_selected, $this->field_obj->id);
 }
开发者ID:baden03,项目名称:buddypress-xprofile-custom-fields-type,代码行数:21,代码来源:Bxcft_Field_Type_MultiSelectCustomPostType.php

示例15: bp_get_the_profile_field_options

	function bp_get_the_profile_field_options( $args = '' ) {
		global $field;

		$defaults = array(
			'type' => false
		);

		$r = wp_parse_args( $args, $defaults );
		extract( $r, EXTR_SKIP );

		if ( !method_exists( $field, 'get_children' ) )
			$field = new BP_XProfile_Field( $field->id );

		$options = $field->get_children();

		switch ( $field->type ) {

			case 'selectbox': case 'multiselectbox':
				if ( 'multiselectbox' != $field->type )
					$html .= '<option value="">--------</option>';

				for ( $k = 0; $k < count($options); $k++ ) {
					$option_values = maybe_unserialize( BP_XProfile_ProfileData::get_value_byid( $options[$k]->parent_id ) );
					$option_values = (array)$option_values;

					/* Check for updated posted values, but errors preventing them from being saved first time */
					foreach( (array)$option_values as $i => $option_value ) {
						if ( isset( $_POST['field_' . $field->id] ) && $_POST['field_' . $field->id] != $option_value ) {
							if ( !empty( $_POST['field_' . $field->id] ) )
								$option_values[$i] = $_POST['field_' . $field->id];
						}
					}

					if ( in_array( $options[$k]->name, (array)$option_values ) || $options[$k]->is_default_option ) {
						$selected = ' selected="selected"';
					} else {
						$selected = '';
					}

					$html .= apply_filters( 'bp_get_the_profile_field_options_select', '<option' . $selected . ' value="' . stripslashes( esc_attr( $options[$k]->name ) ) . '">' . stripslashes( esc_attr( $options[$k]->name ) ) . '</option>', $options[$k] );
				}
				break;

			case 'radio':
				$html = '<div id="field_' . $field->id . '">';

				for ( $k = 0; $k < count($options); $k++ ) {
					$option_value = BP_XProfile_ProfileData::get_value_byid($options[$k]->parent_id);

					/* Check for updated posted values, but errors preventing them from being saved first time */
					if ( isset( $_POST['field_' . $field->id] ) && $option_value != $_POST['field_' . $field->id] ) {
						if ( !empty( $_POST['field_' . $field->id] ) )
							$option_value = $_POST['field_' . $field->id];
					}

					if ( $option_value == $options[$k]->name || $value == $options[$k]->name || ( empty( $option_value ) && $options[$k]->is_default_option ) ) {
						$selected = ' checked="checked"';
					} else {
						$selected = '';
					}

					$html .= apply_filters( 'bp_get_the_profile_field_options_radio', '<label><input' . $selected . ' type="radio" name="field_' . $field->id . '" id="option_' . $options[$k]->id . '" value="' . stripslashes( esc_attr( $options[$k]->name ) ) . '"> ' . stripslashes( esc_attr( $options[$k]->name ) ) . '</label>', $options[$k] );
				}

				$html .= '</div>';
				break;

			case 'checkbox':
				$option_values = BP_XProfile_ProfileData::get_value_byid($options[0]->parent_id);

				/* Check for updated posted values, but errors preventing them from being saved first time */
				if ( isset( $_POST['field_' . $field->id] ) && $option_values != maybe_serialize( $_POST['field_' . $field->id] ) ) {
					if ( !empty( $_POST['field_' . $field->id] ) )
						$option_values = $_POST['field_' . $field->id];
				}

				$option_values = maybe_unserialize($option_values);

				for ( $k = 0; $k < count($options); $k++ ) {
					for ( $j = 0; $j < count($option_values); $j++ ) {
						if ( $option_values[$j] == $options[$k]->name || @in_array( $options[$k]->name, $value ) || $options[$k]->is_default_option ) {
							$selected = ' checked="checked"';
							break;
						}
					}

					$html .= apply_filters( 'bp_get_the_profile_field_options_checkbox', '<label><input' . $selected . ' type="checkbox" name="field_' . $field->id . '[]" id="field_' . $options[$k]->id . '_' . $k . '" value="' . stripslashes( esc_attr( $options[$k]->name ) ) . '"> ' . stripslashes( esc_attr( $options[$k]->name ) ) . '</label>', $options[$k] );
					$selected = '';
				}
				break;

			case 'datebox':

				if ( !empty( $field->data->value ) ) {
					$day = date("j", $field->data->value);
					$month = date("F", $field->data->value);
					$year = date("Y", $field->data->value);
					$default_select = ' selected="selected"';
				}

//.........这里部分代码省略.........
开发者ID:n-sane,项目名称:zaroka,代码行数:101,代码来源:bp-xprofile-templatetags.php


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