| @@ 767-772 (lines=6) @@ | ||
| 764 | if (! $this->setupCapabilitiesMap()) { |
|
| 765 | return false; |
|
| 766 | } |
|
| 767 | if (! $this->capHasBeenAddedToRole($role->name, $cap)) { |
|
| 768 | $role->add_cap($cap, $grant); |
|
| 769 | $this->capabilities_map[ $role->name ][] = $cap; |
|
| 770 | $this->updateCapabilitiesMap($update_capabilities_map); |
|
| 771 | return true; |
|
| 772 | } |
|
| 773 | } |
|
| 774 | return false; |
|
| 775 | } |
|
| @@ 798-803 (lines=6) @@ | ||
| 795 | return false; |
|
| 796 | } |
|
| 797 | $role = $role instanceof WP_Role ? $role :get_role($role); |
|
| 798 | if ($index = $this->capHasBeenAddedToRole($role->name, $cap, true)) { |
|
| 799 | $role->remove_cap($cap); |
|
| 800 | unset($this->capabilities_map[ $role->name ][ $index ]); |
|
| 801 | $this->updateCapabilitiesMap($update_capabilities_map); |
|
| 802 | return true; |
|
| 803 | } |
|
| 804 | return false; |
|
| 805 | } |
|
| 806 | ||