Community & Support

Coding help to implement Ubercart Marketplace to achieve per user per node access

This is what I'm trying to achieve -

UC marketplace to have sellers create and sell video nodes. I'm not able to figure out how to make this work, basically achieve per user per node access.

A user will see a teaser of the node with add to cart button and after the purchase they can see the full video node and it gets listed under their account.

I have tried to create a custom module with ACL and Ubercart, but its not working. After a purchase the code gives the buyer access to all the video nodes rather than a particular purchased node.

if ($order->order_status == 'completed' || $arg2 == 'completed') {
foreach ($order->products as $product) {
$node = node_load(array('nid' => $product->nid));
if ($node->type == variable_get('custom_node_type', DEFAULT_CUSTOM_NODE_TYPE)) {
$acl_id = _get_content_access_acl_id($node);
acl_add_user($acl_id, $order->uid);
}

And, then it tries to compare and provide view access as:

$users = acl_get_uids(_get_content_access_acl_id($node));
if ($users && in_array($user->uid, $users)) {
_remove_node_purchase_details($node);
}

Looking for a programmer who can either correct this code or create a new code to achieve this.

Comments

You need

Content Access and ACL to get this to work. It seems you are moving in the right direction. Make sure you enable node level access control in content access. You will have to patch ubercart (http://drupal.org/node/336257) to enable it to work with rules and then add a rule on checkout which gives access.

Best of luck :-)

If you own it, tone it.

Thanks

Thanks for your reply. I have enabled node level access control in content access. What is the code for adding uids to acl ids for each individual nodes. I'm willing to pay for this code.

Thanks

Advertising helps build a successful ecosystem around Drupal.
nobody click here