Notifications
Clear all

[Solved] Notifications do not work for comments or mentions after they have been approved.

3 Posts
2 Users
0 Likes
603 Views
Posts: 6
Customer
Topic starter
(@alexander-schneider)
Member
Joined: 4 years ago

Hello,

The notifications of the extension "User Notifications" do not work for comments or mentions after they have been approved.

This is a big problem because we have set...

Settings > Discussions > Comment Moderation > Keep a comment in the queue if it contains 1 or more links.

In this case, all mentions must be approved and there is never a notification.

It is equally bad that there is no notification for the first comment after it has been approved ("Comment author must have a previously approved comment" is checked within Settings > Discussions as well).

Best regards,
Ben

UPDATE:

I have since found out what the problem is...

In the method addApprovedNotification in the file wp-content/plugins/wpdiscuz-user-notifications/includes/wunHelperActions.php a notification is written to the table wp_wc_users_notifications only if the setting "Notify me when: my comment is approved" is set.

This setting suggests that only the user who made a mention will be notified. In fact, we do not want to notify the user who made a mention, but we do want to notify the user who was mentioned after the mention was approved.

From my point of view, the said code is not optimal and we have optimized it for our use as follows:

        if ($newStatus === "approved") {
            if ($this->dbManager->isNotificationExists($data) || $comment->comment_author_email === $currentUser->user_email) {
                return;
            }

            if (!empty($this->options->data["notifications"]["myCommentApprove"])) {
                $this->dbManager->addNotification($data);
            }

            $this->addGroupedNotification($comment, $comment->comment_approved, null);
        } else {

With this change, depending on the setting, the user who was mentioned will be notified after an approval and the same applies to the user who mentioned someone.

It would be nice if you could adopt this change so that the plugin remains updateable for us.

Topic Tags
2 Replies
Astghik
Posts: 5912
Admin
(@astgh)
Illustrious Member
Joined: 6 years ago

Hi Ben,

I've already asked the developers to check the issue. I'll update the topic once I get a response from them. 

Reply
1 Reply
Astghik
Admin
(@astgh)
Joined: 6 years ago

Illustrious Member
Posts: 5912

We don't find such an issue on our test website. In our case, the user gets a notification after the admin approves the comment. 

Let's see the steps we've done. 

1. The "Comment must be manually approved" is enabled. 

2. User X leaves a comment and it goes to moderation.

3. Admin approves the comment

4. User X receives the notification. 

Please watch this video: https://www.screencast.com/t/8o50eOU5

Reply
Share:
Scroll to top