Support Forum
Support › MB Relationships › ✅User to User n:n relationship based on User role › Reply To: User to User n:n relationship based on User role
Hi Aristo,
You need to put the user role inside query_args
, like this:
add_action( 'mb_relationships_init', function () {
MB_Relationships_API::register( array(
'id' => 'stud_to_teach',
'from' => array(
'object_type' => 'user',
'query_args' => array( 'role__in' => 'student' ),
'meta_box' => array(
'title' => 'Manages',
'field_title' => 'Select Users',
),
),
'to' => array(
'object_type' => 'user',
'query_args' => array( 'role__in' => 'teacher' ),
'meta_box' => array(
'title' => 'Manages users',
'field_title' => 'Select Users',
),
),
) );
} );