Jump to content

Synchronizing Prestashop & Wordpress user accounts (to have a unique authentication system)


dwidoo

Recommended Posts

Hi all,

 

I have integrated a Wordpress blog in my Prestashop shop and I think it would be great that the registered customer wouldn't have to create a Wordpress account, or enter his login to comment a post or to do something else on the blog that requires authentication. What do you think?

 

I'm no developer, and after googling a lot on this question, I can bring you the following infos, that will maybe motivate some of you to collaborate so we can find a satisfying solution.

 

To create and maintain automatically accounts, Wordpress offers 2 methods:wp_insert_user() et wp_update_user() that take $user_data as argument:

 

$user_data = array(

'ID' => '',
'user_login' => 'test',
'user_nicename' => 'test',
'display_name' => 'test',
'nickname' => 'test',
'first_name' => 'Test',
'user_email' => '[email protected]',
'user_pass' => wp_generate_password(),
'user_url' => '',
'user_registered' => now(),
'role' => get_option('default_role') // Use default role or another role, e.g. 'editor'
);
$user_id = wp_insert_user( $user_data );

 

 

Apparently, it is possible to maintain the systems synchronized with the method:

wp_insert_user( $userdata )

Do you think we also need to do something on the Prestashop and Wordpress cookies?

 

Thank you for having read me!

 

D

Link to comment
Share on other sites

  • 3 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...