Question Answered & Best Answer Emails Not Being Sent…

Solved7.70K viewsIssues
1

As Administrator I am getting all the emails I should but users arn’t getting any.

I’ve installed the PHP(Mail) Log and can see the emails are being sent to me but AnsPress for some very odd reason isn’t even trying to send them to the users.

Could this be a settings issues something or somethign I have overlooked?

 

Matt

1
Showing rows 0 - 0 (1 total, Query took 0.0021 sec) [apmeta_id: 1 - 1]
SELECT * 
FROM `wp_ap_meta` 
WHERE apmeta_type = 'subscriber'

1 2 subscriber 1829 2015-10-25 06:00:39

The only “subscriber” is in October.

Looks like it needs to be updated for the new wp_ap_subscribers table.

Currently it uses

ap_get_question_subscribers_data()..
$query = $wpdb->prepare("SELECT u.user_email, u.ID, u.display_name, UNIX_TIMESTAMP(m.apmeta_date) as unix_date FROM ".$wpdb->prefix."ap_meta m INNER JOIN ".$wpdb->prefix."users as u ON u.ID = m.apmeta_userid where m.apmeta_type = 'subscriber' AND ( m.apmeta_actionid = %d $term_q) GROUP BY m.apmeta_userid", $post_id);

to get all emails where notifications should be sent. When notifying on a comment, it’s simply

        if(!ap_in_array_r($post_author->data->user_email, $subscribers)){
            $subscribers[] = (object) array('user_email' => $post_author->data->user_email, 'ID' => $post_author->ID, 'display_name' => $post_author->data->display_name );
        }

this is why notification on comments work.

So it’s pull data from the wrong table? Any easy fix that you can see?

Yep. Just have to write proper SQL queries for ap_get_question_subscribers_data() and ap_get_comments_subscribers_data().

I’ve sort of got it working…

http://nursingnotes.co.uk/wp-content/uploads/2015/12/anspress_email.php_-1.zip

Replace the one inside your ANSPRESS for Email Plugin Folder.

The automatic emails work when someone replies but the the select best answer doesn’t. lol

All I did was remove ‘where m.apmeta_type = ‘subscriber” from the query and that fixed it a little.

That most certainly will not work. I mean it will, but will think every user that have some records in “meta” is subscriber, it will email spam your users.

I’ve tested it quite comprehensively, it simply no longer checks if they are subscribed to the post before sending the email to the creator. So functional for what I need it for at the moment.

But you do realise it will send it to almost all users, even to those who have no idea about this particular post, right?

But ap_get_question_subscribers_data is not used anywhere, I just marked it as deprecated.

A-ha! https://wordpress.org/plugins/anspress-email/ was updated 6 months ago. It doesn’t deliver updates you actually did.
Real sources look much better!

Could you please release a new version to wordpress.org sometime?
Not many of us use github as primary source of plugins.

Oh, Thats a mistake. Will you confirm all notifications works with GitHub version?

Will test, will reply within an hour.

You are viewing 1 out of 4 answers, click here to view all answers.