Show courses subscribed by user in user profile to others

add this given code in your wplms-customizer.php file wplms customizer plugin :

add_action('bp_init',function (){
add_action( 'bp_setup_nav','courses_tab');
function courses_tab(){
    bp_core_new_nav_item( array( 
        'name' => __( 'Courses','vibe'), 
        'slug' => 'courses', 
        'screen_function' =>'courses_screen', 
        'show_for_displayed_user' => true,
        'item_css_id' => 'courses',
        'default_subnav_slug' => 'home', 
        'position' => 55,
        ) 
    );
}
function courses_screen() {
    add_action( 'bp_template_title', 'courses_title' );
    add_action( 'bp_template_content', 'courses_content');
    bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
}
function courses_title() {
   echo '<h3 class="heading"><span>'._x('Courses','my tours label','vibe').'</span></h3>';
}
function courses_content() {

      $user_id = bp_displayed_user_id();
      $courses = bp_course_get_user_courses($user_id);
      echo do_shortcode('[v_grid first_class="1" title="" show_title="0" post_type="course" taxonomy="" term="" post_ids="'.implode(',',$courses).'" course_style="course2" featured_style="course2" masonry="0" grid_columns="clear4 col-md-3" column_width="200" gutter="30" grid_number="99999" infinite="0" pagination="0" grid_excerpt_length="100" grid_link="1" css_class="" container_css="" custom_css=""][/v_grid]');

}
},1);

 

Was this article helpful?

Related Articles

Leave A Comment?