[Plugin: WP Survey And Quiz Tool] Filters, hooks and custom pages
-
Ollie, or anyone else that can help…
Awesome plugin, nothing else out there that has the same capabilities. Thank you!
I am wanting to customise quite a bit for a client’s needs.
The plugin page says:
Developer Features
Currently 30+ filters and hooks to use throughout the plugin to help extend it without editing the plugin.
Custom pages allows for the theming of the plugin pages without editing the plugin.Is there any current documentation to refer to for these in order to extend the plugin?
Thanks kindly
https://www.ads-software.com/extend/plugins/wp-survey-and-quiz-tool/
-
I would like to know that as well.
@techjeb where you able to get some information on this? Would you be able to send it my way?
Unfortunately I didn’t @radi_v
I ended up editing core files to achieve what I needed.
The implementation is now live and you can see it at https://yourfertility.org.au/fertility-quiz
Happy to answer any questions you may have.
it looks very nice. would you be able to send it to me ? Also would it be possible to have a chat? I need help with making my modifications and would love some suggestions.
please email me at: radi(at)sineinc(dot)com
Thanks,
RadiNicely done. What WPSQT version are you using?
Would love documentation on this plugin too. =)
Been editing and editing the core. Then an Update pops up. =(Hi techjeb,
I checked your website https://yourfertility.org.au/fertility-quiz and find the quiz very attractive.
I want to use WPSQT in the same way but with timer and result. Is it possible , you can share your version with me. Any help will be appreciated.
My website: https://www.turntechie.com
My email Id: [email protected]Thanks in Advance
Abhishek SaxenaI just did a quick search through all the code to find the filter hooks. This is what I found (showing line numbers and a bit of context around each hook). Most of them it seems to be pretty self-evident what the hook does.
lib\Wpsqt\Admin.php161 apply_filters('wpsqt_admin_init',$this) 264 echo apply_filters('wpsqt-export-csv', implode("\r\n", $lines), $_GET['id']); // after sending page headers
lib\Wpsqt\Core.php
00086: public function init(){ 00087: 00088: apply_filters("wpsqt_init",$this); 00353: $possibleLocations = array(); 00354: $possibleLocations[] = WPSQT_DIR.'lib/'; 00355: $possibleLocations = apply_filters('wpsqt_plugin_locations',$possibleLocations);
lib\Wpsqt\Shortcode.php
00091: $this->_acceptableTypes = apply_filters("wpsqt_shortcode_types",$this->_acceptableTypes); 00092: $this->_acceptableTypes = array_map("strtolower",$this->_acceptableTypes); 00183: $message = apply_filters("wpsqt_".$this->_type."_error",$message, $this->_errors); 00256: $fields = apply_filters("wpsqt_".$this->_type."_form_fields",$fields);
lib\Wpsqt\System.php
00160: $details['type'] = $type; 00161: if ( !is_bool($type) ){ 00162: $details = apply_filters( 'wpsqt_fetch_'.$type.'_details' , $details ); 00163: } 00274: if ( empty($sections) ){ 00275: $sections = array(array('id' => false,'difficulty' => false,'order' => false,'name' => false,'limit' => false)); 00276: } 00277: 00278: $sections = apply_filters("wpsqt_fetch_sections",$sections); 00359: $validators = array("None","Text","Number","Email"); 00360: 00361: $validators = apply_filters("wpsqt_validators",$validators); 00383: public static function serializeQuestion( $question , $type ){ 00384: 00385: $question = apply_filters("wpsqt_pre_save_".$type."_question",$question); 00420: return apply_filters("wpsqt_fetch_save_".$type."_question",$question); 00432: $questions = array('Multiple' => 'Multiple choice question with mulitple correct answers.', 00433: 'Single' => 'Multiple choice question with a signle correct answer.', 00434: 'Free Text' => 'Question where the user types in the answer into a textarea.' ); 00435: 00436: return apply_filters('wpsqt_quiz_question_types', $questions ); 00440: * Returns the questions types that are related to 00441: * surveys. Runs the filter wpsqt_survey_question_types. ? 00449: 'Dropdown' => 'Multiple choice question with single correct answers.', 00450: 'Likert' => '', 00451: 'Likert Matrix' => 'Displays a matrix of likert scales from 1 to 5', 00452: 'Free Text' => ''); 00453: 00454: return apply_filters('wpsqt_survey_question_types', $questions ); 00458: public static function getPollQuestionTypes(){ 00459: 00460: $questions = array('Single' => 'Multiple choice question with a single correct answer.','Multiple' => 'Multiple choice question with mulitple correct answers.'); 00461: 00462: return apply_filters('wpsqt_survey_question_types', $questions );
lib\Wpsqt\Tokens.php
00052: ->addToken("TB_B", "Toggle block of information after this tag") 00053: ->addToken("TB_E", "End of block of information to be toggled"); 00054: 00055: } 00056: 00057: return apply_filters( "wpsqt_replacement_tokens" , self::$instance ); 00058: } 00157: $this->setTokenValue('TB_B' , '<div class="wpsqt-toggle"><div class="wpsqt-show-toggle"> <a href="#">[ '.__('More', 'wp-survey-and-quiz-tool').' >> ]</a></div><div class="wpsqt-toggle-block" style="display:none;">'); 00158: $this->setTokenValue('TB_E' , '</div><div class="wpsqt-hide-toggle" style="display:none;"><a href="#">[ << '.__('Less', 'wp-survey-and-quiz-tool').']</a></div></div>' ); 00159: 00160: apply_filters("wpsqt_set_token_values", $this);
lib\Wpsqt\Upgrade.php
00181: if ( version_compare($version, '2.0.0.3') < 0 ){ 00182: $objUpgrade->addQuery("ALTER TABLE <code>".WPSQT_TABLE_RESULTS."</code> ADD <code>score</code> INT NULL , ADD <code>total</code> INT NULL , ADD <code>percentage</code> INT NULL","Added scores columns to results"); 00183: } 00184: apply_filters( 'wpsqt_upgrade_object', $objUpgrade, $version );
lib\Wpsqt\Form\Export.php00024: $this->addOption("wpsqt_type", "Type", "select", $options['type'], "The format the data is to be outputted in.",array("SQL","CSV") ) 00025: ->addOption("wpsqt_data", "Data", "select", $options['data'], "The data that is to be exported", array( "Results","Quizzes and Surveys" ) ); 00026: 00027: apply_filters("wpsqt_form_export",$this);
lib\Wpsqt\Form\Import.php
00021: $this->addOption("wpsqt_type", "Type", "select", $options['type'], "The format the data is to be outputted in.",array("SQL") ) 00022: ->addOption("wpsqt_content", "Content", "textarea", $options['content'], "The data that is to be imported" ); 00023: 00024: apply_filters("wpsqt_form_export",$this);
lib\Wpsqt\Form\Poll.php
00043: $this->addOption("wpsqt_custom_directory", "Custom Directory Location", "static", WPSQT_DIR."/pages/custom/".$blog_id."/quiz-".$options['id'] ,false,array(),false); 00044: } 00045: 00046: $this->options = $options; 00047: 00048: apply_filters("wpsqt_form_poll",$this);
lib\Wpsqt\Form\Question.php00057: ->addOption("wpsqt_explanation_onlyatfinish", "Answer Explanation only at finish", "yesno", $options['explanation_onlyatfinish'], "Only show the explanation of an answer after the quiz is taken and "Finish Display" is set to "Review" .", array(), false) 00058: ->addOption("wpsqt_add_text", "Additional Text", "textarea", $options['add_text'], "Additional text/html for questions, good for using html to display images.",array(),false) 00059: ->addOption("wpsqt_image", "Image", "image", $options['image'], "The image that is to be associated with the question.", array(), false ); 00060: 00061: $this->options = $options; 00062: apply_filters("wpsqt_form_question", $this);
lib\Wpsqt\Form\Quiz.php
00072: if ( array_key_exists('id', $options) ){ 00073: $this->addOption("wpsqt_custom_directory", "Custom Directory Location", "static", WPSQT_DIR."/pages/custom/".$blog_id."/quiz-".$options['id'] ,false,array(),false); 00074: } 00075: 00076: $this->options = $options; 00077: apply_filters("wpsqt_form_quiz",$this); 00078:
lib\Wpsqt\Form\Survey.php
00047: ->addOption("wpsqt_finish_message", "Finish Message", "textarea", $options['finish_message'], "The message to display when the user has successfully finished the quiz. <strong>If empty the default one will be displayed.</strong> <a href=\"#template_tokens\">Click Here</a> to see the tokens that can be used.", array(), false); 00048: 00049: $this->options = $options; 00050: apply_filters("wpsqt_form_survey",$this);
lib\Wpsqt\Page\Main\Questions.php
00064: 00065: $itemsPerPage = get_option('wpsqt_number_of_items'); 00066: $questions = $wpdb->get_results( 00067: $wpdb->prepare("SELECT * FROM <code>".WPSQT_TABLE_QUESTIONS."</code> WHERE item_id = %d ORDER BY <code>order</code> ASC",array($_GET['id']) ),ARRAY_A 00068: ); 00069: $questions = apply_filters("wpsqt_list_questions",$questions);
pages\admin\misc\form.php00039: case 'image': 00040: if (isset($_GET['image']) && $_GET['image'] == 'remove') { 00041: $option['value'] = ''; 00042: } 00043: $media_upload_iframe_src = "media-upload.php?question_id=".$name."&app=wpsqt&TB_iframe=true&cb=" . rand(); 00044: $image_upload_iframe_src = apply_filters('image_upload_iframe_src', $media_upload_iframe_src."&type=image");
Hope that helps!
Noel
Hi I would love to adopt your changes techjeb.
Thank you.
Remo
- The topic ‘[Plugin: WP Survey And Quiz Tool] Filters, hooks and custom pages’ is closed to new replies.