Skip to:
Content

BuddyPress.org

Changeset 13107


Ignore:
Timestamp:
09/11/2021 07:56:26 PM (3 years ago)
Author:
imath
Message:

Be less restrictive when checking the Group object in bp_get_group()

  1. The Groups WP Admin Screen is using a standard object to build Groups permalink.
  2. The current Group's object can be set using a different class than BP_Groups_Group using the 'bp_groups_current_group_class' filter.

For this 2 reasons, we need to adapt bp_get_group() so that a standard object having an id property can be used as the $group function's parameter.

Props espellcaste

Fixes #8567

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/bp-groups-functions.php

    r13104 r13107  
    106106 * @global BP_Groups_Template $groups_template Groups template object.
    107107 *
    108  * @param false|int|string|BP_Groups_Group $group (Optional) The Group ID, the Group Slug or the Group object.
    109  *                                                Default: false.
     108 * @param false|int|string|object|BP_Groups_Group $group (Optional) The Group ID, the Group Slug or the Group object.
     109 *                                                       Default: false.
    110110 * @return BP_Groups_Group|bool The Group object if found, false otherwise.
    111111 */
     
    115115    $group_obj = false;
    116116
    117     if ( $group instanceof BP_Groups_Group ) {
     117    if ( $group instanceof BP_Groups_Group || ( is_object( $group ) && ! empty( $group->id ) ) ) {
    118118        $group_obj = $group;
    119119
Note: See TracChangeset for help on using the changeset viewer.