Hide span for instructor

Home Forums Legacy Support Support queries How-to & Troubleshooting Hide span for instructor

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #335094
    lepeolmedo
    Spectator
    Hi! I need some help. I can't display:none to two <span> I would like to unable. https://prnt.sc/x8os1g The thing is, I want the instructor to have all the other options, but not those two. Thanks.
    #335159
    Ada
    Participant
    Hi, For this you need to install and activate wplms-customizer plugin Then goto plugin editor>> wplms-customizer> wplms-customizer.php Add this code
    
    function hide_span_edit() {
      	$user = wp_get_current_user();
        if (  in_array( 'instructor', (array) $user->roles ) ) {
        //The user has the "instructor" role
      	?>
      	<style>
       #vibebp_member .course_manage .course_tabs .instructor_tabs span:last-child{
        display:none !important;
       }
       #vibebp_member .course_manage .course_tabs .instructor_tabs span:nth-child(7){
        display:none !important;
        }
    </style>
    <?php 
      }
    }
    add_action('wp_head', 'hide_span_edit');
    
    You can download plugin from here https://wplms.io/support/knowledge-base/wplms-customizer-plugin/
    #335648
    lepeolmedo
    Spectator
    Hi, Worked great yesterday. After WPLMS and VibeBP last update is not working any more. https://prnt.sc/xe7pe9
    #335713
    Ada
    Participant
    Hi Check your code
    
    if (  in_array( 'instructor', (array) $user->roles ) ) 
    in this line it should be instructor not Instructor. Please correct this and then check.
    #335883
    lepeolmedo
    Spectator
    Hi, Worked first time when I changed "instructor" to "Instructor" (I saw the user roles in WP was actually with I, not i). but now does not work with either of the 2 options. Anyway, I would prefer to display:none to this entire sector for instructors only. https://prnt.sc/xgt6nl This will restrict both sector for the instructor. Could you help me with this please? Thanks.
    #335963
    Ada
    Participant
    Hi I am not able to add code in your plugin editor https://prntscr.com/xhtdhw So Please use this updated code to hide the span for instructor account Add it in wplms-customizer.php
    
    function hide_instructor_span_edit() {
      	$user = wp_get_current_user();
        if (  current_user_can('edit_posts') && !current_user_can('manage_options')) {
        //The user has the "instructor" role
      	?>
      	<style>
      #vibebp_member .vibebp_main .course_manage .course_tabs .instructor_tabs span:last-child{
        display:none !important;
    
    }
      #vibebp_member .vibebp_main .course_manage .course_tabs .instructor_tabs span:nth-child(7){
        display:none !important;
     }
    </style>
    <?php 
      }
    }
    add_action('wp_head', 'hide_instructor_span_edit');
    
    #335964
    Ada
    Participant
    Or If you want to hide complete manage course section from instructor account then use this code at same place
    
     function hide_instructor_manage() {
      	$user = wp_get_current_user();
        if (  current_user_can('edit_posts') && !current_user_can('manage_options')) {
        //The user has the "instructor" role
      	?>
      	<style>
      		#vibebp_member #course_component .vibebp_left_sidebar a.menu-child.manage_courses {
        display:none !important;
    }
    
    </style>
    <?php 
      }
    }
    add_action('wp_head', 'hide_instructor_manage');
    
    #336049
    lepeolmedo
    Spectator
    Hi, Is not working. I added the code and the instructor still can manage courses. The code added: https://prnt.sc/xibjxh Share to instructor credentials in the next comment.
    #336050
    lepeolmedo
    Spectator
    This reply has been marked as private.
    #336254
    Diana
    Participant
    Sir, While Adding the code from wplms customizer plugin. It is not allowing us to add any code. You need to share either FTP/Cpanel details here in a private reply so that we can check by adding the code
    #336294
    lepeolmedo
    Spectator
    This reply has been marked as private.
    #336704
    Diana
    Participant
    This reply has been marked as private.
    #336723
    lepeolmedo
    Spectator
    This reply has been marked as private.
    #337146
    lepeolmedo
    Spectator
    2 days and hours since last reply. The credentials are working.
    #337416
    Diana
    Participant
    This reply has been marked as private.
Viewing 15 posts - 1 through 15 (of 17 total)
  • The topic ‘Hide span for instructor’ is closed to new replies.