[ Index ] |
PHP Cross Reference of BuddyPress |
[Source view] [Print] [Project Stats]
BuddyPress Activity Classes
File Size: | 1999 lines (68 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
BP_Activity_Activity:: (28 methods):
__construct()
populate()
save()
get()
get_activity_data()
append_user_fullnames()
prefetch_object_data()
generate_action_strings()
get_meta_query_sql()
get_date_query_sql()
get_scope_query_sql()
get_specific()
get_id()
delete()
delete_activity_item_comments()
delete_activity_meta_entries()
append_comments()
get_activity_comments()
rebuild_activity_comment_tree()
get_child_comments()
get_recorded_components()
get_sitewide_items_for_feed()
get_in_operator_sql()
get_filter_sql()
get_last_updated()
total_favorite_count()
check_exists_by_content()
hide_all_for_user()
Class: BP_Activity_Activity - X-Ref
Database interaction class for the BuddyPress activity component.__construct( $id = false ) X-Ref |
Constructor method. since: 1.5.0 param: int|bool $id Optional. The ID of a specific activity item. |
populate() X-Ref |
Populate the object with data about the specific activity item. since: 1.0.0 |
save() X-Ref |
Save the activity item to the database. since: 1.0.0 return: WP_Error|bool True on success. |
get( $args = array() X-Ref |
Get activity items, as specified by parameters. since: 1.2.0 since: 2.4.0 Introduced the `$fields` parameter. since: 2.9.0 Introduced the `$order_by` parameter. since: 10.0.0 Introduced the `$count_total_only` parameter. return: array The array returned has two keys: param: array $args { |
get_activity_data( $activity_ids = array() X-Ref |
Convert activity IDs to activity objects, as expected in template loop. since: 2.0.0 return: array param: array $activity_ids Array of activity IDs. |
append_user_fullnames( $activities ) X-Ref |
Append xProfile fullnames to an activity array. since: 2.0.0 return: array param: array $activities Activities array. |
prefetch_object_data( $activities ) X-Ref |
Pre-fetch data for objects associated with activity items. Activity items are associated with users, and often with other BuddyPress data objects. Here, we pre-fetch data about these associated objects, so that inline lookups - done primarily when building action strings - do not result in excess database queries. The only object data required for activity component activity types (activity_update and activity_comment) is related to users, and that info is fetched separately in BP_Activity_Activity::get_activity_data(). So this method contains nothing but a filter that allows other components, such as bp-friends and bp-groups, to hook in and prime their own caches at the beginning of an activity loop. since: 2.0.0 return: array $activities Array of activities. param: array $activities Array of activities. |
generate_action_strings( $activities ) X-Ref |
Generate action strings for the activities located in BP_Activity_Activity::get(). If no string can be dynamically generated for a given item (typically because the activity type has not been properly registered), the static 'action' value pulled from the database will be left in place. since: 2.0.0 return: array param: array $activities Array of activities. |
get_meta_query_sql( $meta_query = array() X-Ref |
Get the SQL for the 'meta_query' param in BP_Activity_Activity::get(). We use WP_Meta_Query to do the heavy lifting of parsing the meta_query array and creating the necessary SQL clauses. However, since BP_Activity_Activity::get() builds its SQL differently than WP_Query, we have to alter the return value (stripping the leading AND keyword from the 'where' clause). since: 1.8.0 return: array $sql_array 'join' and 'where' clauses. param: array $meta_query An array of meta_query filters. See the |
get_date_query_sql( $date_query = array() X-Ref |
Get the SQL for the 'date_query' param in BP_Activity_Activity::get(). We use BP_Date_Query, which extends WP_Date_Query, to do the heavy lifting of parsing the date_query array and creating the necessary SQL clauses. since: 2.1.0 return: string param: array $date_query An array of date_query parameters. See the |
get_scope_query_sql( $scope = false, $r = array() X-Ref |
Get the SQL for the 'scope' param in BP_Activity_Activity::get(). A scope is a predetermined set of activity arguments. This method is used to grab these activity arguments and override any existing args if needed. Can handle multiple scopes. since: 2.2.0 return: false|array 'sql' WHERE SQL string and 'override' activity args. param: mixed $scope The activity scope. Accepts string or array of scopes. param: array $r Current activity arguments. Same as those of BP_Activity_Activity::get(), |
get_specific( $activity_ids, $max = false, $page = 1, $per_page = 25, $sort = 'DESC', $display_comments = false ) X-Ref |
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 return: array 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). |
get_id( $args = array() X-Ref |
Get the first activity ID that matches a set of criteria. since: 1.2.0 since: 10.0.0 Parameters were made optional. return: int|false Activity ID on success, false if none is found. param: array $args { |
delete( $args = array() X-Ref |
Delete activity items from the database. To delete a specific activity item, pass an 'id' parameter. Otherwise use the filters. since: 1.2.0 return: array|bool An array of deleted activity IDs on success, false on failure. param: array $args { |
delete_activity_item_comments( $activity_ids = array() X-Ref |
Delete the comments associated with a set of activity items. This method is no longer used by BuddyPress, and it is recommended not to use it going forward, and use BP_Activity_Activity::delete() instead. since: 1.2.0 return: bool True on success. param: array $activity_ids Activity IDs whose comments should be deleted. param: bool $delete_meta Should we delete the activity meta items for these comments. |
delete_activity_meta_entries( $activity_ids = array() X-Ref |
Delete the meta entries associated with a set of activity items. since: 1.2.0 return: bool True on success. param: array $activity_ids Activity IDs whose meta should be deleted. |
append_comments( $activities, $spam = 'ham_only' ) X-Ref |
Append activity comments to their associated activity items. since: 1.2.0 return: array The updated activities with nested comments. param: array $activities Activities to fetch comments for. param: string $spam Optional. 'ham_only' (default), 'spam_only' or 'all'. |
get_activity_comments( $activity_id, $left, $right, $spam = 'ham_only', $top_level_parent_id = 0 ) X-Ref |
Get activity comments that are associated with a specific activity ID. since: 1.2.0 return: array The updated activities with nested comments. param: int $activity_id Activity ID to fetch comments for. param: int $left Left-most node boundary. param: int $right Right-most node boundary. param: string $spam Optional. 'ham_only' (default), 'spam_only' or 'all'. param: int $top_level_parent_id Optional. The id of the root-level parent activity item. |
rebuild_activity_comment_tree( $parent_id, $left = 1 ) X-Ref |
Rebuild nested comment tree under an activity or activity comment. since: 1.2.0 return: int Right Node boundary of activity or activity comment. param: int $parent_id ID of an activity or activity comment. param: int $left Node boundary start for activity or activity comment. |
get_child_comments( $parent_id ) X-Ref |
Get child comments of an activity or activity comment. since: 1.2.0 return: object Numerically indexed array of child comments. param: int $parent_id ID of an activity or activity comment. |
get_recorded_components( $skip_last_activity = true ) X-Ref |
Get a list of components that have recorded activity associated with them. since: 1.2.0 return: array List of component names. param: bool $skip_last_activity If true, components will not be |
get_sitewide_items_for_feed( $limit = 35 ) X-Ref |
Get sitewide activity items for use in an RSS feed. since: 1.0.0 return: array $activity_feed List of activity items, with RSS data added. param: int $limit Optional. Number of items to fetch. Default: 35. |
get_in_operator_sql( $field, $items ) X-Ref |
Create SQL IN clause for filter queries. since: 1.5.0 return: string|false param: string $field The database field. param: array|bool $items The values for the IN clause, or false when none are found. |
get_filter_sql( $filter_array ) X-Ref |
Create filter SQL clauses. since: 1.5.0 return: string The filter clause, for use in a SQL query. param: array $filter_array { |
get_last_updated() X-Ref |
Get the date/time of last recorded activity. since: 1.2.0 return: string ISO timestamp. |
total_favorite_count( $user_id ) X-Ref |
Get favorite count for a given user. since: 1.2.0 return: int $value A count of the user's favorites. param: int $user_id The ID of the user whose favorites you're counting. |
check_exists_by_content( $content ) X-Ref |
Check whether an activity item exists with a given string content. since: 1.1.0 return: int|false The ID of the first matching item if found, otherwise false. param: string $content The content to filter by. |
hide_all_for_user( $user_id ) X-Ref |
Hide all activity for a given user. since: 1.2.0 return: mixed param: int $user_id The ID of the user whose activity you want to mark hidden. |
Generated: Tue Oct 15 01:00:54 2024 | Cross-referenced by PHPXref 0.7.1 |