By tryitonce on
I would like to add the "Last Editor" to a View.
There is some info here - but that is not enough for my limited php skills - amounting to copy, cut and paste only - http://drupal.org/node/81242.
The view would be a table and show
Title - Last Edited (time) - Last Edited by (Last Editor)
What would be the php code to add to Views in Custom Field php-code??
Thanks for all pointers ....
Comments
_
In views, the fields User: Name (which will be the last editor) and Node: Updated date are already available, so I don't see why you need any custom PHP for this...
_
you sure? I thought you had to use a relationship to node revisions to get the revision user?
_
Yes, you're right, as ever :-)
Thanks for jumping in!
_
Sorry Pete,
WorldFallz is right. The user I get is the author - original author - not the last editor. Just have a look at - http://www.example.com/admin/content/node - the core listing of content
There must be a special php or other formatted way to retrieve the last editor in a view.
More suggestions are welcome - thanks
_
Yep-- as I mentioned above, add a relationship for 'node revisions', then when you add the "user: name" field specify that relationship.
_
Sorry, I over-read the solution. With the "?" it looked like you are guessing - but it was obviously just the very polite form of pointing in the right direction.
And yes, it works as you said. Thanks!!!!!!!!
I would to do the same in
I would to do the same in VBO...does exist a solution since 2010 ?
thanks
Dev Server Shared Hosting
8 websites powered by drupal 6,8 & 9 - Hosted by Always Data
Great thread! This is exactly
Great thread! This is exactly what I needed! Yep, all you do is add a relationship to your view. Click add relationship, select the "Node revision: User - Relate a node revision to the user who created the revision." Once you have added that, then add/edit your user:name field to the fields section and when you edit it, you will see a use this relationship dropdown. Select the relationship you just added.
With my view I added one field of the username using the relationship and one without using the relationship. This way I can see who the original submitter of contact was and who last updated it. This is exactly what I was looking for! Thanks guys!
thanks for the tips
thanks for the tips
Dev Server Shared Hosting
8 websites powered by drupal 6,8 & 9 - Hosted by Always Data
Thanks,
Thanks,
Awesome thread! it works with little change for Drupal 7
You need to add a relationship to your view. Click add relationship, select the "Content revision: User
Relate a content revision to the user who created the revision." Once you have added that, then add/edit your user:name field to the fields section and when you edit it, you will see a use this relationship dropdown. Select the relationship you just added. Cheers !
It is not working at all, it
It is not working at all, it's showing random stuff, instead of related to the node I'm currently viewing and there's no way to set relationship "node -> viewed"
Work-around
Just add the field "Content: Last edited by" to your view. This will give the username of the user who has last modified the content. (No relationships required)
_
afaik, there is no such field provided by core-- even the author field requires a relationship for anything other than the UID.