1
Anonymous
[General] Country mod
  • 2003/12/26 20:40

  • Anonymous

  • Posts: 0

  • Since:


Hi all!
I'm currently developing a "Country mod" for XOOPS. I changed some files, but it's not working anymore... I backed up the old files, and now my site is running again.
This mod should add the "Country:" element in the user details page and show the flag of the country. The part showing the flags is still "under developing"... I'm thinking on how to implement it.
The files I changed are (from the XOOPS root path):

/include/registerform.php
/language/*/user.php (* = english in my case)
/register.php
/userinfo.php

in registerform.php I added:
Quote:

// Country Mod Begin //
$reg_form->addElement(new XoopsFormSelectCountry("Select your country...", "country", $country)
// Country Mod End //


after

Quote:

$reg_form->addElement(new XoopsFormSelectTimezone(_US_TIMEZONE, "timezone_offset", $tzselected));


and before

Quote:

//$reg_form->addElement($avatar_tray);
$reg_form->addElement(new XoopsFormPassword(_US_PASSWORD, "pass", 10, 20), true);


then in user.php I put:

Quote:

define('_US_NOCOUNTRY',"You haven't chosen a country."); // Country Mod


where it's written

Quote:

//%%%%%% File Name register.php %%%%%


then I added

Quote:

define('_US_COUNTRY','Country'); // Country Mod


in the userinfo.php "section".

Then in register.php I put:

Quote:

// Country Mod Begin
if ( !isset($country) || $country == '' ) {
$stop .= _US_NOCOUNTRY."<br />";
}
// Country Mod End


at line 116, then at line 142 I put

Quote:
$country = trim($country); // Country Mod
$stop = userCheck($uname, $email, $pass, $vpass, $country); // Country Mod


then at line 158 I added

Quote:

// Country Mod
echo _US_COUNTRY.":<select name='country'>
<option value='".$country."' selected>".$country."</option>
<option value=''>----------------</option></select>";


and then at line 381:

Quote:

$country=trim($country);
$stop = userCheck($uname, $email, $pass, $vpass, $country);


and finally in userinfo.php, at line 104:

Quote:

// Country Mod Begin //
$xoopsTpl->assign('lang_country', _US_COUNTRY);
$xoopsTpl->assign('user_country', $thisUser->getVar('country')); (don't know how this getVar() works...)
// Country Mod End //


All the modded files are available for download here.

I already said that the flags section is still to do. At the moment, loading these files, at register.php I get a blank page. If I restore the old files everything works perfectly... Do I need to edit something else? Have I done something wrong? Please help me if you can...

Thank you.

P.S.: I hope not to have been too confusionary...

2
Anonymous
Re: [General] Country mod
  • 2003/12/30 11:35

  • Anonymous

  • Posts: 0

  • Since:


anyone here?

3
Mithrandir
Re: [General] Country mod

You are missing some end-brackets and semi-colons as far as I can see.

ALWAYS on blank screens go to administration menu and turn on PHP debug (preferably turn it on before making changes to the files) so you actually get the error messages instead of just the blank screen.

Do that, report the error here and we may be able to help you.

4
Anonymous
Re: [General] Country mod
  • 2003/12/30 14:44

  • Anonymous

  • Posts: 0

  • Since:


I forgot a closing bracket and a semicolon in the same line!!!

now it works perfectly: the "Country" section is compulsory in the registration form.

now I should add the "Flags" to the profile...

hope... :)


5
Anonymous
Re: [General] Country mod
  • 2003/12/30 19:59

  • Anonymous

  • Posts: 0

  • Since:


mmmh

added the selectbox to the Registration page
added the selectbox to the Administators' users page
added the "Country:" field to the user profile...

now the problem is that I can't find where XOOPS stores and retrieves data from the database...

I already added a column to xoops_users (ALTER TABLE `xoops_users` ADD COLUMN `user_country` varchar(200) NOT NULL DEFAULT ''), but I don't know where XOOPS should put data in it.

I noticed that it's the only admin.php page that controls the edit/delete operations on users (admin side), but if I open admin.php I don't find any "call" to the database, neither into the included files...

Can anyone help me?

Thanks

6
Anonymous
Re: [General] Country mod
  • 2004/1/8 12:13

  • Anonymous

  • Posts: 0

  • Since:


anyone alive here?


7
Mithrandir
Re: [General] Country mod

You'll want to take a look at the kernel/user.php file and the XoopsUserHandler class in particular and specifically the insert(&$user, $force = false).

Also add the new attribute to the XoopsUser class in the initVar() functions in the constructor.

Login

Who's Online

245 user(s) are online (160 user(s) are browsing Support Forums)


Members: 0


Guests: 245


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits