Here is a patch that adds filtering criteria for node type and author role to the admin/content/modr8 screen. The node type select also displays the number of nodes pending moderation for each content type to ease navigation.

Comments

mathankumarc’s picture

Version: 6.x-1.3 » 7.x-1.x-dev

Thanks for your effort.

New features are going into 7.x

mathankumarc’s picture

StatusFileSize
new5.25 KB

Here is patch. This will allow you to filter by the content type and/or username.

pwolanin’s picture

Status: Needs review » Needs work

typo: //Theming is not neede here

I think you should use button-level submit functions. Switch on 'op' is deprecated. Also - it would seem odd that the filter creteria can change at the same time you submit moderation actions?

pwolanin’s picture

if you rewrite the filter form and set the method to 'get' as the original patch does, I would suggest setting also

$form['token'] = FALSE;

per http://api.drupal.org/api/drupal/includes!form.inc/function/drupal_prepa... to skip the form token which will otherwise get added to the URL and potentially get logged more readily.

mathankumarc’s picture

StatusFileSize
new4.25 KB

Here is the modified patch. Added reset button, however its not working.

pwolanin’s picture

So, the reset button should just send the user to a path with no filters?

$form['#method'] = 'GET';

maybe need to be this?

$form['#method'] = 'get';

Also, I'd make the query params more specific. e.g. 'modr8-user' instead of 'user'

pwolanin’s picture

Oh, I see - the reset button is trying to do something more complicated.

For now - you can just make it a reset link?

mathankumarc’s picture

So, the reset button should just send the user to a path with no filters?

yeah.

Also, I'd make the query params more specific. e.g. 'modr8-user' instead of 'user'

thats perfect. will modify it.

Oh, I see - the reset button is trying to do something more complicated.

$form_state['rebuild'] = TRUE;
Will clear the values in the from. however I dunno how to make it work. For now I will make this as a link

mathankumarc’s picture

Status: Needs work » Needs review
StatusFileSize
new4.2 KB

Modified the patch as per the review comments.

pwolanin’s picture

minor improvement:

if (is_object($user) && $user->uid) {

means I cannot filter for anonymous user content.

Maybe better:

if (isset($user->uid)) {
pwolanin’s picture

I think this might be wrong?

+    if (!isset($_GET[$type])) {
+      break;
+    }

should be like:

+    if (empty($_GET[$type])) {
+      continue;
+    }
mathankumarc’s picture

StatusFileSize
new4.17 KB

Yeah got it. If I use the empty() in the first one, then two conditions are not needed in the second one.

Here is the modified patch. Removed some unwanted conditions.

pwolanin’s picture

looks reasonable - if it works, probably RTBC.

mathankumarc’s picture

Status: Needs review » Fixed

Tested and Committed to dev.

bduell’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
StatusFileSize
new5.05 KB

I used the above patch to do the same for the 6.x-1.x version (only, allowing multiple types to be selected because that's what we needed).

Please find the attached patch.

Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

mathankumarc’s picture

@BDuell

I'm glad that, it worked for you. But I don't have any plans to add any new features into 6.x

ssn’s picture

@BDuell Many Thanks dude, your patch is exactly what i was looking for. I made some changes in the get_modr8_node_types() function so that the labels for the content types are displayed as options in select list instead of machine names of the content types. Here is the code hope it will make the select list more user friendly.

/**
 * To fetch the moderation enabled node type list
 */
function get_modr8_node_types() {
  $node_options = array('[any]' => 'Any');
  $result = db_query("SELECT distinct n.type FROM node n WHERE n.moderate = 1 order by n.type");
  while ($r = db_fetch_array($result)) {
    $node_options[$r['type']] = $r['type'];
  }

  //To use labels of the node types for options in select list instead of machine names of the node types. 
  //This makes the select list more user friendly
  $node_types = node_get_types('names');
  foreach($node_options as $type=>$label) {
      $node_options[$type] = $node_types[$type];
  }
  
  return $node_options;
}

This is a little help to make the filter more user friendly.
Again many thanks BDuell