Add views filter 'Author is Current Logged in User'

lelizondob - October 30, 2008 - 10:27
Project:Revision Moderation
Version:5.x-1.1
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

I'm trying to create a view to show nodes created/edited by the current logged in user. The nodes created by the current logged in user it's not a problem, the problem comes with the nodes a user edited. Let me try to make this clear:

If user A creates a node and then user B edit the node, there's no possible way to show a view for user B showing the node he/she edited, but also I want the user A to see the node he/she created. This way the node has two or more "owners".

I think this module is great for doing that, I just had to add a new filter for views..

I changed revision_moderation_views.inc on line 102

    'filters' => array(
      'uid' => array(
        'name' => t('Node revision: Author is Current Logged in User'),
        'operator' => 'views_handler_operator_eqneq',
        'list' => 'views_handler_filter_usercurrent',
        'handler' => 'views_handler_filter_usercurrent_custom',
        'value-type' => 'array',
        'help' => t('This allows you to filter by the logged in user.'),
      ),

This code works, but it will also remove the filter that lets you 'Select an Author'. The problem is when having two:

      'uid' => array(

inside the 'filters' array

if anyone can review this code and tell me how to change that line I'll be happy to provide the community with a patch to add a filter and not remove the original.

#1

lelizondob - October 30, 2008 - 11:03
Project:NodeReview» Revision Moderation
Version:5.x-1.0» 5.x-1.1

Posted on the wrong module.. this belongs to the revision moderation module.

 
 

Drupal is a registered trademark of Dries Buytaert.