• We’ve just begun a project where the users are not in the WP database, but are part of a separate database. We need to display content based on whether those users are logged in or logged out (which they do on a portion of the site that is connected to that other database – that portion of the site is not WP). On the WP portions, how can check to see if the users are logged in for the purpose of displaying different content? I know how to solely within WP, but not when the users are external.

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    You will need to use PHP mysqli functions to connect to that DB and query for the information you need. The mysqli class is similar to the WordPress wpdb class, except you need to create your own object and establish a connection, which is done for you when you use $wpdb.

    There’s lots of information on the ‘net about generic mySQL queries from PHP, but they typically use the older mysql_*() functions. mysqli is a newer implementation that has parallel functions, so translating old to new code should be straight forward.

Viewing 1 replies (of 1 total)
  • The topic ‘How To "If User is Logged In/Out" from External Sser DB’ is closed to new replies.