Changeset 6571 for trunk/src/includes/forums/capabilities.php
- Timestamp:
- 06/16/2017 07:45:05 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/forums/capabilities.php
r6438 r6571 108 108 break; 109 109 110 /** Moderating ********************************************************/ 111 112 case 'moderate_forum' : 113 114 // Get the post 115 $_post = get_post( $args[0] ); 116 if ( ! empty( $_post ) && bbp_allow_forum_mods() ) { 117 118 // Make sure feature is enabled & user is mod on this forum 119 if ( bbp_is_object_of_user( $_post->ID, $user_id, '_bbp_moderator_id' ) ) { 120 $caps = array( 'spectate' ); 121 } 122 } 123 124 break; 125 110 126 /** Publishing ********************************************************/ 111 127 … … 126 142 127 143 // Moderators can always edit 128 if ( user_can( $user_id, 'keep_gate') ) {129 $caps = array( ' keep_gate' );144 if ( bbp_is_user_keymaster( $user_id ) ) { 145 $caps = array( 'spectate' ); 130 146 131 147 // Otherwise, block … … 150 166 $caps = array( 'do_not_allow' ); 151 167 168 // Moderators can always read forum content 169 } elseif ( user_can( $user_id, 'moderate', $_post->ID ) ) { 170 $caps = array( 'spectate' ); 171 152 172 // User is author so allow edit if not in admin 153 173 } elseif ( ! is_admin() && ( (int) $user_id === (int) $_post->post_author ) ) { 154 174 $caps = array( $post_type->cap->edit_posts ); 155 156 // Moderators can always read forum content157 } elseif ( user_can( $user_id, 'moderate', $_post->ID ) ) {158 $caps = array( 'spectate' );159 175 160 176 // Unknown, so map to edit_others_posts … … 198 214 // Forum admin area. 199 215 case 'bbp_forums_admin' : 200 $caps = array( ' keep_gate' );216 $caps = array( 'edit_forums' ); 201 217 break; 202 218 } … … 248 264 */ 249 265 function bbp_is_user_forum_moderator( $user_id = 0, $forum_id = 0 ) { 250 251 // Validate user ID - fallback to current user if no ID passed. 252 $user_id = bbp_get_user_id( $user_id, false, ! empty( $user_id ) ); 266 $user_id = bbp_get_user_id( $user_id, false, empty( $user_id ) ); 253 267 $forum_id = bbp_get_forum_id( $forum_id ); 254 255 // Check if per-forum moderation is enabled, or assume false 256 $retval = bbp_allow_forum_mods() 257 ? bbp_is_object_of_user( $forum_id, $user_id, '_bbp_moderator_id' ) 258 : false; 268 $retval = user_can( $user_id, 'moderate_forum', $forum_id ); 259 269 260 270 // Filter & return
Note: See TracChangeset
for help on using the changeset viewer.