WordPress.org

Ready to get started?Download WordPress

Forums

WP Survey And Quiz Tool
"Anonymous" Title for Results (8 posts)

  1. trewknowledge
    Member
    Posted 3 years ago #

    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?

  2. Backie
    Member
    Plugin Contributor

    Posted 3 years ago #

    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.

  3. feelfree
    Member
    Posted 3 years ago #

    @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?

  4. Backie
    Member
    Plugin Contributor

    Posted 3 years ago #

    @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.

  5. Mike250
    Member
    Posted 2 years ago #

    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.

  6. Mike250
    Member
    Posted 2 years ago #

    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.

  7. Backie
    Member
    Plugin Contributor

    Posted 2 years ago #

    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']) );

  8. Mike250
    Member
    Posted 2 years ago #

    Brilliant mate, thanks for that!

  9. discokid
    Member
    Posted 2 years ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic