mardi 12 avril 2016

wordpress user metadata not saving

I'm using the strip connect api with wordpress, and I've managed to set up the flow to connect a user, and get their access token and userid. However, I need to save this in a way that's connected to the wordpress user, as I need to be able to come back and reference the code later, in order to allow the correct person to be paid. I wrote added a couple lines with add_user_meta() but my var_dump() comes out null. here's the some of the code:

global $wpdb;
$table = $wpdb->prefix."stripe_connect";

$wpdb->insert($table , array(
  'time'                    => current_time('mysql'), 
  'access_token'            => $token, 
  'stripe_publishable_key'  => $key, 
  'stripe_user_id'          => $userid)
);

$user_ID = get_current_user_id();
add_user_meta($user_ID, ‘stripe_userid’, $userid, $unique);
add_user_meta($user_ID, ‘stripe_token’, $token, $unique);

$stripeuserid = get_user_meta($user_ID, 'stripe_userid', true);

var_dump($stripeuserid);


$response = '<h4>Thank you for connecting with Stripe. This information has been saved in the database and can be viewed in the Admin Panel.</h4>';



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire