Adding Relationship field to backend user registration form

Support MB Relationships Adding Relationship field to backend user registration form

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #44272
    webdevwebdev
    Participant

    Hi,
    I have a relationship set up so users can be associated with a school custom post type.
    When I create a new school, the option to add users is available in the edit screen as expected, but when I register a new user in the admin area, the option to assign them to a school is not there - this is only available after user creation, in the Profile screen.
    Is this intended behaviour? What is the best way to add the relationship field to the user registration page so it can be assigned straight away?
    Thank in advance

    #44277
    webdevwebdev
    Participant

    Further to this, I've set both of these relationships to 'show as an admin column', and the relationships show up in the schools posts list, but not in the Users list - so it seems in general the user creation and listing parts are not behaving as expected.

    Please note however, this is currently using the MetaBox Builder - I have not put the code into my plugin as yet. I tend to test things in the Builder first and then add the PHP once I'm happy with all the settings. I'm just mentioning this in case it might make a difference.

    #44279
    PeterPeter
    Moderator

    Hello,

    1. Yes, it is expected. The relationship meta box and other user meta fields are not displayed when you add a new user. Please edit the user after creating to add the value.

    2. You should add the correct column name in the Column position option to display the relationship admin column, screenshot https://imgur.com/Zd8jmXr

    #44281
    webdevwebdev
    Participant

    ah... thanks. The column name does the job - I still had the default 'title'.
    Shame about the user registration page, but a good work around (for anyone who's interested) is to allow a New user to be created directly from the school post relationship field. This then creates the user and automatically creates the relationship as well...

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