• Resolved Ethan Ferdosi

    (@rightshifttech)


    Hi,

    I noticed that when registration is enabled via the job submit form, the submit handler calls the wp_job_manager_create_account which at the end on notify section this call is made:

    // Notify
        if ( version_compare( $wp_version, '4.3.1', '<' ) ) {
        	wp_new_user_notification( $user_id, $password );
        } else {
        	wp_new_user_notification( $user_id, null, 'both' );
        }

    The problem with current solution is that when woo commerce is installed, it used its own new account template which make the emails inconsistant. i.e. users register via login page receive different email than users registered via submit form.

    I was wondering if it is possible to update the code above via (filter or action) to call WC_Email_Customer_New_Account template instead of default WP function.

    Thanks
    Ethan

    https://wordpress.org/plugins/wp-job-manager/

Viewing 11 replies - 1 through 11 (of 11 total)
  • wp_new_user_notification is a pluggable function, so you could just override that and call whatever function you want …

    https://codex.wordpress.org/Pluggable_Functions

    You may be able to post an issue on GitHub and maybe see if a check can be added to see if WC is being used, and then call that function. But again, in the meantime you could override the pluggable function

    Thread Starter Ethan Ferdosi

    (@rightshifttech)

    Thanks tripflex.

    That should work as an ad-hoc solution but will be good if we have that built-in WP Job Manager. I will post on Github.

    Plugin Contributor Adam Heckler

    (@adamkheckler)

    Thanks Ethan! 🙂 Let me know if there’s anything else I can help with.

    Thread Starter Ethan Ferdosi

    (@rightshifttech)

    I know it might be off the topic now, but would help me with the override function. I added this as a mu-plugin but fails due to some required classes are not loaded:

    require_once(ABSPATH .'wp-content/plugins/woocommerce/includes/emails/class-wc-email.php');
    require_once(ABSPATH .'wp-content/plugins/woocommerce/includes/emails/class-wc-email-customer-new-account.php');
    
    if( ! function_exists('wp_new_user_notification') ) {
        function wp_new_user_notification($user_id, $deprecated, $notify){
    
        $wc_emails = new WC_Email_Customer_New_Account();
        $wc_emails->trigger($userid, '', false);
        }
    }
    ?>

    I am not a PHP developer so it might be some obvious errors if you can update me please?

    Plugin Contributor Adam Heckler

    (@adamkheckler)

    Ethan,

    Sorry, but I’m no PHP dev myself, and we aren’t able to help with custom code requests like this in any case. You may want to look into one of these services:

    http://jobs.wordpress.net/

    http://studio.envato.com/

    https://codeable.io/

    Thanks!

    Ethan,
    Contact me through contact form on my site and I’ll help you out, [Link removed]

    Or you can use a site like coders clan

    @tripflex: Please do not solicit contact from other forum users. Asking others to contact you off forums is really frowned upon here. This is to protect users and to prevent people from trying to solicit work or harvest email addresses from the forums.

    Additionally, the point of these community-based forums is to help each other in a public space so that the whole community can benefit from the discussion and any solutions proposed. Private discussions take this benefit away.

    @esmi sorry, wasn’t trying to solicit anything for money, was going to ask him for login details so I could help through there without him having to provide credentials in this open forum.

    @ethan looks like you need to also include the settings abstract class at

    includes/abstracts/abstract-wc-settings-api.php

    If you look at the other files you included, you will see how the class is defined, and then it extends another class. Just make sure you have included all of those, and from a quick check the only one I saw that you didn’t include was the abstract class.

    Good luck

    @tripflex: That is also something that we generally do not allow here. Accessing a user’s site makes you responsible for that site. If you make changes and something breaks later on as a result, then it is your fault.

    Get information, suggest fixes, offer walkthroughs but don’t touch. That’s really going a little too far.

    Thread Starter Ethan Ferdosi

    (@rightshifttech)

    Thanks @tripflex. Including the php file fixed the issue.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘New User Email Notification Email via submit’ is closed to new replies.