assign courses to users using data to other table

Home Forums Legacy Support Support queries Other issues assign courses to users using data to other table

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #352011
    1ui61_55
    Spectator
    I need to add a new funtionality due to is necessary in the company I work. I need to enroll new users to specific courses, is in base to a country and plant that is saved in other table. Could you helpme to know in wich tables I need to save the course id and the id_student? I saw wp_postmeta store thast informartion, but is necessary other date in other table? because if i access to enrolled courses area in case that employee is empty, not show that courses enrolled http://prntscr.com/11b15m8
    #352179
    Anshuman Sahu
    Keymaster
    if its php then you can simply use this function to add the user to course : bp_course_add_user_to_course($user_id,$course_id);
    #352203
    1ui61_55
    Spectator
    Thanks Alex, but is not all the code sure? I understand I need to paste my code in "wplms-customizer.php " the complete code would be: add_action(‘user_register’,function ($user_id){ $courses = [1702,1714,1715]; foreach ($courses as $key => $course_id) { bp_course_add_user_to_course($user_id,$course_id); update_user_meta($user_id,’course_status’.$course_id,1); } }); is true?? because if I paste that in wplms-customizer.php and add a new user, the courses is nod added. http://prntscr.com/11c8bfc
    #352408
    Anshuman Sahu
    Keymaster
    Well yes the code is correct and its strange this is not working , exactly who the users are registering in your site ? this hook "user_register" runs when a new user registers using traditional methods like bp register form or wp register form
    #352425
    1ui61_55
    Spectator
    Alex, and what happend if I create the user in traditional method in wordpress, or if I use LDAP Method, wich type of hook used? can you help me?
    #352437
    1ui61_55
    Spectator
    this hook “user_register” runs when a new user registers using traditional methods like bp register form or wp register form Alex I use the form, but after I login I cant see the courses that I put in the function, and that alreddy exist.
    #352682
    Anshuman Sahu
    Keymaster
    Please share your valid ftp credentials in private reply then and the link to the form .
    #352690
    1ui61_55
    Spectator
    Alex, now works! thanks!! =)
    #352866
    Veronica
    Moderator
    thanks for your confirmation closing this one
Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘assign courses to users using data to other table’ is closed to new replies.