You can build great websites. We can help! You will get expert support and over 3,000 videos! Start your free trial now!
Welcome, Guest
Username: Password:

TOPIC: Ubercart Conditional Actions

Ubercart Conditional Actions 4 years 8 months ago #41602

Hello,
I am using ubercart 6.x-.2.7 and drupal 6.24, and last week I created a conditional action that grant access to the premium articles in the website to customers who buy a magazine subscription.
The problem is that in the Action page I choose to give the subscriber role, once ubercart recognizes the SKU that was bought as the magazine.
But I realize that all customers that buy a subscription receive all the roles that we have in the website, including super user!
I have then, to edit the user account information in order for people to have access only to the premium articles.
What can be done to avoid conditional actions give all the user roles?
Thank you!
Mariana :)
Please become a member of
OSTraining to reply to this post.

Ubercart Conditional Actions 4 years 8 months ago #41654

  • steve
  • steve's Avatar
  • OFFLINE
  • Posts: 10808
  • Thank you received: 381
Hi Mariana

Does the code here help? www.ubercart.org/comment/54046
Please become a member of
OSTraining to reply to this post.

Ubercart Conditional Actions 4 years 7 months ago #43419

Thank Steve,
This seems to be what I need, but I don't know where to add the information I have. I need to give 'subscriber' role for those who buy the printed subscription online. I created an action that recognizes which product people are buying when they check out, but the PHP code is hard to understand.
Would you please tell me where and how to modify it in order to work in my website?
Thank you!
Mariana :)
Please become a member of
OSTraining to reply to this post.

Ubercart Conditional Actions 4 years 7 months ago #43600

  • Nick
  • Nick's Avatar
  • OFFLINE
  • Posts: 23621
  • Thank you received: 694
Hi Mariana,

You're welcome! We're glad we could point you in the right direction! :)

Did you notice the screenshot in the discussion? It can be hard to notice, so here's the direct link in case you missed it:
www.ubercart.org/files/Screen%20shot%202...%2011.37.11%20AM.png

To enter the PHP, there should be an option called "Execute custom PHP code action" (or something similar). If you can't find that part, could you send me some login credentials to This email address is being protected from spambots. You need JavaScript enabled to view it. so I can take a quick look for you? Please include a link to this forum post in the email and then afterward reply to this forum post letting me know you sent the email so that I can check it.

Kind regards,
Nick
Follow us on Twitter - twitter.com/OSTraining
Like us on Facebook - facebook.com/ostraining
Please become a member of
OSTraining to reply to this post.

Ubercart Conditional Actions 4 years 7 months ago #43634

Hi Nick,
Thank you for your help!
I saw the screen shot and did as it says. Then I found where to add the custom PHP action. But my question is if I have to change anything in the PHP code or I just copy and paste as it is?

I just sent you the login credentials to our website.

Sincerely,
Mariana :)
Please become a member of
OSTraining to reply to this post.

Ubercart Conditional Actions 4 years 7 months ago #43833

  • Nick
  • Nick's Avatar
  • OFFLINE
  • Posts: 23621
  • Thank you received: 694
Hi Mariana,

You're welcome!

One quick caveat before we start, please check out Support FAQ on the limit of our support for code, as we don't cover custom code since that's a developer's job: www.ostraining.com/support-faq/.

That being said, you should create a copy of your site to test the conditional action on a test site. Use our "Move Your Drupal Site to a New Location" to make a copy of your site:
www.ostraining.com/blog/drupal/move-your...e-to-a-new-location/

Having a test site will allow you to experiment with changes without worrying about breaking your live site. Then you can test the code as it is to see what the result is and modify as needed.

By the way, we recently added (free-of-charge) a PHP class to everyone's subscription:
www.ostraining.com/courses/class/coding/...nners/view?task=view

The class would definitely be a big help in getting your custom code working.

Hope this helps! :)

Kind regards,
Nick
Follow us on Twitter - twitter.com/OSTraining
Like us on Facebook - facebook.com/ostraining
Please become a member of
OSTraining to reply to this post.
You can build great websites. We can help! You will get expert support and over 3,000 videos! Start your free trial now!