1
wcrwcr
Myquizz 4.0 fatal error
  • 2009/4/28 23:58

  • wcrwcr

  • Home away from home

  • Posts: 1114

  • Since: 2003/12/12


Hi all

Firt time using this nice module on a XOOPS 2.018.2 install.

In the results page i´m getting this:

Quote:
Fatal error: Call to a member function getVar() on a non-object in /home/wwwiepw/public_html/modules/myquiz/include/functions.php on line 432


here a snap from the whole function:

le="color: #000000"><?php /*********************************************************/ /* Quizz Functions */ /*********************************************************/ ## 2009 v4.0 function sendEmail($user ,$score ,$qid, $admemail) { global $xoopsConfig; if (!is_object($user)) { $user =& $GLOBALS["xoopsUser"]; } $msg = _MYQUIZ_WHOINFORM."nn"; $msg .= sprintf(_MYQUIZ_WHOSOLVED, $user->getVar("uname")); $msg .= "n"; $msg .= _MYQUIZ_RESULT." = ".$score."nn"; $msg .= _MYQUIZ_SEE. ": ". XOOPS_URL . "/modules//myquiz/index.php?qidi=".$qid."n"; $xoopsMailer =& getMailer(); $xoopsMailer->useMail(); $xoopsMailer->useMail(); $xoopsMailer->setToEmails($xoopsConfig['adminmail'],'$admemail'); $xoopsMailer->setFromEmail($xoopsConfig['adminmail']); $xoopsMailer->setFromName($xoopsConfig['sitename']); $xoopsMailer->setSubject(_MYQUIZ_RESULT); $xoopsMailer->setBody($msg); return $xoopsMailer->send(); }


the ofending line is:
le="color: #000000"><?php $msg .= sprintf(_MYQUIZ_WHOSOLVED, $user->getVar("uname"));

BTW > i´m answering the quizz as an anonymous user (not registered)

Any fix/tip on this?

Another question..can we make the correct answer to be in shown in a random order?

Thank in advance

2
ghia
Re: Myquizz 4.0 fatal error
  • 2009/4/29 1:30

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


It seems the quiz should be reserved to logged in users.
Try with
le="color: #000000"><?php global $xoopsConfig; $msg = _MYQUIZ_WHOINFORM."nn"; if (!is_object($user)) { $msg .= sprintf(_MYQUIZ_WHOSOLVED, 'Anonymous'); } else { $msg .= sprintf(_MYQUIZ_WHOSOLVED, $user->getVar("uname")); } $msg .= "n";

3
wcrwcr
Re: Myquizz 4.0 fatal error
  • 2009/4/30 14:16

  • wcrwcr

  • Home away from home

  • Posts: 1114

  • Since: 2003/12/12


Sorry, I´m late.

But, hey it works like a charm..perfect.
Now annonymous and registered user can answer the quizzes with no erros after the compleiton

Thank you ghia

Figuring how to randomize the questions´order......

4
_metemet_
Re: Myquizz 4.0 fatal error
  • 2009/4/30 16:08

  • _metemet_

  • Just popping in

  • Posts: 62

  • Since: 2008/4/1 2


to randomize question list for sliding questions, in tek_question.php line 74 ,, make the change like this :
le="color: #000000"><?php $result = $xoopsDB->query("SELECT pollID, pollTitle, voters, comment, answer, image FROM ".$xoopsDB->prefix("myquiz_desc")." WHERE qid='$qid' ORDER BY RAND()");


and thanks , I will correct the mistake of sendEmail function.
whttp://www.xoops-tr.com
x-tr.sourceforge.net

5
wcrwcr
Re: Myquizz 4.0 fatal error
  • 2009/4/30 18:34

  • wcrwcr

  • Home away from home

  • Posts: 1114

  • Since: 2003/12/12


Hi _metemet_

you´re more than welcome

As i´m not a coder let me clarify something.
The code you´ve provided is to randomize the correct answer position?

If no, is it too dificult to achieve that?
I guess it´ll be a nice feature, don´t you think so?

Thank you very much for developing

6
_metemet_
Re: Myquizz 4.0 fatal error
  • 2009/5/1 19:06

  • _metemet_

  • Just popping in

  • Posts: 62

  • Since: 2008/4/1 2


the code I wrote is to randomize question position ,not answers.

I could add a feature to randomize both question and answer list in next release.
whttp://www.xoops-tr.com
x-tr.sourceforge.net

7
wcrwcr
Re: Myquizz 4.0 fatal error
  • 2009/5/1 20:28

  • wcrwcr

  • Home away from home

  • Posts: 1114

  • Since: 2003/12/12


Would be just FANTASTIC _metmet_

Login

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Aug 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!