@theupdatecompany The namespace changed in the latest version; it’s now WebSharks\CommentMail. So the following should work:
new WebSharks\CommentMail\sub_inserter($sub_insert_data);
Thanks – forgive my ignorance but do I need a use statement or something else for this to work in my theme’s functions.php? It still reports ‘class not found’
@theupdatecompany Try something like this:
<?php
use WebSharks\CommentMail\SubInserter;
$sub_insert_data = array(
'post_id' => 123,
'status' => 'subscribed',
'deliver' => 'asap',
'fname' => 'John',
'email' => 'john@example.com',
);
$SubInserter = new SubInserter($sub_insert_data); // Inserts new subscriber.
if ($SubInserter->hasErrors()) {
print_r($SubInserter->errors());
//print_r($SubInserter->errorCodes());
//print_r($SubInserter->errorsHtml());
}
Also, I opened a feature request to add the SubInserter() method to the Comment Mail API so that this can be done more easily in a future version: https://github.com/websharks/comment-mail/issues/290
Thanks – got it working with a slight change, we are using the Pro version so it’s
‘use WebSharks\CommentMail\Pro\SubInserter;’
@theupdatecompany Cool. 🙂 Glad to hear you got it working.
For future reference, we’re not allowed to provide support for the Pro version here on the WordPress.org forums, but since you have a license you’re more than welcome to open a support ticket or post your questions on our main community forum. Thanks for going Pro! 🙂