Pre-fill non-logged in user name and email?
-
We would like the 1000+ members of our organisation to use Stripe for subscription payments. Only a few will have login ids and passwords. The pop-up payment window will nicely pre-fill the user’s name and email if logged in. Is there a workaround for this with members who can’t login? I tried the following kludge on our test site:
get the member’s details;
if not logged in, insert member as a new user and log the new user in (*);
if login confirmed, proceed to payment.
After successful payment delete this userSadly this workaround didn’t work. I wondered if the variable $prefill_user_details in class_asp_pp_display.php was perhaps still set to false? Might I also know where the class AcceptStripePayments is defined?
Thanks for an excellent plugin by the way.
PS The URL above can be tested with:
(No user id: Fred Smith) Member ID: 43541 Email: fs@fs.net
(With user id: Joe Bloggs) Member ID: 43539 Email: jb@jb.net User: joe.bloggs Pass: abc123(*code used to log in new user – variables all pre-set of course) :
// insert new user
$id = wp_insert_user( array(
‘user_login’ => $user_name,
‘user_pass’ => ‘abc123’,
‘user_email’ => $email,
‘first_name’ => $member[‘first_name’],
‘last_name’ => $member[‘last_name’],
‘display_name’ => $full_name,
‘role’ => ”
));// log new user in
wp_set_current_user($id,”);
$user = get_user_by( ‘id’, $id );
if( $user ) {
wp_clear_auth_cookie();
wp_set_current_user ( $user->ID );
wp_set_auth_cookie ( $user->ID );
do_action( ‘wp_login’, $user->user_login, $user );
}The page I need help with: [log in to see the link]
The topic ‘Pre-fill non-logged in user name and email?’ is closed to new replies.