Skip to:
Content

bbPress.org

Opened 3 years ago

Closed 10 hours ago

#3564 closed feature request (duplicate)

Add a static instance variable reference to the BBP_Users_Admin class

Reported by: terresquall Owned by:
Priority: normal Milestone:
Component: General - Administration Version: trunk
Severity: normal Keywords:
Cc:

Description

This is in reference to the BBP_Users_Admin class at includes/admin/users.php. There are some action hooks that reference the instance object itself in setup_actions(), but because the instantiation of the class is not assigned to a variable, there is no way to get a reference of the class.

To rectify this, we can add a static instance variable to it, then assign it in the construct function, like so:

/**
 * The bbPress users admin loader
 *
 * @since 2.0.0 bbPress (r2515)
 */
static $instance;
public function __construct() {
	self::$instance = $this;
	$this->setup_actions();
}

This makes it possible to remove the actions that are hooked by this class.

Change History (1)

#1 @johnjamesjacoby
10 hours ago

  • Component General → General - Administration
  • Milestone Awaiting Review
  • Resolution → duplicate
  • Status new → closed

Thanks for the report. This use case was addressed in [7382] through #3660. BBP_Users_Admin::setup_actions() now fires bbp_admin_users_loaded after registering its hooks and passes the class instance by reference. This allows third-party plugins to remove those callbacks, or retain the object for later use, without adding a public static instance property.

Closing as a duplicate of #3660.

Note: See TracTickets for help on using tickets.