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


PHP BP_Activity_Activity::get_filter_sql方法代码示例

本文整理汇总了PHP中BP_Activity_Activity::get_filter_sql方法的典型用法代码示例。如果您正苦于以下问题:PHP BP_Activity_Activity::get_filter_sql方法的具体用法?PHP BP_Activity_Activity::get_filter_sql怎么用?PHP BP_Activity_Activity::get_filter_sql使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BP_Activity_Activity的用法示例。


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

示例1: get

 function get($max = false, $page = 1, $per_page = 25, $sort = 'DESC', $search_terms = false, $filter = false, $display_comments = false, $show_hidden = false, $exclude = false, $in = false)
 {
     global $nxtdb, $bp;
     // Select conditions
     $select_sql = "SELECT a.*, u.user_email, u.user_nicename, u.user_login, u.display_name";
     $from_sql = " FROM {$bp->activity->table_name} a LEFT JOIN {$nxtdb->users} u ON a.user_id = u.ID";
     // Where conditions
     $where_conditions = array();
     // Searching
     if ($search_terms) {
         $search_terms = $nxtdb->escape($search_terms);
         $where_conditions['search_sql'] = "a.content LIKE '%%" . like_escape($search_terms) . "%%'";
     }
     // Filtering
     if ($filter && ($filter_sql = BP_Activity_Activity::get_filter_sql($filter))) {
         $where_conditions['filter_sql'] = $filter_sql;
     }
     // Sorting
     if ($sort != 'ASC' && $sort != 'DESC') {
         $sort = 'DESC';
     }
     // Hide Hidden Items?
     if (!$show_hidden) {
         $where_conditions['hidden_sql'] = "a.hide_sitewide = 0";
     }
     // Exclude specified items
     if (!empty($exclude)) {
         $exclude = implode(',', nxt_parse_id_list($exclude));
         $where_conditions['exclude'] = "a.id NOT IN ({$exclude})";
     }
     // The specific ids to which you want to limit the query
     if (!empty($in)) {
         $in = implode(',', nxt_parse_id_list($in));
         $where_conditions['in'] = "a.id IN ({$in})";
     }
     // Alter the query based on whether we want to show activity item
     // comments in the stream like normal comments or threaded below
     // the activity.
     if (false === $display_comments || 'threaded' === $display_comments) {
         $where_conditions[] = "a.type != 'activity_comment'";
     }
     $where_sql = 'WHERE ' . join(' AND ', $where_conditions);
     if (!empty($per_page) && !empty($page)) {
         // Make sure page values are absolute integers
         $page = absint($page);
         $per_page = absint($per_page);
         $pag_sql = $nxtdb->prepare("LIMIT %d, %d", absint(($page - 1) * $per_page), $per_page);
         $activities = $nxtdb->get_results(apply_filters('bp_activity_get_user_join_filter', $nxtdb->prepare("{$select_sql} {$from_sql} {$where_sql} ORDER BY a.date_recorded {$sort} {$pag_sql}"), $select_sql, $from_sql, $where_sql, $sort, $pag_sql));
     } else {
         $activities = $nxtdb->get_results(apply_filters('bp_activity_get_user_join_filter', $nxtdb->prepare("{$select_sql} {$from_sql} {$where_sql} ORDER BY a.date_recorded {$sort}"), $select_sql, $from_sql, $where_sql, $sort));
     }
     $total_activities_sql = apply_filters('bp_activity_total_activities_sql', $nxtdb->prepare("SELECT count(a.id) FROM {$bp->activity->table_name} a {$where_sql} ORDER BY a.date_recorded {$sort}"), $where_sql, $sort);
     $total_activities = $nxtdb->get_var($total_activities_sql);
     // Get the fullnames of users so we don't have to query in the loop
     if (bp_is_active('xprofile') && $activities) {
         foreach ((array) $activities as $activity) {
             if ((int) $activity->user_id) {
                 $activity_user_ids[] = $activity->user_id;
             }
         }
         $activity_user_ids = implode(',', array_unique((array) $activity_user_ids));
         if (!empty($activity_user_ids)) {
             if ($names = $nxtdb->get_results($nxtdb->prepare("SELECT user_id, value AS user_fullname FROM {$bp->profile->table_name_data} WHERE field_id = 1 AND user_id IN ({$activity_user_ids})"))) {
                 foreach ((array) $names as $name) {
                     $tmp_names[$name->user_id] = $name->user_fullname;
                 }
                 foreach ((array) $activities as $i => $activity) {
                     if (!empty($tmp_names[$activity->user_id])) {
                         $activities[$i]->user_fullname = $tmp_names[$activity->user_id];
                     }
                 }
                 unset($names);
                 unset($tmp_names);
             }
         }
     }
     if ($activities && $display_comments) {
         $activities = BP_Activity_Activity::append_comments($activities);
     }
     // If $max is set, only return up to the max results
     if (!empty($max)) {
         if ((int) $total_activities > (int) $max) {
             $total_activities = $max;
         }
     }
     return array('activities' => $activities, 'total' => (int) $total_activities);
 }
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:87,代码来源:bp-activity-classes.php

示例2: get

 /**
  * Get activity items, as specified by parameters
  *
  * @param array $args See $defaults for explanation of arguments
  * @return array
  */
 function get($args = array())
 {
     global $wpdb, $bp;
     // Backward compatibility with old method of passing arguments
     if (!is_array($args) || func_num_args() > 1) {
         _deprecated_argument(__METHOD__, '1.6', sprintf(__('Arguments passed to %1$s should be in an associative array. See the inline documentation at %2$s for more details.', 'buddypress'), __METHOD__, __FILE__));
         $old_args_keys = array(0 => 'max', 1 => 'page', 2 => 'per_page', 3 => 'sort', 4 => 'search_terms', 5 => 'filter', 6 => 'display_comments', 7 => 'show_hidden', 8 => 'exclude', 9 => 'in', 10 => 'spam');
         $func_args = func_get_args();
         $args = bp_core_parse_args_array($old_args_keys, $func_args);
     }
     $defaults = array('page' => 1, 'per_page' => 25, 'max' => false, 'sort' => 'DESC', 'exclude' => false, 'in' => false, 'meta_query' => false, 'filter' => false, 'search_terms' => false, 'display_comments' => false, 'show_hidden' => false, 'spam' => 'ham_only');
     $r = wp_parse_args($args, $defaults);
     extract($r);
     // Select conditions
     $select_sql = "SELECT DISTINCT a.*, u.user_email, u.user_nicename, u.user_login, u.display_name";
     $from_sql = " FROM {$bp->activity->table_name} a LEFT JOIN {$wpdb->users} u ON a.user_id = u.ID";
     $join_sql = '';
     // Where conditions
     $where_conditions = array();
     // Spam
     if ('ham_only' == $spam) {
         $where_conditions['spam_sql'] = 'a.is_spam = 0';
     } elseif ('spam_only' == $spam) {
         $where_conditions['spam_sql'] = 'a.is_spam = 1';
     }
     // Searching
     if ($search_terms) {
         $search_terms = esc_sql($search_terms);
         $where_conditions['search_sql'] = "a.content LIKE '%%" . esc_sql(like_escape($search_terms)) . "%%'";
     }
     // Filtering
     if ($filter && ($filter_sql = BP_Activity_Activity::get_filter_sql($filter))) {
         $where_conditions['filter_sql'] = $filter_sql;
     }
     // Sorting
     if ($sort != 'ASC' && $sort != 'DESC') {
         $sort = 'DESC';
     }
     // Hide Hidden Items?
     if (!$show_hidden) {
         $where_conditions['hidden_sql'] = "a.hide_sitewide = 0";
     }
     // Exclude specified items
     if (!empty($exclude)) {
         $exclude = implode(',', wp_parse_id_list($exclude));
         $where_conditions['exclude'] = "a.id NOT IN ({$exclude})";
     }
     // The specific ids to which you want to limit the query
     if (!empty($in)) {
         $in = implode(',', wp_parse_id_list($in));
         $where_conditions['in'] = "a.id IN ({$in})";
     }
     // Process meta_query into SQL
     $meta_query_sql = self::get_meta_query_sql($meta_query);
     if (!empty($meta_query_sql['join'])) {
         $join_sql .= $meta_query_sql['join'];
     }
     if (!empty($meta_query_sql['where'])) {
         $where_conditions[] = $meta_query_sql['where'];
     }
     // Alter the query based on whether we want to show activity item
     // comments in the stream like normal comments or threaded below
     // the activity.
     if (false === $display_comments || 'threaded' === $display_comments) {
         $where_conditions[] = "a.type != 'activity_comment'";
     }
     $where_sql = 'WHERE ' . join(' AND ', $where_conditions);
     // Define the preferred order for indexes
     $indexes = apply_filters('bp_activity_preferred_index_order', array('user_id', 'item_id', 'secondary_item_id', 'date_recorded', 'component', 'type', 'hide_sitewide', 'is_spam'));
     foreach ($indexes as $key => $index) {
         if (false !== strpos($where_sql, $index)) {
             $the_index = $index;
             break;
             // Take the first one we find
         }
     }
     if (!empty($the_index)) {
         $index_hint_sql = "USE INDEX ({$the_index})";
     } else {
         $index_hint_sql = '';
     }
     if (!empty($per_page) && !empty($page)) {
         // Make sure page values are absolute integers
         $page = absint($page);
         $per_page = absint($per_page);
         $pag_sql = $wpdb->prepare("LIMIT %d, %d", absint(($page - 1) * $per_page), $per_page);
         $activities = $wpdb->get_results(apply_filters('bp_activity_get_user_join_filter', "{$select_sql} {$from_sql} {$join_sql} {$where_sql} ORDER BY a.date_recorded {$sort} {$pag_sql}", $select_sql, $from_sql, $where_sql, $sort, $pag_sql));
     } else {
         $activities = $wpdb->get_results(apply_filters('bp_activity_get_user_join_filter', "{$select_sql} {$from_sql} {$join_sql} {$where_sql} ORDER BY a.date_recorded {$sort}", $select_sql, $from_sql, $where_sql, $sort));
     }
     $total_activities_sql = apply_filters('bp_activity_total_activities_sql', "SELECT count(DISTINCT a.id) FROM {$bp->activity->table_name} a {$index_hint_sql} {$join_sql} {$where_sql} ORDER BY a.date_recorded {$sort}", $where_sql, $sort);
     $total_activities = $wpdb->get_var($total_activities_sql);
     // Get the fullnames of users so we don't have to query in the loop
     if (bp_is_active('xprofile') && !empty($activities)) {
//.........这里部分代码省略.........
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:101,代码来源:bp-activity-classes.php

示例3: get

 /**
  * Get activity items, as specified by parameters.
  *
  * @since 1.0.0
  * @since 2.4.0 Introduced the `$fields` parameter.
  *
  * @see BP_Activity_Activity::get_filter_sql() for a description of the
  *      'filter' parameter.
  * @see WP_Meta_Query::queries for a description of the 'meta_query'
  *      parameter format.
  *
  * @param array $args {
  *     An array of arguments. All items are optional.
  *     @type int          $page              Which page of results to fetch. Using page=1 without per_page will result
  *                                           in no pagination. Default: 1.
  *     @type int|bool     $per_page          Number of results per page. Default: 25.
  *     @type int|bool     $max               Maximum number of results to return. Default: false (unlimited).
  *     @type string       $fields            Activity fields to return. Pass 'ids' to get only the activity IDs.
  *                                           'all' returns full activity objects.
  *     @type string       $sort              ASC or DESC. Default: 'DESC'.
  *     @type array        $exclude           Array of activity IDs to exclude. Default: false.
  *     @type array        $in                Array of ids to limit query by (IN). Default: false.
  *     @type array        $meta_query        Array of meta_query conditions. See WP_Meta_Query::queries.
  *     @type array        $date_query        Array of date_query conditions. See first parameter of
  *                                           WP_Date_Query::__construct().
  *     @type array        $filter_query      Array of advanced query conditions. See BP_Activity_Query::__construct().
  *     @type string|array $scope             Pre-determined set of activity arguments.
  *     @type array        $filter            See BP_Activity_Activity::get_filter_sql().
  *     @type string       $search_terms      Limit results by a search term. Default: false.
  *     @type bool         $display_comments  Whether to include activity comments. Default: false.
  *     @type bool         $show_hidden       Whether to show items marked hide_sitewide. Default: false.
  *     @type string       $spam              Spam status. Default: 'ham_only'.
  *     @type bool         $update_meta_cache Whether to pre-fetch metadata for queried activity items. Default: true.
  *     @type string|bool  $count_total       If true, an additional DB query is run to count the total activity items
  *                                           for the query. Default: false.
  * }
  * @return array The array returned has two keys:
  *               - 'total' is the count of located activities
  *               - 'activities' is an array of the located activities
  */
 public static function get($args = array())
 {
     global $wpdb;
     // Backward compatibility with old method of passing arguments.
     if (!is_array($args) || func_num_args() > 1) {
         _deprecated_argument(__METHOD__, '1.6', sprintf(__('Arguments passed to %1$s should be in an associative array. See the inline documentation at %2$s for more details.', 'buddypress'), __METHOD__, __FILE__));
         $old_args_keys = array(0 => 'max', 1 => 'page', 2 => 'per_page', 3 => 'sort', 4 => 'search_terms', 5 => 'filter', 6 => 'display_comments', 7 => 'show_hidden', 8 => 'exclude', 9 => 'in', 10 => 'spam');
         $func_args = func_get_args();
         $args = bp_core_parse_args_array($old_args_keys, $func_args);
     }
     $bp = buddypress();
     $r = wp_parse_args($args, array('page' => 1, 'per_page' => 25, 'max' => false, 'fields' => 'all', 'sort' => 'DESC', 'exclude' => false, 'in' => false, 'meta_query' => false, 'date_query' => false, 'filter_query' => false, 'filter' => false, 'scope' => false, 'search_terms' => false, 'display_comments' => false, 'show_hidden' => false, 'spam' => 'ham_only', 'update_meta_cache' => true, 'count_total' => false));
     // Select conditions.
     $select_sql = "SELECT DISTINCT a.id";
     $from_sql = " FROM {$bp->activity->table_name} a";
     $join_sql = '';
     // Where conditions.
     $where_conditions = array();
     // Excluded types.
     $excluded_types = array();
     // Scope takes precedence.
     if (!empty($r['scope'])) {
         $scope_query = self::get_scope_query_sql($r['scope'], $r);
         // Add our SQL conditions if matches were found.
         if (!empty($scope_query['sql'])) {
             $where_conditions['scope_query_sql'] = $scope_query['sql'];
         }
         // Override some arguments if needed.
         if (!empty($scope_query['override'])) {
             $r = self::array_replace_recursive($r, $scope_query['override']);
         }
         // Advanced filtering.
     } elseif (!empty($r['filter_query'])) {
         $filter_query = new BP_Activity_Query($r['filter_query']);
         $sql = $filter_query->get_sql();
         if (!empty($sql)) {
             $where_conditions['filter_query_sql'] = $sql;
         }
     }
     // Regular filtering.
     if ($r['filter'] && ($filter_sql = BP_Activity_Activity::get_filter_sql($r['filter']))) {
         $where_conditions['filter_sql'] = $filter_sql;
     }
     // Spam.
     if ('ham_only' == $r['spam']) {
         $where_conditions['spam_sql'] = 'a.is_spam = 0';
     } elseif ('spam_only' == $r['spam']) {
         $where_conditions['spam_sql'] = 'a.is_spam = 1';
     }
     // Searching.
     if ($r['search_terms']) {
         $search_terms_like = '%' . bp_esc_like($r['search_terms']) . '%';
         $where_conditions['search_sql'] = $wpdb->prepare('a.content LIKE %s', $search_terms_like);
     }
     // Sorting.
     $sort = $r['sort'];
     if ($sort != 'ASC' && $sort != 'DESC') {
         $sort = 'DESC';
     }
     // Hide Hidden Items?
//.........这里部分代码省略.........
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:101,代码来源:class-bp-activity-activity.php

示例4: get

 /**
  * Get activity items, as specified by parameters
  *
  * @see BP_Activity_Activity::get_filter_sql() for a description of the
  *      'filter' parameter.
  * @see WP_Meta_Query::queries for a description of the 'meta_query'
  *      parameter format.
  *
  * @param array $args {
  *     An array of arguments. All items are optional.
  *     @type int $page Which page of results to fetch. Using page=1
  *                     without per_page will result in no pagination.
  *                     Default: 1.
  *     @type int|bool $per_page Number of results per page. Default: 25.
  *     @type int|bool $max Maximum number of results to return.
  *                         Default: false (unlimited).
  *     @type string $sort ASC or DESC. Default: 'DESC'.
  *     @type array $exclude Array of activity IDs to exclude.
  *                          Default: false.
  *     @type array $in Array of ids to limit query by (IN).
  *                     Default: false.
  *     @type array $meta_query An array of meta_query conditions.
  *                             See WP_Meta_Query::queries for description.
  *     @type array $date_query An array of date_query conditions.
  *                             See first parameter of WP_Date_Query::__construct()
  *                             for description.
  *     @type array $filter See BP_Activity_Activity::get_filter_sql().
  *     @type string $search_terms Limit results by a search term.
  *                                Default: false.
  *     @type bool $display_comments Whether to include activity comments.
  *                                  Default: false.
  *     @type bool $show_hidden Whether to show items marked hide_sitewide.
  *                             Default: false.
  *     @type string $spam Spam status. Default: 'ham_only'.
  *     @type bool $update_meta_cache Whether to pre-fetch metadata for
  *           queried activity items. Default: true.
  *     @type string|bool $count_total If true, an additional DB query
  *           is run to count the total activity items for the query.
  *           Default: false.
  * }
  * @return array The array returned has two keys:
  *     - 'total' is the count of located activities
  *     - 'activities' is an array of the located activities
  */
 public static function get($args = array())
 {
     global $wpdb, $bp;
     // Backward compatibility with old method of passing arguments
     if (!is_array($args) || func_num_args() > 1) {
         _deprecated_argument(__METHOD__, '1.6', sprintf(__('Arguments passed to %1$s should be in an associative array. See the inline documentation at %2$s for more details.', 'buddypress'), __METHOD__, __FILE__));
         $old_args_keys = array(0 => 'max', 1 => 'page', 2 => 'per_page', 3 => 'sort', 4 => 'search_terms', 5 => 'filter', 6 => 'display_comments', 7 => 'show_hidden', 8 => 'exclude', 9 => 'in', 10 => 'spam');
         $func_args = func_get_args();
         $args = bp_core_parse_args_array($old_args_keys, $func_args);
     }
     $defaults = array('page' => 1, 'per_page' => 25, 'max' => false, 'sort' => 'DESC', 'exclude' => false, 'in' => false, 'meta_query' => false, 'date_query' => false, 'filter' => false, 'search_terms' => false, 'display_comments' => false, 'show_hidden' => false, 'spam' => 'ham_only', 'update_meta_cache' => true, 'count_total' => false);
     $r = wp_parse_args($args, $defaults);
     extract($r);
     // Select conditions
     $select_sql = "SELECT DISTINCT a.id";
     $from_sql = " FROM {$bp->activity->table_name} a";
     $join_sql = '';
     // Where conditions
     $where_conditions = array();
     // Excluded types
     $excluded_types = array();
     // Spam
     if ('ham_only' == $spam) {
         $where_conditions['spam_sql'] = 'a.is_spam = 0';
     } elseif ('spam_only' == $spam) {
         $where_conditions['spam_sql'] = 'a.is_spam = 1';
     }
     // Searching
     if ($search_terms) {
         $search_terms_like = '%' . bp_esc_like($search_terms) . '%';
         $where_conditions['search_sql'] = $wpdb->prepare('a.content LIKE %s', $search_terms_like);
     }
     // Filtering
     if ($filter && ($filter_sql = BP_Activity_Activity::get_filter_sql($filter))) {
         $where_conditions['filter_sql'] = $filter_sql;
     }
     // Sorting
     if ($sort != 'ASC' && $sort != 'DESC') {
         $sort = 'DESC';
     }
     // Hide Hidden Items?
     if (!$show_hidden) {
         $where_conditions['hidden_sql'] = "a.hide_sitewide = 0";
     }
     // Exclude specified items
     if (!empty($exclude)) {
         $exclude = implode(',', wp_parse_id_list($exclude));
         $where_conditions['exclude'] = "a.id NOT IN ({$exclude})";
     }
     // The specific ids to which you want to limit the query
     if (!empty($in)) {
         $in = implode(',', wp_parse_id_list($in));
         $where_conditions['in'] = "a.id IN ({$in})";
     }
     // Process meta_query into SQL
     $meta_query_sql = self::get_meta_query_sql($meta_query);
//.........这里部分代码省略.........
开发者ID:eresyyl,项目名称:mk,代码行数:101,代码来源:bp-activity-classes.php

示例5: get

	function get( $max = false, $page = 1, $per_page = 25, $sort = 'DESC', $search_terms = false, $filter = false, $display_comments = false, $show_hidden = false ) {
		global $wpdb, $bp;

		/* Select conditions */
		$select_sql = "SELECT a.*, u.user_email, u.user_nicename, u.user_login, u.display_name";

		$from_sql = " FROM {$bp->activity->table_name} a LEFT JOIN {$wpdb->users} u ON a.user_id = u.ID";

		/* Where conditions */
		$where_conditions = array();

		/* Searching */
		if ( $search_terms ) {
			$search_terms = $wpdb->escape( $search_terms );
			$where_conditions['search_sql'] = "a.content LIKE '%%" . like_escape( $search_terms ) . "%%'";
		}

		/* Filtering */
		if ( $filter && $filter_sql = BP_Activity_Activity::get_filter_sql( $filter ) )
			$where_conditions['filter_sql'] = $filter_sql;

		/* Sorting */
		if ( $sort != 'ASC' && $sort != 'DESC' )
			$sort = 'DESC';

		/* Hide Hidden Items? */
		if ( !$show_hidden )
			$where_conditions['hidden_sql'] = "a.hide_sitewide = 0";

		/* Alter the query based on whether we want to show activity item comments in the stream like normal comments or threaded below the activity */
		if ( !$display_comments || 'threaded' == $display_comments ) {
			$where_conditions[] = "a.type != 'activity_comment'";
		}

		$where_sql = 'WHERE ' . join( ' AND ', $where_conditions );

		if ( $per_page && $page ) {
			$pag_sql = $wpdb->prepare( "LIMIT %d, %d", intval( ( $page - 1 ) * $per_page ), intval( $per_page ) );
			$activities = $wpdb->get_results( $wpdb->prepare( "{$select_sql} {$from_sql} {$where_sql} ORDER BY a.date_recorded {$sort} {$pag_sql}" ) );
		} else
			$activities = $wpdb->get_results( $wpdb->prepare( "{$select_sql} {$from_sql} {$where_sql} ORDER BY a.date_recorded {$sort} {$pag_sql}" ) );

		$total_activities = $wpdb->get_var( $wpdb->prepare( "SELECT count(a.id) FROM {$bp->activity->table_name} a {$where_sql} ORDER BY a.date_recorded {$sort}" ) );

		/* Get the fullnames of users so we don't have to query in the loop */
		if ( function_exists( 'xprofile_install' ) && $activities ) {
			foreach ( (array)$activities as $activity ) {
				if ( (int)$activity->user_id )
					$activity_user_ids[] = $activity->user_id;
			}

			$activity_user_ids = implode( ',', array_unique( (array)$activity_user_ids ) );
			if ( !empty( $activity_user_ids ) ) {
				if ( $names = $wpdb->get_results( $wpdb->prepare( "SELECT user_id, value AS user_fullname FROM {$bp->profile->table_name_data} WHERE field_id = 1 AND user_id IN ({$activity_user_ids})" ) ) ) {
					foreach ( (array)$names as $name )
						$tmp_names[$name->user_id] = $name->user_fullname;

					foreach ( (array)$activities as $i => $activity ) {
						if ( !empty( $tmp_names[$activity->user_id] ) )
							$activities[$i]->user_fullname = $tmp_names[$activity->user_id];
					}

					unset( $names );
					unset( $tmp_names );
				}
			}
		}

		if ( $activities && $display_comments )
			$activities = BP_Activity_Activity::append_comments( &$activities );

		/* If $max is set, only return up to the max results */
		if ( !empty( $max ) ) {
			if ( (int)$total_activities > (int)$max )
				$total_activities = $max;
		}

		return array( 'activities' => $activities, 'total' => (int)$total_activities );
	}
开发者ID:n-sane,项目名称:zaroka,代码行数:79,代码来源:bp-activity-classes.php

示例6: bp_follow_blogs_groupblog_activity_where_conditions

/**
 * Filter the activity WHERE SQL conditions to support groupblog entries.
 *
 * @param array $retval Current MySQL WHERE conditions
 * @param array $r Current activity get arguments
 * @return array
 */
function bp_follow_blogs_groupblog_activity_where_conditions($retval, $r)
{
    global $bp;
    // support heartbeat in groupblog query
    $extra = '';
    if (!empty($r['filter']['since'])) {
        $extra = BP_Activity_Activity::get_filter_sql(array('since' => $r['filter']['since']));
        $extra = ' AND ' . $extra;
    }
    // For BP Groupblog, we need to grab the group IDs that are connected to blogs
    // This is what this query is for, which will form our groupblog subquery
    $group_ids_connected_to_blogs_subquery = "SELECT group_id FROM {$bp->groups->table_name_groupmeta} WHERE meta_key = 'groupblog_blog_id' AND meta_value IN ( " . $r['filter']['primary_id'] . " )";
    $retval['filter_sql'] = "( ( {$retval['filter_sql']} ) OR ( component = 'groups' AND item_id IN ( {$group_ids_connected_to_blogs_subquery} ) AND type = 'new_groupblog_post'{$extra} ) )";
    remove_filter('bp_activity_get_where_conditions', 'bp_follow_blogs_groupblog_activity_where_conditions', 10, 2);
    return $retval;
}
开发者ID:wesavetheworld,项目名称:buddypress-followers,代码行数:23,代码来源:blogs-backpat.php


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