Hi thanks for a great module!
From what I can see, if a node is translated to another language, all users who subscribe to the particular content type get a notification for each new or updated translation. Which means notifications are duplicated and that the user may get notified about content in a language that he does not understand.

I think it would make more sense only sending notifications if the node language is the same as the user's language preference. Or even better, let the user select which translations he wants to subscribe to. That would be useful on sites where not all content is translated and some users understand more than one language. And also so that translators can get notifications about new content in the languages they are able to translate from.

Comments

salvis’s picture

Status: Active » Needs work

I agree, being able to select a subset of the available languages would be best.

We'll need someone with multi-language experience to work on this.

D7 is coming up, and new features such as this need to go into the newer version first, before they can be committed to the older one.

LarsKramer’s picture

Hi salvis, thanks for accepting the idea. ATM I don't have sufficient coding skills to take responsibility for this task, but as soon as a version 7 is available, I will take a look at the code and give it some more thoughts.

Taxoman’s picture

Title: Only send subscriptions for content translations that match user's language preference » Content translation subscriptions filtered by language preference
salvis’s picture

This could be a nice little add-on module: define hook_subscriptions_queue() and filter the items that are about to be queued.

LarsKramer’s picture

On the "overview" page (or in a new sub-tab) there could be a list of checkboxes where the user marks those content languages he wishes to subscribe to. Be default only the user's preferred language should be checked, or maybe also the site default language if it differs from the user's language.

LarsKramer’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev

Pushing to latest dev version.

xeniak’s picture

Following the suggestion in #4:

/**
 * Implements hook_subscriptions_queue_alter().
 * To send notifications only about events in the appropriate language.
 */
function mymodule_subscriptions_queue_alter(&$event) {
  if(isset($event['node'])) {

    $node = $event['node'];
    $event['noqueue_uids'] = array();

    if(!isset($node->language) || $node->language == LANGUAGE_NONE || $node->language == language_default()->language) {
      $query = db_query('SELECT s.uid FROM subscriptions_user AS s INNER JOIN users AS u ON s.uid=u.uid WHERE u.language IS NOT NULL AND u.language<>\'\' AND u.language NOT IN (:lang1, :lang2)',
          array(':lang1' => LANGUAGE_NONE, ':lang2' => language_default()->language));
    } else {
      $query = db_query('SELECT s.uid FROM subscriptions_user AS s INNER JOIN users AS u ON s.uid=u.uid WHERE u.language<>:lang',
          array(':lang' => $node->language));
    }
    $event['noqueue_uids'] += $query->fetchCol();
  }
}

Notices are sent only for events in the user's preferred language.

LarsKramer’s picture

Issue summary: View changes

@xeniak: Thank you for the code!

I was thinking a bit more about this today, and ended up with this idea:

On the Subscriptions tab on the user profile page, put a subtab named "Languages" with the following checkboxes (or append to the general settings on the overview tab):
- subscribe to all untranslated content (this ensures user gets notified about all content even when there is no translation in his/her preferred language)
- subscribe to translations in the following languages (generate list of all languages on site).

The user should always receive notifications for neutral-language content (no need to expose a setting for that, I think).

We should allow for the site administrator to set user defaults, and hide settings to user if desired.

A more advanced alternative could be exposing these settings by content type and taxonomy term, making each of them a collapsible fieldset. But I doubt anybody would need it...

salvis’s picture

Just, please, keep in mind that this must go into a separate module so that the Subscriptions configuration is not burdoned with additional complexity if people do not choose to enable it.

amccune’s picture

Hi, I have been trying to get the module code provided in #7 above to work but it doesnt seem to have any impact at all on the subscription queue.

I have a multi language site - even with the module code above added, when I add a node in romanian, it still sends this out to users who have their language preferences set to english (default site language).

Has anyone ever resolved this?