• Hello,

    I have enabled the option for users to enter their contact details before proceeding with the quiz. I have then added 2 fields, name and email.

    Is there a way to make the title for the the results the person’s name instead of anonymous?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Well currently the only way to do it is by using the default form and using custom pages functionality to remove fields you don’t want.

    @trewknowledge We are facing the same issue. Tried different options but it still says Anonymous instead of the Name. Were you able to find a work around for this issue?

    @feelfree As I stated the only work around is not using the custom forms and instead using the default one provided by the plugin and then using the custom pages functionality to override the form to add the fields you want.

    This design problem has been fixed in the development version, which sadly is currently in no shape for anyone to use.

    I have developed my own workaround. Assuming your two new fields, “name” and “email”, I would expect the form entry name would be:

    Custom_name
    Custom_email

    You should see this on the Mark page. If it’s something else change my below code accordingly.

    Here’s what you do. This is assuming out of the box 1.3.32 installation:

    Edit /wp-content/plugins/wp-survey-and-quiz-tool/pages/admin/results/index.php and add locate line 50:

    <?php foreach( $results as $result ){ ?>

    Under it add:

    <?php
    	$mydata = unserialize($result['person']);
    	$name = ucwords($mydata['Custom_name']);
    	$email = $mydata['Custom_email'];
    ?>

    Then on line 55 replace:

    <?php echo htmlentities($result['person_name']); ?>

    with:

    <?php echo "$name $email"; ?>

    Note: ucwords() makes the name appear in sentence case, capitalizing the first letter of each word. It just looks more professional to me.

    Any troubles, leave me a message.

    I have developed my own workaround. Assuming your two new fields, “name” and “email”, I would expect the form entry name would be:

    Custom_name
    Custom_email

    You should see this on the Mark page. If it’s something else change my below code accordingly.

    Here’s what you do. This is assuming out of the box 1.3.32 installation:

    Edit /wp-content/plugins/wp-survey-and-quiz-tool/pages/admin/results/index.php and add locate line 50:

    <?php foreach( $results as $result ){ ?>

    Under it add:

    <?php
    	$mydata = unserialize($result['person']);
    	$name = ucwords($mydata['Custom_name']);
    	$email = $mydata['Custom_email'];
    ?>

    Then on line 55 replace:

    <?php echo htmlentities($result['person_name']); ?>

    with:

    <?php echo "$name $email"; ?>

    Note: ucwords() makes the name appear in sentence case, capitalizing the first letter of each word. It just looks more professional to me.

    Any troubles, leave me a message.

    Hi,
    Cheers for sharing this tidbit, I thought I should pointout that you really should be escaping the html entities in the name and email as currently you’re wide open to a XSS attack. Also to get the proper desired effect it should be

    $name = ucword( strtolower($mydata['Custom_name']) );

    Brilliant mate, thanks for that!

    Hi guys, am I right in thinking this will list the username entered in the form rather than the WordPress username? If so, can the WP username be listed instead?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: WP Survey And Quiz Tool] "Anonymous" Title for Results’ is closed to new replies.