Skip to:
Content

bbPress.org

Ticket #3190: 3190-1.diff

File 3190-1.diff, 2.9 KB (added by espellcaste, 7 years ago)
  • 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 ( ! isset( $args[0] ) || empty( $args[0] ) ) {
     61                                        $caps = array();
     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 ( ! isset( $args[0] ) || empty( $args[0] ) ) {
     133                                $caps = array();
     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 ( ! isset( $args[0] ) || empty( $args[0] ) ) {
     172                                $caps = array();
     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 ( ! isset( $args[0] ) || empty( $args[0] ) ) {
     81                                        $caps = array();
     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 ( ! isset( $args[0] ) || empty( $args[0] ) ) {
     153                                $caps = array();
     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 ( ! isset( $args[0] ) || empty( $args[0] ) ) {
     192                                $caps = array();
     193                        }
     194
     195                        // Get the post.
    184196                        $_post = get_post( $args[0] );
    185197                        if ( ! empty( $_post ) ) {
    186198