Skip to:
Content

bbPress.org

Ticket #3190: 3190-2.diff

File 3190-2.diff, 3.9 KB (added by espellcaste, 7 years ago)
  • src/includes/forums/capabilities.php

     
    6767                        // Do some post ID based logic
    6868                        } else {
    6969
    70                                 // Get the post
     70                                if ( empty( $args[0] ) ) {
     71                                        return $caps;
     72                                }
     73
     74                                // Get the post.
    7175                                $_post = get_post( $args[0] );
    7276                                if ( ! empty( $_post ) ) {
    7377
     
    107111
    108112                case 'moderate_forum' :
    109113
    110                         // Get the post
     114                        if ( empty( $args[0] ) ) {
     115                                return $caps;
     116                        }
     117
     118                        // Get the post.
    111119                        $_post = get_post( $args[0] );
    112120                        if ( ! empty( $_post ) && bbp_allow_forum_mods() ) {
    113121
     
    150158                // Used everywhere
    151159                case 'edit_forum' :
    152160
    153                         // Get the post
     161                        if ( empty( $args[0] ) ) {
     162                                return $caps;
     163                        }
     164
     165                        // Get the post.
    154166                        $_post = get_post( $args[0] );
    155167                        if ( ! empty( $_post ) ) {
    156168
     
    182194                // Allow forum authors to delete forums (for BuddyPress groups, etc)
    183195                case 'delete_forum' :
    184196
    185                         // Get the post
     197                        if ( empty( $args[0] ) ) {
     198                                return $caps;
     199                        }
     200
     201                        // Get the post.
    186202                        $_post = get_post( $args[0] );
    187203                        if ( ! empty( $_post ) ) {
    188204
  • src/includes/replies/capabilities.php

     
    3434 *
    3535 * @since 2.2.0 bbPress (r4242)
    3636 *
    37  * @param array $caps Capabilities for meta capability
    38  * @param string $cap Capability name
    39  * @param int $user_id User id
    40  * @param array $args Arguments
     37 * @param array  $caps    Capabilities for meta capability.
     38 * @param string $cap     Capability name.
     39 * @param int    $user_id User id.
     40 * @param array  $args    Arguments.
    4141 *
    4242 * @return array Actual capabilities for meta capability
    4343 */
     
    5757                        // Do some post ID based logic
    5858                        } else {
    5959
    60                                 // Get the post
     60                                if ( empty( $args[0] ) ) {
     61                                        return $caps;
     62                                }
     63
     64                                // Get the post.
    6165                                $_post = get_post( $args[0] );
    6266                                if ( ! empty( $_post ) ) {
    6367
     
    125129                // Used everywhere
    126130                case 'edit_reply' :
    127131
    128                         // Get the post
     132                        if ( empty( $args[0] ) ) {
     133                                return $caps;
     134                        }
     135
     136                        // Get the post.
    129137                        $_post = get_post( $args[0] );
    130138                        if ( ! empty( $_post ) ) {
    131139
     
    160168
    161169                case 'delete_reply' :
    162170
     171                        if ( empty( $args[0] ) ) {
     172                                return $caps;
     173                        }
     174
    163175                        // Get the post
    164176                        $_post = get_post( $args[0] );
    165177                        if ( ! empty( $_post ) ) {
  • src/includes/topics/capabilities.php

     
    5454 *
    5555 * @since 2.2.0 bbPress (r4242)
    5656 *
    57  * @param array $caps Capabilities for meta capability
    58  * @param string $cap Capability name
    59  * @param int $user_id User id
    60  * @param array $args Arguments
     57 * @param array  $caps    Capabilities for meta capability.
     58 * @param string $cap     Capability name.
     59 * @param int    $user_id User id.
     60 * @param array  $args    Arguments.
    6161 *
    6262 * @return array Actual capabilities for meta capability
    6363 */
     
    7777                        // Do some post ID based logic
    7878                        } else {
    7979
    80                                 // Get the post
     80                                if ( empty( $args[0] ) ) {
     81                                        return $caps;
     82                                }
     83
     84                                // Get the post.
    8185                                $_post = get_post( $args[0] );
    8286                                if ( ! empty( $_post ) ) {
    8387
     
    145149                // Used everywhere
    146150                case 'edit_topic' :
    147151
    148                         // Get the post
     152                        if ( empty( $args[0] ) ) {
     153                                return $caps;
     154                        }
     155
     156                        // Get the post.
    149157                        $_post = get_post( $args[0] );
    150158                        if ( ! empty( $_post ) ) {
    151159
     
    180188
    181189                case 'delete_topic' :
    182190
    183                         // Get the post
     191                        if ( empty( $args[0] ) ) {
     192                                return $caps;
     193                        }
     194
     195                        // Get the post.
    184196                        $_post = get_post( $args[0] );
    185197                        if ( ! empty( $_post ) ) {
    186198