I just started using UC and UC Node Checkout today so this may be a stupid question but I was wondering if you permit an anonymous user to submit and pay for posting a node if they can later edit it?

It appears when an anonymous user creates a node they are provided with a user account and UID for the purposes of reviewing the order, but the author of the node is 'anonymous', thus preventing the user to access the node. I can see where this would be useful for the purposes of event registration but for paid advertisements or node postings this could be a problem.

Currently, it appears that users would have to be registered prior to posting if they wanted to edit the node after submission but a UI improvement may be to allow anonymous users to post, after which they are provided an account (as is currently the case) and this new user is designated as author of the node for the purposes of future editing. Is there currently a way to do this?

Thanks a lot.

Comments

rszrama’s picture

Title: Allow anonymous users to edit own node? » Updated author UID for node's purchased anonymously
Category: support » feature
Status: Active » Postponed

I'm changing this to an appropriate feature request and marking it as postponed for consideration in a later version of the module. It's a good idea though:

Update nodes purchased anonymously through UC Node Checkout to the proper UID for the user created during checkout.

rszrama’s picture

Title: Updated author UID for node's purchased anonymously » Updated author UID for nodes purchased anonymously

Typo fix.

WebNewCastle’s picture

This sounds great. I wanted to just add my vote and encouragement for considering this feature request again in the future. I'm a big fan of Node Checkout. It is perfectly suited for what it was intended to do and does it well. I also think that it has great potential to become a robust solution for a variety of use cases.

The feature requested here would allow greater usage of the module outside of the usage of the more event/registration/data form collection aspect. I've used and/or tested usage of this module for other things, but I also seem to get some interesting projects in the "non-standard" eCommerce category.

Thanks for reviewing the request that was made earlier and for your work on eCommerce solutions in general.

jlmeredith’s picture

I have a fair number of conference sites that I maintain and this functionality would be very helpful. Does anyone have an idea of what would be a good bounty amount for this request? I am willing to pitch int get it addressed.

alekm’s picture

This is actually possible to do already without a patch, requires conditional statement.

1. Go To -> Store Admin -> Conditional Action -> Add Predicate
2. Trigger -> Customer Completes Checkout -> Click Save and move onto Conditions
3. Conditions -> This is area is optional, you may want to make this available for specific products -> Click Actions
4. Under Actions -> Select "Custom PHP Code" from the Drop-Down and put this in:

if (isset($order)) {
  foreach ($order->products as $product) {
    if (isset($product->data['node_checkout_nid'])) {
      $node = node_load($product->data['node_checkout_nid']);
      $node->uid=$account->uid;
       node_save($node); 
    }
  }
}

Save your work and all should be good to go!

Good luck!

deleuje’s picture

#5 didn't work for me. The created node author is still anonymous.

update: It did work when I took out the conditional I was using.

Clint Eagar’s picture

#5 Works for me, thanks for sharing.

emilorol’s picture

Hi,

For some reason I can not find out why the above shared CA (conditional action) is not working in "UC Node Checkout 6.x-2.0-beta8".

I have even place it in the condition and in the action section of the predicate without luck.

Also I have play with modifications like:

  if (isset($order)) {
    foreach ($order->products as $product) {
      if (isset($product->data['node_checkout_nid'])) {    
        $nid = $product->data['node_checkout_nid'];
        $uid =  $order->uid;
        db_query("UPDATE {node} SET uid = %d WHERE type = 'CONTENT-TYPE' AND nid = %d", $uid, $nid);
      }
    }
  }

What am I missing? It seems like if some other function is been executed after mine setting the user back to anonymous, but I can not tell which one.

Thank you,
Emil

emilorol’s picture

Hi,

I case someone need a solution while the issue is solved, here is my solution:

<?php
/*
 *	Implements hook_nodeapi();
 */
 
function MY-CUSTOM-MODULE_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  switch ($op) {
    case 'presave':
      if ($node->type == 'CONTENT-TYPE') {
        //Get the user that order the node as the node author
        if ($node->uid == 0) {
        $uid = db_result(db_query("SELECT o.uid FROM uc_orders o LEFT JOIN content_type_registration r ON o.order_id = r.field_CONTENT-TYPE_order_id_value WHERE r.nid = %d", $node->nid));
        $node->uid = intval($uid);
        }
      }
    break;
  }
}
?>

Thank you,
Emil

mattcasey’s picture

#5 works fine with the current 6.x-2.x-dev

Jon Bonning’s picture

Nice thread here. I was wondering about node purchase anonymity myself. Thanks to emiliacosta for the solution!

grachan2’s picture

Sorry, I'm new at this. Where would I put this code in #9? Do I have to create a module, or can I put something in template.php? Thanks!

spyderpie’s picture

How would I do this in D7?

khakistocracy’s picture

Version: 6.x-2.x-dev » 7.x-2.x-dev

Just wanted to join spyderpie here and ask if anybody knows how to accomplish this in D7?

I'm getting pretty desperate for a way of doing this before my site goes live... Anybody with some node checkout skills that could help.... please!?

khakistocracy’s picture

Status: Postponed » Active
zeezhao’s picture

Issue summary: View changes

for D7:
Event: Customer completes checkout
Condition: none
Action: Execute custom php code

if (isset($order)) {
  foreach ($order->products as $product) {
    if (isset($product->data['node_checkout_nid'])) {
      $node = node_load($product->data['node_checkout_nid']);
      $node->uid=$order->uid;
       node_save($node); 
    }
  }
}