uc_roles and display the currect content

Posts: 46
Joined: 11/21/2007
Bug Finder

I've recently converted site from using the e-commerce module to ubercart which is just fantastic, an commerce module that works Eye-wink

I'm not completely sure if this is the right place for this problem (more a drupal question perhaps) but basically I have a music site which sells single tracks using uc_products and we also sell music through subscription using uc_roles

I wonder if anyone who has a subscription site with a similar scenario and has some sort of solution, I'll try my best to describe what im trying to do.

I use views to generate my products in a table, in one case for anonymous users and authenticated users I use views to generate the products and in one column it displays the add to cart button

For users with the role "subscribed users" I use views to display the direct link to the music file, I've attached an image to better display what i mean.

The problem is the subscribed user can still see the anonymous and authenticated users list of products as well as the subscribed list. For the life of me I can't work out how to only display the one list for subscribed users. my guess is because the user that was given the role "subscribed user" the user still has the role authenticated user so it shows both lists, I can't work out how to get around this, any help would be extremely appreciated!

AttachmentSize
access_control.jpg72.74 KB
Posts: 46
Joined: 11/21/2007
Bug Finder

I'm sorry, I realise this is a views question but the only way I can think of this working is if it somehow checks if the user is both authenticated user and subscribed user and if they are apart of both those roles then the content that is only intended for the anonymous users and authenticated users will not be shown, does anyone have any idea how to do this using views?

The only place I can see to control who views what is in the access area in the edit views.

Posts: 46
Joined: 11/21/2007
Bug Finder

Is it possible to remove someone form a role as well as add them into a role with the uc_role module?

Posts: 4700
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

The roles module will expire a role when it times out, but if you want to remove an arbitrary role from an account you should setup a workflow configuration to do it.

Posts: 46
Joined: 11/21/2007
Bug Finder

Thank you for replying, Workflow seems to answer a lot of my questions except one or two. do you know if its possible to add a role to the user as soon the roles module expires? for example the subscribed user expires and looses their subscribed role through the roles module is it possible to add a role at the same time as removing one during the expiration?

The only way I can figure out to do this in workflow is to add the role after the user has logged off and back in, but this way seems a bit problematic since it will most probably confuse the user

Posts: 4700
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Unfortunately, it doesn't look like this module has been integrated with Workflow-ng or define any sort of hook that you could use to do this. Sad

This really needs to happen, and it's the last function in the file that I believe would need to be modified - _role_action().

Posts: 46
Joined: 11/21/2007
Bug Finder

I have created a feature request http://www.ubercart.org/issue/3871/give_uc_roles_option_remove_role Would it be possible for a few pointers/suggestions where I could start Ryan?

Posts: 332
Joined: 08/07/2007
Administrator

Yup that's where all the sweet role action takes place. All one would have to is make use of workflow-NG's hooks to implement a new event where a role was added/removed/renewed/deleted. I'd do it, but I'm trying to focus on one project at a time.

--

-Shawn Conn: If the Name Don't Rhyme It Ain't Mine

Posts: 46
Joined: 11/21/2007
Bug Finder

Thank for that Shawn, I'll do my best