bp_activity_get( array|string $args = '' )
Retrieve an activity or activities.
Description
The bp_activity_get() function shares all arguments with BP_Activity_Activity::get(). The following is a list of bp_activity_get() parameters that have different default values from BP_Activity_Activity::get() (value in parentheses is the default for the bp_activity_get()).
- ‘per_page’ (false)
See also
- BP_Activity_Activity::get(): For more information on accepted arguments and the format of the returned value.
Parameters
- $args
-
(Optional) See BP_Activity_Activity::get() for description.
Default value: ''
Return
(array) $activity See BP_Activity_Activity::get() for description.
Source
File: bp-activity/bp-activity-functions.php
1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 | function bp_activity_get( $args = '' ) { $r = bp_parse_args( $args , array ( 'max' => false, // Maximum number of results to return. 'fields' => 'all' , '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. 'privacy' => false, // Privacy of activity 'search_terms' => false, // Pass search terms as a string 'meta_query' => false, // Filter by activity meta. See WP_Meta_Query for format 'date_query' => false, // Filter by date. See first parameter of WP_Date_Query for format. 'filter_query' => false, 'show_hidden' => false, // Show activity items that are hidden site-wide? 'exclude' => false, // Comma-separated list of activity IDs to exclude. 'in' => false, // Comma-separated list or array of activity IDs to which you // want to limit the query. 'spam' => 'ham_only' , // 'ham_only' (default), 'spam_only' or 'all'. 'update_meta_cache' => true, 'count_total' => false, 'scope' => false, /** * 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 blog_id etc. * 'secondary_id' => false, // Secondary object ID to filter on e.g. a post_id. * ); */ 'filter' => array () ), 'activity_get' ); $activity = BP_Activity_Activity::get( array ( 'page' => $r [ 'page' ], 'per_page' => $r [ 'per_page' ], 'max' => $r [ 'max' ], 'sort' => $r [ 'sort' ], 'privacy' => $r [ 'privacy' ], 'search_terms' => $r [ 'search_terms' ], 'meta_query' => $r [ 'meta_query' ], 'date_query' => $r [ 'date_query' ], 'filter_query' => $r [ 'filter_query' ], 'filter' => $r [ 'filter' ], 'scope' => $r [ 'scope' ], 'display_comments' => $r [ 'display_comments' ], 'show_hidden' => $r [ 'show_hidden' ], 'exclude' => $r [ 'exclude' ], 'in' => $r [ 'in' ], 'spam' => $r [ 'spam' ], 'update_meta_cache' => $r [ 'update_meta_cache' ], 'count_total' => $r [ 'count_total' ], 'fields' => $r [ 'fields' ], ) ); /** * Filters the requested activity item(s). * * @since BuddyPress 1.2.0 * * @param BP_Activity_Activity $activity Requested activity object. * @param array $r Arguments used for the activity query. */ return apply_filters_ref_array( 'bp_activity_get' , array ( & $activity , & $r ) ); } |
Changelog
Version | Description |
---|---|
BuddyPress 1.2.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.