• Resolved winnewoerp

    (@joschi81)


    Hi all,

    I need to integrate a function to send the user an e-mail with a confirmation link when he/she submits a post or comment. I know that there is quite a good plugin that does this for comments, but I need an adapted solution for my own plugin.

    So any suggestions are welcome: what hooks do I have to use? How do I save the comment without the admin getting the normal e-mail “Please moderate…”? How do I send an e-mail to the admin when the comment/post has been confirmed via e-mail?

    This is quite a general question, I know. But as I said: I’m glad for every bit of help you can provide.

    Thx
    Josch

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator bcworkz

    (@bcworkz)

    Examine wp-includes/pluggables.php. Many, if not all email functions are defined here. As they are pluggable functions, you can copy the applicable function to your plugin functions, edit as needed, and your modified function of the same name will be used instead of the default.

    As far as an email confirmation link initiating an email to admin, you need your own page to do this. You can use one of the pluggable email functions as a guide. Be sure to employ some sort of basic security system to prevent search spiders from accidentally triggering spurious emails to admin.

    Thread Starter winnewoerp

    (@joschi81)

    Cool, thanks. I’m still “learning” the function structure of WP. I’ll try to find the right pluggable functions and to overwrite them, then.

    Just fo curiosity: How does WP handle the situation when two different plugins overwrite the same pluggable function?

    Moderator bcworkz

    (@bcworkz)

    Assuming the plugins implement the same pluggable logic of if(!function_exists('pluggable_function_name')), which ever plugin is loaded first gets used. Not sure if there’s any logic to which plugins are loaded first.

    If the plugins do not implement the pluggable logic, any attempt to redefine the function will cause a fatal php error, so for the sake of stability, you should use the pluggable logic just in case some other plugin doesn’t.

    Thread Starter winnewoerp

    (@joschi81)

    Thanks a lot, bcworkz. I close this topic now. That’s all the info I needed.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘E-Mail with confirmation link for posts and comments’ is closed to new replies.