Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter DaveMaison

    (@davemaison)

    Had to figure it out on my own because I’m on a time crunch. Here is how you add custom replacement tokens.

    Open wp-content/wp-survey-and-quiz-tool/lib/wpsqt/Tokens.php:

    in the getTokenObject() function, add the following line:
    self::$instance->addToken(“YOUR_CUSTOM_TOKEN“, “Description of your token that appears in the plugin.“)

    in the setDefaultValues() function, add the following line:
    $this->setTokenValue(‘YOUR_CUSTOM_TOKEN‘, ( isset($_SESSION[‘wpsqt’][$quizName][‘Custom_YourName‘]) ) ? $_SESSION[‘wpsqt’][$quizName][‘Custom_YourName‘] : ‘Anonymous User’);

    Open wp-content/wp-survey-and-quiz-tool/pages/site/quiz/section.php:

    At the top of the page add the following
    <?php
    if( !isset( $_SESSION[‘wpsqt’][$quizName][‘Custom_YourName‘] ) && $_REQUEST[ ‘Custom_YourName‘ ] != ” ){
    $_SESSION[‘wpsqt’][$quizName][‘Custom_YourName‘] = $_REQUEST[ ‘Custom_YourName‘ ];
    }
    ?>

    Note: Replace the italicized values with whatever your want. Names of request objects of the custom form fields will have spaces removed and prefixed by “Custom_”.

    Example: Your Name becomes Custom_YourName

    Thread Starter DaveMaison

    (@davemaison)

    Was this plugin abandoned?

Viewing 2 replies - 1 through 2 (of 2 total)