Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

BBP_User_Engagements_User::get_cache_key( string $meta_key = '', int $object_id )

Private function to get a 2.5 compatible cache key.


Description Description

This method exists to provide backwards compatibility with bbPress 2.5, which had caching surrounding the FIND_IN_SET usermeta queries.


Parameters Parameters

$meta_key

(Optional)

Default value: ''

$object_id

(Required)


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/common/engagements.php

	private function get_cache_key( $meta_key = '', $object_id = 0 ) {

		// No negative numbers in cache keys (zero is weird, but not disallowed)
		$object_id = absint( $object_id );

		// Maybe guess at post type
		$post_type = ! empty( $object_id )
			? get_post_type( $object_id )
			: bbp_get_topic_post_type();

		switch ( $meta_key ) {

			// Favorites
			case '_bbp_favorite' :
				$key = 'bbp_get_topic_favoriters_';
				break;

			// Subscriptions
			case '_bbp_subscription' :

				// Forums & Topics used different keys :/
				$key = ( bbp_get_forum_post_type() === $post_type )
					? 'bbp_get_forum_subscribers_'
					: 'bbp_get_topic_subscribers_';

				break;

			// Unknown, so pluralize
			default :
				$nounize = rtrim( $meta_key, 'e' );
				$key     = "bbp_get_{$post_type}_{$nounize}ers_";
				break;
		}

		// Return the old (pluralized) user option key with object ID appended
		return "{$key}{$object_id}";
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.6.3 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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