The default email rules to notify site users of a role expiration (or renewal, etc.) have tokens that do not work. Specifically, anything which begins with [uc_role:...]. I assume this is because the order and its attached data is not available in the set data selectors, which are account and expiration. No other data selectors are available to the rule.

Happy to test!

Maria

CommentFileSizeAuthor
#7 1331324.patch507 bytestr

Comments

liliplanet’s picture

Looking forward to any solution and thank you :)

jonathan_hunt’s picture

Version: 7.x-3.0-rc2 » 7.x-3.0-rc4
Priority: Normal » Major

I've run into this also. It makes uc_roles quite unusable for production sites, so I've increased the Priority of this issue.

tr’s picture

Please post a patch if you know what the problem is ...

jonathan_hunt’s picture

I know the symptom, as described by @mariagwyn but it's not clear to me what the solution is. It looks like uc_role tokens are not part of the expiration data made available to the rule "Notify customer when a role is about to expire" but I don't know enough about rules or the way it interacts with uc_roles to have a patch at this time. How does a uc_role get "in scope" for the rule?

jonathan_hunt’s picture

I may have found the issue, more testing required:

diff --git a/modules/ubercart/uc_roles/uc_roles.tokens.inc b/modules/ubercart/uc_roles/uc_roles.tokens.inc
index 0c06404..19f5284 100644
--- a/modules/ubercart/uc_roles/uc_roles.tokens.inc
+++ b/modules/ubercart/uc_roles/uc_roles.tokens.inc
@@ -43,8 +43,8 @@ function uc_roles_tokens($type, $tokens, $data = array(), $options = array()) {
 
   $replacements = array();
 
-  if ($type == 'uc_role' && !empty($data['uc_role'])) {
-    $object = $data['uc_role'];
+  if ($type == 'uc_role' && !empty($data['uc_roles'])) {
+    $object = $data['uc_roles'];
 
     foreach ($tokens as $name => $original) {
       switch ($name) {
jonathan_hunt’s picture

The above alteration fixes the issue for me.

tr’s picture

Status: Active » Needs review
StatusFileSize
new507 bytes

@jonathan_hunt: Thank you for finding that. OK, so the problem seems to be a typo. But I believe the proper key is 'uc_role' so I think this should be fixed in the calling function, not in uc_roles.tokens.inc, otherwise it will cause other problems elsewhere.

Please undo your changes and try this patch to see if it also fixes the problem:

jonathan_hunt’s picture

That's working for me, thanks.

longwave’s picture

Status: Needs review » Fixed

Committed #7.

Status: Fixed » Closed (fixed)

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