Sometimes you might want to see more than the standard 50 nodes per page when you administer content (/admin/content/node/overview). Unfortunately, this number of 50 nodes per page is hardcoded into the Node core module (modules/node/node.admin.inc, line 461).
This mini module adds a select field to the administer content page for selecting a different number of nodes per page and stores this value in the variable table in the database.
Important note:
For this mini module to work you need to modify code from a core function. It's only a slight modification but be sure you know what you do. And in any case read the following instructions beforehand:
Cleanly overriding core modules in Drupal through the magic of multisite
http://raincitystudios.com/blogs-and-pods/boris-mann/cleanly-overriding-...
One way to override Drupal core modules - safely
http://www.elvisblogs.org/drupal/one-way-override-drupal-core-modules-sa...
Overriding core module functions
For an ongoing discussion about this delicate subject see:
Enable override and extension of core module functions
http://drupal.org/node/29428
Modification to node.admin.inc
Here's the modification to the node.admin.inc file. You have to replace the hardcoded 50 in the pager_query() function with a variable ($limit) which calls the variable from the database or sets a default value, if the variable is not set.
/**
* Form builder: Builds the node administration overview.
*/
function node_admin_nodes() {
$limit = variable_get('default_nodes_overview', 50); // added for the module
$filter = node_build_filter_query();
$result = pager_query(db_rewrite_sql('SELECT n.*, u.name FROM {node} n '. $filter['join'] .' INNER JOIN {users} u ON n.uid = u.uid '. $filter['where'] .' ORDER BY n.changed DESC'), $limit, 0, NULL, $filter['args']);
...
.module file
// $Id$
/**
* @file
* Sets the default number of nodes to display per page on the content admin page (/admin/content/node/overview).
*/
/**
* Implements hook_form_alter().
* Adds a select field and a submit button to node_admin_content form.
*/
function default_nodes_overview_form_node_admin_content_alter(&$form, &$form_state) {
$form['default_nodes_overview'] = array(
'#type' => 'select',
'#title' => t('Number of nodes on content admin page'),
'#default_value' => variable_get('default_nodes_overview', 50),
'#options' => drupal_map_assoc(array(10, 15, 20, 25, 50, 100, 200)),
'#description' => t('The default number of nodes to display per page on the content admin page (/admin/content/node/overview).'),
'#weight' => 1,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save settings'),
'#submit' => array('system_settings_form_submit'),
'#weight' => 2,
);
}
.info file
name = "Default Nodes Overview"
description = "Sets the default number of nodes to display per page on the content admin page (/admin/content/node/overview)."
core = 6.x
package= Core modifications
Comments
Shouldn't this be made into a
Shouldn't this be made into a variable in core?
Cheers
________________
Live fast die young
Doesn't work for Drupal
Doesn't work for Drupal 6.2
$result = pager_query(db_rewrite_sql('SELECT n.*, u.name FROM {node} n '. $filter['join'] .' INNER JOIN {users} u ON n.uid = u.uid '. $filter['where'] .' ORDER BY n.changed DESC'), 50, 0, NULL, $filter['args']);
--
Qasim Zeeshan
http://qasimzeeshan.com
Change code
This is the most simple you can do:
Look at file node.admin.inc
Change 50 to 500 (or any number you want):
" $nids = $query
->fields('n',array('nid'))
->limit(50)
->orderByHeader($header)
->execute()
->fetchCol();
Ony that!
My sites: Medicare
Thanks. This worked great!
I like this solution and understand wholeheartedly that we are not supposed to touch the core, but in a time crunch, I see nothing wrong with changing one hard coded number in the core. I think the drupal 7 team should make this customizable in the admin.
Great solution and the quickest!
I am confused
Where in the file (and which file?) do I add this?
" $nids = $query
->fields('n',array('nid'))
->limit(50)
->orderByHeader($header)
->execute()
->fetchCol();
Thanks
Node Module
modules/node/node.admin.inc
try this one
$nids = $query
->fields('n',array('nid'))
->limit(50)
->orderByHeader($header)
->addTag('node_access')
->execute()
->fetchCol();
Change 50 to whatever you want.
Note. please browse module page and clear cache after changing this file.
This module does the trick:
This module does the trick: https://www.drupal.org/project/admin_frosting
Thanks for the pointer.
Thanks for the pointer. Admittedly, this post might have gotten a bit stale in the meantime ;-)