#20741 closed defect (bug) (invalid)
set_user_role action second argument not being passed
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 3.3.2 |
| Component: | Role/Capability | Keywords: | |
| Focuses: | Cc: |
Description
According to capabilities.php:608
do_action( 'set_user_role', $this->ID, $role );
But the output of this when you change user's role
function twentyeleven_set_user_role($user_id, $role) {
global $wpdb;
$all_args = func_get_args();
print_r($all_args);
exit;
}
add_action( 'set_user_role', 'twentyeleven_set_user_role');
is
Array
(
[0] => 2
)
where 2 is the user id.
Also: I wish I could receive both new and old roles in the action. Possible?
Change History (2)
Note: See
TracTickets for help on using
tickets.
Receiving the old role is a duplicate of another ticket.
You are only getting one argument because add_action() defaults to one argument.
add_action( $tag, $function_to_add, $priority = 10, $accepted_args = 1 )