This module is fantastic - the only thing that is holding me back from using it is that I want to be able to update a users role when they sign up to a subscription plan. I understand there is no rules integration yet or even if there are plans to.

Has anyone managed a way around this easily?

Comments

7wonders’s picture

Category: bug » feature
Status: Active » Needs review
StatusFileSize
new7.95 KB

Here is a patch that adds a new recurly_rules module with basic rules integration. It adds a new rules event for recurly push notifications and then all account, subscription and transaction variables become available to the rule. If you want to filter on a specific push you can use condition -> text comparison -> recurly-push:type and then use the available notification types

For good measure I added the entity-type and entity-id variables also so they are available.

Keep in mind this adds all the variables (account, subscription and transaction variables) even if the notification didn't contain them so check the link above to see what sends what.

You will most likely need the patch here too - http://drupal.org/node/1899350 to get rid of that error.

threadsniper’s picture

Pardon the hand-holding request 7wonders, but we are so desperate to get this functionality working I would be willing to offer a small consulting fee if you'd explain in more detail how I might get this working with your included patch...

quicksketch’s picture

Thanks @7wonders for your work on this. I'm not a big fan of Rules module and I don't personally use it on any of my own sites. Could you release this as a separate project? I'd be happy to add a link to the project page.

bjlewis2’s picture

Did anything ever come of this?

@7wonders do you think you'll release this as a module anytime soon? I'd love to use the Recurly module, but since I'm not a developer, I can't actually do anything with it. :(

All I need to be able to do is add a role when subscribed, and remove it when unsubscribed. Rules integration would be great since I already use it on my site.

damienmckenna’s picture

StatusFileSize
new2.41 KB

In case anyone wants to download the module separately.

bjlewis2’s picture

I downloaded the module, and it did add integration to Rules. But, I had absolutely no idea how to make it happen... So, I've hired someone to write a module that just adds and removes roles based on Recurly subscriptions. When that's ready I'll create a project for it on Drupal.org.

quicksketch’s picture

So, I've hired someone to write a module that just adds and removes roles based on Recurly subscriptions.

I think this may be a good 80% use-case here. I'd be interested in including this functionality directly in the Recurly module; though exactly where the options should go I'm not sure.

bjlewis2’s picture

Oh, I assumed you weren't interested since it states in the README.txt that you have to write custom code for that. Is it something that you were planning to write? Or do you just want me to hand it over when it's done to be included as a sub-module?

(Also, the guy I have writing it hasn't worked in Drupal before, so I'm not sure how well the code will adhere to Drupal standards.)

quicksketch’s picture

Yeah the README.txt states that it doesn't include integration just to prevent confusion. With the right implementation, I think it would be useful to include. I'm not sure if it needs to be a separate module or part of the base module. I suppose a separate (but bundled) module would provide the best approach, in the event that someone releases an official Recurly Rules module that would probably provide the same functionality.

quicksketch’s picture

For the review process, it'd be easiest if this module was put up on Drupal.org as a sandbox module. Then even if it doesn't get bundled into the main project it can easily be used by other people (and promoted to a full project if needed). It also gives us a place to track individual issues with the module.

bjlewis2’s picture

Okay, would you mind if I emailed you to get help on creating that sandbox? I haven't done it before.

quicksketch’s picture

Just click the "Your projects" tab in your user profile, then click "Add a new project". Or visit http://drupal.org/node/add/project-project.

bjlewis2’s picture

Got it. Thanks!

bjlewis2’s picture

Incase anyone's interested, the basic module is ready for testing. There is at least one bug currently (already reported), so additional testing would be fantastic!

http://drupal.org/sandbox/bjlewis2/1980090

quicksketch’s picture

Thanks Brian! It looks like a good conceptual start, the basics are there and it looks like it would work. However as far as a contrib-level project, this definitely still needs some work. We'd need a UI somewhere (and finding out where that "somewhere" should be is one of the problems) so that users can set the role-to-recurly-plan mapping. I would expect that we should also provide support for different recurly plans mapping to different roles, making the UI more challenging.

Anyway, it's a good start but needs further development to become part of the module.

bjlewis2’s picture

I totally agree with everything you say.

My original agreement with the developer was to get "an initial working module" written. And since I can work with the hard coded assumptions, I'm probably going to use this module on my site as-is. I'd be more than willing to add you as a maintainer of the module, if you're interested, as I'm not sure how much more he's interested in working on this.

carsonblack’s picture

I updated the sandbox with some new code. It doesn't do the extra fancy mappings as quicksketch describes. But to be fair, bjlewis2 did name his sandbox module "simple" subscription updates ;-) My stuff just lets you pick a role to be the "subscriber" role in a new tab on the recurly config page.

Beyond that, I think having some Rules integration would be great for this module, although I can understand the disdain for it. Just sayin'.
quicksketch, would there be an issue with performance or something by including the rules integration? As I understand it, the proper way to implement it would be in a separate .inc file and that would only be used if the rules module were enabled. I might be wrong about that though. Or is it a not wanting to get sucked into maintaining that part of it thing? Because I can TOTALLY understand that if you don't use Rules.

quicksketch’s picture

My coworker @eojthebrave put up a new official module for adding/removing roles to an individual user account: https://drupal.org/project/recurly_roles

PatchRanger’s picture

Solution with fully-functional and configurable Rules integration is attached as a patch to #2035975: Expose drupal_recurly_account via services views module: see https://drupal.org/node/2035975#comment-7659532.

Donovan’s picture

Issue summary: View changes

@DamienMcKenna thank you for the standalone recurly rules integration module. This is very helpful in its own right; but especially so since the recurly roles module is not working for me -- all push notifications to my site are failing. I suspect this issue will prevent recurly rules from working as well though. Can you (or anyone else) advise on what the syntax of the Recurly push notification http auth username and http auth password fields are (I.e., is it an email/password tuple or username/password or something else)?

In any case, thank you for providing a very useful module!

quicksketch’s picture

Status: Needs review » Postponed

I'm marking this postponed as I would like it to be a separate project from the base Recurly module instead of as part of it. I would mark it won't fix, but I'd like this issue to stay in the queue until the project moves to it's own official page.

nDigitHQ’s picture

Has anyone branched this off? We're using the implementation listed in the zip file above but it doesn't account for passing the user email back and forth.

recurly-push:account:email doesn't work as expected so when someone cancels an account (and the push notification comes through), the system doesn't have any information on how to remove that user.

Would be interested in hearing from anyone who has been able to fix this problem.

bjlewis2’s picture

I'd really encourage you to try the Recurly Roles module mentioned above. It's a solid module and it's working well on my site.

nDigitHQ’s picture

Bjlewis2 -- we have that integrated but we also need rules integration to handle removal from Mailchimp.

The main problem with the Roles module is that it relies on Recurly's webhooks (which are flimsy at times). Actually just posted about that issue here: https://www.drupal.org/node/2407305

markdorison’s picture

Version: 7.x-1.x-dev » 7.x-3.x-dev
colan’s picture

Version: 7.x-3.x-dev » 8.x-1.x-dev