Create temporary user with Subscriber role
-
Hi, first some background (skip ahead if tl;dr). I’m working with CAS (a single sign-on protocol) and WordPress. The sign-ons work but only when I create a user in wordpress with the same login_name as their username in CAS. This works great for admin accounts and people I want to have greater access, but I would like to take advantage of the authentication CAS is already doing for the non-privileged users. This would be great for things like event signups, I won’t have to validate emails and create users because the users in the CAS have full names and emails already associated with it that are authenticated much more rigorously than I can expect users to want to go through just to sign up for an event.
So wpcas provides a method to provision users, I could create a user for each one, but my site isn’t nearly as strict with security as the host for the CAS is. Having a list of every user/email that’s ever visited my site sitting there waiting to be taken would be a problem. So what I want to do is create a temporary user with the Subscriber role. Is there a way to do this without adding them to the database? something like
set_current_user(new WP_User($user, [email protected])) ?
- The topic ‘Create temporary user with Subscriber role’ is closed to new replies.