• Resolved knubew

    (@knubew)


    Hello,

    actually I’m using version 6.4.1 in my dev stage page.

    For new reviews, notifications are only sent to the admin email address – but not to the respective owner who created the reviewed post. These email addresses are stored in the ‘users’ table in the table field ‘user_email’ but do not appear to be used.

    Am I doing something wrong or is this possibly a bug?

    I am currently using this settings:
    Please see: https://imgur.com/5tJtJoI

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Gemini Labs

    (@geminilabs)

    Maybe the German translation is incorrect. The English version says:

    Send to author of the page that the review is assigned to

    Are you assigning the reviews to the page? If not, then the author of that page will not get an email notification.

    Thread Starter knubew

    (@knubew)

    Are you assigning the reviews to the page?

    Yes, each review is assigned to the page it was written for.

    Plugin Author Gemini Labs

    (@geminilabs)

    I’ve just tested this and it’s working for me. You might want to check the “Common Problems and Solutions” section on the Help & Support page.

    My notification settings.
    Reviews are being assigned to the current page.
    The author of the page is a user with the name: Editor
    The email address of the “Editor” user
    Notification sent to both the admin email and the Editor’s email (since Editor is the author of the page).
    Thread Starter knubew

    (@knubew)

    Thank you for the good description and the pictures. I think I now understand the problem I’m having.

    Apparently I didn’t understand your question (“Are you assigning the reviews to the page?“) correctly. I thought the question was related to the ‘glsr_assigned_users’ database table. In this table, each ‘rating_id’ is assigned the correct ‘user_id’, but all WordPress pages are assigned to the author “Admin”. I’m using the “Pods” plugin and all WordPress authors fill the custom content types and fields in “Pods”. All pages are more a kind of “templates” and the page content is pulled from Pods at runtime.

    I suspect that I’ll probably have to add my own routine to “/plugins/site-reviews/plugin/modules/Notification.php” so that email notifications to the authors work correctly in my specific case. But first I have to understand your program code – hopefully I can do that, because I’m not a PHP programmer.

    But everything I need is actually there:
    1. The ‘rating_id’ and the correct ‘user_id’ are saved in the database table ‘glsr_assigned_users’.
    2. The corresponding User-ID is stored in the ‘ID’ field and the e-mail address is stored in the ‘user_email’ field in the ‘users’ database table.

    I guess that I have to integrate a query somewhere in the “function getEmailAddresses()” in ‘Notification.php’, which then retrieves the matching user-id and email address from the database table ‘users’. I think the email address then has to be added to the “email[]” array in the “function getEmailAddresses()”.

    Okay, this probably won’t be fun for me…
    but thank you very much so far…

    Plugin Author Gemini Labs

    (@geminilabs)

    Thread Starter knubew

    (@knubew)

    Thank you very much, but this code sends an additional notification to the person, who wrote the review but not to the author of the page content.

    <span style=”text-decoration: underline;”>Short example:</span>

    Data table: “glsr_assigned_users”
    rating_id = 1
    user_id = 4

    Data table: “users”
    ID = 4
    user_login = xyz
    user_pass = xyz
    user_nicename = xyz
    user_email = [email protected]
    user_url = ….

    The mail address “[email protected]” with the “ID = 4” in the ‘users’ table should be used. Is the any chance to realize this???

    Thread Starter knubew

    (@knubew)

    Okay, I have a solution.

    No “nice” code, but it works for me. ??

    add_filter('site-reviews/notification/emails', function ($emails, $review) {
      global $wpdb;
      $userID = $review->user_id;
    
      $qResult = $wpdb->get_results("
        SELECT user_email 
        FROM ".$wpdb->prefix."users 
        WHERE ID = '".$userID."' 
        LIMIT 1
      ");
    
      if ($wpdb->num_rows == 1) {
        $emails[] = $qResult[0]->user_email;
        return $emails;
      }
      else {
        $emails[] = "";
        return  $emails;;
      }
    }, 10, 2);

    Thank you for your kind help.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Question about sending email notifications’ is closed to new replies.