Here's my use case: I need a list of webforms on the site that the current user hasn't filled out yet (or a list of webforms filled out by the current user). By restricting this information to the current user only, we don't need to worry about access permission issues, users already know what webforms they have submitted.

The patch applies to views/webform.views.inc, and the new handler file has attached separately (thanks CVS for not allowing to diff new files) with a .txt appended (.inc uploads are not allowed).

Credit: I used the views integration of node and flag as examples/references.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

djalloway’s picture

FileSize
2.67 KB

@flobruit,
I've tested your code and it seems to work as intended.
If it is alright with you, I've cleaned up some of the wording and names to clarify the filter a bit.

I've also rolled the patch to include the new file via CVS.
Here are the results.

**The trick to getting CVS to add new files when you roll a patch, is to manually modify the hidden CVS folder entries, and add a new line for each of your new files. You can read more about that at here (mid-way down the page under the section "Adding/Deleting Files Using the Diff Command")**

floretan’s picture

@djalloway: Thanks for the fixes and the CVS hint!

Is there any chance this could be committed to webform_views as well?

djalloway’s picture

looking to add this to the webform_views module.

but... the Left Join is making the view display duplicates (5 submissions on 1 Webform = 5 Results).

floretan’s picture

I only used the negative version of the filter, but the positive does indeed result in duplicate results. The solution would be to use an EXISTS subquery instead, but that's not used anywhere else in Drupal due to the way db_rewrite_sql() works.

Given that this filter only applies to webforms submitted by the current user, I guess it could be ok to bypass db_rewrite_sql() without risking to disclose private information. However, the positive version of the filter doesn't really make that much sense in real use cases, so maybe we need to drop it and simply keep the negative version, which can be very useful especially combined with other filters (pending webforms in your groups for example).

djalloway’s picture

sure, that is worth a shot.

Dave Sherohman’s picture

Version: » 6.x-2.9

Are there any changes on this since the October 12 revision of the patch?

I'm going to be looking in the near future to present users with a list of eight webforms (out of nine total existing on the site) with an indicator for each showing whether the user has completed it or not. Display will be a single list with fixed order which may mix positive/negative results (e.g., webforms should be ordered 1, 2, 3, 4, 5, 6, 7, 8 even when user has done #1, 3, 5, and 7, but not #2, 4, 6, or 8). Does that fall within (or at least fairly close to) what this patch does or will I be better off building that functionality from scratch?

quicksketch’s picture

Version: 6.x-2.9 » 6.x-3.0-beta6

If this issue hasn't been marked as "fixed" this hasn't been committed. The Views integration is only included in the 3.x version. This feature does sound like what you want though other than I'm not sure what you mean by "positive/negative" results.

Dave Sherohman’s picture

By "positive/negative" results, I was adopting comment #4's usage of the "positive version" (returns forms the user has submitted) and "negative version" (returns forms the user has not submitted) of the filter.

Is there an expected completion date on 6.x-3.0 or is it on a purely "it'll be ready when it's ready" timeline?

quicksketch’s picture

I've been hoping to get 3.0 out for some time, I think this latest beta6 will be the last, then we'll move into RCs or possibly directly to a final release. 3.0 is already more stable than 2.x is, since it's moved a lot of areas that caused trouble (such as modifying the node form). That said, a final 3.0 release does NOT mean that the feature in this issue will be included. Most likely it won't be, as I'm really only concentrating on bugs to get the 3.0 version out the door.

Apfel007’s picture

is this patch already included?

quicksketch’s picture

No this patch is not in the 3.x version of the module yet.

YK85’s picture

subscribing

derhasi’s picture

Issue tags: +dvcs11

This issue can be solved by fixing #1258044: Webform views integration needs to provide relationships for both user and node based views.. Then the user filters can be used to fullfill this need.

quicksketch, shall it be marked as duplicate?

derhasi’s picture

Status: Needs review » Closed (duplicate)

Ok, as this is state of February, I guess it's okay to mark it as duplicate ;)