In the 4.6 version of og, mail is automatically sent when a user is subscribed. There is currently no option to disable this, even if your application makes this undesireable.

This patch factors out the actual subscription and unsubscription code, and adds two functions to the API:

function og_create_subscription($gid, $uid);
function og_delete_subscription($gid, $uid);

The patched version of the module calls these functions in og_approve, og_deny, and og_unsubscribe.

The patch does not add any UI at all; it's designed to allow module developers to subscribe and unsubscribe users without getting mail sent as a side effect.

Comments

moshe weitzman’s picture

looks good ... any chance you provide a patch for HEAD? 4.6 is not getting any new features or refactoring anymore.

moshe weitzman’s picture

Status: Needs review » Needs work
Torenware’s picture

No problem, although I don't have a working install of HEAD right now. I'll pull the head version and carefully do the patch, and will pass you both the patch and the modified copy of og.module.

I can't guarantee it will work because I won't be able to test it easily. But you can just drop in the copy and see if it "behaves".

Torenware’s picture

Status: Needs work » Needs review
StatusFileSize
new66.86 KB

Here's a version based upon the "cvs" version, which is hopefully close to what you mean by "HEAD".

The code that's affected by my patch actually hasn't changed between 4.6.0 and CVS, which made my life easier; the harder part was to find the differences between vanilla 4.6.0 and cvs. But I'd guess that my merge should run "out of the box".

I'm enclosing both the merged file and the patch, since if the merged version causes any kind of trouble, the patch is unlikely to be any good either.

Torenware’s picture

StatusFileSize
new1.94 KB

Here's the same code, as a patch off the CVS version.

killes@www.drop.org’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new1.95 KB

I've updated the patch to obey Drupal code style conventions.
I am not completely sure about the usefullness of the watchdog messages, So I've taken them out. "user 23 added to group 42" isn't a usefull message after all.

Moshe: I think I would add the proposed hooks into those new functions.

killes@www.drop.org’s picture

StatusFileSize
new5.17 KB

ok, the last patch didn't take into account all possible simplifications. thi sone does and will be committed swith permission.

moshe weitzman’s picture

Status: Reviewed & tested by the community » Fixed

this one was committed a long time ago

Anonymous’s picture

Status: Fixed » Closed (fixed)