Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
Nightgunner5 committed Jun 16, 2011
1 parent f86e670 commit 50df652
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -5,6 +5,7 @@ TO INSTALL:
TO USE:
=======
In your init:

var wp_auth = require('wordpress-auth').create( 'http://my-blog.example',
'LOGGED_IN_KEY from wp-config.php',
'LOGGED_IN_SALT from wp-config.php',
Expand All @@ -15,16 +16,19 @@ In your init:
'WordPress table prefix (eg. wp_)' );

When you get a HTTP request and you need to verify auth:

wp_auth.checkAuth( req ).on( 'auth', function( auth_is_valid, user_id ) {
auth_is_valid; // true if the user is logged in, false if they are not
user_id; // the ID number of the user or 0 if the user is not logged in
} );

To get a usermeta value:

wp_auth.getUserMeta( user_id, 'meta_key (eg. occupation)', function( data ) {
// data is null if the user doesn't exist or doesn't have the key.
// Otherwise, it is the value you would get in WordPress (unserialized intelligently)
} );

To set a usermeta value:

wp_auth.setUserMeta( user_id, 'meta_key (eg. occupation)', 'meta_value (eg. Eating spaghetti)' );

0 comments on commit 50df652

Please sign in to comment.