tabulated survey at topic head

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in the Customisations Database.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTICE: This forum is only for the announcement of new releases and/or updates of MODs. Any MOD support should be obtained through the Customisations Database in the support area designated for each MOD.

A direct link to support for each MOD is in the first post of the respective topic.
Locked
ddaddy
Registered User
Posts: 100
Joined: Sun Dec 21, 2008 6:24 pm

Re: tabulated survey at topic head

Post by ddaddy »

I have that set already.
The survey is not a hidden survey, but i've set that the users are hidden once theyve taken the survey.
Is it possible for Admin to see the list of users, or can you only use the 'Retrieve answers from other user' option to go through them 1 at a time?

Cheers

asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: tabulated survey at topic head

Post by asinshesq »

[deleted to avoid future confusion]
Last edited by asinshesq on Wed Jun 24, 2009 4:07 pm, edited 1 time in total.

ddaddy
Registered User
Posts: 100
Joined: Sun Dec 21, 2008 6:24 pm

Re: tabulated survey at topic head

Post by ddaddy »

The permissions are set. If I set the questionnaire to hide results and show users, it shows fine to admins :-)

But if I set a questionnaire to show results, but hide users, it doesn't show the users list to anyone, even admins!

asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: tabulated survey at topic head

Post by asinshesq »

ddaddy wrote:The permissions are set. If I set the questionnaire to hide results and show users, it shows fine to admins :-)

But if I set a questionnaire to show results, but hide users, it doesn't show the users list to anyone, even admins!
Ah, my mistake, I wasn't following what you were originally asking about. The mod has two separate settings:

- hide survey results (with this setting, the poster and persons with special permission can still see the results)

- hide names of responders (with this setting, no one can see the names of responders, because the idea behind this setting was for the survey to be totally anonymous).

If you want to allow admins to see names of responders even when you have a survey that hides the names, you would do this:

Code: Select all

OPEN
includes/functions_survey.php

FIND
			if (!$survey_data['hide_names_of_respondents'])

REPLACE WITH
			if (!$survey_data['hide_names_of_respondents'] || $auth->acl_get('a_'))
Let me know if that does it for you. Also keep in mind the privacy issues this creates if people incorrectly believe their responses are totally anonymous. I would suggest that if you use this you make it clear to your users that even though their responses are anonymous to regular users, admins will still see be able to see the names of the responders.

t2ffn
Registered User
Posts: 61
Joined: Tue Jun 02, 2009 7:44 pm
Location: Hull, England

Re: tabulated survey at topic head

Post by t2ffn »

asinshesq wrote:
t2ffn wrote:Can I limit the groups the Survey shows when selecting who needs to answer the survey? I want to remove Bots, Admin, Registered Users etc etc as I have my own groups set up and want to declutter the list.
Oops, I thought I had actually done that for the obvious groups that should be skipped (must have been for one of my other mods). Anyway, try this:

Code: Select all

OPEN
includes/functions_survey.php

FIND
	if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
	{
		$sql = 'SELECT group_id, group_name, group_type
			FROM ' . GROUPS_TABLE . '
			ORDER BY group_name';
	}
	else
	{
		$sql = 'SELECT DISTINCT g.group_id, g.group_name, g.group_type
			FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . ' ug
			WHERE g.group_type <> ' . GROUP_HIDDEN . '
				OR
				(
					g.group_id = ug.group_id
					AND ug.user_id = ' . $user->data['user_id'] . '
					AND ug.user_pending = 0
				)
			ORDER BY g.group_name';
	}

REPLACE WITH
	// define special groups like BOTS that should not show up in the list
	$skipped_groups = "('BOTS', 'GUESTS', 'REGISTERED_COPPA')";

	if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
	{
		$sql = 'SELECT group_id, group_name, group_type
			FROM ' . GROUPS_TABLE . '
			WHERE group_name NOT IN ' . $skipped_groups . '
			ORDER BY group_name';
	}
	else
	{
		$sql = 'SELECT DISTINCT g.group_id, g.group_name, g.group_type
			FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . ' ug
			WHERE g.group_name NOT IN ' . $skipped_groups . '
				AND
				(
					g.group_type <> ' . GROUP_HIDDEN . '
					OR
					(
						g.group_id = ug.group_id
						AND ug.user_id = ' . $user->data['user_id'] . '
						AND ug.user_pending = 0
					)
				)
			ORDER BY g.group_name';
	}
Once you have done that, you can tinker with the $skipped_groups line above if you want it to skip groups beyond the ones I have up there. For example, if you wanted to skip all the groups that are automatically set up by phpbb3, the line would read:

Code: Select all

	$skipped_groups = "('ADMINISTRATORS', 'BOTS', 'GLOBAL_MODERATORS', 'GUESTS', 'REGISTERED', 'REGISTERED_COPPA')";
Please let me know if this works right.
[edit: I see I missed a close single-quote at after 'ADMINISTRATORS in the second $skippped_groups definition, so I just added that]
asinshesq, finally got this installed, and this works perfectly!

Thanks a lot :D

ddaddy
Registered User
Posts: 100
Joined: Sun Dec 21, 2008 6:24 pm

Re: tabulated survey at topic head

Post by ddaddy »

In the list of users that haven't yet completed the survey, its showing users that have been inactivated. Is it possible to remove these from the list?

Thanks

asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: tabulated survey at topic head

Post by asinshesq »

ddaddy wrote:In the list of users that haven't yet completed the survey, its showing users that have been inactivated. Is it possible to remove these from the list?

Thanks
Try this:

Code: Select all

OPEN
includes/functions_survey.php

FIND
			' . $sql_not_in_user_id_list . '

AFTER, ADD
			AND u.user_type <> ' . USER_INACTIVE . '
Let me know if that does the trick.
Last edited by asinshesq on Sun Jul 05, 2009 10:01 am, edited 3 times in total.

ddaddy
Registered User
Posts: 100
Joined: Sun Dec 21, 2008 6:24 pm

Re: tabulated survey at topic head

Post by ddaddy »

asinshesq wrote:
ddaddy wrote:In the list of users that haven't yet completed the survey, its showing users that have been inactivated. Is it possible to remove these from the list?

Thanks
Try this:

Code: Select all

OPEN
includes/functions_survey.php

FIND
			AND sa.survey_id = ' . $survey_data['survey_id'] . '
BEFORE, ADD
			AND u.user_type = ' . USER_INACTIVE . '
Let me know if that does the trick.
Didn't work. I resulted in none of the results being shown, and all users being listed as not completing the survey.
Changing it back brought all the results back.

ddaddy
Registered User
Posts: 100
Joined: Sun Dec 21, 2008 6:24 pm

Re: tabulated survey at topic head

Post by ddaddy »

I've sussed it.

Code: Select all

FIND
' . $sql_not_in_user_id_list . '

ADD AFTER
AND u.user_type != ' . USER_INACTIVE . '
Cheers

asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: tabulated survey at topic head

Post by asinshesq »

ddaddy wrote:I've sussed it.

Code: Select all

FIND
' . $sql_not_in_user_id_list . '

ADD AFTER
AND u.user_type != ' . USER_INACTIVE . '
Cheers
Right, I meant NOT equal to rather than equal to!

asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: tabulated survey at topic head

Post by asinshesq »

But by the way, people should use <> rather than != in sql statements because not all supported databases allow !=. So the change people should make to exclude inactive users in the list of people who have not taken the survey is the one I describe a few posts up (see http://www.phpbb.com/community/viewtopi ... #p10095675 ).

ddaddy
Registered User
Posts: 100
Joined: Sun Dec 21, 2008 6:24 pm

Re: tabulated survey at topic head

Post by ddaddy »

You've put it in the wrong q1uery though. This stops inactive users results being shown.
You need it in the next query to stop their names being shown.

Code: Select all

FIND
' . $sql_not_in_user_id_list . '

ADD AFTER
AND u.user_type <> ' . USER_INACTIVE . '

asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: tabulated survey at topic head

Post by asinshesq »

ddaddy wrote:You've put it in the wrong q1uery though. This stops inactive users results being shown.
You need it in the next query to stop their names being shown.

Code: Select all

FIND
' . $sql_not_in_user_id_list . '

ADD AFTER
AND u.user_type <> ' . USER_INACTIVE . '
Right, careless error as usual. I've corrected the post above to match yours.

User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 17223
Joined: Thu Jan 06, 2005 1:30 pm
Location: Fishkill, NY
Name: David Colón
Contact:

tabulated survey at topic head

Post by DavidIQ »

MOD Updated to version 1.0.8
See first post for Download Link
Apply to become a Jr. Extension Validator
My extensions | In need of phpBB services? | Was I helpful today?
No unsolicited PMs unless you're planning on asking for paid help.

asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: tabulated survey at topic head

Post by asinshesq »

DavidIQ wrote:MOD Updated to version 1.0.8
See first post for Download Link
Thanks, David and the rest of the mod team. Here's the changelog letting you know what changes have been made since version 1.0.7:

Code: Select all

##	2009-06-18 - Version 1.0.8
##		fixed problems in prosilver template that interfered with use of FIND when using answer for another user feature
##		and that caused strict xhmtl validation to fail when not showing nonresponders
##
##		fixed survey.php errors that sometimes prevented answer for another user feature from working
##
##		changed code so that certain groups like guests and bots are excluded from the list of groups who can take surveys
##
##		added umil install for permissions and db changes
I have included upgrade scripts in the contrib folder for anyone who is upgrading from a prior version.
Last edited by asinshesq on Mon Jul 13, 2009 10:07 am, edited 2 times in total.

Locked

Return to “[3.0.x] MOD Database Releases”

cron