I see the values to use this in rules, and my system tells me it's updating the expiration date, but nothing actually happens to the expiration date field - the box is left unchecked and hence there is no date assigned. It does not appear to be saving the data.
Here is my rule (I tried both "+365 days" as well as "+1 year"
{ "rules_set_expiration_date" : {
"LABEL" : "Set expiration date",
"PLUGIN" : "reaction rule",
"REQUIRES" : [ "rules", "user_expire" ],
"ON" : [ "user_insert", "user_update" ],
"IF" : [
{ "user_has_role" : { "account" : [ "account" ], "roles" : { "value" : { "4" : "4" } } } }
],
"DO" : [
{ "user_expire" : { "account" : [ "account" ], "expiration" : "+365 days" } }
]
}
}
============
Here is the rules debug log:
Rules debug information:
" Reacting on event After updating an existing user account.
0 ms Reacting on event After updating an existing user account.
20.34 ms Evaluating conditions of rule Set expiration date. [edit]
22.825 ms The condition user_has_role evaluated to TRUE [edit]
22.85 ms AND evaluated to TRUE.
" Rule Set expiration date fires. [edit]
0 ms Rule Set expiration date fires.
0.449 ms Evaluating the action user_expire. [edit]
3.058 ms Rule Set expiration date has fired.
26.035 ms Saved account of type user.
" Reacting on event After updating an existing user account. [edit]
0 ms Reacting on event After updating an existing user account.
2.369 ms Not evaluating reaction rule Set expiration date to prevent recursion. [edit]
2.423 ms Finished reacting on event After updating an existing user account.
61.637 ms Finished reacting on event After updating an existing user account.
=====================
I feel like there should be something turning the user expire option "on" first, THEN this would run:
{ "user_expire" : { "account" : [ "account" ], "expiration" : "+365 days" } }
but I know so little about coding that I won't attempt a guess beyond that.
If there is any insight, please let me know. My user accounts do not appear to be changing at all. Much appreciated!
Comments
Comment #1
erikwebb commentedAdd rules tag
Comment #2
erikwebb commentedThe expiration should be a specific date (I believe). Can you try a date so that we can narrow the problem?
I agree it should support a relative time, but let's figure that out separately.
Comment #3
mohammadjolani commentedI solved it for new user and rules.
But this is my first patch so could any one tell me is this write patch format or not and how to apply patch for the any project and upload it to Drupal git repo.
Comment #4
erikwebb commentedComment #6
mohammadjolani commentedFix for the above patch.
Comment #7
mohammadjolani commentedComment #8
erikwebb commentedComment #9
Bojhan commentedThis fix works :)
Comment #10
erikwebb commentedhttp://drupalcode.org/project/user_expire.git/commit/efe7155