Hello,

I have a "premium" role on my website and I have assigned to subscriptions to be auto-enabled when a user gets that role. The problem is that when that role is revoked subscriptions are keep sending to those people. I was trying through Rules to add a trigger and an action to remove subscriptions when the premium role is revoked but i assume this is not currently supported since i didn't see anything related with subscriptions there.

Is there a workaround? or does this feature already exists and I am missing something?

Thank you for your time

Comments

salvis’s picture

I have assigned to subscriptions to be auto-enabled when a user gets that role

I don't think that works as you expect. Those subscriptions are assigned only if a new user is created with the corresponding role. If the role is assigned later, then nothing happens, I think.

The problem with adding/removing subscriptions to an existing user is that you don't know what changes the user has made manually. If you re-add a subscription that the user has removed, or you remove one that the user has manually added, s/he won't like it.

At this point we have no Rules integration, but you are welcome to post a patch.

arekanderu’s picture

Thank you for your reply salvis.

I will probably write a small module to handle this and remove the subscriptions from non-premium users.

salvis’s picture

Status: Active » Fixed

Yes, that makes sense.

salvis’s picture

arekanderu’s picture

One more question though; Can you please point me out a function (if any) in the subscriptions module which will remove all subscriptions from a user or maybe some module helper methods i could use?

salvis’s picture

We didn't have a function for that, but there should be one.

I just created subscriptions_delete($recipient_uid, ...) and pushed it to the -dev version. Give it up to 12h to be repackaged.

arekanderu’s picture

Thanks a lot salvis. I'll try it out and give you some feedback

salvis’s picture

Yes, please do.

arekanderu’s picture

salvis, function works as expected, thanks again.

salvis’s picture

Great, thanks!

arekanderu’s picture

I don't think that works as you expect. Those subscriptions are assigned only if a new user is created with the corresponding role. If the role is assigned later, then nothing happens, I think.

I was just checking that and you are right. If the role is assigned later, then indeed nothing happens. (Just wanted to confirm it) I guess...I need to write a little more code cause if the role is assigned later i want the user to have their subscriptions enabled.

Thanks for the help

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

grammar error