Wordpress site share between two different user tables

I have a wordpress site and an iphone app for the same. You have a common database with different user tables.

1> mysite.com β†’ wp_user

2> iPhone app β†’ app_user

what i want, i want to make available a user of the application to enter the WordPress site. means

1> the user of the site can only enter the site

2> the user of the application can go to the site + application for the iPhone

how can I get the user of the application to enter the site.

I tried to debug a WP-login script, but cannot find the correct path

I need help from you guys.

thanks.

+6
source share
5 answers

The required functionality looks a little complicated, maybe more methods are possible, but I recommend:

  • Create a custom Wordpress login form

  • Retrieve the username and password and first check if they exist on your site or not. If they exist, just log in (these are site users). wp_signon can be used here.

  • If they are not Wordpress users, check if they are users of the mobile application using MySQL and looking at the table of mobile applications, if they exist, then extract their information and register them on the WordPress website wp_create_user , you can add your own metadata so you know that these are application users. After registering, create a login session using wp_signon .

I will recommend you create a plugin for this task in wordpress.

Happy coding!

+9
source

You can use the WordPress XML-RPC API to authenticate your iphone user with Wordpress. A detailed explanation and basic working code can be found in Extending the WordPress XML-RPC API ( http://www.skyverge.com/blog/extending-the-wordpress-xml-rpc-api/ ).

+2
source

I would recommend a custom login plugin.

You can use the wp-rename login plugin as a starting point for this.

In this plugin, the WP credential verification part is processed in the rwl-login.php file on line 449.

Similarly, you should add code to verify credentials for mobile devices also in this case switch. If you built your code following the standards of WP mobile applications, you can simply include the login verification file, as is done for regular WP verification on line 450

if you do not do your own check and redirect correctly in this case. You may also have your own application that has registered the handler for this custom URL so that it can correctly capture and handle redirects.

+1
source

Create 2 user groups, namely:

  • Site user
  • Application user

When a user tries to log in, check the user group that belongs to him and, accordingly, grant access or display an error message.

To make changes to the system of the login system, the user filter β€œ authenticate ” or even better, use wp_authenticate

0
source

Thinking out loud - first confirming the underlying problem:

You need the user to be able to log into the iOS app and provide access to the WP site.

Ongoing review: a user ID + password + salt (or something similar) is created in the iOS and wordpress application. Use this hash sent via the iOS app in WP to confirm the user.

Yes, there are security issues associated with this information passing through the air, just as your username and PW will go through the air.

Using a suitable hash (using the lookup table in WP, very simple), there are methods in WP to force the user to log in (this is done, you can dig code assistants from my archives).

Problem: It is necessary to translate the PW change into hash generation / update. WP has custom interceptors that are very solvable.

Good to know: almost all aspects of user management, including permissions and groups, are available through the WP API / framework. It’s possible (though not easy) to swap PW with an iOS app that will update WP and much more.

I hope I helped you, the messages are a bit confusing.

0
source

Source: https://habr.com/ru/post/959217/


All Articles