I’m creating a dashboard app and decided to use WordPress since it has a dashboard that has 100% of the functionality I need out of the box. The dashboard itself has a few dashboard widgets users can customize.
What I need is to grant logged out users access the dashboard. I plan on storing their dashboard configurations to localStorage and just transfer that data to their profile once they create an account. The idea is that more people will use the app since creating an account is the biggest barrier and for what my app does, is unnecessary anyways unless you need longterm storage.
Basically, I need people to visit mysite.com and start using my app right away without needing to register first.
My workaround right now is to signon visitors into a guest account and redirect them to the dashboard. My index.php looks like this:
<?php
/**
* The dashboard IS our app, so we log them in with a guest account
*/
if (!is_user_logged_in()) {
wp_signon([
'user_login' => 'guest',
'user_password' => 'guest',
'remember' => true
]);
}
wp_redirect(admin_url());
exit();
I already have logic in place to disable admin pages, hide widgets, and replace the “Howdy, ‘Guest’” menu with a login button that logs them out of the guest account and takes them to the built in login/register page. I’d like to remove all this complexity by lowering the permissions/capabilities required to see the dashboard if possible.