Similar to #1422880: Add hook_node_options_alter(), just about all data from hook_subscription() should be passed through drupal_alter() first.

Comments

damienmckenna’s picture

Status: Active » Needs review
StatusFileSize
new2.63 KB

Patch enclosed for D6.

salvis’s picture

Status: Needs review » Needs work

D7 first, please.

I'm not sure how useful that is, given that add-ons typically add functionality via hook_subscriptions(), but if it helps someone, then it's worth the (minor) trouble.

But please, do make it clear that you're subverting Subscriptions internals, and that support calls should go to you first...

damienmckenna’s picture

D7 patch on the way.

My specific use case was that they wanted to remove the option of subscribing to individual content types, they only wanted people to subscribe to individual posts, so with the above patch I implemented it as follows:

/**
 * Implementation of hook_subscriptions_types_alter().
 */
function mymodule_subscriptions_types_alter(&$types) {
  // Don't allow people to subscribe by content type.
  if (isset($types['type'])) {
    unset($types['type']);
  }
}
salvis’s picture

Makes sense, thanks you.

damienmckenna’s picture

StatusFileSize
new2.96 KB

An update that adds hook_subscriptions_queue_alter too.

salvis’s picture

D7 first...

+++ b/subscriptions.module
@@ -294,6 +294,8 @@ function subscriptions_queue($event) {
+    drupal_alter('subscriptions_queue', $subs_module_query);
+    ¶

This causes a conflict. We already have hook_subscriptions_queue_alter().

Also, there's white space on the empty line below.

damienmckenna’s picture

Status: Needs work » Needs review
StatusFileSize
new3.01 KB

Updated patch for D6 that renames the hook_subscriptions_list_alter to hook_subscriptions_queue_list_alter.

damienmckenna’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
StatusFileSize
new3.14 KB

Similar patch for D7.

salvis’s picture

Status: Needs review » Fixed

Updated patch for D6 that renames the hook_subscriptions_list_alter to hook_subscriptions_queue_list_alter.

It was hook_subscriptions_queue_alter() that caused the conflict. I prefer hook_subscriptions_queue_query_alter() — "list" does not make sense in this context.

Pushed to both -dev versions, thanks!

damienmckenna’s picture

Blah, I changed the right one but explained it incorrectly. Thanks for committing it.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.