Active
Project:
Term Node Count
Version:
6.x-1.3
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
6 May 2010 at 14:10 UTC
Updated:
6 May 2010 at 14:12 UTC
// the user is reverting back to an older revision // the problem here is that instead of telling me the most recent vid // drupal gives me the vid associated with whatever version we're reverting to // to get around that i do some sql magic to get the revision for this node directly preceding the newest one // i wish there was a better way to do it $old_vid = db_result(db_query('SELECT vid FROM {node_revisions} WHERE nid = %d ORDER BY timestamp DESC LIMIT 1', $node->nid)); <code> </blockquote> What if i have 5 revisions and switch from 3rd to 1st? Why didn't you use <code>'SELECT vid FROM {node} WHERE nid = %d'?
Since you query database before drupal saves node actual revision AFAIK stored there .
Comments
Comment #1
fasdalf@fasdalf.ru commentedSorry. Missclicked Preview. It should be:
What if i have 5 revisions and switch from 3rd to 1st?
Why didn't you use
'SELECT vid FROM {node} WHERE nid = %d'?Since you query database before drupal saves node actual revision AFAIK stored there .