VBO, adding content nodes to og group without update flag
izmeez - June 30, 2009 - 05:47
| Project: | Views Bulk Operations (VBO) |
| Version: | 6.x-1.x-dev |
| Component: | Miscellaneous |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
I heard about the Views Bulk Operations module a few months ago and I have now used it. Thank you, it is very powerful.
I would like to use it to update an existing site with content to an implementation using og. I need to add all existing content nodes to an og group and I can see how VBO allows me to do this. But, I would like to do this without triggering the update flag, that is without changing the date when the node is updated. Do you know if there is any way to do this?
Any help would be appreciated. Thanks,
Izzy

#1
By default, the
node_save()function saves thechangedattribute to the current time. VBO callsnode_save()if the action that was executed advertises that it modifies the node. Otherwise, the changes made by the action would not be saved in the database. So today, there isn't a way to keep thechangedattribute from being updated (unless the action doesn't require the node to be saved). In your case, the actionog_add_group_actionincludes the modification flag because it does set an attribute on the node, that needs to be saved later.What you're asking for could be implemented within VBO by saving the last update date before saving the node, then programmatically resetting the attribute in the database after the node is saved. This would be an option in the VBO settings. Before implementing it, though, let's wait for some discussion on this thread from other users to ensure we're not breaking any implicit or explicit rules by "fooling" Drupal.
#2
Karim,
Thank you very much for this information and this useful module.
I only need this function as a one-time operation so I am not sure if it needs to be implemented as a feature.
With the information you provided, I located the function save_node in Drupal core modules/node/node.module
I commented out the two lines that set the time and timestamp.
Of course, I ensured a database backup, and that content types were correctly configured to post to groups.
Then used VBO. It worked great ! Thanks.
Izzy
#3
Glad I could help. Don't forget to un-comment the lines in node.module ;-)
#4
Yes, of course that was part of the workflow.
Izzy
#5
Automatically closed -- issue fixed for 2 weeks with no activity.