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


PHP bp_xprofile_fullname_field_id函数代码示例

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


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

示例1: test_xprofile_sync_bp_profile_new_user

 /**
  * @group xprofile_set_field_data
  * @ticket BP5836
  */
 public function test_xprofile_sync_bp_profile_new_user()
 {
     $post_vars = $_POST;
     $_POST = array('user_login' => 'foobar', 'pass1' => 'password', 'pass2' => 'password', 'role' => 'subscriber', 'email' => 'foo@bar.com', 'first_name' => 'Foo', 'last_name' => 'Bar');
     $id = add_user();
     $display_name = 'Bar Foo';
     $_POST = array('display_name' => $display_name, 'email' => 'foo@bar.com', 'nickname' => 'foobar');
     $id = edit_user($id);
     // clean up post vars
     $_POST = $post_vars;
     $this->assertEquals($display_name, xprofile_get_field_data(bp_xprofile_fullname_field_id(), $id));
 }
开发者ID:dcavins,项目名称:buddypress-svn,代码行数:16,代码来源:functions.php

示例2: get_fullname

 public static function get_fullname($user_id = 0)
 {
     if (empty($user_id)) {
         $user_id = bp_displayed_user_id();
     }
     $data = xprofile_get_field_data(bp_xprofile_fullname_field_id(), $user_id);
     return $data[$field_name];
 }
开发者ID:kd5ytx,项目名称:Empirical-Wordpress,代码行数:8,代码来源:bp-xprofile-classes.php

示例3: xprofile_sync_bp_profile

/**
 * Syncs the standard built in WordPress profile data to XProfile.
 *
 * @since BuddyPress (1.2.4)
 * @package BuddyPress Core
 */
function xprofile_sync_bp_profile(&$errors, $update, &$user)
{
    // Bail if profile syncing is disabled
    if (bp_disable_profile_sync() || !$update || $errors->get_error_codes()) {
        return;
    }
    xprofile_set_field_data(bp_xprofile_fullname_field_id(), $user->ID, $user->display_name);
}
开发者ID:kosir,项目名称:thatcamp-org,代码行数:14,代码来源:bp-xprofile-functions.php

示例4: prepare_user_ids_query

 /**
  * Prepare the query for user_ids.
  *
  * @since 1.7.0
  */
 public function prepare_user_ids_query()
 {
     global $wpdb;
     $bp = buddypress();
     // Default query variables used here.
     $type = '';
     $per_page = 0;
     $page = 1;
     $user_id = 0;
     $include = false;
     $search_terms = false;
     $exclude = false;
     $meta_key = false;
     $meta_value = false;
     extract($this->query_vars);
     // Setup the main SQL query container.
     $sql = array('select' => '', 'where' => array(), 'orderby' => '', 'order' => '', 'limit' => '');
     /* TYPE **************************************************************/
     // Determines the sort order, which means it also determines where the
     // user IDs are drawn from (the SELECT and WHERE statements).
     switch ($type) {
         // 'online' query happens against the last_activity usermeta key
         // Filter 'bp_user_query_online_interval' to modify the
         // number of minutes used as an interval.
         case 'online':
             $this->uid_name = 'user_id';
             $this->uid_table = $bp->members->table_name_last_activity;
             $sql['select'] = "SELECT u.{$this->uid_name} as id FROM {$this->uid_table} u";
             $sql['where'][] = $wpdb->prepare("u.component = %s AND u.type = 'last_activity'", buddypress()->members->id);
             /**
              * Filters the threshold for activity timestamp minutes since to indicate online status.
              *
              * @since 1.8.0
              *
              * @param int $value Amount of minutes for threshold. Default 15.
              */
             $sql['where'][] = $wpdb->prepare("u.date_recorded >= DATE_SUB( UTC_TIMESTAMP(), INTERVAL %d MINUTE )", apply_filters('bp_user_query_online_interval', 15));
             $sql['orderby'] = "ORDER BY u.date_recorded";
             $sql['order'] = "DESC";
             break;
             // 'active', 'newest', and 'random' queries
             // all happen against the last_activity usermeta key.
         // 'active', 'newest', and 'random' queries
         // all happen against the last_activity usermeta key.
         case 'active':
         case 'newest':
         case 'random':
             $this->uid_name = 'user_id';
             $this->uid_table = $bp->members->table_name_last_activity;
             $sql['select'] = "SELECT u.{$this->uid_name} as id FROM {$this->uid_table} u";
             $sql['where'][] = $wpdb->prepare("u.component = %s AND u.type = 'last_activity'", buddypress()->members->id);
             if ('newest' == $type) {
                 $sql['orderby'] = "ORDER BY u.user_id";
                 $sql['order'] = "DESC";
             } elseif ('random' == $type) {
                 $sql['orderby'] = "ORDER BY rand()";
             } else {
                 $sql['orderby'] = "ORDER BY u.date_recorded";
                 $sql['order'] = "DESC";
             }
             break;
             // 'popular' sorts by the 'total_friend_count' usermeta.
         // 'popular' sorts by the 'total_friend_count' usermeta.
         case 'popular':
             $this->uid_name = 'user_id';
             $this->uid_table = $wpdb->usermeta;
             $sql['select'] = "SELECT u.{$this->uid_name} as id FROM {$this->uid_table} u";
             $sql['where'][] = $wpdb->prepare("u.meta_key = %s", bp_get_user_meta_key('total_friend_count'));
             $sql['orderby'] = "ORDER BY CONVERT(u.meta_value, SIGNED)";
             $sql['order'] = "DESC";
             break;
             // 'alphabetical' sorts depend on the xprofile setup.
         // 'alphabetical' sorts depend on the xprofile setup.
         case 'alphabetical':
             // We prefer to do alphabetical sorts against the display_name field
             // of wp_users, because the table is smaller and better indexed. We
             // can do so if xprofile sync is enabled, or if xprofile is inactive.
             //
             // @todo remove need for bp_is_active() check.
             if (!bp_disable_profile_sync() || !bp_is_active('xprofile')) {
                 $this->uid_name = 'ID';
                 $this->uid_table = $wpdb->users;
                 $sql['select'] = "SELECT u.{$this->uid_name} as id FROM {$this->uid_table} u";
                 $sql['orderby'] = "ORDER BY u.display_name";
                 $sql['order'] = "ASC";
                 // When profile sync is disabled, alphabetical sorts must happen against
                 // the xprofile table.
             } else {
                 $this->uid_name = 'user_id';
                 $this->uid_table = $bp->profile->table_name_data;
                 $sql['select'] = "SELECT u.{$this->uid_name} as id FROM {$this->uid_table} u";
                 $sql['where'][] = $wpdb->prepare("u.field_id = %d", bp_xprofile_fullname_field_id());
                 $sql['orderby'] = "ORDER BY u.value";
                 $sql['order'] = "ASC";
             }
//.........这里部分代码省略.........
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:101,代码来源:class-bp-user-query.php

示例5: prepare_user_ids_query


//.........这里部分代码省略.........

			// 'popular' sorts by the 'total_friend_count' usermeta
			case 'popular' :
				$this->uid_name = 'user_id';
				$this->uid_table = $wpdb->usermeta;
				$sql['select']  = "SELECT u.{$this->uid_name} as id FROM {$this->uid_table} u";
				$sql['where'][] = $wpdb->prepare( "u.meta_key = %s", bp_get_user_meta_key( 'total_friend_count' ) );
				$sql['orderby'] = "ORDER BY CONVERT(u.meta_value, SIGNED)";
				$sql['order']   = "DESC";

				break;

			// 'alphabetical' sorts depend on the xprofile setup
			case 'alphabetical' :

				// We prefer to do alphabetical sorts against the display_name field
				// of wp_users, because the table is smaller and better indexed. We
				// can do so if xprofile sync is enabled, or if xprofile is inactive.
				//
				// @todo remove need for bp_is_active() check
				if ( ! bp_disable_profile_sync() || ! bp_is_active( 'xprofile' ) ) {
					$this->uid_name = 'ID';
					$this->uid_table = $wpdb->users;
					$sql['select']  = "SELECT u.{$this->uid_name} as id FROM {$this->uid_table} u";
					$sql['orderby'] = "ORDER BY u.display_name";
					$sql['order']   = "ASC";

				// When profile sync is disabled, alphabetical sorts must happen against
				// the xprofile table
				} else {
					$this->uid_name = 'user_id';
					$this->uid_table = $bp->profile->table_name_data;
					$sql['select']  = "SELECT u.{$this->uid_name} as id FROM {$this->uid_table} u";
					$sql['where'][] = $wpdb->prepare( "u.field_id = %d", bp_xprofile_fullname_field_id() );
					$sql['orderby'] = "ORDER BY u.value";
					$sql['order']   = "ASC";
				}

				// Alphabetical queries ignore last_activity, while BP uses last_activity
				// to infer spam/deleted/non-activated users. To ensure that these users
				// are filtered out, we add an appropriate sub-query.
				$sql['where'][] = "u.{$this->uid_name} IN ( SELECT ID FROM {$wpdb->users} WHERE " . bp_core_get_status_sql( '' ) . " )";

				break;

			// Any other 'type' falls through
			default :
				$this->uid_name = 'ID';
				$this->uid_table = $wpdb->users;
				$sql['select']  = "SELECT u.{$this->uid_name} as id FROM {$this->uid_table} u";

				// In this case, we assume that a plugin is
				// handling order, so we leave those clauses
				// blank

				break;
		}

		/** WHERE *************************************************************/

		// 'include' - User ids to include in the results
		$include     = false !== $include ? wp_parse_id_list( $include ) : array();
		$include_ids = $this->get_include_ids( $include );
		if ( ! empty( $include_ids ) ) {
			$include_ids    = implode( ',', wp_parse_id_list( $include_ids ) );
			$sql['where'][] = "u.{$this->uid_name} IN ({$include_ids})";
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:67,代码来源:bp-core-classes.php

示例6: xprofile_sync_bp_profile

/**
 * Syncs the standard built in WordPress profile data to XProfile.
 *
 * @since BuddyPress (1.2.4)
 * @package BuddyPress Core
 */
function xprofile_sync_bp_profile(&$errors, $update, &$user)
{
    global $bp;
    if (!empty($bp->site_options['bp-disable-profile-sync']) && (int) $bp->site_options['bp-disable-profile-sync'] || !$update || $errors->get_error_codes()) {
        return;
    }
    xprofile_set_field_data(bp_xprofile_fullname_field_id(), $user->ID, $user->display_name);
}
开发者ID:danielcoats,项目名称:schoolpress,代码行数:14,代码来源:bp-xprofile-functions.php


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