add take this course button and cutom data to course item

Home Forums Legacy Support Support queries How-to & Troubleshooting add take this course button and cutom data to course item

Viewing 6 posts - 16 through 21 (of 21 total)
  • Author
    Posts
  • #3577
    samehm
    Participant
    it doesn't show as you logged please log in with user:test1 and password:test1 url:http://eoptech.co.il/course/%D7%97%D7%93%D7%95%D7%90-1-%D7%A8%D7%91%D7%99%D7%A2%D7%99/ it doesn't show the counter
    #3689
    samehm
    Participant
    i have added the following code to wplms-customizer in order to check weather it hiddens the button or not (return blank) but the button avaliable add_filter('wplms_take_course_button','myfx',10,2); function myfx($course_button_html,$course_id){ $user_id = get_current_user_id(); //Check if user has taken a course from course category using $course_id, $user_id //return blank if you want to hide the button. $course_button_html=''; return $course_button_html; }
    #3779
    Anshuman Sahu
    Keymaster
    this is not the full code for your customizations we just provided the idea and the code itself .you have to write your own logic in this . The function takes two parameters here  "button html" and course_id which are self explanatory and it returns button html only . Perform your logic and return the button html .
    #3793
    samehm
    Participant
    alex , i understand your code ,and what i have to do  but i want to check if your suggestion is works. simply i want to try to hide the button before doing any logic therefore i'm assign $course_button_html=''; and return it as blank to hide the button but the button still available and not become hidden . and please check this : it doesn't show as you logged please log in with user:test1 and password:test1 url:http://eoptech.co.il/course/%D7%97%D7%93%D7%95%D7%90-1-%D7%A8%D7%91%D7%99%D7%A2%D7%99/ it doesn't show the counter of lefted seats in the button  
    #3868
    samehm
    Participant
    -what is the method to getting category id of single course ? by getting the course id as parameter i get the category id. -what is the method to get list of courses which have been subscribed by single user and please reply for the above reply
    #4392
    Anshuman Sahu
    Keymaster
    To get all courses taken by the user :  bp_course_get_user_courses($user_id): Returns array of Course Ids To get category please refer : https://developer.wordpress.org/reference/functions/get_the_category/ If the button still is showing then it seems you function is failing to check some conditions . Can you please share the code that you have used to customize the button  .
Viewing 6 posts - 16 through 21 (of 21 total)
  • The topic ‘add take this course button and cutom data to course item’ is closed to new replies.