[wp-hackers] Role settings using WP_User class

Robert Deaton false.hopes at gmail.com
Wed Oct 18 12:11:25 GMT 2006


You're calling functions that are defined in pluggable.php, which is
loaded after plugins. You need to delay the execution of that code to
the init action.

On 10/18/06, Francesco Terenzani <f.terenzani at gmail.com> wrote:
> Hi wp-hackers,
>
> I'm going to make a plugin that have to adds some users.
>
> I have a function that look like this:
>
> function add_user($id){
>   $user = new WP_User($id);
>   $user->set_role(get_option('default_role'));
> }
>
> but this function return the fatal error:
>
> Call to undefined function: get_userdata() in
> mypath\wp\wp-includes\functions.php on line 2259
>

-- 
--Robert Deaton


More information about the wp-hackers mailing list