Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.5 > vBulletin 3.5 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Test Your Members' Knowledge Before Allowing Them to Post in Certain Forums Details »»
Test Your Members' Knowledge Before Allowing Them to Post in Certain Forums
Version: 1.00, by amykhar amykhar is offline
Developer Last Online: Nov 2013 Show Printable Version Email this Page

Version: 3.5.0 RC1 Rating:
Released: 07-31-2005 Last Update: 08-03-2005 Installs: 32
DB Changes Uses Plugins
 
No support by the author.

This mod is an addon to the Inferno Quiz System You must have that mod installed and working to use this.

What it does: It requires users to achieve a minimum score on a specified quiz to post in a forum.
Example: You have a PHP discusssion forum for advanced coders. You don't want novices bothering your members with trivial questions. So, you require anybody who wishes to post in that forum to achieve a minimum score of 70% on an advance PHP quiz that you created using Inferno Quiz.

How to install it: Import the Product. Done. No template edits, nothing else to do.

How to use it: In your admincp forum manager, edit the forum(s) you wish this to use this mod for. Enter a Quiz ID and the minimum acceptable score. Save the forum. You're done.

You can easily require users to pass different quizzes to be able to post in different forums. If a user has not taken the quiz, he is directed to do so. If he has failed the quiz, he sees an error message.

I don't expect many of you will use this. I'm not even using it. But, the idea hit me and it was fun to throw together.

Amy

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #52  
Old 06-14-2008, 01:30 PM
Alfa1's Avatar
Alfa1 Alfa1 is offline
 
Join Date: Dec 2005
Location: Netherlands
Posts: 3,537
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by TFEX View Post
Interesting, so what you are saying is you've never solved the issue then?
No, I did not encounter the issue before, since I did not get the result I expected: to deny forum access to members that have not passed the test.

Quote:
Originally Posted by TFEX View Post
I do not really need the plugin to jump right to the quiz, just to the phrase, and I can direct users to the quiz from there. Any suggestions? I was thinking the entire lines need to be reworked and the error references taken right out, replaced with something that simply directs users to that particular phrase. I will keep going, at least I am making some progress here.
Yes, I agree. Since the phrases are nowhere to be found in the templates, I worked through the code of the inferno quiz php files, but as expected there is nothing in there either. It seems that Amy forgot a part of the code.
If we could find a code that just shows a text message, then that would work for me. I am not in need of any translations or phrases. This would also make it easy to include a hyperlink to the related quiz.

I have been trying different code, in a trial and error sort of way, but not much luck until now.

I just added the same plugin to the hook newthread_start and that 'works' in exactly the same manner as the existing plugins: it gives the same error. So I guess that if this error is solved, it will work.
Reply With Quote
  #53  
Old 06-14-2008, 03:23 PM
TFEX TFEX is offline
 
Join Date: May 2008
Posts: 83
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I solved the missing phrase issue.

When you manually create the phrase ('quiz_not_taken' or 'quiz_failed'), the "Phrase Type" field must be set as "Error Messages" rather than "GLOBAL". I did this and all "Could not find phrase" errors were gone, and the correct phrases showed up.

However, I still cannot get it to direct to the quiz id itself (the rest of the code in the line, I am assuming). Here is the code again:

Code:
eval(standard_error(fetch_error('quiz_not_taken', $foruminfo['score'], "<a href='quiz.php?do=Take&id=".$foruminfo[quizid]."'>$quizinfo[q_name]</a>")));
So this is the part I need to look at now:

Code:
$foruminfo['score'], "<a href='quiz.php?do=Take&id=".$foruminfo[quizid]."'>$quizinfo[q_name]</a>"
I can put a link to the quiz in the phrase translation of course, but I have two different forums requiring quizzes, and I need to set a different quiz for each forum. This solution would only allow me to direct users to one quiz for all forums.

Again, progress

I'll keep at it.
Reply With Quote
  #54  
Old 06-14-2008, 04:00 PM
TFEX TFEX is offline
 
Join Date: May 2008
Posts: 83
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I can insert

Code:
<a href='quiz.php?do=Take&id=".$foruminfo[quizid]."'>$quizinfo[q_name]</a>
into the phrase translation and it provides a link to quiz.php, but the variables '.$foruminfo[quizid].' and '$quizinfo[q_name]' are not resolving. So I get to the quiz page, but it tells me on the right side (in the actual quiz area) that the quiz does not exist. I can still find the quiz from that point and take it though by flipping through the right-hand column.
Reply With Quote
  #55  
Old 06-14-2008, 06:25 PM
TFEX TFEX is offline
 
Join Date: May 2008
Posts: 83
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well since I can still set a certain quiz id as the requirement for the forum, I think I am going to stop obsessing over the re-directs and do a band-aid solution... just insert a link into the phrases that points to the category the quizzes are in, and be specific in the quiz descriptions so the users know which one to take when they get there. Too much else to do so I am drawing the line on this one, at least it works to an extent, so I can use it.

Just remember after you import the product:

go to the phrase manager and add the phrases "quiz_not_taken" and "quiz_failed". Be sure to add them as the phrase type "Error Messages".

edit the phrase translations to include your message, and point to wherever your quiz or category is located.

you can find the quiz ID, for the quiz you want to enter in the forum manager, by browsing to it through your forums and looking in your address bar for "do=Take&id=2" Where "2" is the quiz ID

the "minimum acceptable score" field must be a percentage. I entered "100", but enter whatever you like.

I've tested it, and the requirement does disappear after you pass the quiz. I have not tested the failing option yet though, but I imagine it is ok as well, I'll post again if it isn't.

Thanks so much for all your help Alfa1. Let's hope someone updates these mods, I'll be looking forward to it.
Reply With Quote
  #56  
Old 06-14-2008, 09:02 PM
TFEX TFEX is offline
 
Join Date: May 2008
Posts: 83
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here we go again. For some reason, all of a sudden, it doesn't recognize that I have passed the quiz. It appears there may be a problem with this:

Code:
if($foruminfo['score'] <= $quiztaken['r_score'])
or, more to the point this:

Code:
$quiztaken['r_score']
Everything works great except if I pass the quiz I keep getting re-prompted to take it when I attempt to post a thread.

I does recognize when I have failed the quiz, however.

I looked for the phrase r_score and found nothing, as usual. Feels good to be doing someone else's work for them, especially when I have no clue what I am doing. Here I thought I was going to be running a forum, not coding one. If I cannot fix this I am going to suggest that this hack be sent to the graveyard, and I'm going to avoid any of amy's hacks from now on. They have, so far, wasted 4 days of my time, and it appears they are going to continue to do so.
Reply With Quote
  #57  
Old 06-14-2008, 09:15 PM
Alfa1's Avatar
Alfa1 Alfa1 is offline
 
Join Date: Dec 2005
Location: Netherlands
Posts: 3,537
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes, too have what I need. A link to the correct quiz would be nice, but the band-aid solution will do as well.

Here are my phrases:
PHP Code:
You have not passed the quizneeded to enter this forum.
<
br>You need to prove your knowledge first
<br><br>
<
a href="quiz.php?do=Cat&id=1">Click here to take the quiz. </a
PHP Code:
You have not taken the quizneeded to enter this forum.
<
br>You need to prove your knowledge first
<br><br>
<
a href="quiz.php?do=Cat&id=1">Click here to take the quiz. </a
ThanX TFEX.

EDIT: I saw your post too late. I am currently wrestling with this in another way: once the quiz is taken, it does not let the user take it again. Thus leaving the member shut out of the forum. (if a mistake is made with the quiz)

In relation to your problem: I cant help but notice that there is a problem with $foruminfo['score'] again.
Anyway: go to styles and templates -> search in templates
Then search for 'r_score'
You will land in the template quiz_leaderboard_row
PHP Code:
{$gData['r_score']} 
quiz.php is full with references to r_score:
PHP Code:
    // Insert Results
    
$DB->query("insert into ".TABLE_PREFIX."quiz_results
    (`r_data`,`r_userid`,`r_score`,`r_forquiz`)
    values
    ('"
.addslashes(serialize($Answers))."',".$vbulletin->userinfo['userid'].",$Overall,$Quiz[qid])"); 
PHP Code:
        // Get All The Results
        
$Get_Results $DB->query("
        select u.username,
        r.r_userid,r.r_score
        from "
.TABLE_PREFIX."quiz_results r
        left join "
.TABLE_PREFIX."user u on(u.userid=r.r_userid)
        where r.r_forquiz = '
{$Quiz['qid']}'
        "
); 
PHP Code:
        while($Result $DB->fetch_array($Get_Results)){
        
$Results[] = "<a href='quiz.php?$session[sessionurl]do=UserStat&userid={$Result['r_userid']}&id={$Quiz['qid']}'>{$Result['username']}</a>";
        
$Average   += $Result['r_score'];
        
$Done++;
        } 
Reply With Quote
  #58  
Old 06-14-2008, 09:40 PM
TFEX TFEX is offline
 
Join Date: May 2008
Posts: 83
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've come to the conclusion that half of this hack is missing, the rest is badly neglected and/or poorly written, and it's not worth wasting your time on. Trust me, I've wasted plenty of mine, and I am finished.

My recommendation to anyone wanting something like this, is to post a request in the "Requests for Paid Services" forum. I doubt you will get much of a response though since Inferno Quiz is no longer supported either.

If I avoided this hack in the first place, I would be much farther ahead than I am now. Please move it to the graveyard whoever, it is utterly useless.
Reply With Quote
  #59  
Old 06-14-2008, 09:45 PM
TFEX TFEX is offline
 
Join Date: May 2008
Posts: 83
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Alfa your problem with users being shut out is solved here

https://vborg.vbsupport.ru/showthrea...=83130&page=38

have a look at the last post. I wish you the best of luck, I am done with this, my kids miss me, and I am getting nowhere after 4 days. One gong-show after another. Save yourself the time.
Reply With Quote
  #60  
Old 06-14-2008, 10:44 PM
Alfa1's Avatar
Alfa1 Alfa1 is offline
 
Join Date: Dec 2005
Location: Netherlands
Posts: 3,537
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Many thanks for that solution!

I cant reproduce the error you are getting. I have tried it with various accounts and settings, but it seems that it works for me. Please check your quiz results and settings.
Reply With Quote
  #61  
Old 06-14-2008, 11:33 PM
TFEX TFEX is offline
 
Join Date: May 2008
Posts: 83
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

holy tunnel-vision batman.

It works for me as well now. I had forgotten that the forum I am using it on does not allow registered users to post new threads, only reply to them. The answer was in my forum permissions. As soon as I logged in as admin and posted a thread for my test account to reply to, everything was green. I am going to run through it all again just to be sure. I WILL post the results and we'll know beyond a doubt that this hack is useable or not.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:45 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04673 seconds
  • Memory Usage 2,340KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (5)bbcode_code
  • (6)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete