Ticket #8317: rolefix.diff
File rolefix.diff, 3.6 KB (added by , 16 years ago) |
---|
-
wp-admin/includes/schema.php
351 351 add_role('subscriber', 'Subscriber|User role'); 352 352 353 353 // Add caps for Administrator role 354 $role = get_role('administrator');354 $role =& get_role('administrator'); 355 355 $role->add_cap('switch_themes'); 356 356 $role->add_cap('edit_themes'); 357 357 $role->add_cap('activate_plugins'); … … 384 384 $role->add_cap('level_0'); 385 385 386 386 // Add caps for Editor role 387 $role = get_role('editor');387 $role =& get_role('editor'); 388 388 $role->add_cap('moderate_comments'); 389 389 $role->add_cap('manage_categories'); 390 390 $role->add_cap('manage_links'); … … 406 406 $role->add_cap('level_0'); 407 407 408 408 // Add caps for Author role 409 $role = get_role('author');409 $role =& get_role('author'); 410 410 $role->add_cap('upload_files'); 411 411 $role->add_cap('edit_posts'); 412 412 $role->add_cap('edit_published_posts'); … … 417 417 $role->add_cap('level_0'); 418 418 419 419 // Add caps for Contributor role 420 $role = get_role('contributor');420 $role =& get_role('contributor'); 421 421 $role->add_cap('edit_posts'); 422 422 $role->add_cap('read'); 423 423 $role->add_cap('level_1'); 424 424 $role->add_cap('level_0'); 425 425 426 426 // Add caps for Subscriber role 427 $role = get_role('subscriber');427 $role =& get_role('subscriber'); 428 428 $role->add_cap('read'); 429 429 $role->add_cap('level_0'); 430 430 } … … 437 437 function populate_roles_210() { 438 438 $roles = array('administrator', 'editor'); 439 439 foreach ($roles as $role) { 440 $role = get_role($role);440 $role =& get_role($role); 441 441 if ( empty($role) ) 442 442 continue; 443 443 … … 458 458 $role->add_cap('read_private_pages'); 459 459 } 460 460 461 $role = get_role('administrator');461 $role =& get_role('administrator'); 462 462 if ( ! empty($role) ) { 463 463 $role->add_cap('delete_users'); 464 464 $role->add_cap('create_users'); 465 465 } 466 466 467 $role = get_role('author');467 $role =& get_role('author'); 468 468 if ( ! empty($role) ) { 469 469 $role->add_cap('delete_posts'); 470 470 $role->add_cap('delete_published_posts'); 471 471 } 472 472 473 $role = get_role('contributor');473 $role =& get_role('contributor'); 474 474 if ( ! empty($role) ) { 475 475 $role->add_cap('delete_posts'); 476 476 } … … 482 482 * @since 2.3.0 483 483 */ 484 484 function populate_roles_230() { 485 $role = get_role( 'administrator' );485 $role =& get_role( 'administrator' ); 486 486 487 487 if ( !empty( $role ) ) { 488 488 $role->add_cap( 'unfiltered_upload' ); … … 495 495 * @since 2.5.0 496 496 */ 497 497 function populate_roles_250() { 498 $role = get_role( 'administrator' );498 $role =& get_role( 'administrator' ); 499 499 500 500 if ( !empty( $role ) ) { 501 501 $role->add_cap( 'edit_dashboard' ); … … 508 508 * @since 2.6.0 509 509 */ 510 510 function populate_roles_260() { 511 $role = get_role( 'administrator' );511 $role =& get_role( 'administrator' ); 512 512 513 513 if ( !empty( $role ) ) { 514 514 $role->add_cap( 'update_plugins' ); … … 522 522 * @since 2.7.0 523 523 */ 524 524 function populate_roles_270() { 525 $role = get_role( 'administrator' );525 $role =& get_role( 'administrator' ); 526 526 527 527 if ( !empty( $role ) ) { 528 528 $role->add_cap( 'install_plugins' ); -
wp-includes/capabilities.php
533 533 //Build $allcaps from role caps, overlay user's $caps 534 534 $this->allcaps = array(); 535 535 foreach ( (array) $this->roles as $role ) { 536 $role = $wp_roles->get_role( $role );536 $role =& $wp_roles->get_role( $role ); 537 537 $this->allcaps = array_merge( $this->allcaps, $role->capabilities ); 538 538 } 539 539 $this->allcaps = array_merge( $this->allcaps, $this->caps );