Forum Replies Created
-
Ok, thanks sharmavishal
I’m using WPLMS theme:
https://themeforest.net/item/wplms-learning-management-system/6780226Maybe is not a problem of Buddypress?
Finally i have done this:
function send_mail_to_teacher($user_id, $user_login, $user_password, $user_email, $usermeta){ $key = get_user_meta( $user_id, 'activation_key', TRUE ); $first_name = bp_get_profile_field_data('field=Name&user_id='.$user_id); $surname = bp_get_profile_field_data('field=Surname&user_id='.$user_id); $args = array( 'tokens' => array( 'key' => $key, 'user.email' => $user_email, 'user.id' => $user_id, 'first_name' => $first_name, 'surname' => $surname, ), ); $teacher_email = bp_get_profile_field_data('field=Teacher&user_id='.$user_id); bp_send_email( 'sendtoteacher', $teacher_email, $args ); } add_action('bp_core_signup_user', 'send_mail_to_teacher', 10, 5);
missing the first value of array activate.url because this text editor show me an error when i copy that line
Yes, but this code doesn’t work
function activation_email( $user_id, $user_email, $key, $user_login = '' ) { $args = array( 'tokens' => array( 'key' => $key, 'user.email' => $user_email, 'user.id' => $user_id, ), ); if ( $user_id ) { $to = $user_id; } else { $to = array( array( $user_email => $user_login ) ); } $teacher = bp_get_profile_field_data('field=Teacher&user_id='.$user_id); bp_send_email( 'core-user-registration', $teacher , $args ); } add_action('bp_core_signup_send_validation_email','activation_email',99,4);
Anyone knows how can i do this with the new BuddyPress email API?
Finally i have done this:
function activation_email( $subject, $message, $user_id, $user_email, $key ) { $teacher = bp_get_profile_field_data('field=Teacher&user_id='.$user_id); $activate_url = esc_url( $activate_url ); $message = sprintf( __( "Thanks for registering! To complete the activation of this account please click the following link:\n\n%1\$s\n\n", 'buddypress' ), $activate_url ); $user_email = $teacher; wp_mail( $user_email, $subject, $message ); } add_action( 'bp_core_sent_user_validation_email', 'activation_email', 10, 5 );
It is not necessary teachers to be registered on the website. Only to receive an email to confirm that the student belongs to his college.
I would like to do this: Student registres – send an email to the adressinserted by the student to registration form – approve the student with a link by this mail – student receives and email with the approvation.