Viewing 6 replies - 1 through 6 (of 6 total)
  • You could definitely do this by overriding the current function that sends the approval email. Then add a parameter to define the attachment in the wp_mail function.

    https://codex.www.ads-software.com/Function_Reference/wp_mail

    Thread Starter remymedranda

    (@remymedranda)

    Josh,

    How would I override the current function?

    I searched the page you referenced for attachment and this was the example code it offered.

    <?php
    $attachments = array( WP_CONTENT_DIR . ‘/uploads/file_to_attach.zip’ );
    $headers = ‘From: My Name <[email protected]>’ . “\r\n”;
    wp_mail(‘[email protected]’, ‘subject’, ‘message’, $headers, $attachments );
    ?>

    So what would be the proper code to add to my functions list that would override the current function?

    Thread Starter remymedranda

    (@remymedranda)

    I had someone give me a hand with this today, and was successful but they couldn’t get it done adding the modifiers to the functions.php file instead they modified the plugin by adding the following code to new-user-approve/new-user-approve.php (not by my advice)

    $attachments= array( WP_CONTENT_DIR . ‘/uploads/2014/09/Filling-out-the-Wholesale-Application.pdf’ );
    // send the mail
    wp_mail( $user_email, $subject, $message, $this->email_message_headers(), $attachments );

    This is not ideal, I know. So if you would be so kind, how would you suggest I (he) does this then?

    Thread Starter remymedranda

    (@remymedranda)

    Josh I’ve had my coding buddy help me out to add an attachment to the new user approve email, but he couldn’t do it by adding the line to my functions.php, he had to add it the plugins main php files, so now everytime you release an upgrade it’s messing up my attachments.

    He can’t figure out how to do it on the functions.php. Is there anyway you can build this functionality in, or just tell me the code I should add to my functions.php that can handle this attachment issue, so I don’t have to ask this guy to constantly keep adding this line of code that gets stripped out every time there’s an update.

    Thread Starter remymedranda

    (@remymedranda)

    Josh, would it be possible to develop a premium version of this plugin with features such as attachment abilities, and custom emails etc… all those goodies most of us ask you on here.

    I’ve been asking my friend to develop an extension plugin to your plugin so that everytime you send out an update I don’t have to ask him to keep adding the code for the attachment that gets sent out in our approval email.

    This would be incredibly awesome if you got this done!

    Josh Harrison

    (@picklewagon)

    Here are some instructions on how to do this using core filters. https://newuserapprove.com/support/faq/add-attachment-approval-email/

    There is also more information on a premium version of the plugin at https://newuserapprove.com/products/options-addon/

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Way to add an attachment to the Approval Email?’ is closed to new replies.