PDA

View Full Version : vBQuiz Add-on v1.2


Martin64
08-05-2002, 10:00 PM
vBQuiz Add-on v1.3 (for vBQuiz 1.0)
(https://vborg.vbsupport.ru/showthread.php?s=&threadid=42000)
(by Martin64, martin64@vbhackers.com. Additional functions by FASherman)

ABOUT: Since vBQuiz is such a great hack, I decided to make this add-on to pay my respect to TWTCommish ;) Don't forget to visit his great board at http://www.movieforums.com. :P

NOTE: Of course, you must have installed vBQuiz 1.0 before you start.

DESCRIPTION: Let's describe this add-on as having 3 functions, all optional and independant of eachother:

Step 1: This part of the add-on displays a "Forum Quiz Center", which has a link to the main quizzes page and also, it shows how many of X available quizzes you have taken. This part of the add-on was made by FASherman so a big thank you to him :). Check out this version online at http://www.fasherman.com/forums

Below the Forum Quiz Center, it will display the easiest and hardest quizzes.

Step 2: As you know if you have vBQuiz 1.0 installed, only Admins are able to add, edit and remove quizzes. This add-on enables the ability for Moderators to manage quizzes as well.

Step 3. Finally, these instructions will create a Quizzes CP. This could come handy if you plan to assign certain members to manage quizzes only. Please note that still need to be assigned as moderator of a board in order to be able to reach the Quizzes Control Panel.

Enjoy! :knockedout:

Martin64
08-06-2002, 10:04 PM
Here's the screenshot as promised:

Tim Wheatley
08-06-2002, 10:21 PM
Great stuff - thanks.

Modified the templates for my board though. :)

Tim

[D]Vincent
08-06-2002, 10:23 PM
Looks great but I don't really want my mods to be able to edit it and the stuff on the main page doesn't really make me jump for joy either, nice hack though.

Tim Wheatley
08-06-2002, 10:24 PM
1thing.

You say to find:
//today online hack end
etc etc....

Well not all people have that installed. ;)

Martin64
08-06-2002, 11:30 PM
Thanks Tim, I'll update that. :)
Didn't mean to include that line: :p

TWTCommish
08-07-2002, 01:10 AM
Excellent hack, Martin. Very cool. :) You can afford to ditch this part of the code, though, I think:


$easiest[description] = (strlen($easiest[description]) == $quiz_characters) ? bbcodeparse(substr($easiest[description], 0, $quizcharacters).'...') : bbcodeparse(substr($easiest[description], 0, $quizcharacters));
$hardest[description] = (strlen($hardest[description]) == $quiz_characters) ? bbcodeparse(substr($hardest[description], 0, $quizcharacters).'...') : bbcodeparse(substr($hardest[description], 0, $quizcharacters));

Regit
08-07-2002, 01:49 AM
i really want if the register user can post their own quiz ,
( need the admin approve to display ) , it's great for the member who want to submit their own quiz ..

anyone can do this addon ??

Link14716
08-07-2002, 03:33 AM
it'd probably be easy to make a store addon or sopmething, I'll try ;)

Tim Wheatley
08-07-2002, 04:23 AM
Is it not possible to put the admin_quiz.php file into the main forum dir and modify the permissions then just sort the template?

(Sorry - clueless). :D:D

Martin64
08-07-2002, 07:57 AM
TWTCommish: Yeah, that makes sense, thanks. :p. Updated.

Ninth Dimension
08-07-2002, 01:13 PM
/me clicks install button

Mr_P
08-07-2002, 09:10 PM
installed and works fine

Id let me members use if i could as end of day its them who are gonna be using it and we all know that mods are lazy to even make a quiz up.

Anyway this and the quiz hack is well neat and intergrate well together but im going ov the beaten track here a bit but would anyone who reads this know how to add it so points are given to the user upon completiton of the quiz (if they got all right etc and passed the quiz) as this makes it more beneficial and each user can only take the quiz once so surely this would avoid cheats who would do the same quiz over again.And the points system i refer to is ov course Lesannes Store Hack as it is the best i have seen.

Like i say i know im ov track here but excellant addon anyway m8

Tim Wheatley
08-07-2002, 09:37 PM
Hm. Thinking about it I'd love it if I could show in postbit and/or profile all the quiz scores added together. I have all my quizzes formatted with 10 questions with 3 possible answers. So all scores and x out of 10. I'd like it if I could add up the number of quizzes then the total score they have. :)

Erwin
08-07-2002, 10:18 PM
Originally posted by Tim Wheatley
Is it not possible to put the admin_quiz.php file into the main forum dir and modify the permissions then just sort the template?

(Sorry - clueless). :D:D

It's not as easy as that. Remember, you need to set it up so that members can only edit or delete the quizzes they made - at the moment, people with access to admin_quiz.php can edit or delete anyone else's quiz.

Martin64
08-08-2002, 12:59 PM
Originally posted by Erwin


It's not as easy as that. Remember, you need to set it up so that members can only edit or delete the quizzes they made - at the moment, people with access to admin_quiz.php can edit or delete anyone else's quiz.

Indeed.

Besides, I don't really see the use of this, since this could cause the quizzes to become very inaccurate since you don't have someone to approve them. For instance, the last quiz someone submitted to me was full of bad questions and answers, and it took me 15 minutes just to correct the spelling and grammar errors. I rather have someone trusted to correct the quizzes than for a regular member to just throw it up there. :classic:

Admins and/or moderators do have a sense of responsibility for the board to work flawlessly and without problems, while regular members (generally) don't have to act like grown ups.

It's a good thought, however, but for members to add quizzes themselves without them approved by admins/mods first? Not in my board, at least. But I must say, a system where anyone can add a quiz, which has to wait for moderation, would be sweet.

Mr_P
08-10-2002, 03:41 PM
yeah but i know this is quiz section but what about giving users something in return if they manage to complete the quiz say 80%

a lot of us now use a points system so how hard would it be to incorporate some code into this so if the user did get over the percentage they would be rewarded with a set amount of points.
Or even charge em to take quiz or make em lose a certain amount if they fail to get over half right - ideas are endless but putting it into practise is even harder.

Store hack points system is best and is widely used

Apok2002
08-11-2002, 06:23 PM
I've always ran the board myself, w/ the help of another Sr. Administrator. I use individual forum mods, but they are not in ther UserGroup Mods...their names were added to a specific forum as a Moderator from the Forum Modify menu.

So if I were to designate a few mods to take care of quizzes, and ONLY quizzes (no other access)...how exactly would I do this? What link would I give them? Where would I put this link for them to access the Mod CP so they can edit quizzes ONLY?

----
Side note...as far as rewarding quiz takers...those w/ the top 3 scores w/i a given period of time, I award points manually. It would be nice if it did it automatically, but I'm not counting on that happening any time soon.
---

assassingod
08-11-2002, 07:15 PM
Thanks alot for this hack Martin64. I really needed this since I am a lazy git and cant think of questions for my quizzes. So Ill let the mods do them from now on:D

* assassingod clicks install

Tim Wheatley
08-11-2002, 07:43 PM
Originally posted by Martin64


Indeed.

Besides, I don't really see the use of this, since this could cause the quizzes to become very inaccurate since you don't have someone to approve them. For instance, the last quiz someone submitted to me was full of bad questions and answers, and it took me 15 minutes just to correct the spelling and grammar errors. I rather have someone trusted to correct the quizzes than for a regular member to just throw it up there. :classic:

Admins and/or moderators do have a sense of responsibility for the board to work flawlessly and without problems, while regular members (generally) don't have to act like grown ups.

It's a good thought, however, but for members to add quizzes themselves without them approved by admins/mods first? Not in my board, at least. But I must say, a system where anyone can add a quiz, which has to wait for moderation, would be sweet.

The approval or delete is already a part of the script. You even have to do that when YOU make a quiz now... :) If a member submits a bad quiz you edit it or delete it.

IMO it would save bundles of time because you don't have to type everything. Even a quiz riddled with spelling mistakes is easier to edit than to type all over again.

Martin64
08-12-2002, 06:21 PM
Originally posted by Tim Wheatley


The approval or delete is already a part of the script. You even have to do that when YOU make a quiz now... :) If a member submits a bad quiz you edit it or delete it.

IMO it would save bundles of time because you don't have to type everything. Even a quiz riddled with spelling mistakes is easier to edit than to type all over again.

Hehe, I didn't think of that. :p

However, if so, the normal members should only be able to add quizzes, and only be able to manage their own quizzes. That makes this a completely different hack and is not easy to do.

Martin64
08-12-2002, 07:32 PM
Originally posted by Apok2002
I've always ran the board myself, w/ the help of another Sr. Administrator. I use individual forum mods, but they are not in ther UserGroup Mods...their names were added to a specific forum as a Moderator from the Forum Modify menu.

So if I were to designate a few mods to take care of quizzes, and ONLY quizzes (no other access)...how exactly would I do this? What link would I give them? Where would I put this link for them to access the Mod CP so they can edit quizzes ONLY?

----
Side note...as far as rewarding quiz takers...those w/ the top 3 scores w/i a given period of time, I award points manually. It would be nice if it did it automatically, but I'm not counting on that happening any time soon.
---

They don't have to be in the moderator usergroup, they just need to be assigned as moderators and be able to access the Mod CP to be able to add quizzes (since authorization is based on "ismoderator", not "usergroup").

Want to make a Quizzes CP? Note that they will still be able to access the Mod CP since they're moderators. But if you don't tell them about the Mod CP they might not be avare of its existance.

I believe we could create a new table in your database, create a new usergroup and give that usergroup the ability to view the quizzes cp, modify the global.php located in your /quizzes directory to authorize this usergroup to be able to view the quizzes cp but I have no idea to do that correctly. At least it would take some time for me to figure out :p

Anyway, follow these instructions to create a Quizzes CP:

1. Create a new directory under your forum home called "quizzes" (http://www.yoursite.com/forum/quizzes). CHMOD it to 755.

2. Download the following files from your /mod directory to a temporary folder: admin_quiz.php, cp_logo.gif, index.php, global.php.

3. Open the index.php file you just downloaded and FIND:

vBulletin Moderator's Control Panel

REPLACE this with:

vBulletin Quizzes Control Panel

FIND and DELETE:

<form action="user.php" method="get">
<input type="hidden" name="action" value="findnames">
<input type="hidden" name="s" value="<?php echo $session[sessionhash]; ?>">
<tr class="firstalt">
<td>Quick User Finder</td>
<td><input type="text" name="findname" size="30"> <span id="submitrow"><input type="submit" value="Find Now"></span></td>
</tr>
</form>
<form action="http://www.php.net/manual-lookup.php" method="get" target="_blank">
<tr class="secondalt">
<td>PHP Function Lookup</td>
<td><input type="text" name="function" size="30"> <span id="submitrow"><input type="submit" value="Find Now"></span></td>
</tr>
</form>
<form action="http://www.mysql.com/doc/manual.php" method="get" target="_blank">
<input type="hidden" name="depth" value="2">
<tr class="firstalt">
<td>MySQL Language Lookup</td>
<td><input type="text" name="search_query" size="30"> <span id="submitrow"><input type="submit" value="Find Now"></span></td>
</tr>
<tr class="secondalt">
<td>Useful Links</td>
<td><select onchange="jumpto(this.options[this.selectedIndex].value)">
<option>&raquo; Useful Links &laquo;</option>
<option value="http://www.vbulletin.com/">vBulletin Home Page</option>
<option value="http://www.vbulletin.com/members/">vBulletin Members' Area</option>
<option value="http://www.vbulletin.com/forum/">vBulletin Support Forums</option>
<option value="http://www.vbulletin.com/manual/">vBulletin Online Manual</option>
<option value="http://www.php.net/">PHP Home Page</option>
<option value="http://www.php.net/manual/">PHP Online Manual</option>
<option value="http://www.mysql.com/">MySQL Home Page</option>
<option value="http://www.mysql.com/documentation/">MySQL Documentation</option>
</select></td>
</tr>
</form>
</table>
</td></tr></table>
</form>

FIND:

Moderators' Control Panel

REPLACE this with:

Quizzes Control Panel

FIND:

Welcome to the vBulletin Moderators' Control Panel

REPLACE this with:

Welcome to the vBulletin Quizzes Control Panel

FIND and DELETE:

<?php

doformheader("user","find");
maketableheader("Useful Admin Stuff");

if ($stats = @exec("uptime")) {
$datecut=time()-$cookietimeout;
$guestsarry = $DB_site->query_first("SELECT COUNT(host) AS sessions FROM session WHERE userid=0 AND lastactivity>$datecut");
$membersarry = $DB_site->query("SELECT DISTINCT userid FROM session WHERE userid<>0 AND lastactivity>$datecut");

$guests = number_format($guestsarry['sessions']);
$members = number_format($DB_site->num_rows($membersarry));

$onlineusers = number_format($guests + $members) . " users online ($members members &amp; $guests guests).";

preg_match("/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/",$stats,$regs);
echo "<tr class=\"secondalt\"><td>Server Load Averages</td><td><b>$regs[1], $regs[2], $regs[3]</b> $onlineusers</td></tr>\n";
}
?>

FIND:

Control Panel Home

REPLACE it with:

Quizzes CP Home

FIND (note that this requires that you have previously installed my Add-on.):

// *************************************************
makenavoption("Add","announcement.php?action=add","|");
makenavoption("Edit","announcement.php?action=modify");
makenavselect("Announcements");
// *************************************************
makenavoption("New Posts","moderate.php?action=posts","<br>");
makenavoption("New Attachments","moderate.php?action=attachments");
makenavselect("Moderation Lists");
// *************************************************
makenavoption("Ban","user.php?action=find","|");
makenavoption("View","user.php?action=find");
makenavselect("User Actions");
// *************************************************
makenavoption("Mass Move","thread.php?action=move","<br>");
makenavoption("Mass Prune","thread.php?action=prune");
makenavselect("Thread Control","<hr>");
// ************************************************

REPLACE this with:

// *************************************************
makenavoption("Add","announcement.php?action=add","|");
makenavoption("Edit","announcement.php?action=modify");
makenavselect("Announcements");
// *************************************************
makenavoption("New Posts","moderate.php?action=posts","<br>");
makenavoption("New Attachments","moderate.php?action=attachments");
makenavselect("Moderation Lists");
// *************************************************
makenavoption("Ban","user.php?action=find","|");
makenavoption("View","user.php?action=find");
makenavselect("User Actions");
// *************************************************
makenavoption("Mass Move","thread.php?action=move","<br>");
makenavoption("Mass Prune","thread.php?action=prune");
makenavselect("Thread Control","<hr>");
// *************************************************

Upload the files I asked you to download earlier (and the modified index.php too, of course) to your /quizzes directory.

Ask your new quizz moderators to point their browsers at http://www.yoursite/forum/quizzes.index.php

All done. :)

Hmm...maybe I should include this in v1.1 of my add-on ;)

Tim Wheatley
08-12-2002, 07:52 PM
So if I wanted to user usergroup - can I simply switch that command and set it as my normal members usergroup?

Martin64
08-12-2002, 07:57 PM
Originally posted by Tim Wheatley
So if I wanted to user usergroup - can I simply switch that command and set it as my normal members usergroup?

In short, yes. But then everyone would be able to edit eachothers quizzes, and they would have all the quiz answers handy.

Martin64
08-12-2002, 08:32 PM
Oh yeah, I forgot: here's a screenshot that shows what the instructions above creates. :)

Tim Wheatley
08-12-2002, 09:06 PM
If I remove the 'edit' and 'approve' and 'dissaprove'?? Surely it's possible - pleeeeeeeeeeeeeeeeeeeeeeeeeease? :D:D:D :banana:

Apok2002
08-13-2002, 12:48 AM
Tim, if you do that, then you would have to aprove the quizzes yourself (or someone you designate)...but that doesn't solve the problem that now ALL members can see the correct answers. Being curious by nature, I'm sure you'll have a lot of people who want to check out this new little feature...and of course, they'll probably want their name to appear as a top quiz taker...and use the answers they've just obtained to do so.

I offer Forum Points to my top scorers...so it's not a good way to handle this on my personal forum. But if it's just something for fun (which it all is for each of us of course), then you'd be able to do that...but it may create more problems that you haven't thought of.

And Martin, thanks! I'm going to try that out tonight. I'll let ya know how it works. And you should definately include that "option" in the new version.

I like it like this, because my mods are busy, I'm busy, and the quizzes is just something "extra" I'm giving my community. We don't always have time to keep up w/ all the submitted quizzes. And I like to have my community actually participate in a lot of the stuff we do. This is just another great opportunity for them to do that. :)

kira
08-13-2002, 04:29 AM
Hi Martin. Many thanks for a great add-on! Of course, I do have a little request, because no good deed goes unpunished! :D I was wondering, is it possible to tweak this so that we'd see a link to the most recently added quiz, rather than the easiest/hardest quizzes? Sorry for being a nag!

Martin64
08-14-2002, 08:43 AM
Originally posted by kira
Hi Martin. Many thanks for a great add-on! Of course, I do have a little request, because no good deed goes unpunished! :D I was wondering, is it possible to tweak this so that we'd see a link to the most recently added quiz, rather than the easiest/hardest quizzes? Sorry for being a nag!

lol @ edit note :p

Yes, that's possible. I might have time to look at it later today/tonight. :)

kira
08-14-2002, 07:42 PM
Many thanks, Martin, that would be excellent! It'd be an easy way to let people know when there's a new quiz. :)

Tim Wheatley
08-14-2002, 09:48 PM
Yeah I think you're right actually...

Thanks for your help and views - I really do appreciate it, I'll keep it as-is. :)

xxxsaint
08-25-2002, 01:16 PM
has anyone been able to integrate this with lesane's store ?

Martin64
08-26-2002, 07:11 PM
xxxsaint: I suppose you are referring to the original hack and not this add-on, and as far as I know, it hasn't.

kira
08-27-2002, 12:37 AM
Hi, Martin! Sorry to be a nudge, but do you think you might have a "lightbulb moment" (as Oprah calls 'em) regarding whether it's possible to add a "most recent quiz" update to a forum's homepage? (See my post earlier in this thread (https://vborg.vbsupport.ru/showthread.php?postid=284247#post284247)) This would be soooo useful to my forum! Thanks. :)

Martin64
08-27-2002, 04:19 PM
Oh yeah, I completely forgot about that! I'm awfully busy with College work at the moment though, but maybe I'll have some spare time to work on it. It shouldn't be that hard at all, maybe someone with a little more time on their hands could give it a try. :)

FASherman
08-29-2002, 11:37 AM
I think Martin64 will have a new version with this feature it in. If you want a head start on what it will look like...

You can see the demo at http://www.fasherman.com/forums/

Martin64
08-29-2002, 02:54 PM
vBQuiz Add-on v1.2 released! Check the first post of this thread.

This version includes a "Forum Quiz Center", which has a link to the main quizzes page and also, it shows how many of X available quizzes you have taken. Below that, the easiest and hardest quizzes will show up. Demo is availabe at http://www.fasherman.com/forums/, just like FASherman pointed out in the post above.

Enjoy! :D

Mr_P
08-29-2002, 10:50 PM
Originally posted by Martin64
DEMO: View the easiest and hardest quizzes online at my boards: http://www.emutalk.net.

Enjoy! :knockedout:


excellant hack by the way but clicking on the above link launches a Java virus which is JS exploit.

Did`nt get it second time i clicked it but first time i had 2 pop up ads off that site as well.

Martin64
08-30-2002, 12:09 PM
Yeah, those are popup ads, but a Java virus? I've never heard anyone report about that before. I will report to my advertising company.

Mr_P
08-30-2002, 01:43 PM
No worries m8 just wante du to know but norton and Macafee picked em up but like i say they just JS exploits - think they were trying to set my home page or something.

kira
08-30-2002, 08:28 PM
Ooh Martin and FASherman are my new boyfriends! ;) That Quiz center is looking gorgeous -- can't wait to install it! Many many thanks, guys.

Martin64
08-30-2002, 08:38 PM
lmao, I wish I hadn't read that one. ;)
Thanks yourself for using it. :D

JGM007
09-11-2002, 04:58 PM
Thank you Martin and FASherman for the hack.
I am still very green with vBulletin. I have installed the hack on my forums at http://board.madoshi.com

Currently the quiz center is stuck at the bottom of the main board, I would like to have it rest under the "General" section of the board. What do I need to do to the templates to get it to rest there?

Thanks!
-JGM

LOD-squa
09-12-2002, 07:02 PM
Nice hack I installed it.

LangTuDaTinh
10-14-2002, 06:20 PM
thanks for this great add-on hack. however i have a question?

if i delete this part in /quizzes/global.php

$permissions=getpermissions();

if (!ismoderator() or !$permissions['canview']) {
cpheader("<title>Moderators control panel</title>");
?><br><br><br>
<table cellpadding="1" cellspacing="0" border="0" class="tblborder" align="center" width="450"><tr><td>
<table cellpadding="4" cellspacing="0" border="0" width="100%">
<?php maketableheader("Please Log in:","login",0,1); ?>
<tr class="firstalt" id="submitrow"><td align="center" nowrap><p>You are either not a valid moderator or have not logged in.</p>
<form action="index.php" method="post" id="submitrow">
<input type="hidden" name="s" value="<?php echo $session[sessionhash]; ?>">
<input type="hidden" name="action" value="login">
<input type="hidden" name="redirect" value="<?php

if ($HTTP_SERVER_VARS['REQUEST_URI']!="") {
$redirecturl = $HTTP_SERVER_VARS['REQUEST_URI'];
} else {
$redirecturl = $PHP_SELF;
}

if (strpos(" $redirecturl", "?")) {
$redirecturl .= "&s=$session[sessionhash]";
} else {
$redirecturl .= "?s=$session[sessionhash]";
}

echo htmlspecialchars($redirecturl);

?>">
<input type="text" name="loginusername">
<input type="password" name="loginpassword">
<input type="submit" value=" Log in " accesskey="s">
</form>
</td></tr></table>
</td></tr></table>
<p align="center"><font size="1">vBulletin v<?php echo $templateversion ?> Moderator Control Panel</font></p>

<?php
cpfooter();
exit;
}


what will happen is that it not require login anymore so any user can add or modify a quiz

also in /quizzes/index.php

if i remove all stuffes and leave only this

<?php

makenavoption("Add","admin_quiz.php?action=addquiz","|");
makenavoption("Approve","admin_quiz.php?action=approve","|");
makenavselect("Quizzes");

?>

so that they only can add or approve...no delete or modify.

so the question is , will this modify (above) will effect the forum security and if it does, in what way?

thanks

hidjra
10-26-2002, 02:54 AM
hi,

does anyone know how many queries this will add to forumhome?

and how many queries will it add if we also add the addon kira suggested?

:banana:
hidjra

TheEDIGuy
11-12-2002, 06:09 PM
Installed step 1, on vBulletin 2.2.8 - works great, thanks!

John
Fans of Reality TV
www.fansofrealitytv.com

Erwin
11-12-2002, 07:37 PM
Originally posted by hidjra
hi,

does anyone know how many queries this will add to forumhome?

and how many queries will it add if we also add the addon kira suggested?


:banana:
hidjra

This will add 6 queries to your forumhome.

TheEDIGuy
11-13-2002, 12:03 PM
I installed this yesterday, and it works well, but I noticed that the "average scores" displayed on the forum home are different than those displayed within the actual quiz area.

I have 3 quizzes, so it's fairly easy to compare these average scores. I wonder why that is. Anyone else seeing the same thing?

FleaBag
11-22-2002, 11:25 AM
This has turned my forums/index.php into a clone of my quiz.php?

werwer
11-24-2002, 12:03 AM
Hi
A nice hack, I'll install it...
Is it possible to dysplay 5 quesions per page befor the nest questions button?!
Any1 can help with this?!

I think it would be more modular if quiz admins could choose how many questions to dysplay per page befor spliting the next page!!

thanx

TheEDIGuy
11-24-2002, 10:45 PM
Originally posted by GamerForums
This has turned my forums/index.php into a clone of my quiz.php?
My users are reporting a problem similar, and I've tested and located the problem...Now I'm looking for a solution short of uninstalling the hack.

This hack works wonderfully on Internet Explorer. However, Netscape (all versions have been tested, through 7.0) redirects the main forums index page to the quiz.php page.

As an example, I have users who have my Forum Index page (at /forums/index.php) bookmarked, but when they either click on the bookmark or type in our web address, instead they get /forums/quiz.php. They've even double-checked their bookmarks, and they are correct. It's definitely this hack that's causing the problem, but as I said, only for Netscape users.

Someone please come through with a fix? I don't know enough about PHP to go through it, but I love the hack, and don't want to have to uninstall it.

TheEDIGuy
11-24-2002, 10:49 PM
By the way, I'm running 2.2.8, if that helps.

Martin64
11-25-2002, 08:05 PM
Right, that's odd. I don't know what in the code that could possibly cause that, but evidently something is. :)

Quick solution: don't use Netscape! Seriously though, someone with a bit more experience in PHP than I maybe can help us with this as I'm clueless. Sorry :/

FleaBag
11-25-2002, 08:22 PM
I don't use Netscape... I use IE6.

snout
12-05-2002, 07:11 PM
Thank you m8 for the wonderful hack..... damn wot an xcellent addon boy :)

* snout likes very much.

vbb 229, installed no prob

Martin64
12-05-2002, 08:35 PM
I'm glad you like it. :D

snout
12-11-2002, 06:20 AM
Got a Q for ya.... Is there any way that the results of the quiz could be CC or mailed to another address, im a bit of a n00b when it comes to PHP?

Thanks in advance

Intex
02-01-2003, 02:56 PM
Very nice add-on Martin64 :cool:.

I've got one question - can you just ermove the other CP options that appear (announcements, moderation lists, user actions, thread controls)? And on the same lines for the Quizzes CP, can you stop moderators deleting quizzes that they didn't create?

Intex
02-01-2003, 03:55 PM
Actually a problem has just arisen and I notice its been mentioned here already.

After installing the hack it looked fine, the relevent stuff at the bottom of the homepage (index.php) showed the quiz icon and the other info. But then later on after I came back to the forum, the homepage had been taken over by Quizzes page only. All the other forum information had disappeared.

The problem is cause by the instructions in Step 1, namely:

++++++++++++++++++++++++++++++++++++++++++++++++++ +++

Still in index.php, find this:

eval("\$loggedinusers = \"".gettemplate('forumhome_loggedinusers')."\";");
}

BELOW this add the following:

// see if anyone's taken any of the quizzes yet
$resultcheck = $DB_site->query("SELECT r.resultid FROM quiz q, quiz_results r$resultclause");

if (!$DB_site->num_rows($resultcheck)) {
eval("dooutput(\"".gettemplate("quiz")."\");");
exit();
}

$quiz_characters = $quizcharacters + 1;

// get the easiest quiz
$easiest = $DB_site->query_first("SELECT q.quizid, q.quiztitle, LEFT(q.description, $quiz_characters) AS description,
AVG(r.totalcorrect) AS average
FROM quiz q, quiz_results r
WHERE r.quizid = q.quizid
AND r.complete = 1
AND q.approve = 1
$authorclause
GROUP BY q.quizid
ORDER BY average DESC
LIMIT 1");

// get the hardest quiz
$hardest = $DB_site->query_first("SELECT q.quizid, q.quiztitle, LEFT(q.description, $quiz_characters) AS description,
AVG(r.totalcorrect) AS average
FROM quiz q, quiz_results r
WHERE r.quizid = q.quizid
AND r.complete = 1
AND q.approve = 1
$authorclause
GROUP BY q.quizid
ORDER BY average ASC
LIMIT 1");

$easiest[average] = number_format($easiest[average], 2);
$hardest[average] = number_format($hardest[average], 2);

// vbQuiz QuizCenter
$quiztaken=$DB_site->query_first("SELECT COUNT(*) AS results FROM quiz_results where userid=$bbuserinfo[userid]");
$quiztotal=$DB_site->query_first("SELECT COUNT(*) AS results FROM quiz");
$newquiz=$DB_site->query_first("SELECT COUNT(*) AS results FROM quiz where timestamp >$bbuserinfo[lastvisit]");
if ($newquiz[results]!=0) {
$onoff="on.gif";
} else {
$onoff="off.gif";
}
if ($newquiz[results]==1) {
$isare="is";
$quiz="quiz";
} else {
$isare="are";
$quiz="quizzes";
}

eval("\$quiz_center = \"".gettemplate("quiz_center")."\";");
// End vbQuiz QuizCenter

Save and close index.php

I'm not sure why, but its this that is causing the problem, even though it worked the first time I went to the homepage as I described above. But if I remove that code from index.php, then my forum goes back to how it should do.

I looked at the html page source with and without the code and clearly you can see that the page is taken over with Quiz template (see below):


1. HTML Source without the step 1 html code within index.php

<!-- BEGIN TEMPLATE: forumhome -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<!-- no cache headers -->

etc.


2. HTML Source with the step 1 html code within index.php

<!-- BEGIN TEMPLATE: quiz -->
<html>
<head>
<title>Skynet Forums - Quizzes</title>
<!-- BEGIN TEMPLATE: headinclude -->

the end of this source is:

</font></p>
<!-- END TEMPLATE: footer -->
</body>
</html>
<!-- END TEMPLATE: quiz -->

So its definitely taking over the homepage as there is no sign of the forum home template being used.

Like I say it was all working, the only thing I did do was to remove all of the test quizzes that I made, then everything went like above. Wouldn't have thought it would have cause that.

I really like this hack so any help would be appreciated.

Martin64
02-01-2003, 09:26 PM
I'll have a look at it (haven't touched this hack in ages. :))

Martin64
02-01-2003, 09:45 PM
Found the problem.

If you have this add-on installed, open forums/index.php.

FIND AND DELETE:

if (!$DB_site->num_rows($resultcheck)) {
eval("dooutput(\"".gettemplate("quiz")."\");");
exit();
}


I have no idea what that code is doing there. :) I'll update the instructions and attach them...

Martin64
02-02-2003, 01:40 AM
v1.3 released. I changed the look of it a bit, and of course fixed what was posted just above.

Let me know how it works out for you guys. :)

Intex
02-02-2003, 08:23 AM
Martin64 - I just installed it and works great - good job man !! :cool:.

The only thing I have to get sorted now is the fact that my images don't show up, but this is an issue with vBQuiz not your hack :D.

Thx again.

Talisman
03-14-2003, 12:20 AM
We really like your add-on, Martin 64, but it adds too many queries. Uninstalled.

deepdark
04-12-2003, 06:14 PM
i cant find admin_quiz.php in zip file???

sabret00the
04-12-2003, 08:38 PM
excellent, do you know how long i been looking for this?

Martin64
04-16-2003, 10:36 PM
Talisman: You don't have to use all features of this hack. For instance, if only only wish to display the easiest + hardest quizzes you'd save a few queries.

deepdark: It comes with vBQuiz, if you have installed it previously it will sit in your admin folder. Sorry about not being clear about this. :P

sabret00the: Thank you. :)

lange
05-01-2003, 11:40 AM
Does this work with 2.3.0?

Martin64
05-01-2003, 11:44 AM
As I'm still on 2.2.9 I don't know if it works with 2.3.0, but I see no reason why it wouldn't. :)

bigtime
05-04-2003, 05:44 AM
For anyone using phpportals:

How do I make this appear on my front index page?

Forum Quiz Center
Test your brainpower in the Forum Quiz Center
You have taken 1 of the 1 quizzes available.
There is 1 new quiz since your last visit.
Easiest Quiz: Test Quiz - 1.00 average
Hardest Quiz: Test Quiz - 1.00 average

To make it appear in the forum index $quiz_center is added to the forumhome template....how can I do the equivalent for the phpportals index page?

Thanks in advance.

Great hack too!

LangTuDaTinh
05-04-2003, 06:30 AM
u can add a new block for it. but i wouldn't recommend it if u have a lot of quiz's results ....

XrayHead
07-12-2004, 05:24 PM
Hi Martin

Cool hack, Installed no probs at all apart from the Styles problem but I just copied all the templates over to the style I am using. I also had to change one of the templates as it was uploading the images to the wrong DIR (just changed it to the complete path).

Anyway I was hoping you could tell me how I can re-set my quizzes so they can be taken again?

Also would it be possible for people to take the quiz more than once so they could improve there score?

Thanks again for the hack.

Xrayhead

XrayHead
07-15-2004, 08:59 AM
Regards to the question above.

If I was to go to the quiz_results table in my sql database and delete the entries (IE The results of people who have taken the quiz), will this allow the users to take the quiz again and reset the quizz's?

Thanks

Xrayhead

subu1
07-18-2004, 07:34 PM
...i have an error

Warning: main() [function.main]: Unable to access ./admin/config.php in /home/virtual/site1/fst/var/www/html/board/quizzes/global.php on line 116

Warning: main(./admin/config.php) [function.main]: failed to create stream: No such file or directory in /home/virtual/site1/fst/var/www/html/board/quizzes/global.php on line 116

on line 116

require('./admin/config.php');

:rolleyes: :rolleyes: :rolleyes: :rolleyes: :rolleyes:

please help me

edit: ups sorry this was my Forum *global.php* :nervous: