Changeset 7364
- Timestamp:
- 09/02/2013 02:52:44 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/includes/testcase.php
r7334 r7364 10 10 11 11 class BP_UnitTestCase extends WP_UnitTestCase { 12 13 protected $temp_has_bp_moderate = array(); 12 14 13 15 public function setUp() { … … 264 266 } 265 267 268 public function grant_bp_moderate( $user_id ) { 269 if ( ! isset( $this->temp_has_bp_moderate[ $user_id ] ) ) { 270 $this->temp_has_bp_moderate[ $user_id ] = 1; 271 } 272 add_filter( 'bp_current_user_can', array( $this, 'grant_bp_moderate_cb' ), 10, 2 ); 273 } 274 275 public function revoke_bp_moderate( $user_id ) { 276 if ( isset( $this->temp_has_bp_moderate[ $user_id ] ) ) { 277 unset( $this->temp_has_bp_moderate[ $user_id ] ); 278 } 279 remove_filter( 'bp_current_user_can', array( $this, 'grant_bp_moderate_cb' ), 10, 2 ); 280 } 281 282 public function grant_bp_moderate_cb( $retval, $capability ) { 283 $current_user = bp_loggedin_user_id(); 284 if ( ! isset( $this->temp_has_bp_moderate[ $current_user ] ) ) { 285 return $retval; 286 } 287 288 if ( 'bp_moderate' == $capability ) { 289 $retval = true; 290 } 291 292 return $retval; 293 } 294 266 295 /** 267 296 * Go to the root blog. This helps reset globals after moving between
Note: See TracChangeset
for help on using the changeset viewer.