Draft & Pending lessons showing at frontend

Home Forums Chit Chat WPLMS customizations Draft & Pending lessons showing at frontend

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #12874
    jerdude
    Participant
    Hi, When I'm logged in to my site as an instructor, and I navigate to the All Courses page, I can see Pending/Draft courses, regardless of those courses are created by me or not. Those are mainly courses submitted to the site but have yet to be approved by admin. I shouldn't be able to see those courses in the front right? Please help. Thanks!
    #12975
    Anshuman Sahu
    Keymaster
    The courses which are not published and in drafts can be seen by the instructors on all courses page but these courses cannot be seen by the students on all courses page .
    #12977
    jerdude
    Participant
    How do I hide it from everyone? So that only published courses can be seen?
    #13158
    Anshuman Sahu
    Keymaster
    Try adding the given code in your wplms-customizer.php file in wplms customizer plugin :   add_filter('bp_course_wplms_filters','wplms_hide_draft_courses',99); function wplms_hide_draft_courses($query_args){   if(!current_user_can('manage_options')){       $query_args['post_status'] = array('publish');   }   return $query_args;   }
    #13183
    jerdude
    Participant
    Hi, thanks for the help but it didn't work. I added the code as such to wplms-customizer/wplms-customizer.php You should have received a copy of the GNU General Public License along with wplms_customizer program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */ add_filter('bp_course_wplms_filters','wplms_hide_draft_courses',99); function wplms_hide_draft_courses($query_args){ if(!current_user_can('manage_options')){ $query_args['post_status'] = array('publish'); } return $query_args; } Appreciate your further help. Thanks!
    #13421
    Anshuman Sahu
    Keymaster
    Please note that only admins will see the courses on the all courses page  if the above code added  . Also you have to add the code at the end of the wplms-customizer.php file before " ?> " .
    #26358
    foxycleop
    Spectator
    Hi Alex: The code you have provided works to hide all draft/pending courses from instructors (which is good) However, it also hides an instructor's own PENDING courses from the front end (course directory etc.). The instructor can't even preview THEIR OWN course (until it is published). That is NOT good user experience or workflow, Is it possible to modify the code in some way so that an instructor is able to see/preview their own "pending courses". It is NOT going to work because let's say an instructor created a new course and sent to be approved by admin. But then he/she can't find a trace of it anywhere - firstly it will confuse the hell out of the instructor, secondly let's say the instructor wants to make some changes to the course (before it is published), there is no way for him/her to do that - because the pending course is just not visible. The ideal situation is that an instructor is not able to see other instructors' Draft/Pending courses but should be able to see their own. thanks!
    #26868
    H.K. Latiyan
    Participant
    This is not possible as of now. There is only one query which runs for fetching courses, what you're suggesting would require two WP Querys and we'll then have to merge results into one. So, unfortunately it is not possible as of now.
    #26961
    foxycleop
    Spectator
    I don't know much about databases, is it not possible to have a separate page where we query for the draft and pending posts for instructors? Is there some workaround or creative solution to this?
    #26975
    foxycleop
    Spectator
    Can we not create something like this on a separate page and connect this to view course button as shown here -> https://cloudup.com/cDAW6kXICfY This page will live separately from Course Directory page and will create a separate link for easy access in instructor menu etc?? Is this not a viable solution for the time being? <?php //if a certain page, then display posts authored by the logged in user $page_title = 'Contributors Page'; if ( is_user_logged_in() && is_page($page_title) ) { global $current_user; get_currentuserinfo(); echo 'User ID: ' . $current_user->ID . "\n"; $args=array( 'author' => $current_user->ID, 'post_type' => 'course', 'post_status' => 'pending',
    #27550
    espinete
    Spectator
    I agree with foxycleop. I need a solution to this. Thanks.
    #29708
    areyera
    Participant
    me too i agree , we need a solution for this. thanks.
Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘Draft & Pending lessons showing at frontend’ is closed to new replies.