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
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);
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
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
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?
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.
Please share your valid ftp credentials in private reply then and the link to the form .
Alex, now works! thanks!! =)
thanks for your confirmation
closing this one