drupal v: 6.17
ubercart 2.0
various other modules that should have no bearing on the content list.

I have been trying to simply add a new column to the content list/table. I have been trying with 'node_admin_nodes' and various other functions to alter the form.

The closest i can get to is show the table with the new column but the search filters have disappeared and the original content list/table shows below. So there are two content lists.

If anyone could point me in the right direction or help out it would be most appreciated.

Comments

nevets’s picture

An alternative approach is to use views and views bulk operations to create a view/page that meets your needs.

webspring’s picture

Thanks for the reply.
I would rather not go in the direction of views for this one. It seems like this should be a simple thing to do, just add a column to the admin content list?

Would anyone have another insight?

nevets’s picture

The default admin page is not designed to be extensible, which is why I suggested views.

webspring’s picture

That is a shame. But i was very close with my solution. I had the new column showing in a working content list, the only problem was that the original content filters had disappeared. I guess i will have to do some messing around with the filter functions/hooks.

Any pointers about the filters at all?

Jaypan’s picture

You can add a column by overriding the theme for the page. I can't remember what the specific theme function is though. It may be theme_node_filter_form().

ron_sparks’s picture

I wanted to o this do so i could add a node reference column.

I have a bunch of locations with auto title linked to centers, it would be nice to have a column that shows URL referrals so i know what the locations are linked to.

Jaypan’s picture

You can add a column by overriding the theme for the page.

You can override the theme function for the page and add your column there.

ron_sparks’s picture

I am not sure i quite know where to start with this but i may have to look into this, and ill search for some views that rebuild the admin management, but i dont really want to rebuild the drupal content management part of the site in views seems like that is counter to using a content management system... but what do i know.

Jaypan’s picture

I think that the miscommunication here is that this thread is in the module development section of the forum, and you are looking for a module to do what you want. I'm telling you how to do it in a module, but that's not what you are looking for.

ron_sparks’s picture

ah i see i need to build the module, thanks for clearing up the muddy ness a little.
If i make something awesome ill share it here.

noah’s picture

I cribbed some code from the "Weight" module to make something similar work. It doesn't actually add a new column to the table, but appends some data to an existing column (the "status" column in this case, though Weight uses "operations"). This just shows the date/time of the last update to each node:

function [module]_form_alter(&$form, $form_state, $form_id) {
	// add "last updated" info to the content list
	if ($form_id == 'node_admin_content') {
		if (!empty($form['admin']['status'])) {
			foreach ($form['admin']['status'] as $nid => $title) {
				$updated = db_result(db_query('SELECT changed FROM node WHERE nid = "%d"', $nid));
				$updated_string = date('Y-m-d \a\t g:ia', $updated);
				$form['admin']['status'][$nid]['#value'] .= " (edited $updated_string)";
			}
		}
	}
}
zeezack’s picture

mikedotexe’s picture

This is a great idea. Way to attack this with a different approach. I wrapped mine in a span tag I can make the text smaller. Thank you, noah

{referring to the post two above me}

Hakuna Matata

mikedotexe’s picture

Views Bulk Operations module creates a new view called "admin_content" that works excellent for adding a column, and having it be sortable.
get VBO module
then navigate to your list of views at admin/build/views

find "admin_content"

If you edit the view and change the Path (under the Page display) from admin/content/node2 to admin/content/node it'll override Drupal's content list.

With only minor tweaking, this was the perfect replacement. This saved the day for me

Hakuna Matata

jo_as_neo’s picture

Extra columns (https://www.drupal.org/project/extra_columns) would fit your need, I think. You can choose which column you want to add from a list of all your fields in all your content types.

See the issue list for a minor glitch and its manual fix.