15 replies [Last post]
jasont's picture
Offline
Joined: 07/27/2009
Juice: 76
Was this information Helpful?

This is something I have been asking around for the past week without receiving any feedback but it is a serious bug. Here are the results of my testing:

Using RC-3

Fresh install of Ubercart 2 RC-3
Standard Conditional Action Settings
Product with Role assigned to purchase

When the above mentioned product is purchased using version RC-3, the buyer receives emails for account details, role granted notification and invoice. The admin receives the new order email.

Everything here works great, the user is granted a NEW role.

Using RC-6

Updated to Ubercart 2 RC-6
The same conditional actions as test with RC-3
The same product with role assigned to purchase with RC-3

I then updated to RC-6 according to the best practices for updating a module. Everything was kept the same. Same product details and the same conditional action settings.

When the same product is purchased with RC-6, the buyer receives emails for account details and the invoice. No email is sent to notify the buyer of a newly granted role. The admin receives the new order email.

The buyer for this order had a different email and username. Upon further investigation, the newly created user has had their role RENEWED instead of being granted a NEW role. Even though they didn't have the role prior to the purchase. This does not explain the lack of am email notification either as the standard settings email buyer's notification of renewed roles.

At this point I have no idea where the code went wrong for RC-6 and not being a seasoned programmer I haven't been able to come up with any ideas why.

*All I can suggest at this point is that anyone granting roles via Ubercart purchases should REMAIN ON RC-3.*

DavidPlanesTV's picture
Offline
Joined: 02/03/2008
Juice: 130
No problems here

I am now on RC-6 and have had no problems with the granting of roles purchased through Ubercart

David

jasont's picture
Offline
Joined: 07/27/2009
Juice: 76
Re: No problems here

Do you mind me asking if your newly granted roles are logging as renewed or newly created? Also, are you sending the "role granted notification" email to your new clients through the conditional actions system? This is odd because I made a complete re-install of Ubercart starting with RC-3 and then upgraded to RC-6 without changing any settings that were working in RC-3.

Jason

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6846
Re: Serious Problem With RC-6 Roles

So, the issue isn't that the roles aren't getting to the customer, but that the email isn't being sent. "Renewing" and "granting" a role are really the same kind of thing. The only difference is whether the user already had that role before.

However, that confusion of semantics is what was keeping the email from being sent out. Here's a patch to fix that.

AttachmentSize
u12818_role_email.patch 811 bytes
jasont's picture
Offline
Joined: 07/27/2009
Juice: 76
Re: Re: Serious Problem With RC-6 Roles

Hey Lyle thanks for the fix on the emails. You are right about "Renewing" and "Granting" roles really being the same kind of thing. The only reason to really separate the two is for different notifications being sent to the user.

[Edit]
I think what I suggested previously was way off. I will make a backup of my current system with RC-3, install RC-6 with the new code adjustments and do some testing to let you know how it goes. Thanks again Lyle.

[Edit 2]
Ok so just did some quick testing. Email system works great, thanks for the fix Kyle Smiling

The roles however still do begin as "Renewed" for new buyers. It isn't a big deal however it would be nice to be able to send different emails for new buyers as opposed to repeat buyers.

jasont's picture
Offline
Joined: 07/27/2009
Juice: 76
Re: Re: Re: Serious Problem With RC-6 Roles

Ok I have been doing some more testing with RC6 and introduced the Recurring Fees Module. It appears as though no emails are now coming through to notify users of upcoming role expiration or expired roles. I ran Cron numerous times just in case this was why the emails weren't being sent however it didn't send them off. The only role notification being sent is the initial role notification each time a buyer purchases a product.

As a result, it is back to RC3 to do some testing with Recurring Roles, just to make sure it was not the cause of the problem. If I can get it working as it should in RC3 and then I upgrade to RC6 without changing settings, it should provide some more information needed to fix this issue.

I do believe something has weirded out between the RC3 and RC6 versions as the uc_roles.ca.inc code appears to have changed sizably in regards to Roles. There are a number of variable name changes between the two such as $order_user being used in RC3 and $account being used in RC6. Also a number of changes seem to have been made in the order of processes.

Jason

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6846
Re: Re: Re: Re: Serious Problem With RC-6 Roles

In the Products Features settings, make sure you have a grace period set for the expiration warning to be sent in. I think it might not ever be sent by default. Once I set it to a couple of days, it started working when I ran cron.

I'm also getting different messages that distinguish between renewed and granted roles. However, I'm not using the Recurring module, so I don't know how much effect that will have. I expect it shouldn't matter too much, though.

Committed the patch, so expect to see it in the next available version.

jasont's picture
Offline
Joined: 07/27/2009
Juice: 76
Re: Re: Re: Re: Re: Serious Problem With RC-6 Roles

Sorry for the lack of response in this issue, been flat out working on other elements.

My testing with the RC3 version and Recurring module brought about some mixed results. I will do some more testing with the RC6 version to single out what is going wrong here, minus the recurring fees module.

Lyle, are the new roles granted in RC6 showing as "new role granted" in the order view? For me it was heading straight to renewed. I'll let you know what happens with my testing.

Thanks for taking the time to work on this Lyle, everyone here appreciates the great work you guys put into Ubercart!

Jason

jasont's picture
Offline
Joined: 07/27/2009
Juice: 76
A Quick Update. Fresh

A Quick Update.

Fresh installation of Ubercart RC6. I installed Ubercart onto the website and applied the patch afterward. I did not change any default settings in the conditional actions. I added a new test product with an assigned role which expires in 4 days. The expiration reminder is set for 2 days.

Purchased the product as anonymous user, received 3 emails. One for account details, the standard Drupal email for new accounts. One for the product invoice. One to notify me the client role was renewed. Problem is, fresh install, anonymous checkout whilst being a completely new user.

I didn't receive the usual message that pops up if your recognized for using a username or password in the database. I log in, check the order view and have customer user role renewed. Not a mix up in the emails so we can count that out.

Is there any possible way that I could be getting user role renewed due to something I am overlooking? There are no extra users in the database according to the "users" table, a completely fresh installation of UC including new product nodes etc.

[Edit]

Looking at the code, here is where I think it may be running into trouble.

In uc_roles.ca.inc on line 475 we are determining the current expiration if it exists.

Then on line 478 we are granting a role which from the looks of it is setting a new expiration according to the uc_roles.module on line 217.

However then on line 484 of the uc_roles.ca.inc we are then checking to see if a role expiration exists and send a comment.

This seems to be the problem.

The role expiration is being set prior to checking if it previously existed or not. Thus the comment in the order view is always set to renew which in turn, always sends the role renewed email because line 497 relies on the order comment being renew or granted.

Jason

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6846
Re: A Quick Update. Fresh

There's a patch on drupal.org (http://drupal.org/node/569920) that ought to take care of this. Give it a try and see if it works better.

jasont's picture
Offline
Joined: 07/27/2009
Juice: 76
Re: Re: A Quick Update. Fresh

Thanks for the link Lyle, it is exactly what I was looking for. This is likely going to be a necessary patch to be included in the next version of Ubercart. I am just glad it wasn't me going crazy by obsessing over this and not seeing anyone else experiencing the problem.

mairav's picture
Offline
Joined: 03/19/2009
Juice: 20
Re: Re: Re: A Quick Update. Fresh

Thanks for this solution, it helped me too.

mairav's picture
Offline
Joined: 03/19/2009
Juice: 20
Re: Re: Re: Re: A Quick Update. Fresh

As far as I tested, applying only the patch given in http://drupal.org/node/569920#comment-2017570 the mails are sent again and taking in account if the role is given for the first time or is a renewal.
Thanks for that link.

jasont's picture
Offline
Joined: 07/27/2009
Juice: 76
Re: Re: Re: Re: Re: A Quick Update. Fresh

I just want to follow up on this as it is important for those using Ubercart Role assignments on live sites. It is necessary to apply the patch that mairav has referenced above this post^. If you do not, your clients will not receive the right emails according to granted or renewed roles.

Big thanks to the coders who solved this issue.

mairav's picture
Offline
Joined: 03/19/2009
Juice: 20
Re: Serious Problem With RC-6 Roles

This problem has been solved in rc7. Thanks for adding the solution so fast to a release.

ron_s's picture
Offline
Joined: 09/11/2008
Juice: 173
Re: Re: Serious Problem With RC-6 Roles

I am running rc7, and noticing a problem connected to this. When a user is granted a role for the first time, they are receiving the "renewed" email rather than the "granted" email. The message says the role was renewed, yet the user never had the role prior to placing an order.