Add different User Roles to All instructors page

Home Forums Legacy Support Support queries How-to & Troubleshooting Add different User Roles to All instructors page

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #14399
    bsk-jojo
    Spectator
    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?
    #14564
    Anshuman Sahu
    Keymaster
    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
    #14903
    bsk-jojo
    Spectator
    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.  
    #15139
    Anshuman Sahu
    Keymaster
    #15180
    bsk-jojo
    Spectator
    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.
    #15252
    Anshuman Sahu
    Keymaster
    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 .
    #15375
    bsk-jojo
    Spectator
    Hi Alex, thanks for your help. Works now.
Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Add different User Roles to All instructors page’ is closed to new replies.