bp_activity_get_current_context()
Gets the current activity context.
Description
The "context" is the current view type, corresponding roughly to the current component. Use this context to determine which activity actions should be whitelisted for the filter dropdown.
Return
(string) Activity context. 'member', 'member_groups', 'group', 'activity'.
Source
File: bp-activity/bp-activity-functions.php
856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 | function bp_activity_get_current_context() { // On member pages, default to 'member', unless this is a user's Groups activity. if ( bp_is_user() ) { if ( bp_is_active( 'groups' ) && bp_is_current_action( bp_get_groups_slug() ) ) { $context = 'member_groups' ; } else { $context = 'member' ; } // On individual group pages, default to 'group'. } elseif ( bp_is_active( 'groups' ) && bp_is_group() ) { $context = 'group' ; // 'activity' everywhere else. } else { $context = 'activity' ; } return $context ; } |
Changelog
Version | Description |
---|---|
BuddyPress 2.8.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.