2019 June 3
With the goal of increasing "engagement" with posts, I added code to the local function ratburger_wp_insert_comment() in ~/theme/functions.php which was originally added on 2018-02-20 and issues notifications when a new comment is added on a post (main site posts only; groups are handled elsewhere). As originally implemented, notifications were sent to the author of the post and all others who had commented on the post so far (excluding, of course, the author of the new comment). The new code retrieves the list of users who have liked the post via a $wpdb->get_results() query like: SELECT user_id FROM wp_ulike WHERE post_id = '' AND status = 'like' AND user_id BETWEEN 1 AND 999999 GROUP BY user_id LIMIT 999999; This returns a list of User IDs who have liked the post. We walk through this list, once again ignoring the author of the post (who has already been notified) and the author of the new comment, and add the remaining users to the associative array $commenters. Since this is an associative array, duplication between those who have commented on and liked the post is automatically removed. Then the existing code which used to notify commenters will now notify both commenters and likers. The ratburger_wp_insert_comment() function was added before we got nedit working on RB, and thus contained ugly and confusing tabs thanks to vi. I expanded all of the tabs to spaces and re-indented the code for readability. There is quite a bit of other code in ~/theme/functions.php which could use the same treatment, but in the interest of minimising non-functional changes I will defer such abstergification until a major sweep through local code such as a WordPress major release update. Committed the changes to notify users of comments on posts which they have liked (Build 316) and published on GitHub.