I’m writing a web/db application. My clients would like authentication based on whether the user is logged into WordPress.
Assuming this application is hosted from within /wordpress
I would like to be able to:
-
Determine who, if anyone, is logged into WordPress
Seems as if it should be possible via
wp_get_current_user()
but I can’t find any documentation detailing which include files need to be included to make that work. Including/wp-includes/plugin.php
andpluggable.php
results in aclass WP_User not found
error fromwp_get_current_user()
. I presume some required include files are not included, but which? -
Read WordPress cookies
Seems to require knowledge of the hash that was used when they were created – how is this gettable?
Additional Information: The clients are a group of over 300 artists who want
- a website managed in WordPress and
- a system to manage exhibition submissions,
- a member database,
- rotas,
- user roles
- catalogue production
- detailed business rules/validation, permissions etc
It boils down to various m:n relationships. So a separate system providing ‘club admin’ alongside WordPress for the public-facing website, seemed a better fit than WordPress with endless plugins with uncertain futures. The group, understandably, desires SSO. OAuth or similar is not an option since we’re restricted to a single shared hosting (cPanel) account.
UPDATE – simple solution found – see my answer below