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

pbarnett’s picture

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...

WorldFallz’s picture

you sure? I thought you had to use a relationship to node revisions to get the revision user?

pbarnett’s picture

Yes, you're right, as ever :-)

Thanks for jumping in!

tryitonce’s picture

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

WorldFallz’s picture

There must be a special php or other formatted way to retrieve the last editor in a view.

Yep-- as I mentioned above, add a relationship for 'node revisions', then when you add the "user: name" field specify that relationship.

tryitonce’s picture

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!!!!!!!!

aiphes’s picture

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

drupalfan81’s picture

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!

aiphes’s picture

thanks for the tips

Dev Server Shared Hosting
8 websites powered by drupal 6,8 & 9 - Hosted by Always Data

jatorresdev’s picture

Thanks,

smndey’s picture

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 !

v8powerage’s picture

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"

romina.nayak’s picture

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)

WorldFallz’s picture

afaik, there is no such field provided by core-- even the author field requires a relationship for anything other than the UID.