WordPress Login System (with the loop?)

I currently have a MySQL database from my old site that used to have a basic PHP log-in form and it would query a table containing the user information to log them in. Basic stuff. However I’ve recently moved to WordPress and it appears to be quite overwhelming at first, so I’m struggling to understand how to integrate my old log-in form with a WordPress site.

I have tried looking at this post:
WordPress login system and I am still confused. I understand the ‘loop’ is responsible for displaying multiple ‘Posts’ on a single page. But to integrate my own PHP code or more specifically; a log-in page, would I make a logged-in ‘Post’ and a not-logged-in ‘Post’, and perhaps use a template to display one or the other for a single page via a ‘Loop’ that uses an if statement to check if the user is logged in?

Read More

Or is there some easier method that I’m completely missing?

Thanks!

EDIT: I’ve thought about creating two pages, both using a template to check if the user is logged in at the top, and display relevant content if they are, or redirect to the log-in page if they aren’t. Would this work?

The other possible method I could think of is creating two Posts and displaying the relevant one on a single Page via The Loop. Would this be possible? Are there any security concerns?

EDIT2: I’m going to try the Members plugin and see if I can modify the WordPress MySQL tables to allow room for my previous data.

EDIT3: I need to sync my user logins to our external database as it contains flags to check whether my members are able to access our ‘support’ pages. I’m not sure how this would be viable while relying on the normal WordPress login system and tables.

Related posts

2 comments

  1. Keep it simple stupid.

    The point of WordPress is to make things easier. So if you want to go with WP, you should adopt the WP way of doing things.

    As comments has suggested, import your current user table into WP. Should be simple enough to change the columns around to get a working import directly into the WP users table.

    If there is extra information in your current user table, simple create new fields in the User Profile section of WP. There should be plugins for this (although I have not tried any), but it is quite simple to add these fields yourself, just google for it, there are many tutorials.

    For a frontend page to be accessed by only logged in users, simple create a page template and check if user is logged in with is_user_logged_in().

    For the access part (Support Pages), either create different user roles and check that the currently logged in user is of the correct role. Or you could also add a custom user capability and validate it on your support pages.

  2. Based on the very general details you have given there is no ‘easier method’ you are missing. We can’t help you form the requirements of your application, but we can help with code if you paste examples of the code you are using, what you are trying to achieve, and what is going wrong with it. Pick one thing, try it out, and if it doesn’t work and you get stuck then post it here.

Comments are closed.