Custom Fields
Support MB Relationships Connecting a specific USER ROLE to a specific POST TYPE

  • Creator
  • #12584

    I want to connect a specific user role (Contacts) to a CPT (Deals). your documentation says to do this

    add_action( 'mb_relationships_init', function () {
        MB_Relationships_API::register( array(
            'id'   => 'users_to_posts',
            'from' => array(
                'object_type' => 'user',
                'meta_box'    => array(
                    'title'       => 'Assigned To',
                    'field_title' => 'Select Deals',
            'to'   => array(
                'object_type' => 'post',
                'post_type'   => 'post',
                'meta_box'    => array(
                    'title'         => 'Managed By',
                    'context'       => 'side',
                    'empty_message' => 'No users',
        ) );
    } );

    2 questions:

    1. the object_type is set to user, but can I specify a user role instead of all users?
    2. if I want to connect CONTACTS with DEALS, then do I just change post_type=”posts” to post_type=”deals” on the TO side?
Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
  • #12594
    Anh Tran

    Hi Neil,

    1. The connection is available for all users. We do not have a way to control per user role yet.
    2. Yes, that’s true. Just change the post type parameter.

    Anh –

    once I connect USERS to a POST, where will I see the Connect To and From info?

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
grid gear info copy caret-up caret-down trash