mail notification to admin for course creation

Home Forums Legacy Support Support queries How-to & Troubleshooting mail notification to admin for course creation

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #3161
    cvsoft
    Participant
    Hi, we want to send an email notification to admin when an instructor has created a course. We need this because admin does not want to give access everytime (instructor would have to wait too long). Admin just wants to check if everything is ok. How can we do that? Thank you!
    #3484
    Anshuman Sahu
    Keymaster
    This is possible but the mail will be sent everytime a course goes in publish state. Which means :   a. When instructor publishes a new course b. When instructor edits the name of the course .
    #3542
    cvsoft
    Participant
    Hi, thanks for the reply. No problem that mail will be sent in case of editing course. Is there an update for the theme now or is this custom code? Thank you.
    #3638
    Anshuman Sahu
    Keymaster
    Please try adding the given code in your wplms-customizer.php file in wplms customizer plugin  . add_action('publish_course','wplms_on_post_course');   function wplms_on_post_course( $ID, $post ) {   $admin_emails = array( '[email protected]', '[email protected]' );   $user_id = get_current_user_id();   $subject = ' Instructor '.bp_core_get_user_displayname($user_id).' published the course '.$post->post_title; $message = ' Instructor '.bp_core_get_user_displayname($user_id).' published the course '.$post->post_title;   wp_mail( $admin_emails, $subject, $message );     }
    #3658
    cvsoft
    Participant
    Hi, thanks, mail notification is working. But something goes wrong with course title in mail. Its blank. => .$post->post_title
    #3771
    Anshuman Sahu
    Keymaster
    Try using this function then  : add_action('publish_course','wplms_on_post_course',10,2);   function wplms_on_post_course( $ID, $post ) {   $admin_emails = array( '[email protected]', '[email protected]' );   $user_id = get_current_user_id();   $subject = ' Instructor '.bp_core_get_user_displayname($user_id).' published the course '.get_the_title($ID); $message = ' Instructor '.bp_core_get_user_displayname($user_id).' published the course '.get_the_title($ID);   wp_mail( $admin_emails, $subject, $message );   }
    #3788
    cvsoft
    Participant
    Hi, now it's working perfectly! Thank you!
Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘mail notification to admin for course creation’ is closed to new replies.