Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

This seems odd to me because if you're signing on a user you shouldn't already be signed in... therefore your permissions shouldn't matter.

It may be a bit of an odd way of going about it, so that could be causing the issue. Here's the code:

function login( $user_name, $password ) {
    $creds = array();
    $creds['user_login'] = $user_name;
    $creds['user_password'] = $password;
    $creds['remember'] = false;

    $user = wp_signon( $creds, true );

    if( is_wp_error( $user ) ) {
        $result = $user;
    }
    else {
        /* do some other stuff */
    }

    return $result;
}

This is found on a separate page used for web services... this page loads the proper WordPress functions with:

require_once('../../../../../wp-load.php');

And is posted to via jQuery from the front end.

Worth noting that other WP functions such as interaction with global $wpdb works in this file.

share|improve this question
    
What is the exact error WordPress is giving you when you use this? –  EAMann Jul 9 '12 at 20:25
    
fail insufficient_permissions: Current user does not have the permissions to execute that function –  Matt Jul 9 '12 at 20:39
    
Maybe I'm not understanding the Question, but the sample code works for me, if run as an autonomous PHP file. Are you getting this error in jQuery? Because I only found 3 occurrences for "insufficient" in WordPress core... Snapshot: cl.ly/I4FS –  brasofilo Jul 14 '12 at 15:49
    
As @brasofilo said, there is no such error in the WordPress core. Exactly what happens when you run this code and exactly what is the real error you are getting? –  Michael Hampton Jul 15 '12 at 21:03

1 Answer 1

A quick Google on that error garners two results: this question, and an indexed error response from a script named venue_admin_api.php.

Is that your website? Or are you using the same library?

Regardless, somewhere in your codebase (ignoring WP core), that error exists - find it, & post the surrounding code, otherwise I can't see how we can help any further!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.