Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/26/2014 08:53:24 PM (10 years ago)
Author:
imath
Message:

In {{{bp_blogs_add_user_to_blog
()}}} function make sure getting user roles returns an array

On multisite configs, when a member registers, he is not assigned to any blog and has no role.
When activating the user from the Manage signups screen, getting his role in bp_blogs_add_user_to_blog() was returning an empty string causing a notice error when trying to get the keys of the "capabilities" usermeta.
To avoid this, we now make sure this usermeta is an array.

Fixes #5834

File:
1 edited

Legend:

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

    r8945 r8965  
    860860        // Get user capabilities
    861861        $key        = $wpdb->get_blog_prefix( $blog_id ). 'capabilities';
    862         $user_roles = array_keys( bp_get_user_meta( $user_id, $key, true ) );
     862        $user_roles = array_keys( (array) bp_get_user_meta( $user_id, $key, true ) );
    863863
    864864        // User has roles so lets
Note: See TracChangeset for help on using the changeset viewer.