0

I would like to change the author of a content for a bunch of nodes. So I've chosen Views Bulk Operations (VBO) module to achieve it.

Part of it, created a VBO view, but in the VBO options I see "Change owner" and "Change the author of content" (shown below).

What's the difference?

enter image description here

1

Change owner is an action implemented by the Views Bulk Operations module, while Change the author of content is an action implemented by the Node module. (See views_bulk_operations_change_owner_action_info() and node_action_info().)

The VBO module implements that action for any entity for which that action makes sense. (In other words, if the entity doesn't have an owner, the action is not implemented for that entity.) Apart that, the underline code doesn't change much.

// This is the function for the VBO action.
function views_bulk_operations_change_owner_action($entity, $context) {
  $entity->uid = $context['owner_uid'];
}
// This is the function for the Node module action.
function node_assign_owner_action($node, $context) {
  $node->uid = $context['owner_uid'];
  $owner_name = db_query("SELECT name FROM {users} WHERE uid = :uid", array(
    ':uid' => $context['owner_uid'],
  ))
    ->fetchField();
  watchdog('action', 'Changed owner of @type %title to uid %name.', array(
    '@type' => node_type_get_name($node),
    '%title' => $node->title,
    '%name' => $owner_name,
  ));
}

The obvious difference is that the VBO action implementation doesn't log for which node the owner has been changed. When changing the owner for many nodes, its implementation could be faster than the Node module one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.