Ticket #8558: 8558.2.patch
| File 8558.2.patch, 3.7 KB (added by , 4 years ago) |
|---|
-
src/bp-groups/bp-groups-functions.php
diff --git src/bp-groups/bp-groups-functions.php src/bp-groups/bp-groups-functions.php index b23780ae4..f9bb87405 100644
function bp_groups_migrate_invitations() { 3531 3531 $wpdb->query( "DELETE FROM {$bp->groups->table_name_members} WHERE ID IN ($ids_to_delete)" ); 3532 3532 } 3533 3533 } 3534 3535 /** 3536 * Register a new Group Extension. 3537 * 3538 * @since 1.1.0 3539 * @since 10.0.0 The function was moved from the `/bp-groups/classes/class-bp-group-extension.php` file. 3540 * It only registers Group Extensions if their corresponding class name has not been already 3541 * registered. 3542 * 3543 * @param string $group_extension_class Name of the Extension class. 3544 * @return bool Returns true on success, otherwise false. 3545 */ 3546 function bp_register_group_extension( $group_extension_class = '' ) { 3547 if ( ! class_exists( $group_extension_class ) ) { 3548 return false; 3549 } 3550 3551 $bp = buddypress(); 3552 3553 if ( isset( $bp->groups->group_extensions[ $group_extension_class ] ) ) { 3554 return false; 3555 } 3556 3557 // Add the new Group extension to the registered ones. 3558 $bp->groups->group_extensions[ $group_extension_class ] = true; 3559 3560 return true; 3561 } 3562 3563 /** 3564 * Init Registered Group Extensions. 3565 * 3566 * @since 10.0.0 3567 */ 3568 function bp_init_group_extensions() { 3569 $registered_group_extensions = buddypress()->groups->group_extensions; 3570 3571 if ( ! $registered_group_extensions ) { 3572 return; 3573 } 3574 3575 foreach ( array_keys( $registered_group_extensions ) as $group_extension_class ) { 3576 $extension = new $group_extension_class; 3577 3578 add_action( 'bp_actions', array( &$extension, '_register' ), 8 ); 3579 add_action( 'admin_init', array( &$extension, '_register' ) ); 3580 } 3581 } 3582 add_action( 'bp_init', 'bp_init_group_extensions', 11 ); -
src/bp-groups/classes/class-bp-group-extension.php
diff --git src/bp-groups/classes/class-bp-group-extension.php src/bp-groups/classes/class-bp-group-extension.php index 1a12ebcee..e89f3b890 100644
10 10 // Exit if accessed directly. 11 11 defined( 'ABSPATH' ) || exit; 12 12 13 if ( ! class_exists( 'BP_Group_Extension', false ) ) : 13 14 /** 14 15 * API for creating group extensions without having to hardcode the content into 15 16 * the theme. … … class BP_Group_Extension { 1695 1696 } 1696 1697 } 1697 1698 } 1698 1699 /** 1700 * Register a new Group Extension. 1701 * 1702 * @since 1.1.0 1703 * 1704 * @param string $group_extension_class Name of the Extension class. 1705 * @return false|null Returns false on failure, otherwise null. 1706 */ 1707 function bp_register_group_extension( $group_extension_class = '' ) { 1708 1709 if ( ! class_exists( $group_extension_class ) ) { 1710 return false; 1711 } 1712 1713 // Register the group extension on the bp_init action so we have access 1714 // to all plugins. 1715 add_action( 'bp_init', function() use ( $group_extension_class ) { 1716 $extension = new $group_extension_class; 1717 add_action( 'bp_actions', array( &$extension, '_register' ), 8 ); 1718 add_action( 'admin_init', array( &$extension, '_register' ) ); 1719 }, 11 ); 1720 } 1699 endif; // End class_exists check. -
src/bp-groups/classes/class-bp-groups-component.php
diff --git src/bp-groups/classes/class-bp-groups-component.php src/bp-groups/classes/class-bp-groups-component.php index df567e36f..c8c9b7787 100644
class BP_Groups_Component extends BP_Component { 94 94 */ 95 95 public $current_directory_type = ''; 96 96 97 /** 98 * List of registered Group extensions. 99 * 100 * @see bp_register_group_extension() 101 * 102 * @since 10.0.0 103 * @var array 104 */ 105 public $group_extensions = array(); 106 97 107 /** 98 108 * Start the groups component creation process. 99 109 *