Is there a way to let a user pay for the right to view a node?

Posts: 2
Joined: 05/09/2008

I'd like to set up a site where the user has to pay to view a node.

Finding what he/she would like must happen with a view (table of some of the CCK fields) and to see the rest of the CCK fields (full node view) the user must pay for the privilege.

Is there anything like that available?

What would be the complexity of coding something like that?

Thanx

Anton

Posts: 2
Joined: 05/07/2008

Hello Anton,

I think you could solve this role based.

Upon purchase the user has a role assigned, that enables him to access the content.

There is an example in ubercart itself.

Purchase the 'membership' or sth like that.

hth - regards,
thomas.

Posts: 5
Joined: 05/08/2008

hi, if anyone can propose a rough recipe for doing this i'd be grateful.
i just can't seem to get my head around this one! have tried using role assignment but its granting access to all nodes, not just the one purchased. i.e. cannot get it to assign the role on a single, per-node basis.

any ideas anyone? this seems like it should be so simple but i've been banging my head against this one for days now!

i have been using the old cck field permissions module for D5 which I know may be buggy, but i don't see any other option at the moment.

also is there a way to set ubercart to regard every product as a single, one off product? without using the Stock levels / Inventory Contributed Module?

thanks for any help at all on this.

Posts: 793
Joined: 08/14/2007
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.

I think it could involve another module, such as Content Access (along with the ACL API):

http://drupal.org/project/acl
http://drupal.org/project/content_access

You would then have to write a custom module that hooks into hook_order() - since you are not purchasing a role, but a node - the module would have to allow access by hooking into the ACL and granting access to that node for that user.

Sounds simple in abstract but I haven't done any digging to give you a real concept of the work it would entail. I'm sure it's possible, it just hasn't been done yet AFAIK Smiling

--

"Pain don't hurt." - Dalton

Mike Nelson's RiffTrax! www.rifftrax.com

Posts: 5
Joined: 05/08/2008

Thanks for your help with this - it does clarify what I suspected - the need to write my own module. I have no PHP experience, am really more a designer so this is pretty much what I was trying to avoid, but maybe i'll have to get my hands dirty with code!

Does anyone know if Shopify might fit the bill out of the box for my needs? I like Ubercart a lot but need something up in a hurry for a client, and am pushed for time. Not ideal I know!

Thanks for any advice!

Posts: 793
Joined: 08/14/2007
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.

IIRC there was some work being done on purchasable nodes (as a Contrib module for Ubercart) but I'm not sure what progress has been made, if any. Actually they were more along the lines of "Publishing" nodes but have a look.

http://www.ubercart.org/forum/development/2121/uc_nodetype_module_purcha...

http://www.ubercart.org/forum/support/1987/purchase_right_publish_node

--

"Pain don't hurt." - Dalton

Mike Nelson's RiffTrax! www.rifftrax.com

Posts: 2
Joined: 05/09/2008

I've had a look at allowing access to nodes and I have a good idea how to implement the access part IF I can get an idea how to populate a "paid for" table with (uid,nid,expiry_date).

A few questions:

1) Would I have to create a product for each node or is there a way I can get away with only 1 product. What I have in mind is adding a link to the view (eg. Add this CV to your cart). What would the appropriate function be to call with this link? Could I store some extra data (the nid) with this function to use when the payment is made?

2) I assume I can implement a hook that will be called when a specific line item goes through the right step. What is this hook? Where would I get my nid from step 1 then?

Is this a good approach to take?

With that info I could prob throw something together as a quick proof of concept.

Thanx a 2^20

Anton