joemerchant2
Forum Replies Created
-
Forum: Plugins
In reply to: [WP Survey And Quiz Tool] Controlling the Post Location of the Quiz.Here is a summary of the problems and what I’ve fixed:
Problems
1. Duplicate pre-quiz content
2. Error messages on last page of multi-page quiz which also cause the score not to display and say “quiz can’t be automarked.”
3. Pre and post content displays on all page – not good if the prequiz material is “Start the quiz now!”Here is what I got done today:
Re-coded the content buffer function so that only one copy of the pre-quiz message is displayed. See belowfunction callback($buffer) { // Grabs the actual page content (with shortcodes etc.) global $post; $pageContent = get_post($post->ID); $content = $pageContent->post_content; //load data to pass through if not a quiz/survey // Checks if it is a quiz/survey before removing the content and replacing etc. if (strpos($content, "[wpsqt_")) { // Splits it to before shortcode and after $contentSplit = preg_split('$\[wpsqt_(quiz|survey)\sname\=\"(\w|\s)*\"\]$', $content); // clear out everything in the qcontent ID $buffer = preg_replace('/<div class="qcontent">(.)*?<\/div>/s', '', $buffer); // clear out everything in the content and before the pre-div. $startPoint='<div id="content">'; $endPoint='<div class="pre-content">'; $newText=''; $buffer = replaceTags($startPoint, $endPoint, $newText, $buffer); // Replaces the pre and post content divs with the content we split above $buffer = str_replace('<div class="pre-content"></div>', '<div class="pre-content">'.nl2br($contentSplit[0]).'</div>', $buffer); $buffer = str_replace('<div class="post-content"></div>', '<div class="post-content">'.nl2br($contentSplit[1]).'</div>', $buffer); } // Returns the buffer for output return $buffer; } function replaceTags($startPoint, $endPoint, $newText, $source) { return preg_replace('#('.preg_quote($startPoint).')(.*)('.preg_quote($endPoint).')#si', '$1'.$newText.'$3', $source); }
Forum: Plugins
In reply to: [WP Survey And Quiz Tool] Controlling the Post Location of the Quiz.Coding a fix. Almost done.
Forum: Plugins
In reply to: [WP Survey And Quiz Tool] Display quiz results on member pageLet’s give him some time to implement it first and then tell us how he does it. As a programmer myself, I can tell you what works in my head doesn’t always work out that way.
Yes and no. It was fixed but then your change to the other issue (pre quiz material posted after the quiz instead of before) seems to have brought it about plus a couple of others. Let’s follow it in the other thread.
Forum: Plugins
In reply to: [WP Survey And Quiz Tool] Controlling the Post Location of the Quiz.I noticed your code reads:
$buffer = preg_replace(‘/<div class=”qcontent”>
However, the div ID is actually “content.” I tried changing it to “content” but nothing changed. However, the function “callback($buffer)Forum: Plugins
In reply to: [WP Survey And Quiz Tool] Display quiz results on member pageThis page is a good overview. I could post the code but then it would get into “it doesn’t work for me” and we’d go back and forth. Learn the fundamentals on this page and you’ll do great.
I’ll only add one thing. On that page, they say “SELECT *” which pulls all fields from the table. You want score and total so it would be similar to: “SELECT score, total, percentage”
Forum: Plugins
In reply to: [WP Survey And Quiz Tool] Display quiz results on member pageSELECT percentage FROM YOURTABLEPREFIX_wpsqt_all_results
where person_name = ‘value’You can also pull out SCORE and TOTAL
value is the persons name.There is a PERSON field that’s an array of data as well.
Forum: Plugins
In reply to: [WP Survey And Quiz Tool] Controlling the Post Location of the Quiz.And I took the quiz and it showed this:
Warning: Invalid argument supplied for foreach() in /home/behindth/public_html/wpconversion/wp-content/plugins/wp-survey-and-quiz-tool/lib/Wpsqt/Shortcode.php on line 207
Warning: Invalid argument supplied for foreach() in /home/behindth/public_html/wpconversion/wp-content/plugins/wp-survey-and-quiz-tool/lib/Wpsqt/Shortcode.php on line 372
Warning: Invalid argument supplied for foreach() in /home/behindth/public_html/wpconversion/wp-content/plugins/wp-survey-and-quiz-tool/lib/Wpsqt/Shortcode.php on line 372
AND
“quiz can’t be auto marked”
Forum: Plugins
In reply to: [WP Survey And Quiz Tool] Controlling the Post Location of the Quiz.Also, it incorrectly shows on all paginated pages of the quiz.
Forum: Plugins
In reply to: [WP Survey And Quiz Tool] Display quiz results on member pageI’ll look into this…
Forum: Plugins
In reply to: [WP Survey And Quiz Tool] Controlling the Post Location of the Quiz.Save you from digging through the code…
I shortened the pre-quiz content to one sentence and then displayed the page. After the CONTENT DIV and before the QUIZ DIV, I see this:You may begin....now. <br> <br> <div class="pre-content"> You may begin....now. <br> <br> </div>
Ok…ah…problem with css was on my end. Last minute change yesterday…grrrr.
Thanks. No hurry. I’m looking at a site roll out in a week so I’ve got time.
I stand corrected. The CSS is still broken on my Pages. but at least I have my content back!
Forum: Plugins
In reply to: [WP Survey And Quiz Tool] Controlling the Post Location of the Quiz.Fixed sort of…whatever is first on the page before the shortcut tag, is being duplicated.