Custom Fields
Re-Envisioned
Support MB User Profile Only Admin to Add New Users

  • Creator
    Topic
  • #23574
    Resolved Rebecca Robertson
    Participant

    Hello,
    My site only has registered authors and only administrators can register them.
    It is not a membership site, so it doesn’t have members or subscribers or anyone else who needs to register for any reason at all… which means that I don’t want to set it to anyone can register. Only the administrator can see the registration page, links to it do not appear on anyone else’s profile page or anywhere else on the site.

    I want to create a frontend form that allows me, as the administrator, to register new authors. I need to assign them a role and give them access to they types of posts they can create and a handful of other things. Once they are added by me they can then edit most of their profile from their author dashboard.

    The problem is that when I add the registration form to the proper page, I get told that I’m already logged in. I don’t want to have to log out and create a new author every time I need to create, which would be impossible as only the admin can see the page the form is on.

    How do I create a form that will allow me to add new authors from the frontend and another form that will allow my authors to edit their profile later?

    Thank you,
    Becky Robertson

Viewing 7 replies - 1 through 7 (of 7 total)
  • Author
    Replies
  • #23577
    Long Nguyen
    Moderator

    Hi Rebecca,

    To register users on the frontend even logged in, please add the attribute show_if_user_can to the shortcode Registration form.

    [mb_user_profile_register id="meta-box-id" label_submit="Register" confirmation="Your account has been created successfully." show_if_user_can="manage_options"]

    For new users, you can use the Edit profile form to allow users edit their profile.

    Get more details in the documentation: https://docs.metabox.io/extensions/mb-user-profile/#shortcodes

    #23596
    Rebecca Robertson
    Participant

    Thank you!

    The form is showing my name and password, is there a way for it to be blank? If not, I can work with that.

    Thanks again for the very quick reply!

    #23597
    Long Nguyen
    Moderator

    Hi,

    I do not see the user name and password of the logged-in user in the Registration form. Screenshot https://share.getcloudapp.com/z8u4kQxN.

    Could you please check the shortcode again?

    #23598
    Rebecca Robertson
    Participant

    This is what I see:
    https://drive.google.com/file/d/1glH-O6zJey3GAjiS3Zp0kKAfn4vefuN4/view?usp=sharing

    Here is the shortcode:
    <?php echo do_shortcode(‘[mb_user_profile_register role="author" label_submit="Add Author" confirmation="The new author has been added successfully."" show_if_user_can="create_users"]‘); ?>

    I’ve created 1 new author using the form, so it works, but the confirmation is the default one rather than the one I put in the shortcode and when I added a password it told me that I already have a password for the site. Mostly it’s fine as I’m the only one who will be using this form, I just hate not knowing what I’m doing wrong.

    Basically what I want is to add the first, last and user names, email, role and temporary password. Then a link to their page should be sent to them and they can change what they need to and add all the other stuff.

    #23599
    Rebecca Robertson
    Participant
    #23601
    Long Nguyen
    Moderator

    Hi,

    I think it’s the auto-fill username and password function of the browser or a browser add-on. Please try again with the Incognito mode to check your username and password.
    https://support.google.com/chrome/answer/95464

    You can also send an email to the new user by using the hook rwmb_profile_after_process and the function wp_new_user_notification() base on the user ID.

    #23603
    Rebecca Robertson
    Participant

    Ah! Thank you, that was the issue! Works beautifully!

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.