Changeset 8117 for sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-bbp-user-moderation/inc/class-plugin.php
- Timestamp:
- 01/21/2019 05:38:26 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-bbp-user-moderation/inc/class-plugin.php
r8041 r8117 65 65 66 66 // Prevent editing their topics/replies. 67 add_filter( 'bbp_map_meta_caps', array( $this, 'bbp_map_meta_caps' ), 100, 3);67 add_filter( 'bbp_map_meta_caps', array( $this, 'bbp_map_meta_caps' ), 100, 4 ); 68 68 } 69 69 … … 315 315 } 316 316 317 public function bbp_map_meta_caps( $caps, $cap, $user_id ) {317 public function bbp_map_meta_caps( $caps, $cap, $user_id, $args ) { 318 318 $limited_caps = array( 319 319 'edit_topic', … … 322 322 323 323 if ( in_array( $cap, $limited_caps, true ) ) { 324 $caps = array( 'do_not_allow' ); 324 $do_not_allow = array( 'do_not_allow' ); 325 326 if ( ! isset( $args[0] ) ) { 327 // No post was specified.. Do not allow editing of an unknown. 328 $caps = $do_not_allow; 329 } else { 330 // If we can't find the post OR the post is NOT pending.. do not allow 331 $_post = get_post( $args[0] ); 332 if ( ! $_post || $_post->post_status !== bbp_get_pending_status_id() ) { 333 $caps = $do_not_allow; 334 } 335 // else { 336 // // We found the post, and it's status is pending.. fall-through and allow. 337 // } 338 } 325 339 } 326 340
Note: See TracChangeset
for help on using the changeset viewer.