After having added a “changed by” on nodes I now need to display the user who modified each node on the node_admin_content
form (at admin/content
) right next to the "Author" column.
I've managed to easily solve this by altering node.admin.inc and adding just 2 lines of code:
...
'changed_by' => t('Changed By'),
...
...
'changed_by' => theme('username', array('account' => user_load($node->changed_by))),
...
This, of course, is not a proper solution since it alters the core.
So I then tried altering the form via:
function hook_form_node_admin_content_alter(&$form, &$form_state, $form_id) {
$form['admin']['nodes']['#header']['changed_by'] = t('Changed By');
// ... ?
}
Using dpm
I can see that the form has the nodes in options. The problem is that this is the result of rendering the nodes as table options. I don't have access to the original nodes, nor do I want to re-execute the node fetch query in order to get the "changed by" information. I guess doing this in the form hook would not be solving it in the correct layer. Or is it?
So, what is a good way to alter the node_admin_content
form to add more data that exists on nodes?