I have put together some simple enhancements for watcher module to work with the user relationships module. We came across an issue where we needed to give users the ability to only allow email notifications for comments from users they are following. User A is making the comment on a node User B is watching. User B (requester) requested a relationship from User A(requestee), (one-way, no approval needed). User B only wants email notifications from users it is "following" (which includes User A).

Install the attached module, run update.php, which adds a new field for the users' watcher settings (this needs to be added to the default menu that the admin sets). Then patch watcher.module as follows:

function _watcher_email_notify_comment_insert(&$comment) {

// Are email notifications enabled?
$email_notifications = variable_get('watcher_email_notifications_enabled', true);
if (!$email_notifications) {
return false;

// Since a comment is by necessity authored by the current user, we can safely assume
// that the current user authored it and use the comment's UID for exclusion.

// Who are the users that want to be notified of this event?
//$recipients = _watcher_db_get_users_notify_comment_insert($comment['nid'], $comment['uid']); //Commented out for watcher_ur recipient listing.

module_load_include('module', 'watcher_ur', 'watcher_ur');
$recipients = watcher_ur_db_get_users_notify_comment_insert($comment['nid'], $comment['uid']);

Will keep you posted on any updates to the module and patch.

watcher_ur.zip1.31 KBjalder


bflora’s picture


bhavin.ahya’s picture

First of all, great try

Very useful add-on for watcher module.
But to allow email notifications for comments from the users we are following we will not be able to get email notifications. For that we need to click on that watching review link ('you are not watching....') because in the query you have written that "wus ON wus.uid = wn.uid" in the 2nd line.

SELECT wn.uid, wn.mail wnmail, u.mail umail, u.name, wus.notifications_ur_comments FROM {watcher_nodes} wn LEFT JOIN {watcher_user_settings} wus ON wus.uid = wn.uid LEFT JOIN {users} u ON u.uid = wus.uid WHERE nid = %d AND ((wn.uid <> 0 AND wn.uid <> %d AND notifications_new_comments = 1 AND send_email = 1) OR (wn.uid = 0 AND (watch_for = 1 OR watch_for = 2)))

It may be possible that one user is not going to watch the node but can be follower of some one. so in that case user would be able to get email notifications.