HEX
Server: Apache/2.4.65 (Debian)
System: Linux 88f31f35b0b8 6.1.0-38-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.147-1 (2025-08-02) x86_64
User: www-data (33)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: /var/www/html/wp-content/plugins/wp-seopress/src/Thirds/BuddyPress/BuddyPressGetCurrentId.php
<?php // phpcs:ignore

namespace SEOPress\Thirds\BuddyPress;

defined( 'ABSPATH' ) || exit( 'Cheatin&#8217; uh?' );


/**
 * BuddyPress Get Current Id
 */
class BuddyPressGetCurrentId {

	/**
	 * Get Current Id
	 *
	 * @return int|null
	 */
	public function getCurrentId() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid
		$id = null;

		if ( function_exists( 'bp_is_current_component' ) && true === bp_is_current_component( 'activity' ) ) {
			$id = buddypress()->pages->activity->id;
		}
		// IS BUDDYPRESS MEMBERS PAGE.
		if ( function_exists( 'bp_is_current_component' ) && true === bp_is_current_component( 'members' ) ) {
			$id = buddypress()->pages->members->id;
		}

		// IS BUDDYPRESS GROUPS PAGE.
		if ( function_exists( 'bp_is_current_component' ) && true === bp_is_current_component( 'groups' ) ) {
			$id = buddypress()->pages->groups->id;
		}

		return $id;
	}
}