bp_activity_get_current_context()

Gets the current activity context.


Description Description

The "context" is the current view type, corresponding roughly to the current component. Use this context to determine which activity actions should be permitted in the filter dropdown.


Top ↑

Return Return

(string) Activity context. 'member', 'member_groups', 'group', 'activity'.


Source Source

File: bp-activity/bp-activity-functions.php

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;
}


Top ↑

Changelog Changelog

Changelog
Version Description
2.8.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.