Open kristineds opened 8 years ago
:+1:
:+1:
@raamdev @jaswsinc Could you point me in the right direction on how I can add this feature? Should I be creating a new function? Or use the existing one? I'm looking at this: https://github.com/websharks/comment-mail-pro/blob/433c3acb15bd3d35ec710c6ce13535f2a7dedb86/src/includes/classes/MenuPageActions.php#L92
@kristineds The block of code in saveOptions()
that you referenced contains this block which deals with mail tests; i.e., if certain POST variables are set—those that would request that a test email be sent, those routines handle sending a test email.
However, those tests that are performed are specifically designed to help test SMTP connectivity in general; e.g., whenever you change the SMTP or other mail settings you can click a button that will run those tests. The test emails themselves only contain just a quick plain-text message to indicate the test worked, they do not contain any sort of comment notifications that would showcase changes that you made to the templates.
So in order to add this functionality you would need to create brand new methods that would be capable of the following, as I see it:
wp_insert_post()
wp_insert_comment()
Then process the queue as seen here.
new QueueProcessor(false, 10, 0, $realtime_max_limit); // No delay.
wp_delete_post()
One problem with this technique is that any WordPress plugins running on a given site (i.e., those that hook into Post creation or Comment creation) might respond to a new Post being created (or to a new Comment being created, and they might run also whenever you run this test with what is nothing more than a fake scenario. So that's something to keep in mind. I haven't given this a ton of thought yet.
One problem with this technique is that any WordPress plugins running on a given site (i.e., those that hook into Post creation or Comment creation) might respond to a new Post being created (or to a new Comment being created, and they might run also whenever you run this test with what is nothing more than a fake scenario.
That was my thought exactly when I saw you mention programmatically creating a post for this. I don't think that's a good idea. There's way too much room for error there (e.g., a site could have thousands of subscribers and the site might have a plugin installed that automatically announces newly published posts to all its subscribers--the dummy post might get sent to thousands of people!).
A better approach, IMO, would be to have the user supply a URL to a published post that contains comments. It could be a dummy post that they create, or it could be a real post with real comments. The whole idea here is to allow a site owner to see what the email will look like for subscribers. (We just need to make sure that we're not inadvertently triggering notifications to existing subscribers when a site owner supplies a URL to a real post, with real comments and real subscribers.)
Customer wrote..
Comment Mail currently has a "Test Mail settings" field under "Email Message Headers" options. It would be nice to have this option added under Email Template settings to be able to send test emails with the current email template configuration.
Mentioned here (private ticket): https://websharks.zendesk.com/agent/tickets/10684