Leighton:
Did you ever add Rules integration to the membership suite? I saw you were considering it in the past. And if not, any plans to do so?
Leighton:
Did you ever add Rules integration to the membership suite? I saw you were considering it in the past. And if not, any plans to do so?
I'll work on adding the Rules integration to the next release (even if it only supports a few actions/triggers/conditions at first). In the mean time, if you can think of any good conditions/actions/triggers, feel free to post them here.
Sincerely,
Leighton Whiting
Here is a list of what I've added so far and what will be released with Membership Suite 6.9:
Conditions:
-Check if a user has a membership
Actions:
-Add Membership to User
-Set Expiration Date for User Membership
-Change Membership Status (Active, Cancelled, EOT, etc)
Triggers:
-Membership is added to a user
-Membership is expiring
-Membership is cancelled
-Membership has a payment
I'll be posting a video tutorial on how to use these Rules.
Sincerely,
Leighton Whiting
Sorry to somewhat hijack this thread, but the rules integration seems great. If I have things correct, one would be able to create rules for email reminders for all plans. This would allow one to define a "global" expiration message for all plans instead of changing it for each membership plan. The email templates for each plan could even be done away with once rules is integrated as a rule could be created instead. Is this correct?
@entrepreneur,
The Membership Suite 6.9 will only include support for Membership Suite rules and a few rules for MS Core. Rules like adding a new Order and adding new payments will come in the next version.
@bkbetts,
Yes, you could use rules to do that, and replace the email functionality that the plans currently use. I won't be taking them out, however, because that would mean requiring that people use rules and that would add some unnecessary difficulty to the system, and I'd like to keep it as simple as possible. The rules integration will be for those advanced users who don't mind getting their hands dirty a little :)
Sincerely,
Leighton Whiting
Hi Leighton,
Thanks for the great improvements.
Any chance of adding this feature request in the future:
1. with roles promotion upon payment, an og group is automatically created for that user. Maybe through the use of rules.
Thanks
Ed
Ed,
I can't speak for the OG group creation part, but if they have rules actions that can do that, then this is already possible because Membership Suite provides a trigger for Membership Signups and Expirations.
Sincerely,
Leighton Whiting
Entrepreneur,
I think a new action needs to be created for this to work. Try replacing your ms_membership.rules.inc with the attached file, which adds a new action called 'Add a Membership to a User by Plan ID'. You would then have to use either tokens or php to automatically get the plan id number that you want to use from the node (probably stored in a CCK field, for example).
Let me know if that works for you.
Sincerely,
Leighton Whiting
| Attachment | Size |
|---|---|
| ms_membership.rules_.zip | 1.63 KB |
| ssmemrules.PNG | 22.83 KB |
Entrepreneur,
I'll keep it in. I found a bug that I think was causing that problem. Attached is the updated file. Give it a try and let me know if it works.
Sincerely,
Leighton Whiting
| Attachment | Size |
|---|---|
| ms_membership.rules_.zip | 1.68 KB |
Oops, I only applied the fix to the 'Add Membership to User' action and forgot the 'Add Membership to User by Plan ID' action. The attached file should work.
Sincerely,
Leighton Whiting
| Attachment | Size |
|---|---|
| ms_membership.rules_.zip | 1.68 KB |
Entrepreneur,
The last one works for me, it adds the membership and the roles as it should.
Sincerely,
Leighton Whiting
Yeah, I just downloaded it to check, and the fix is in there. This is the function that was changed so you can check it yourself:
/**
* Action: Add a membership to a user
*/
function ms_membership_action_add_membership_by_id($mpid, $account) {
$m_plan = ms_membership_load_membership_plan($mpid);
// Add a new membership for this user
$membership = ms_membership_insert_new_membership($m_plan, $account);
// Add and remove the roles at the start of the membership
ms_membership_change_roles($account->uid, $m_plan->start_grant_roles, $m_plan->start_remove_roles);
return array('membership' => $membership);
}
I added in the ms_membership_change_roles function so that the roles would be added.
Sincerely,
Leighton Whiting
The server time shouldn't affect the granting of the roles, since it is run immediately after the membership is added to the user. I would check the membership plan and make sure that it is set up to add a role at the start of the membership. Also, turn on the Debug Messages and run it and then check the logs. It should say what it is doing.
Sincerely,
Leighton Whiting
Other than adding that code (which was working for me) to the rules integration, I haven't changed anything with rules in this release. I was planning on adding some more Core rules (like creating orders, payments, etc) but wanted to get this release out first because of some bug fixes.
Sincerely,
Leighton Whiting
It looks like according to the log, the role is being added correctly both times, which is also the case for me. I suspect that when the Rule triggers, something happens afterwards that removes the role from the user. Can you expand a bit on what the rule does (when it triggers) and also if you can think of any other rules or modules that deal with removing roles from users?
Sincerely,
Leighton Whiting

Entrepreneur,
I was originally planning on making the Rules module required and have all of the workflow go through Rules, so that everything would be customizable, but I realized that this would cause more problems than it would solve (confusing users with the complexity), so I launched without it. I am still considering providing a lesser integration with Rules, so that you can add actions to MoneyScripts Triggers, and Rules wouldn't be required to use the module. I'll give this a +1 on the feature list :)
Sincerely,
Leighton Whiting