$modSettings

Started by clanmchenry, August 07, 2009, 05:42:34 PM

Previous topic - Next topic

clanmchenry

Im modifiying a mod

   Anti-Spam Verification Questions
   Copyright (c) 2008 by Deprecated (at) Earthlink (dot) net. All rights reserved.

I'v made the mod get up to five questions from text files
( entered on admin reg setting page)

I have it read the files in the register() function
post the questions in the template_Before() function
check the answer in the register2() function
the Questions are always blank.

I believe the $modSettings varibles are not getting through form logic

Im not sure where the $modsettings[] varibles are set or if there is some technique to get them from other functions....

Im a novice programmer.

any help appreciated



tom

Arantor

$modSettings are pulled from the settings table, and if you make any changes you have to save them back to the settings table. In this case you're pulling from a text file which is something else.

As per your other post, you'd actually be better discussing this specifically in the mod's own support topic since this is an edit of an existing mod.
Holder of controversial views, all of which my own.


clanmchenry


JBlaze

clanmchenry, do you still require assistance?
Jason Clemons
Former Team Member 2009 - 2012

clanmchenry

Yes,

Any sugestions would be welcome.

Arantor

What exactly does the mod not do that you're trying to add?
Holder of controversial views, all of which my own.


clanmchenry

Im having the mod read the questions from a text file with multiple questions and answers , then choose one question/answer at random to post to the registration screen.

my problem is that the $modSettings are passing to the template and being displayed, but they are not getting to the answer compare logic


register() - reads file and assigns to 

             $modSettings['rnd_ver_ques_1']= $qna[0];// question from file
             $modSettings['rnd_ver_ans_1'] = $qna[1];//answer from file

template_before() - posses the questions on the screen (works)

register2() - compares file answer to posted answer

              if (   (!empty($modSettings['rnd_ver_ques_1'])   &&
                        strcmp(strtolower($modSettings['rnd_ver_ans_1']),
                        isset($_POST['rnd_ver_resp_1']) ?
                        strtolower($_POST['rnd_ver_resp_1']) : ''))


The  $modsettings['rnd_ver_ans_1']  varible is blank.....

the $modsettings['rnd_ver_enable'] varible has its value

im not sure why the answer varible is not being passed

thanks in advance.

Arantor

Because you're never saving it back to the settings table after setting it in register(). Look up the saveDBSettings function in the Function DB.
Holder of controversial views, all of which my own.


clanmchenry

Thanks,

Im not sure where to find
saveDBSettings function
or the
Function DB.
I checked the MySQL data and cant find the varibles anywhere...???


I'll keep looking, but does it matter that I'm using 1.1.10 ver.

also... my Questions and answers are passing to the
register.template.php<> template_before()

I would think that if they pass from

register.php<> register()
to
register.template.php<> template_before()

that they would also be able to pass back to
register.php<> register2()


Arantor

Function DB - see the Support link at the top of the page.

The variables get pushed into the settings table, but unless you call saveDBsettings they will not do so. Doesn't matter you're using 1.1.10 as far as I know.

And no, they won't necessarily, there's a lot of changes - and a page change. You need to save the values into the settings table.
Holder of controversial views, all of which my own.


clanmchenry

Thanks

I tried looking at the support link at the top-- function DB

but I get a data base error.....?    Irony...?:)

anyway, I'll see if I can find it. but if I knew the syntax for

saveDBsettings

I could just try it.... but I dont want to seem lazy...:)

thanks again

Arantor

No, the SMF site has had problems recently - but that's the first place I'd be looking for information. Or failing that a good text editor that can find through files. Offhand I think it's in Sources/ManageSettings.php (2.0) or Sources/ModSettings.php (1.1).
Holder of controversial views, all of which my own.


zepp

OK

I figured it out and got my mod to work..!!

the way to update the $modSettings appears to be using

updateSettings(array(
                        'My_Varible' => trim($txt['My_Varible']) 
                   ));

this puts My_Varible into the $modSettings array to become a $SESSION token

anywho.... I submitted my mod - Random Secure

Thanks for the help

Arantor

That's great until the user signs out. I'm assuming that's OK for your mod.
Holder of controversial views, all of which my own.


zepp

The variables are only needed between pages during registration.

Quote from: Arantor on August 15, 2009, 09:59:01 PM
That's great until the user signs out. I'm assuming that's OK for your mod.

thanks to all who helped,


Advertisement: