I'm using WebForm to build a list of people, in Drupal 7. I want to display the number of submissions to folks. Not the content of each submission, just the total number of submissions. I have a View that displays this count to me - the administrator - but the View shows zero for anonymous visitors. Any suggestions? Can I do this in Views? Something I need to do in Permissions? Do I need to do this in code?

Comments

NotGoddess’s picture

Under the advanced settings you can click on 'Query Settings' and check the box to disable SQL rewriting. That will disable node access calls and may give you the info you want.

I'm unique, just like everybody else.
If I helped, please pay it forward, backward or sidelong.

ArthurC’s picture

I tried your suggestion, NotGoddess, but it made no difference. I could possibly create a tpl.php. I may have to create one. But truthfully, I'd spend hours trying to figure out what code to put into it. If it's a permissions thing, is it possible that by the time the process got to the custom template file, the permissions code would already have set the value I need, to zero.

If I were just writing SQL, I'd write:
SELECT count( sid ) AS TotalSubmissions FROM `webform_submissions` WHERE nid = X;

NotGoddess’s picture

Sometimes you need to take an end-run around the permissions to get what you want. That'll do it- maybe just whip up a custom module to display the block so you can have caching & your own permissions in place. That way you won't need to enable the PHP input filter.
See the examples module if you need help making it.

I'm unique, just like everybody else.
If I helped, please pay it forward, backward or sidelong.

Spokenbird’s picture

Sorry to revive an old thread, but did you ever get a working solution to this? I am having the same issue where I, logged in as administrator, can see the submission number, but those logged in as regular users cannot. 

Would love to get this working. 

danchadwick’s picture

There is views support for a submission count. Look under either Content (for a list of submissions for this node) or user (for a list of submissions of any node by this user).

For Content, the count is:

  1. A link to the results page, with a count of all results, if the user is authorized to see all results, OR
  2. A link to the user's submissions, with a count of the user's submissions, if the user is authorized to see their submissions, OR
  3. A simple count of all the submissions.

Requires webform 7.x-4.2 or later.

gogowitsch’s picture

For Drupal 8-11, these modules can show a counter (or a bar, if you have a target count):

These 2 solutions don’t require views.