Support » Plugins » Hacks » 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, $ ?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz


    You could possibly create an anonymous user by automatically creating a user by feeding the routine a serialized username and email, but there is no way to do so without adding it to the database. Thus you would need a scheduled task to routinely delete anonymous users that are not currently logged on.



    I’m also working with CAS and so do you, I would like to grab information from CAS for non-privileged users.
    What have you decide Wordletz? What solution have you choose? (if there is…)



    I made a provision script to automatically create a user with their information from CAS (just the username and email), and then I have a cron job that removes them after a certain period of time.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Create temporary user with Subscriber role’ is closed to new replies.