I'm sorry to post this but, there are a ton of issues about providing a field in views for the person who changed the state of the workflow. None of these issues seem to provide any resolution to the issue, at least that I could find.

So here's a start... It'd be great if someone smarter then me could grab the users name and replace it with the uid, but for what I'm doing UID suffices.

Comments

dstol’s picture

StatusFileSize
new935 bytes

Err, forgot the patch.

eforth’s picture

Any progress on this? I've been trying, but I'm lack of skills ^^

ngocleanh’s picture

I want name not uid?

dstol’s picture

Version: 6.x-1.3 » 6.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new1021 bytes

Here's the added relationship to accomplish adding the user name rather then the UID.

So add the relationship called User and then you can add the field for the user name.

jcisio’s picture

Title: Views field for user who changed the state » Support for UID/name in Views
Status: Needs review » Needs work

Thanks for the patch, dstol. It works as expected. But, could you add just more: not only display this field, but can filter this field (like, show all nodes that are currently set by the user XYZ)?

jcisio’s picture

Marking #486896: Add Workflow-User relationship to View as duplicate. The patch provided from that issue complement this patch to solve the problem!

pbeakley’s picture

I'm having some trouble working out the logic of the relationship. Say I wanted to get the user who triggered the change in a particular workflow state of a node -- how would I go about doing that? Is that even possible with this patch?

EDIT: Okay, so what I've attempted is a View with the node's argument, two fields (previous workflow and user) and a Workflow: user relationship. For the user field, I'm requiring the Workflow: User relationship. However, all I'm getting is the last user to have moved the node's workflow state. What I was hoping for was a table, say, of all the states and the user who triggered each state.

alasda’s picture

Status: Needs work » Needs review
StatusFileSize
new1.09 KB

This patch adds argument and filter support, along with the relationship and field.

andreiashu’s picture

Status: Needs review » Reviewed & tested by the community

I tested the patch from #8 for relationship and filtering and it works as expected. RTBC

restyler’s picture

Thank you, guys!
The latest patch is not working as expected (by me) when I add Workflow:user field to view.
It shows user uid instead of showing (expected by me) username.
I'm not sure that is a bug, just wanted to highlight that.

Exploratus’s picture

When I add it as a filter, it just shows the user id of the node author???? What good is that for?

I basically have the same issue as #7

leoklein’s picture

@whatmetropolis: You need to create a 'relationship' for workflow user and then point to that relationship when adding the user field to your View.

In any case, patch from #8 works for me. Thanks.

hlopes’s picture

This patch throws me a warning on views 6.x.2.11.

warning: htmlspecialchars() expects parameter 1 to be string, array given in /home/escr/public_html/includes/bootstrap.inc on line 859.

This happens as soon as i select "Link this field to its node" on a display that has this relationship and an argument that uses it.

#EDIT: Sorry, my bad.... It has nothing to do with this patch.

jdwfly’s picture

I'm for this too. Using the relationship to get the user name worked quite well. The patch failed to apply for me but I put it in by hand so it may need to be rerolled with the latest version.

Bastlynn’s picture

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

I'm going to re-roll the patch for the 7.x branch and try to resolve the issues we're seeing with it applying. Once I've got that, the fix will get backported to 6.x.

Bastlynn’s picture

I tweaked the code in #8 a little to make the need for the relationship to get the data in clearer. Otherwise, nice work! It's committed to the D7 branch and I'll backport to D6.

Bastlynn’s picture

Status: Reviewed & tested by the community » Closed (fixed)

Patch has been backported to 6 on the 6.x-1.x branch. It's currently in dev, but when the branch is next released it'll be out there official like.

dstol’s picture

Awesome thanks Bastlynn!

leoklein’s picture

Thank you! I had the same problem this year!