WordPress.org

Ready to get started?Download WordPress

Forums

How to register Subscribers and Authors (10 posts)

  1. scdwb
    Member
    Posted 4 years ago #

    Hello,

    I need to be able to register two types of users on my website. One will be user level 0 as a subscriber and the other will be user level 2 as an author.

    I will be using two different registration forms for each type of user. I can't find anywhere any documentation about the function or tags to use on forms to tell wordpress the registration should be a subscriber or an author.

    So form 1, when completed will register them as a subscriber and form 2, when completed, will registers the user as an author.

    Can anyone help me out or point me to the documentation?

    Thanks

  2. scdwb
    Member
    Posted 4 years ago #

    Really struggling with this, can anyone help?

    There is just a default role option on the wordpress admin, which allows you to choose the role to assign to people who register on this site.

    But what about when you want multiple types of users? In my case I need to be able to let subscribers and authors register.

    Please can anyone help out?

    Thanks in advance!

  3. Rev. Voodoo
    Volunteer Moderator
    Posted 4 years ago #

    Since I let anyone sign up for my blog, I set my default to subscriber. Then when anyone needs to be an author or whatever, I change them manually from the admin interface. I wouldn't want to let people pick their level.

    That's not the way you want to handle things I take it?

  4. scdwb
    Member
    Posted 4 years ago #

    Hi Rvoodoo,

    Thanks for your reply. No I need to allow people to register as a subscriber and an author on my site via two separate forms.

    My wordpress site is a property website. So the authors are the letting agents who can register and are able to advertise their properties (so these are wordpress posts).

    The subscribers are users who will log in to view the letting agent contact details. As these details are hidden to users who are not registered. As these are users browsing properties they are interested in I don't want to make these authors as they don't need to add/edit property listings.

    I'm really surprised I can't find out any info about this ! :-)

  5. Rev. Voodoo
    Volunteer Moderator
    Posted 4 years ago #

    I guess because nobody else handles their site that way? I can't understand the reasoning behind it?

    If you let everyone sign up as subscribers then you are safe. Nobody sees what they aren't supposed to. (if you don't want just anybody signing up, you make it so you have to approve everyone) Then you promote manually the letting agents to author status in your admin, then only the people you authorize are authors, and everyone else is still subscriber.

    But if that system doesn't work for you, I hope you find what you are looking for! Good Luck!

  6. scdwb
    Member
    Posted 4 years ago #

    The reason is because my website is a property website. I'm redeveloping my existing property website with wordpress as it is so powerful and can be used for almost any kind of website.

    The default role of an author in wordpress allows them to add/edit/delete their own posts. This is exactly what I need for the letting agents on my website. They log in and add/edit/delete their own property listings.

    Where as subscribers register to unlock the hidden contact details of the letting agents.

    So there will be two link:

    1 - Register to unlock this agents contact details (this goes to subscriber registration page).

    2 - Advertise your properties (this goes to the author registration page).

    I hope the reasoning behind it is a bit clearer now. I suppose as I'm using the site as a CMS rather than a blog system this way of handling a wordpress site hasn't been written about.

  7. witchybrit
    Member
    Posted 4 years ago #

    I would suggest having some custom code work done. Let me know if you want a quote :)

  8. scdwb
    Member
    Posted 4 years ago #

    Possibly, how much would you do this for?

    I wouldn't have thought it was a big job. Maybe just have an if statement during registration. If form equals this, assign subscriber role else assign the author role.

    Would this be the right way to go about it?

    Thanks in advance

  9. witchybrit
    Member
    Posted 4 years ago #

    email me and I can give you details.

  10. scdwb
    Member
    Posted 4 years ago #

    Still struggling with this but would the following method work:

    In the registration form have a hidden field called "role" with the value "author". Then include this code in the header.

    <?php
    if (isset($_POST['Submit']) && $_POST['role'] == "author") {
    
    update_usermeta($userid,'user_level','2');
    
    }
    ?>

    So if the submit button has been pressed and the role field equals author then it would update this user immediately on registration to level 2. Which is the author level.

    If this method works, I could use it for my letting agents registration form.

    The other registration form for normal users on my site would not have this hidden field so their role would not change on registration and would stay as the default subscriber role (which I have selected in the admin).

    If this method will work could someone help me out with the code as I'm a bit stuck. I know the code I have written is wrong :-)

    Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.