Skip to:
Content

bbPress.org


Ignore:
Timestamp:
09/17/2012 12:03:03 AM (13 years ago)
Author:
johnjamesjacoby
Message:

Capabilities:

  • Remove experimental Bozo functionality. We can use the 'participate' to prevent forum participation without creating topics or replies.
  • Introduce functions to reset, save, and remove user capabilities.
  • Use these functions in both theme-side and admin-side profiles.
  • Add capabilities to bbp-twentyten theme. This will be moved into the stand-alone bbp-twentyten theme soon'ish.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bbp-includes/bbp-user-functions.php

    r4196 r4222  
    934934    $edit_user = edit_user( $user_id );
    935935
     936    // Either reset caps for role
     937    if ( ! empty( $_POST['bbp-default-caps'] ) ) {
     938        bbp_reset_user_caps( $user_id );
     939
     940    // Or set caps individually
     941    } else {
     942        bbp_save_user_caps( $user_id );
     943    }
     944
    936945    // Error(s) editng the user, so copy them into the global
    937946    if ( is_wp_error( $edit_user ) ) {
     
    13361345
    13371346/**
    1338  * Checks if user is a bozo.
    1339  *
    1340  * @since bbPress (r4169)
    1341  *
    1342  * @uses is_user_logged_in() To check if user is logged in
    1343  * @uses bbp_get_displayed_user_id() To get current user ID
    1344  * @uses bbp_is_user_active() To check if user is active
    1345  *
    1346  * @param int $user_id The user ID to check. Defaults to current user ID
    1347  * @return bool True if inactive, false if active
    1348  */
    1349 function bbp_is_user_bozo( $user_id = 0 ) {
    1350 
    1351     // Default to current user
    1352     if ( empty( $user_id ) && is_user_logged_in() )
    1353         $user_id = bbp_get_current_user_id();
    1354 
    1355     // Anonymous users are not bozos
    1356     if ( empty( $user_id ) )
    1357         return false;
    1358 
    1359     // Return if a user has the bozo capability
    1360     return (bool) apply_filters( 'bbp_is_user_bozo', user_can( $user_id, 'bozo' ), $user_id );
    1361 }
    1362 
    1363 /**
    13641347 * Return a user's main role
    13651348 *
Note: See TracChangeset for help on using the changeset viewer.