Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/15/2015 07:57:03 PM (10 years ago)
Author:
tw2113
Message:

[Samus Aran]
I first battled the documentation inconsistencies on planet Zebes. It was there that I foiled the plans of the
Space Pirate leader Mother Brain to use the issues to attack galactic civilization...

I next fought the inconsistencies on their homeworld SR388. I completely eradicated them except for an @since tag,
which after hatching followed me like a confused child...

I personally delivered it to the Galactic Research Station at Ceres so scientists could study its energy production qualities...

The scientists' findings were astounding! They discovered that the powers of the docs inconsistencies
might be harnessed for the good of galactic civilization!

Satisfied that all was well, I left the station to seek a new bounty to hunt. But, I had hardly gone beyond the asteroid
belt when I picked up a distress signal!

Ceres station was under attack!

More documentation cleanup for part of BP-Core component.

See #6398.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-caps.php

    r10108 r10356  
    2525    global $wp_roles;
    2626
    27     // Sanity check on roles global variable
     27    // Sanity check on roles global variable.
    2828    $roles = isset( $wp_roles->roles )
    2929        ? $wp_roles->roles
     
    6464    global $wp_roles;
    6565
    66     // Load roles if not set
     66    // Load roles if not set.
    6767    if ( ! isset( $wp_roles ) ) {
    6868        $wp_roles = new WP_Roles();
    6969    }
    7070
    71     // Loop through available roles and add them
     71    // Loop through available roles and add them.
    7272    foreach( $wp_roles->role_objects as $role ) {
    7373        foreach ( bp_get_caps_for_role( $role->name ) as $cap ) {
     
    100100    global $wp_roles;
    101101
    102     // Load roles if not set
     102    // Load roles if not set.
    103103    if ( ! isset( $wp_roles ) ) {
    104104        $wp_roles = new WP_Roles();
    105105    }
    106106
    107     // Loop through available roles and remove them
     107    // Loop through available roles and remove them.
    108108    foreach( $wp_roles->role_objects as $role ) {
    109109        foreach ( bp_get_caps_for_role( $role->name ) as $cap ) {
     
    136136 * @param int    $user_id See {@link WP_User::has_cap()}.
    137137 * @param mixed  $args    See {@link WP_User::has_cap()}.
    138  *
    139138 * @return array Actual capabilities for meta capability. See {@link WP_User::has_cap()}.
    140139 */
     
    165164function bp_get_community_caps() {
    166165
    167     // Forum meta caps
     166    // Forum meta caps.
    168167    $caps = array();
    169168
     
    186185 *
    187186 * @param string $role The role for which you're loading caps.
    188  *
    189187 * @return array Capabilities for $role.
    190188 */
     
    194192    switch ( $role ) {
    195193
    196         // Administrator
     194        // Administrator.
    197195        case 'administrator' :
    198196            $caps = array(
    199                 // Misc
     197                // Misc.
    200198                'bp_moderate',
    201199            );
     
    203201            break;
    204202
    205         // All other default WordPress blog roles
     203        // All other default WordPress blog roles.
    206204        case 'editor'      :
    207205        case 'author'      :
     
    243241function bp_set_current_user_default_role() {
    244242
    245     // Bail if not multisite or not root blog
     243    // Bail if not multisite or not root blog.
    246244    if ( ! is_multisite() || ! bp_is_root_blog() ) {
    247245        return;
    248246    }
    249247
    250     // Bail if user is not logged in or already a member
     248    // Bail if user is not logged in or already a member.
    251249    if ( ! is_user_logged_in() || is_user_member_of_blog() ) {
    252250        return;
    253251    }
    254252
    255     // Bail if user is not active
     253    // Bail if user is not active.
    256254    if ( bp_is_user_inactive() ) {
    257255        return;
    258256    }
    259257
    260     // Set the current users default role
     258    // Set the current users default role.
    261259    buddypress()->current_user->set_role( bp_get_option( 'default_role', 'subscriber' ) );
    262260}
     
    274272 *     @type mixed $a,...   Optional. Extra arguments applicable to the capability check.
    275273 * }
    276  *
    277274 * @return bool True if the user has the cap for the given parameters.
    278275 */
     
    292289    }
    293290
    294     // Use root blog if no ID passed
     291    // Use root blog if no ID passed.
    295292    if ( empty( $blog_id ) ) {
    296293        $blog_id = bp_get_root_blog_id();
     
    341338 * @param int    $user_id ID of the user being checked against.
    342339 * @param array  $args    Miscellaneous arguments passed to the user_has_cap filter.
    343  *
    344340 * @return array $allcaps The user's cap list, with 'bp_moderate' appended, if relevant.
    345341 */
    346342function _bp_enforce_bp_moderate_cap_for_admins( $caps = array(), $cap = '', $user_id = 0, $args = array() ) {
    347343
    348     // Bail if not checking the 'bp_moderate' cap
     344    // Bail if not checking the 'bp_moderate' cap.
    349345    if ( 'bp_moderate' !== $cap ) {
    350346        return $caps;
    351347    }
    352348
    353     // Bail if BuddyPress is not network activated
     349    // Bail if BuddyPress is not network activated.
    354350    if ( bp_is_network_activated() ) {
    355351        return $caps;
    356352    }
    357353
    358     // Never trust inactive users
     354    // Never trust inactive users.
    359355    if ( bp_is_user_inactive( $user_id ) ) {
    360356        return $caps;
    361357    }
    362358
    363     // Only users that can 'manage_options' on this site can 'bp_moderate'
     359    // Only users that can 'manage_options' on this site can 'bp_moderate'.
    364360    return array( 'manage_options' );
    365361}
Note: See TracChangeset for help on using the changeset viewer.