Ejemplo n.º 1
0
/**
 * Retrieve sitewide activity
 *
 * You should use bp_activity_get() instead
 *
 * @since 1.0.0
 * @deprecated 1.2.0
 *
 * @param array $args
 *
 * @uses BP_Activity_Activity::get() {@link BP_Activity_Activity}
 *
 * @return object $activity The activity/activities object
 */
function bp_activity_get_sitewide($args = '')
{
    _deprecated_function(__FUNCTION__, '1.2', 'bp_activity_get()');
    $defaults = array('max' => false, 'page' => 1, 'per_page' => false, 'sort' => 'DESC', 'display_comments' => false, 'search_terms' => false, 'show_hidden' => false, 'filter' => array());
    $args = wp_parse_args($args, $defaults);
    return apply_filters('bp_activity_get_sitewide', BP_Activity_Activity::get($args), $r);
}
 /**
  * In BuddyPress 1.2.x, this was used to retrieve specific activity stream items (for example, on an activity's permalink page).
  * As of 1.5.x, use BP_Activity_Activity::get( ..., $in ) instead.
  *
  * @deprecated 1.5
  * @deprecated Use BP_Activity_Activity::get( ..., $in ) instead.
  * @param mixed $activity_ids Array or comma-separated string of activity IDs to retrieve
  * @param int $max Maximum number of results to return. (Optional; default is no maximum)
  * @param int $page The set of results that the user is viewing. Used in pagination. (Optional; default is 1)
  * @param int $per_page Specifies how many results per page. Used in pagination. (Optional; default is 25)
  * @param string MySQL column sort; ASC or DESC. (Optional; default is DESC)
  * @param bool $display_comments Retrieve an activity item's associated comments or not. (Optional; default is false)
  * @return array
  * @since 1.2
  */
 function get_specific($activity_ids, $max = false, $page = 1, $per_page = 25, $sort = 'DESC', $display_comments = false)
 {
     _deprecated_function(__FUNCTION__, '1.5', 'Use BP_Activity_Activity::get( ..., $in ) instead.');
     return BP_Activity_Activity::get($max, $page, $per_page, $sort, false, false, $display_comments, false, false, $activity_ids);
 }
Ejemplo n.º 3
0
/**
 * Fetch specific activity items.
 *
 * @since BuddyPress (1.2.0)
 *
 * @see BP_Activity_Activity::get() For more information on accepted arguments
 * @uses wp_parse_args()
 * @uses apply_filters() To call the 'bp_activity_get_specific' hook
 * @uses BP_Activity_Activity::get() {@link BP_Activity_Activity}
 *
 * @param array $args {
 *     All arguments and defaults are shared with BP_Activity_Activity::get(),
 *     except for the following:
 *     @type string|int|array Single activity ID, comma-separated list of IDs,
 *           or array of IDs.
 * }
 * @return array $activity See BP_Activity_Activity::get() for description.
 */
function bp_activity_get_specific($args = '')
{
    $r = bp_parse_args($args, array('activity_ids' => false, 'display_comments' => false, 'max' => false, 'page' => 1, 'per_page' => false, 'show_hidden' => true, 'sort' => 'DESC', 'spam' => 'ham_only', 'update_meta_cache' => true));
    $get_args = array('display_comments' => $r['display_comments'], 'in' => $r['activity_ids'], 'max' => $r['max'], 'page' => $r['page'], 'per_page' => $r['per_page'], 'show_hidden' => $r['show_hidden'], 'sort' => $r['sort'], 'spam' => $r['spam'], 'update_meta_cache' => $r['update_meta_cache']);
    return apply_filters('bp_activity_get_specific', BP_Activity_Activity::get($get_args), $args, $get_args);
}
 /**
  * @group get
  * @group count_total
  */
 public function test_get_with_count_total_default_to_false()
 {
     $a1 = $this->factory->activity->create();
     $a2 = $this->factory->activity->create();
     $activity = BP_Activity_Activity::get();
     $this->assertSame(null, $activity['total']);
 }
 /**
  * In BuddyPress 1.2.x, this was used to retrieve specific activity stream items (for example, on an activity's permalink page).
  *
  * As of 1.5.x, use BP_Activity_Activity::get() with an 'in' parameter instead.
  *
  * @since 1.2.0
  *
  * @deprecated 1.5
  * @deprecated Use BP_Activity_Activity::get() with an 'in' parameter instead.
  *
  * @param mixed    $activity_ids     Array or comma-separated string of activity IDs to retrieve.
  * @param int|bool $max              Maximum number of results to return. (Optional; default is no maximum).
  * @param int      $page             The set of results that the user is viewing. Used in pagination. (Optional; default is 1).
  * @param int      $per_page         Specifies how many results per page. Used in pagination. (Optional; default is 25).
  * @param string   $sort             MySQL column sort; ASC or DESC. (Optional; default is DESC).
  * @param bool     $display_comments Retrieve an activity item's associated comments or not. (Optional; default is false).
  * @return array
  */
 public static function get_specific($activity_ids, $max = false, $page = 1, $per_page = 25, $sort = 'DESC', $display_comments = false)
 {
     _deprecated_function(__FUNCTION__, '1.5', 'Use BP_Activity_Activity::get() with the "in" parameter instead.');
     return BP_Activity_Activity::get($max, $page, $per_page, $sort, false, false, $display_comments, false, false, $activity_ids);
 }
Ejemplo n.º 6
0
/**
 * Fetch specific activity items
 *
 * @since 1.2.0
 *
 * @param array $args See docs for $defaults for details
 *
 * @uses nxt_parse_args()
 * @uses apply_filters() To call the 'bp_activity_get_specific' hook
 * @uses BP_Activity_Activity::get() {@link BP_Activity_Activity}
 *
 * @return array The array returned by BP_Activity_Activity::get()
 */
function bp_activity_get_specific($args = '')
{
    $defaults = array('activity_ids' => false, 'page' => 1, 'per_page' => false, 'max' => false, 'sort' => 'DESC', 'display_comments' => false, 'show_hidden' => true);
    $r = nxt_parse_args($args, $defaults);
    extract($r, EXTR_SKIP);
    return apply_filters('bp_activity_get_specific', BP_Activity_Activity::get($max, $page, $per_page, $sort, false, false, $display_comments, $show_hidden, false, $activity_ids));
}
Ejemplo n.º 7
0
/**
 * Fetch specific activity items.
 *
 * @since 1.2.0
 *
 * @see BP_Activity_Activity::get() For more information on accepted arguments.
 * @uses wp_parse_args()
 * @uses apply_filters() To call the 'bp_activity_get_specific' hook.
 * @uses BP_Activity_Activity::get() {@link BP_Activity_Activity}
 *
 * @param array|string $args {
 *     All arguments and defaults are shared with BP_Activity_Activity::get(),
 *     except for the following:
 *     @type string|int|array Single activity ID, comma-separated list of IDs,
 *                            or array of IDs.
 * }
 * @return array $activity See BP_Activity_Activity::get() for description.
 */
function bp_activity_get_specific($args = '')
{
    $r = bp_parse_args($args, array('activity_ids' => false, 'display_comments' => false, 'max' => false, 'page' => 1, 'per_page' => false, 'show_hidden' => true, 'sort' => 'DESC', 'spam' => 'ham_only', 'update_meta_cache' => true));
    $get_args = array('display_comments' => $r['display_comments'], 'in' => $r['activity_ids'], 'max' => $r['max'], 'page' => $r['page'], 'per_page' => $r['per_page'], 'show_hidden' => $r['show_hidden'], 'sort' => $r['sort'], 'spam' => $r['spam'], 'update_meta_cache' => $r['update_meta_cache']);
    /**
     * Filters the requested specific activity item.
     *
     * @since 1.2.0
     *
     * @param BP_Activity_Activity $activity Requested activity object.
     * @param array                $args     Original passed in arguments.
     * @param array                $get_args Constructed arguments used with request.
     */
    return apply_filters('bp_activity_get_specific', BP_Activity_Activity::get($get_args), $args, $get_args);
}
/**
 * Fetch specific activity items.
 *
 * @since BuddyPress (1.2.0)
 *
 * @see BP_Activity_Activity::get() For more information on accepted arguments
 * @uses wp_parse_args()
 * @uses apply_filters() To call the 'bp_activity_get_specific' hook
 * @uses BP_Activity_Activity::get() {@link BP_Activity_Activity}
 *
 * @param array $args {
 *     All arguments and defaults are shared with BP_Activity_Activity::get(),
 *     except for the following:
 *     @type string|int|array Single activity ID, comma-separated list of IDs,
 *           or array of IDs.
 * }
 * @return array $activity See BP_Activity_Activity::get() for description.
 */
function bp_activity_get_specific( $args = '' ) {

	$r = bp_parse_args( $args, array(
		'activity_ids'      => false,      // A single activity_id or array of IDs.
		'display_comments'  => false,      // true or false to display threaded comments for these specific activity items
		'max'               => false,      // Maximum number of results to return
		'page'              => 1,          // page 1 without a per_page will result in no pagination.
		'per_page'          => false,      // results per page
		'show_hidden'       => true,       // When fetching specific items, show all
		'sort'              => 'DESC',     // sort ASC or DESC
		'spam'              => 'ham_only', // Retrieve items marked as spam
		'update_meta_cache' => true,
	) );

	$get_args = array(
		'display_comments'  => $r['display_comments'],
		'in'                => $r['activity_ids'],
		'max'               => $r['max'],
		'page'              => $r['page'],
		'per_page'          => $r['per_page'],
		'show_hidden'       => $r['show_hidden'],
		'sort'              => $r['sort'],
		'spam'              => $r['spam'],
		'update_meta_cache' => $r['update_meta_cache'],
	);

	/**
	 * Filters the requested specific activity item.
	 *
	 * @since BuddyPress (1.2.0)
	 *
	 * @param BP_Activity_Activity $activity Requested activity object.
	 * @param array                $args Original passed in arguments.
	 * @param array                $get_args Constructed arguments used with request.
	 */
	return apply_filters( 'bp_activity_get_specific', BP_Activity_Activity::get( $get_args ), $args, $get_args );
}
Ejemplo n.º 9
0
/**
 * Fetch specific activity items
 *
 * @since BuddyPress (1.2)
 *
 * @param array $args See docs for $defaults for details
 *
 * @uses wp_parse_args()
 * @uses apply_filters() To call the 'bp_activity_get_specific' hook
 * @uses BP_Activity_Activity::get() {@link BP_Activity_Activity}
 *
 * @return array The array returned by BP_Activity_Activity::get()
 */
function bp_activity_get_specific($args = '')
{
    $defaults = array('activity_ids' => false, 'display_comments' => false, 'max' => false, 'page' => 1, 'per_page' => false, 'show_hidden' => true, 'sort' => 'DESC', 'spam' => 'ham_only');
    $r = wp_parse_args($args, $defaults);
    extract($r, EXTR_SKIP);
    $get_args = array('page' => $page, 'per_page' => $per_page, 'max' => $max, 'sort' => $sort, 'display_comments' => $display_comments, 'show_hidden' => $show_hidden, 'in' => $activity_ids, 'spam' => $spam);
    return apply_filters('bp_activity_get_specific', BP_Activity_Activity::get($get_args), $args, $get_args);
}
Ejemplo n.º 10
0
function bp_activity_get( $args = '' ) {
	$defaults = array(
		'max' => false, // Maximum number of results to return
		'page' => 1, // page 1 without a per_page will result in no pagination.
		'per_page' => false, // results per page
		'sort' => 'DESC', // sort ASC or DESC
		'display_comments' => false, // false for no comments. 'stream' for within stream display, 'threaded' for below each activity item

		'search_terms' => false, // Pass search terms as a string
		'show_hidden' => false, // Show activity items that are hidden site-wide?

		/**
		 * Pass filters as an array -- all filter items can be multiple values comma separated:
		 * array(
		 * 	'user_id' => false, // user_id to filter on
		 *	'object' => false, // object to filter on e.g. groups, profile, status, friends
		 *	'action' => false, // action to filter on e.g. activity_update, profile_updated
		 *	'primary_id' => false, // object ID to filter on e.g. a group_id or forum_id or blog_id etc.
		 *	'secondary_id' => false, // secondary object ID to filter on e.g. a post_id
		 * );
		 */
		'filter' => array()
	);

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

	/* Attempt to return a cached copy of the first page of sitewide activity. */
	if ( 1 == (int)$page && empty( $max ) && empty( $search_terms ) && empty( $filter ) && 'DESC' == $sort ) {
		if ( !$activity = wp_cache_get( 'bp_activity_sitewide_front', 'bp' ) ) {
			$activity = BP_Activity_Activity::get( $max, $page, $per_page, $sort, $search_terms, $filter, $display_comments, $show_hidden );
			wp_cache_set( 'bp_activity_sitewide_front', $activity, 'bp' );
		}
	} else
		$activity = BP_Activity_Activity::get( $max, $page, $per_page, $sort, $search_terms, $filter, $display_comments, $show_hidden );

	return apply_filters( 'bp_activity_get', $activity, &$r );
}