In an earlier release of Role Expire for 7.x, I had a rule that would update an existing users role after a commerce order. The rule was effective in creating the user role and in establishing a user entry in the role expire table. That doesn't seem to be the case with the current release as a "role expire" isn't set. Was there a code change that I missed?

CommentFileSizeAuthor
#8 1277154-rulesintegration.patch4.91 KBlarowlan
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sharplesa’s picture

Yikes! Sorry, joemaine. Could you please provide a step-by-step procedure that I can follow that exposes the intended/actual behavior. We'll get on it right away.

joemaine’s picture

Hi Andy,

You're quick!

I'm using Role Expire in combination with Drupal Commerce. I have a "Rule" established that fires when a commerce order checkout proces is completed (event). Only Authorized users can place orders. The Rule has two conditions (verify that the user is not an Admin, and confirm the SKU in the commerce order. The actions are to add a user role and send an email message. Everything works correctly (the new role is established and the email is sent), but the user is not added to the role expires table/date is not entered into the user edit page/role expiration doesn't show on the user view page.

To activate the user with a "role expire" an Admin must edit the user (delete role/save/enter role/save). I had tested this functionality before...and I'm pretty sure that it worked.

sharplesa’s picture

So let me see if I'm following you. I take it you're using Drupal Commerce to allow people to subscribe to a role. You're using the Rules module to add the role to the user, and you're wanting that newly subscribed role to also have an expiration date. With role_expire-7.x-1.0-beta1, the role gets assigned as intended, but the default expiration date set for the role does not get applied, so the user now inadvertently has the role In Perpetuam. Is that what's happening?

Your current workaround is that a user with administer roles permission has to manually set the role expiration on the user's edit page.

And your memory is that, in the past (still 7.x?), adding a role through the rules module also added the role_expire information for that role. Right?

Please confirm that this captures what you're experiencing. Thanks.

joemaine’s picture

Hi Andy,

That is correct. ...and all in Drupal 7.

I think I saw a role expire rule from 6.x that did populate an expiration date/time for a user - different than the rule that I'm using, and the role expire fields aren't exposed to rules in 7.x. ("Add expire time to role" appears within rules...but it can't be configured). Problem would be solved if it could be used to add the default expiration date/time to the user role created by a previous action in a rule.

sharplesa’s picture

By way of an update, I've spent several hours studying Rules 2.x and trying to slog through updating role_expire.rules.inc. I've succeeded in moving the role_expire actions to the right.place in the Rules interface, but I still haven't succeeded at getting the Rules expiration date configuration page to work.

I recognize that this activity isn't exactly addressing your particular issue, but thought that if I could get this to work, I would have the insight necessary to address yours.

ETA? I'm finding that Rules is very complex and unevenly documented. I don't yet feel like I have a handle on all the necessary concepts in order to complete this task. So, if it depends on me, I'm guessing three more weeks.

trevorkjorlien’s picture

Yes, I've found the same problem as joemaine.

I recently just started using Role Expire with Commerce, but I'm looking for the same functionality (i.e., being able to set the role expiry in a checkout rule).

Thanks for the update, sharplesa. I have very little PHP skills, but as far as testing goes, I'd be happy to get this functionality rolling.

YesCT’s picture

I'm looking at moving a D6 ubercart site to a D7 commerce one, because I need to be able to check and see what role is about to expire and send different messages depending on what role is going to expire. Sounds like that is not totally compatible yet. I'll set up a test site and try it out.

larowlan’s picture

Status: Active » Needs review
FileSize
4.91 KB

This patch fixes rules integration and works with commerce.

jsibley’s picture

Issue summary: View changes

The patch dates from 2011 and hasn't been committed? Is that correct?

Is there a better solution that supersedes this one?

Thanks.

jsibley’s picture

After assigning a role with an expiration date, I can see the expiration date on a user's page. I also see expiration dates listed under "role expiration".

Where is the expiration date currently stored? Is it stored in a Drupal table, and if so, which table? (it would be helpful to know this for troubleshooting)

jsibley’s picture

I believe that the expiration date I've been seeing is from ubercart roles. It looks like when a user purchases a role through ubercart, the expiration date is stored in an ubercart table.

I assume that date could also be stored, through rules, in the role expire table. I'm trying to figure out how to do that now.

rcodina’s picture

Status: Needs review » Closed (outdated)

Please, check out latest version of module. If necessary open a new issue and update the patch. Thanks for using this module and giving feedback!