Is it possible to add two or more user roles to the all instructors page?
I found this: https://wplms.io/support/knowledge-base/show-custom-user-role-in-all-instructors-page/
When I use the code I see only the members who are editors like in the example. Not all instructors and editors.
I want to show three differen user roles on this page. Can you please help me with this?
That is just for showing purpose after whne you have added a custom user role .
To add a custom user roles you can use the third party plugins available or you can refer to this link :
https://codex.wordpress.org/Function_Reference/add_role
Hi Alex,
I may have been unclear. I have several custom user roles added already and I want to show them now on the all-instructor page and not only the instructors.
Hi Alex,
I know this link already as you can see I posted it with my question.
With this code in the example I only get one additional user group shown in the instructor page.
But I have 4 user groups I want to show on the page. Is this possible? What changes I have to do on the code in the link?
Hope you can help me.
Please find the allinstructorscustom.php file in the attached file .
Repeat this code for each custom user role :
$args = array(
'role' => 'contributor', //custom user role
'number' => 99,
'orderby' => 'post_count',
'order' => 'DESC'
);
$custom_query = new WP_User_Query( $args );
if ( isset($custom_query) && !empty( $custom_query->results ) ) {
foreach ( $custom_query->results as $user ) {
$instructors[]=$user->ID;
}
}
in this we have added the user role "contributor"
refer the file .
i have commented out the code that you have to add for each user role .
Hi Alex,
thanks for your help. Works now.