email activation not sending due to custom code

Home Forums Legacy Support Support queries Other issues email activation not sending due to custom code

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #209328
    blugenes
    Spectator
    Can you please help with assistance, the website is live and you guys are not responding please help students are registering and not receiving any emails to activate their account and and when i go to all users -> pending -> choose user and then try to send the mail again then i get this error: The site is experiencing technical difficulties. Please check your site admin email inbox for instructions. and i got this email aswell: Since WordPress 5.2 there is a built-in feature that detects when a plugin or theme causes a fatal error on your site, and notifies you with this automated email. In this case, WordPress caught an error with your theme, WPLMS Blank ChildTheme. First, visit your website (https://aldestraining.co.za/) and check for any visible issues. Next, visit the page where the error was caught (https://aldestraining.co.za/wp-admin/users.php?page=bp-signups&action=do_resend&signup_ids=76&_wpnonce=f3ce8f95aa) and check for any visible issues. An error of type E_ERROR was caused in line 95 of the file /var/www/web/wplive.aldestraining.co.za/wp-content/themes/wplmsblankchildhtheme/functions.php. Error message: Cannot use object of type BP_Email as array this is the code on that line: add_action('bp_send_email',function($args){ if($args[1] == 'student_course_subscribed'){ if(!empty($args[3]) && !empty($args[3]['tokens']) && !empty($args[3]['tokens']['course.name'])){ global $wpdb; $course_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_title = %s AND post_type='course'", $args[3]['tokens']['course.name'] ) ); if(!empty($course_id)){ if(has_term(‘insurance-courses’,’course-cat’,$course_id) || has_term(‘e-learning-courses’,’course-cat’,$course_id)){ $args[0]->set_cc('[email protected]'); } } } } });
    #209330
    blugenes
    Spectator
    This reply has been marked as private.
    #209332
    blugenes
    Spectator
    also i removed the custom code for now as everything works once i delete the code
    #209439
    Mk
    Moderator
    also i removed the custom code for now as everything works once i delete the code
    So your issue is solved or not? if not what do you want, actually I am not getting you ?
    #209543
    blugenes
    Spectator
    no it is not solved, i need that code in there, i just took it out because the website is live and with that code there the students dont get emails, but i need that code in there and the emails to work
    #209697
    Anshuman Sahu
    Keymaster
    checking....
    #209700
    Anshuman Sahu
    Keymaster
    Okay found some mistakes in code and corrected it and tested it .It works without errors but did not checked if email arrived or not . updated code is :       add_action('bp_send_email',function($args){   if($args[2] == 'student_course_subscribed'){   if(!empty($args[4]) && !empty($args[4]['tokens']) && !empty($args[4]['tokens']['course.name'])){     global $wpdb;     $course_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_title = %s AND post_type='course'", $args[4]['tokens']['course.name'] ) );       if(!empty($course_id)){       if(has_term('insurance-courses','course-cat',$course_id) || has_term('e-learning-courses','course-cat',$course_id)){         $args[0]->set_cc('[email protected]');       }     }   } } });
    #209788
    blugenes
    Spectator
    Thank you i will check and let you know
    #209884
    Mk
    Moderator
    ok.
Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘email activation not sending due to custom code’ is closed to new replies.