PDA

View Full Version : Country Flag Hack v2.0


Pages : [1] 2

AJR
06 Sep 2001, 10:46
UPDATED TO v2.1 - 3/11/2002

Version 2.1 - March 11, 2002
====================================================
Well, it's been awhile! I sorta disappeared there while
doing many other things! I guess v2.0 that was supposed
to use the same images as vBStats didn't go as planned
(thanks Bane :)). I removed this hack from my site
awhile ago when I was having some other problems. I have
finally decided to add it back and it worked great in 2.2.0,
and I'm sure it will work in all other 2.2.x versions.

Changes:
- Updated to work with vBulletin 2.2.x
- Added Display Flag in Member List - Thanks Orca
- Used slightly larger flag images by X-Fan (I did run
them through Ulead's 16-color optimization which cut
the total file size from 271K to 54K!)
- Added 'align="absmiddle"' to image tag for text vertical centering
- Fixed Bane's name in docs below where I botched it up!
- Support for 280 Countries


Version 2.0 - September 6, 2001
====================================================
Changes from v1.0:
- Images have been changed from country codes to country names
- Flags will now have their ALT text as country name.
- Modified Hack to work with Bane's vbStats hack that will be released in the future.
- Added CP Addon by Stasik and modded it for new country names
- Changed country field in USER table from CHAR(2) to VARCHAR(50)
- Support for 226 countries

Known Problems:
- Countries with a dash (-) or comma (,) will not show up
automatically in as selected when you or the member edit
their profile (Congo, Korea, and Micronesia are the only 3)
Anyone know a fix please let me know.
- The 'modifyprofile_country' template needs to be changed
to a default original templatesetid of -1 (changed templates
have the templatesetid set to 2) or else the Admin CP addon
will not work (Any ideas why?). To do this, use phpMyAdmin
and run this query:
UPDATE template SET templatesetid="-1" where title="modifyprofile_country"
This will move the template from the custom to default templates
and will be found in the 'User Option Templates' group.

Any questions or comments can be posted here. Enjoy!

webhost
06 Sep 2001, 11:14
AJR

Thanks for the update.

Question, I am upgrading, in the new zip file I only see the small flags, I am using the large flags.Do you also have them somewhere laying around with full names like the small flags in your new zip file?

AJR
06 Sep 2001, 12:29
Webhost... I do not have the large flag names converted because the vBStats Hack by Bane, when released, will require the small flags as the same name as the Country Hack.

If you want to use the large flags and don't plan on using the vBStats hack, rename the large flags that you have with the names from the modifyprofile_country template. If I get a chance I'll do it and post them, but it won't be for a day or two. If you are planning on using the vbstats hack, for now you can keep the names as country codes and just use the modifyprofile_country template from v1.0 text file... make sure to only grab from:

<select name="country">
.
.
.
</select></smallfont>

Do not at the <td><smallfont> or </td> before and after since they are being put into the other templates. The plus is you won't have the problem with the 3 countries that have - or ,. The only drawback to this is the ALT name will not be shown as the full country name. If anyone gets time to convert the large flags from country code to country name before I do, please post them here.

aldamon
07 Sep 2001, 12:51
Nevermind, my bad....

Great work! Excellent hack!

redrat
08 Sep 2001, 12:12
Great hack :D
Thanks a lot

TheComputerGuy
08 Sep 2001, 14:24
I get a dB error on the member.php file when I try to go edit my country

the error is saying that it is sending an email to me...just a slight problem as it says

Typhon
08 Sep 2001, 16:05
This is a great hack... and it works like a charm on my site. I'm currently in the process of converting all the flags to a beveled 30x15 pixels, and I'll post the ZIP files when I get it done. Thanks!

AJR
08 Sep 2001, 18:11
Originally posted by TheComputerGuy
I get a dB error on the member.php file when I try to go edit my country

the error is saying that it is sending an email to me...just a slight problem as it says

And......what was the email that was sent to you (the db error)? That is the key to helping you with your problem.

TheComputerGuy
08 Sep 2001, 21:15
> Database error in vBulletin: Invalid SQL: SELECT country FROM user WHERE
userid=1
> mysql error: Unknown column 'country' in 'field list'
> mysql error number: 1054
> Date: Saturday 08th of September 2001 01:44:45 PM
> Script: /forums/member.php?s=&action=getinfo&find=lastposter&forumid=31
> Referer: http://www.moneytec.com/forums/index.php?s=

AJR
08 Sep 2001, 21:28
Originally posted by TheComputerGuy
> mysql error: Unknown column 'country' in 'field list'


It tells you the problem right in the error message. You didn't do STEP 1 in the country_flag_hack_20.txt file:

STEP 1:
======
In phpMyAdmin, you can run this query to create the country field:
ALTER TABLE user ADD country VARCHAR (50) NOT NULL


If the field 'country' is not there it can't save the country selection!

AJ

Dunny
09 Sep 2001, 14:14
1 - Add to database-Table user, field named: country
properties: ( country varchar(50) NOT NULL )

In phpMyAdmin, you can run this query:
ALTER TABLE user ADD country VARCHAR (50) NOT NULL


any chance of making this step better for the simple people among us ;)

webhost
09 Sep 2001, 18:18
Checking my installation and I have a question, look at this below the first instruction I can only find this line one time in user.php, it also mentions user.cp what is this, something doesn't look right in this section can you explain?


5 - Open admin/user.php

Find the FIRST line of this code (this shows up 2 times in user.cp):
makeinputcode("Birthday<br>(Format yyyy-mm-dd)","birthday");

Below it add:
// Country Hack CP Addon by Stasik (modded by AJ)
echo "<tr class='".getrowbg()."'><td>Country Flag</td><td nowrap>";
eval("\$countrytext.= \"".gettemplate("modifyprofile_country")."\";");
echo "$countrytext</td></tr>";
// Country Hack CP Addon End


Find the SECOND line of this code (this shows up 2 times in user.cp):
makeinputcode("Birthday<br>(Format yyyy-mm-dd)","birthday");

Below it add:
// Country Hack CP Addon by Stasik (modded by AJ)
$country=$user[country];
$countryalt = str_replace("%20"," ",$country);
$countrysel = str_replace("%20","_",$country);
if($user[country] == ""){
$ctrydefaultselected = "selected";
$flag = "No flag selected yet.";
} else {
$ctryname = "ctry".$countrysel."selected";
$$ctryname = "selected";
$flag = "<img src=\"../images/flags/$user[country].gif\" alt=\"$countryalt\" border=\"0\">";
}
echo "<tr class='".getrowbg()."'><td>Flag<br>$flag</td><td nowrap>";
eval("\$countrytext.= \"".gettemplate("modifyprofile_country")."\";");
echo "$countrytext</td></tr>";
// Country Hack CP Addon End


Find:
$DB_site->query("UPDATE user SET birthday='$birthday',options='$options',usergroupid='$usergroupid',username='".addslashes(htmlspecialchars($ausername))."'$pwdinclude,email='".addslashes(htmlspecialchars($email))."',styleid='$styleid',parentemail='".addslashes(htmlspecialchars($parentemail))."',coppauser=$coppauser,homepage='".addslashes(htmlspecialchars($homepage))."',icq='".addslashes(htmlspecialchars($icq))."',aim='".addslashes(htmlspecialchars($aim))."',yahoo='".addslashes(htmlspecialchars($yahoo))."',signature='".addslashes($signature)."',adminemail=$adminemail,showemail=$showemail,invisible=$invisible,usertitle='".addslashes($usertitle)."',customtitle=$customtitle,joindate=$joindate,cookieuser=$cookieuser,nosessionha sh=$nosessionhash,daysprune='$daysprune',lastvisit=$lastvisit,lastactivity=$last activity,lastpost=$lastpost,posts='$posts',timezoneoffset='$timezoneoffset',emai lnotification=$emailnotification,receivepm='$receivepm',emailonpm='$emailonpm',i paddress='".addslashes($aipaddress)."',pmpopup=IF(pmpopup=2 AND $pmpopup=1,pmpopup,'$pmpopup') WHERE userid=$userid");

Replace it with:
// Country Hack CP Addon by Stasik (modded by AJ) Replace
// $DB_site->query("UPDATE user SET birthday='$birthday',options='$options',usergroupid='$usergroupid',username='".addslashes(htmlspecialchars($ausername))."'$pwdinclude,email='".addslashes(htmlspecialchars($email))."',styleid='$styleid',parentemail='".addslashes(htmlspecialchars($parentemail))."',coppauser=$coppauser,homepage='".addslashes(htmlspecialchars($homepage))."',icq='".addslashes(htmlspecialchars($icq))."',aim='".addslashes(htmlspecialchars($aim))."',yahoo='".addslashes(htmlspecialchars($yahoo))."',signature='".addslashes($signature)."',adminemail=$adminemail,showemail=$showemail,invisible=$invisible,usertitle='".addslashes($usertitle)."',customtitle=$customtitle,joindate=$joindate,cookieuser=$cookieuser,nosessionha sh=$nosessionhash,daysprune='$daysprune',lastvisit=$lastvisit,lastactivity=$last activity,lastpost=$lastpost,posts='$posts',timezoneoffset='$timezoneoffset',emai lnotification=$emailnotification,receivepm='$receivepm',emailonpm='$emailonpm',i paddress='".addslashes($aipaddress)."',pmpopup=IF(pmpopup=2 AND $pmpopup=1,pmpopup,'$pmpopup') WHERE userid=$userid");
$DB_site->query("UPDATE user SET birthday='$birthday',options='$options',usergroupid='$usergroupid',username='".addslashes(htmlspecialchars($ausername))."'$pwdinclude,email='".addslashes(htmlspecialchars($email))."',styleid='$styleid',parentemail='".addslashes(htmlspecialchars($parentemail))."',coppauser=$coppauser,homepage='".addslashes(htmlspecialchars($homepage))."',icq='".addslashes(htmlspecialchars($icq))."',aim='".addslashes(htmlspecialchars($aim))."',yahoo='".addslashes(htmlspecialchars($yahoo))."',signature='".addslashes($signature)."',adminemail=$adminemail,showemail=$showemail,invisible=$invisible,usertitle='".addslashes($usertitle)."',customtitle=$customtitle,joindate=$joindate,cookieuser=$cookieuser,nosessionha sh=$nosessionhash,daysprune='$daysprune',lastvisit=$lastvisit,lastactivity=$last activity,lastpost=$lastpost,posts='$posts',timezoneoffset='$timezoneoffset',coun try='$country',emailnotification=$emailnotification,receivepm='$receivepm',email onpm='$emailonpm',ipaddress='".addslashes($aipaddress)."',pmpopup=IF(pmpopup=2 AND $pmpopup=1,pmpopup,'$pmpopup') WHERE userid=$userid");
// Country Hack CP Addon End

Dunny
09 Sep 2001, 18:37
makeinputcode("Birthday<br>(Format yyyy-mm-dd)","birthday",$user[birthday],0);

i think the 2nd one looks like this mate...does anyone know how you do the first step exactly?

webhost
09 Sep 2001, 18:41
just go to your database for your forums. Find table named user open up find field name country and edit it change to VARCHAR (50) and save.

Anyone got the large flags renamed yet?

Dunny
11 Sep 2001, 09:44
can anyone really simplify the 1st step, I take it the person who owns the board has to do it?

I just have FTP access to install the hacks so Im completly lost and the board owner doesnt have a clue! :)

cheers

webhost
11 Sep 2001, 09:54
Dunny can not guarantee this but you can try it. Unzip then Load it in your admin directory and then try to run it.

Dunny
11 Sep 2001, 21:05
that worked perfect mate, thanks alot!

the file should be added to the release...

MrLister
12 Sep 2001, 04:57
great hack. i just installed it!

Alien
13 Sep 2001, 20:34
Works great, good job. :D

Mark Hewitt
15 Sep 2001, 14:26
A brilliant hack! I've put it on my site and I've also put it on my memberlist.

webhost
21 Sep 2001, 04:56
First of three sets of big flags. 74x37 pixels

webhost
21 Sep 2001, 04:58
Second Set of bigflags. The third set will be sometime tomorrow there are 71 in that group.
Total Flags of all three groups is 288

webhost
21 Sep 2001, 05:15
Large Flags finished, you can download all three zip files now, These Flags have full names.

tkhjosh
21 Sep 2001, 06:22
when i run flag.php this is what i get

There seems to have been a slight problem with the database. Please try again by pressing the refresh button in your browser.

An E-Mail has been dispatched to our Technical Staff, who you can also contact if the problem persists.

We apologise for any inconvenience.


any help please?

AJR
21 Sep 2001, 06:33
What does the email that is sent to the administrator say? That holds the key to where the problem is! It sounds like one of your $db queries was not typed in correctly (if you have other hacks installed it is easy to overwrite something from another hack), OR you didn't add the country field to the user table.

tkhjosh
21 Sep 2001, 07:05
i ran the flag.php that webhost gave, not enough? there must be more to do?

AJR
21 Sep 2001, 07:10
I need to know what that email said! Then I can help you.

tkhjosh
21 Sep 2001, 07:11
Originally posted by webhost
Dunny can not guarantee this but you can try it. Unzip then Load it in your admin directory and then try to run it.

here here....

AJR
21 Sep 2001, 07:17
Not the quote from webhost, the email that should have been sent to the admin of the vbulletin forum... it contains error information about the query that was run to cause the error!! That is the email that I need!

merk
21 Sep 2001, 07:23
Thats why you shouldnt bother supporting your hacks AJR ;):D

tkhjosh
21 Sep 2001, 07:29
Database error in vBulletin Control Panel: Invalid SQL: ALTER TABLE user ADD
country VARCHAR (50) NOT NULL

mysql error: Duplicate column name 'country'
mysql error number: 1060
Date: Friday 21st of September 2001 02:24:11 PM
Script: /forums/admin/flag.php?
Referer:

AJR
21 Sep 2001, 07:37
You only need to run flag.php ONCE! This will create the field for country in the user table. After that you DON'T run flag.php again! Delete flag.php!

Make sure you have followed the rest of the instructions in the .txt file. All the php files that were edited need to be uploaded and everything should be working!

tkhjosh
21 Sep 2001, 07:48
i tried replacing all the files with default and the same problem persist.

AJR
21 Sep 2001, 07:59
First of all, you need to get ONE hack working before you start another. You seem to be simultaneously working on 2 hacks (Country Flag and Astrological Sign) and getting errors from one, the other, or both!!!

i tried replacing all the files with default and the same problem persist.

What do you mean by this?? ?? ?? ?? ?? There are NO files to replace. You need to go to the first post in this thread and download the actual hack. Then you need to read and follow the .txt file as it guides you through editing the .php files it needs to work. Then, after EVERYTHING is followed in the .txt file, if you still have problems, let me know. You are posting in both this and the Astrological Sign hack at the same time which you can't be working on both at the same time... get one working first! Then move on to the next hack!

tkhjosh
21 Sep 2001, 08:54
Originally posted by tkhjosh
i tried replacing all the files with default and the same problem persist.


meaning i uploaded the default .php files example member.php and register.php and ran flag.php again but did not work. :(

AJR
21 Sep 2001, 09:05
Like I said, if you already ran flag.php, DON'T run it again! The first time you ran it, it added the country field to the user table. Every time you try to run it now, it sees that the country field already exists and will ALWAYS give you an error because it exists. If you made all the changes to the .php files and uploaded them, go to your forum homepage, log in as you, click on the 'User CP' and click on 'Edit Profile'. Look for 'Select your Country' and choose your country from the dropdown list. Submit the modifications and look for one of your posts in the forum. You should see the flag next to your name! Click on your profile and you should see the flag next to your name!

tkhjosh
21 Sep 2001, 10:03
ok i get the options for selecting country, but it is blank! nothing to choose! i think below is what i dont understand, if possible pls explain.


this is from the readme:

*** The 'modifyprofile_country' template needs to be changed
to a default original templatesetid of -1 (changed templates
have the templatesetid set to 2) or else the Admin CP addon
will not show the country select list (Any ideas why?). To do
this, use phpMyAdmin and run this query:
UPDATE template SET templatesetid="-1" where title="modifyprofile_country"
This will move the template from the custom to default templates
and will be found in the 'User Option Templates' group.

hope to hear from u soon.

AJR
21 Sep 2001, 10:11
If you have access to phpMyAdmin, go to it and use the following query:

UPDATE template SET templatesetid="-1" where title="modifyprofile_country"

Otherwise, upload the attached tempchange.php file to your admin directory and execute it like you did with flag.php. Then try going to your Edit Profile and see if the list is there.

tkhjosh
21 Sep 2001, 10:21
nope....sighz...ok

and a problem i cant seem to add the template modifyprofile_country anymore, i tried adding 2 times but its never there, help~

AJR
21 Sep 2001, 10:50
You can't add a 'modifyprofile_country' template anymore because one already exists! By running the tempchange.php, it changed the template from a "custom" to a "default original" template (-1). You will now find the template in the 'User Option Templates' group. Click on expand and you should see the 'modifyprofile_country' template.

tkhjosh
21 Sep 2001, 11:09
i see it but i still dont have the scroll bar at the choosing profile
it is completely blank!

Select your Country:
If you select your country, your country flag image will appear next to your name on your posts.

but there is no flags, nothing. yes i did upload the flags to images/flags

there is no scroll bar, pls help!

webhost
21 Sep 2001, 11:26
tkhjosh



Stop this madness, check your email and your PM'S please

Mark Hewitt
21 Sep 2001, 11:43
Just to add some contrast here. I've installed the hack and it was flawless. My users love it :D

webhost
21 Sep 2001, 11:44
Same here.

maverick1236
21 Sep 2001, 15:44
Great Hack!!

side note:
I see webhost is helping people with their hacks!!!
Hes helped me with a couple in the past-hes real good!!!
Im sure he'll get it workin 4 ya!!!!!

tkhjosh
21 Sep 2001, 22:47
i just need to fix the scroll bar to choose the flags now. AJR there? :(

tkhjosh
22 Sep 2001, 00:12
i want to thank AJR & webhost for all thier help, it worked after i installed 1.0 and the problem was with the v2.0 tables. THANKS SO MUCH!!!!!!!!!!!!!!!!!!!!! can u help me with the star signs :P

Delhaze
22 Sep 2001, 19:55
I have added a new country to the "modifyprofile_country" template, it shows up ok as a user changing profile and for a new user, but is missing from the admin control panel as an admin changing a user or adding a user.

Have I done something wrong?

Update:

It seems the same issue that requires the template to be the default -1 also stops any changes made by using the control panel "edit" being shown afterwards in the admin control panel.

I had to modify the -1 template in phpmyadmin and then "revert to original" to get it to show up.

This kinda defeats the purpose of having it in a template :mad:

AJR
23 Sep 2001, 07:09
Delhaze... make your changes to the 'modifyprofile_country' template, then execute the attached file. This file will:

- Verify that you have a modified template for 'modifyprofile_country'
- Once verified, it will then delete the original 'modifyprofile_country' template
- Finally it will change the modified template to an original template.

I programmed in the verification because if you DIDN'T modify the 'modifyprofile_country' template, it would delete the original and you'd be left with no template and no country dropdown list! I've checked template_change.php numerous times to make sure it works!

Delhaze
23 Sep 2001, 12:41
Originally posted by AJR
Delhaze... make your changes to the 'modifyprofile_country' template, then execute the attached file. This file will:

- Verify that you have a modified template for 'modifyprofile_country'
- Once verified, it will then delete the original 'modifyprofile_country' template
- Finally it will change the modified template to an original template.

I programmed in the verification because if you DIDN'T modify the 'modifyprofile_country' template, it would delete the original and you'd be left with no template and no country dropdown list! I've checked template_change.php numerous times to make sure it works!

This wouldn't work for me, my template set id is different so the verification fails.

Kengan
24 Sep 2001, 00:11
Thanks ! COOL Hack ! I will try it tonight ! ;)

The Realist
06 Oct 2001, 13:58
In the Install instructions it states the below were it shows up twice.

I can only find it once in my user.php, can anyone help please.

Lost!

Brian

5 - Open admin/user.php

Find the FIRST line of this code (this shows up 2 times in user.cp):
makeinputcode("Birthday<br>(Format yyyy-mm-dd)","birthday");

Trillian
07 Oct 2001, 17:14
Realist,

Simply paste it after the first time you see it. It is true that the exact syntax of the code appears only once in the script. What the author was implying is that there is a second line in the script that looks very familiar to the first, and was trying to avoid confusion ;)

And to the author, GREAT WORK! My members are having a lot of fun with this hack :)

Delhaze
07 Oct 2001, 23:02
Originally posted by Trillian
Realist,

Simply paste it after the first time you see it. It is true that the exact syntax of the code appears only once in the script. What the author was implying is that there is a second line in the script that looks very familiar to the first, and was trying to avoid confusion ;)

And to the author, GREAT WORK! My members are having a lot of fun with this hack :)

I dont thing thats correct, the second line that is similar also needs code to be added below it. Read the first page of the thread and it should be clearer.

jamesdasher
14 Oct 2001, 03:26
Okay, can somebody tell me what I did wrong...I wanted the large flags (provided by webhost) so I downloaded all the files unzipped them into the flags folder (at the same time erasing the original flags)...but...all the different pages are still trying to find the old image and saying 'not found'? Can anybody help?

James

aldamon
16 Oct 2001, 14:38
Hi,

The hack has been working great, but I thought you should know there's an error in your instructions. The flag for Great Britain, "Great Britain.gif", is referred to as "Great Britan.gif" (without the "I") in your instructions. You might want to change that. The flag obviously won't display without the change.

Thanks!

orca
16 Oct 2001, 17:13
Hi there,

here's what I did to display the flag in memberlist:

Open memberlist.php and find


if ($userinfo[receivepm]) {
eval("\$userinfo[pmlink] = \"".gettemplate("postbit_sendpm")."\";");
} else {
$userinfo[pmlink] = "&nbsp;";
}


Just below it add


// Country Hack
if (!$userinfo[country]) {
$flag = "&nbsp;";
} else {
$Country=$post[country];
$Countryalt = str_replace("%20"," ",$Country);
$flag = "<img src=\"images/flags/$Country.gif\" alt=\"$Countryalt\" border=\"0\">";
}
// Country Hack End


Now you need to modify memberlist and memberlistbit template.

In the template memberlist you need to increase the colspan of the td tag to 7:


<td bgcolor="{ categorybackcolor }" colspan="7"><normalfont color="{ categoryfontcolor }"><b>$bbtitle Members List</b></normalfont></td>


After you done that, insert


<td bgcolor="{ tableheadbgcolor }" align="center"><smallfont color="{ tableheadtextcolor }"><b>Country Flag</b></smallfont></td>


wherever you like. Be sure the remember where it was since you need to insert it at the same place in memberlistbit. E.g. if you add it after Email you need to put the following


<td bgcolor="{ firstaltcolor }">$flag</td>


just after


<td bgcolor=" { secondaltcolor } ">$userinfo[useremail]</td>


Please omit the spaces around the {} brackets. You may need to change the order of first- and secondaltcolor to get alternating colors.

Alternatively, you could leave memberlist alone and insert only $userinfo[country]. This will display the countries name.

DixonsNL
23 Oct 2001, 20:20
AJR, Your that man! ;) I got it running, and it works Perfect!! thnx m8! :) Keep the good hacks comming :D

Diva
25 Oct 2001, 15:53
Hi... I got the hack up and running. I love it! The problem? This guy tried to help with another, replaced my '.php' with the originals and now I can't seem to get the drop down box. I tried replacing all and basically starting over. The people who had flags still have them. I only see a section where the drop down box should be. Any suggestions? I love this hack!

Diva
26 Oct 2001, 18:21
Yay! It works! I don't know what I did, but I got it working! It looks great. Thanks AJR!

And thanks to Orca for the memberslist add on. It works like a charm!

On to tackle my next hack. :eek:

aldamon
30 Oct 2001, 20:08
Please please pretty please make sure this works on 2.2.0!!!! I simply will not switch to the new version if my flags won't work!

orca
31 Oct 2001, 13:10
Actually, I think there's not a big reason why this shouldn't work. You just need to reapply the file and template modifications.

MrLister
31 Oct 2001, 15:53
hmmm when you reply does it mean it's isntalled..... i didn't click install and it's installed. i mean i did install it but it showed it here automatically or because i put down my last post.

aldamon
01 Nov 2001, 15:09
This hack is a no go in 2.2.0. Damn it. Could someone suggest some changes? I've tried to tweak it for 2.2.0 with no luck.

aldamon
01 Nov 2001, 20:57
Well a few tiny changes this hack WILL indeed work with 2.2.0.

Yes!

xug
02 Nov 2001, 11:41
I Think this is a great hack, but I don't get it to work with my new
v2.2.0
What do I need to change to get it to work ?

Alien
02 Nov 2001, 15:07
I got this to work with 2.2.0 as well, but wish I saved the changes I had to make.. It wasn't anything difficult though...

Sorry I didn't save the changes. :(

orca
02 Nov 2001, 15:47
Originally posted by xug
I Think this is a great hack, but I don't get it to work with my new
v2.2.0
What do I need to change to get it to work ?

It works for me with the same changes as on 2.0.3...

aldamon
02 Nov 2001, 15:58
That's impossible. The code has changed in key sections changed in the hack. Have you actually tried to register or to change your options in the user cp after your "successful" upgrade?

orca
02 Nov 2001, 16:54
Well, ok, that's true. The dropdown menu is missing for the registration. That may needs a change.

orca
02 Nov 2001, 17:05
If you update, the template modifyprofile_country is deleted if you ran the query. Just redo the template.
This works, I just did it on my site.

webhost
03 Nov 2001, 05:01
It worked fine for me without any changes, if you read through this post it states somewhere in here to change it from a custom template to a main template which I did, when I dumped my old database and restored template followed.

orca
03 Nov 2001, 09:19
I had it also as custom template...it was removed anyway after running the update script.

Mark Hewitt
03 Nov 2001, 16:51
I've just reinstalled it in 2.2.0, no problems at all. And no template changes required! :D

xug
04 Nov 2001, 23:32
When you have looked well why you was copying and pasting some of this great hack in vb2.2.0 you would have seen that there are now some functions that will not work properly.

Old hack text :
// Country Hack Replace
// $DB_site->query("INSERT INTO user (userid,username,password,email,".$newstylefield."parentemail,coppauser,homepage,icq,aim,yahoo,signature,adminemail,showemail,invi sible,usertitle,joindate,cookieuser,daysprune,lastvisit,lastactivity,usergroupid ,timezoneoffset,emailnotification,receivepm,emailonpm,options,birthday,maxposts, startofweek,ipaddress,pmpopup,referrerid,nosessionhash) VALUES (NULL,'".addslashes(htmlspecialchars($username))."','".addslashes($password)."','".addslashes(htmlspecialchars($email))."',".$newstyleval."'".addslashes(htmlspecialchars($parentemail))."','$coppauser','".addslashes(htmlspecialchars($homepage))."','".addslashes(htmlspecialchars($icq))."','".addslashes(htmlspecialchars($aim))."','".addslashes(htmlspecialchars($yahoo))."','".addslashes($signature)."','$adminemail','$showemail','$invisible','".addslashes($usertitle)."','".time()."','$cookieuser','".addslashes($prunedays)."','".time()."','".time()."','$newusergroupid','".addslashes($timezoneoffset)."','$emailnotification','$receivepm','$emailonpm','$options','".addslashes($birthday)."','".addslashes($umaxposts)."','".addslashes($startofweek)."','".addslashes($ipaddress)."','$pmpopup','".addslashes($testreferrerid['userid'])."','$nosessionhash')");
$DB_site->query("INSERT INTO user (userid,username,password,email,".$newstylefield."parentemail,coppauser,homepage,icq,aim,yahoo,signature,adminemail,showemail,invi sible,usertitle,joindate,cookieuser,daysprune,lastvisit,lastactivity,usergroupid ,timezoneoffset,emailnotification,receivepm,emailonpm,options,birthday,maxposts, startofweek,ipaddress,pmpopup,referrerid,nosessionhash,country) VALUES (NULL,'".addslashes(htmlspecialchars($username))."','".addslashes($password)."','".addslashes(htmlspecialchars($email))."',".$newstyleval."'".addslashes(htmlspecialchars($parentemail))."','$coppauser','".addslashes(htmlspecialchars($homepage))."','".addslashes(htmlspecialchars($icq))."','".addslashes(htmlspecialchars($aim))."','".addslashes(htmlspecialchars($yahoo))."','".addslashes($signature)."','$adminemail','$showemail','$invisible','".addslashes($usertitle)."','".time()."','$cookieuser','".addslashes($prunedays)."','".time()."','".time()."','$newusergroupid','".addslashes($timezoneoffset)."','$emailnotification','$receivepm','$emailonpm','$options','".addslashes($birthday)."','".addslashes($umaxposts)."','".addslashes($startofweek)."','".addslashes($ipaddress)."','$pmpopup','".addslashes($testreferrerid['userid'])."','$nosessionhash','".addslashes($country)."')");
// Country Hack End


Must be :
// Country Hack Replace
// $DB_site->query("INSERT INTO user (userid,username,password,email,".$newstylefield."parentemail,coppauser,homepage,icq,aim,yahoo,signature,adminemail,showemail,invi sible,usertitle,joindate,cookieuser,daysprune,lastvisit,lastactivity,usergroupid ,timezoneoffset,emailnotification,receivepm,emailonpm,options,birthday,maxposts, startofweek,ipaddress,pmpopup,referrerid,nosessionhash,avatarid) VALUES (NULL,'".addslashes(htmlspecialchars($username))."','".addslashes($password)."','".addslashes(htmlspecialchars($email))."',".$newstyleval."'".addslashes(htmlspecialchars($parentemail))."','$coppauser','".addslashes(htmlspecialchars($homepage))."','".addslashes(htmlspecialchars($icq))."','".addslashes(htmlspecialchars($aim))."','".addslashes(htmlspecialchars($yahoo))."','".addslashes($signature)."','$adminemail','$showemail','$invisible','".addslashes($usertitle)."','".time()."','$cookieuser','".addslashes($prunedays)."','".time()."','".time()."','$newusergroupid','".addslashes($timezoneoffset)."','$emailnotification','$receivepm','$emailonpm','$options','".addslashes($birthday)."','".addslashes($umaxposts)."','".addslashes($startofweek)."','".addslashes($ipaddress)."','$pmpopup','".addslashes($testreferrerid['userid'])."','$nosessionhash','$avatarid')");
$DB_site->query("INSERT INTO user (userid,username,password,email,".$newstylefield."parentemail,coppauser,homepage,icq,aim,yahoo,signature,adminemail,showemail,invi sible,usertitle,joindate,cookieuser,daysprune,lastvisit,lastactivity,usergroupid ,timezoneoffset,emailnotification,receivepm,emailonpm,options,birthday,maxposts, startofweek,ipaddress,pmpopup,referrerid,nosessionhash,avatarid,country) VALUES (NULL,'".addslashes(htmlspecialchars($username))."','".addslashes($password)."','".addslashes(htmlspecialchars($email))."',".$newstyleval."'".addslashes(htmlspecialchars($parentemail))."','$coppauser','".addslashes(htmlspecialchars($homepage))."','".addslashes(htmlspecialchars($icq))."','".addslashes(htmlspecialchars($aim))."','".addslashes(htmlspecialchars($yahoo))."','".addslashes($signature)."','$adminemail','$showemail','$invisible','".addslashes($usertitle)."','".time()."','$cookieuser','".addslashes($prunedays)."','".time()."','".time()."','$newusergroupid','".addslashes($timezoneoffset)."','$emailnotification','$receivepm','$emailonpm','$options','".addslashes($birthday)."','".addslashes($umaxposts)."','".addslashes($startofweek)."','".addslashes($ipaddress)."','$pmpopup','".addslashes($testreferrerid['userid'])."','$nosessionhash','$avatarid','".addslashes($country)."')");
// Country Hack End

At the end off both lines the '$avatarid' needs to be inserted in the script for vb2.2.0, because when you have copied this part from the vb2.0.3 hack version it's not available

This was just what i found in a flash and maybe there are more things that needs to be adjusted !!

My $0.02

Logtenberg
08 Nov 2001, 01:10
When trying to view a members profile I get this error (Just installed flag hack)

Database error in vBulletin: Invalid SQL: UPDATE user SET profileviews=profileviews+1 WHERE userid=4196
mysql error: Unknown column 'profileviews' in 'field list'
mysql error number: 1054
Date: Wednesday 07th of November 2001 07:59:46 PM
Script: /forum/member.php?s=&action=getinfo&userid=4196
Referer: http://66.78.40.13/forum/showthread.php?threadid=441&goto=nextnewest

Anyone know the problem?

Also - I noticed that when I edited the required files and saved them, the size of the files would always increase be 2 or more kilobytes. Where did this extra size come from? (I am using windows 2000 and am editing the files in wordpad)

webhost
08 Nov 2001, 01:16
looks like u need to add a field to the user table

Logtenberg
08 Nov 2001, 01:17
What field would that be? did I miss a step?

webhost
08 Nov 2001, 01:23
Unknown column 'profileviews' in 'field list'

place that profileviews has a new field in your user table, should say smth in the instructions

xug
12 Nov 2001, 05:12
Is this hack working on V2.2.0 or not ?????

webhost
12 Nov 2001, 10:40
yes

xug
12 Nov 2001, 12:55
When I go to step 3 of the installation :

3 - Open showthread.php (or admin/functions.php for v2.0.3)

find:
$post[joindate]=vbdate($registereddateformat,$post[joindate]);

Just above add:
// Country Hack
if (!$post[country]) {
$flag = "";
} else {
$Country=$post[country];
$Countryalt = str_replace("%20"," ",$Country);
$flag = "<img src=\"images/flags/$Country.gif\" alt=\"$Countryalt\" border=\"0\">";
}
// Country Hack End

----------

I can't find the line that I need to search for !!!!!!
I work with VB2.2.0
Please HELP!

webhost
12 Nov 2001, 13:00
put it right under this


$jointime = (time() - $post[joindate]) / 86400; // Days Joined
if ($jointime < 1) { // User has been a member for less than one day.
$postsperday = "$post[posts]";
} else {
$postsperday = sprintf("%.2f",($post[posts] / $jointime));
}

xug
13 Nov 2001, 01:27
I have done everything what is written in this thread and got only errors.

I uninstalled it and hope that there will be an new update version soon in this forum.

webhost
13 Nov 2001, 02:43
xug

I sent you a pm, Send your php files to me for this and I will fix them for you. E-mail address in the pm.

xug
13 Nov 2001, 02:50
I sended a reply !
Thanks for all the help !

Matt
17 Nov 2001, 05:04
I installed :) Problem is it shows up in the profile fine but nothing shows up where I put $flag in my postbit template :(

Any ideas why not?

over
17 Nov 2001, 17:36
has anyone tried this hack for 2.2.1 ? or is it just me that can't find a couple parts in the files to modify?

Bane
23 Nov 2001, 09:56
Could try this I guess, I tried to do the changes when I installed on 2.2.1, I also corrected the horrible maiming of my name (Bain?) in the docs :p Lemme know how it turns out for the 2.2.1 users, this is a quick change so sorry, just put it together for a friend doing an install.


NOTE:
In the docs you will notice the following for every file edit::
FIND:
error_reporting(7);

BELOW this ADD:
/* Hacks Added to this File
##############################
[vB v2.2.0] Country Flag Hack v2.0 (X) [Date]
############################## */

This is NOT NEEDED. It is something that I do to better track the changes that I made to each file, where X = the number of changes I made to the file, and Date = the date I did it, so I can see quickly if my version is the latest. This is not in anyway necessary but my mate is about as scatterbrained as I am about these things so I included it for him.

Good luck all.

over
23 Nov 2001, 12:13
ta for the update :) installin the now :)

ariaforums
23 Nov 2001, 14:12
$post[joindate]=vbdate($registereddateformat,$post[joindate]);

I still cannot find this in adminfunctions.php :(

Bane
23 Nov 2001, 14:18
Originally posted by ariaforums
$post[joindate]=vbdate($registereddateformat,$post[joindate]);

I still cannot find this in adminfunctions.php :(

Try looking for it without spaces $post[joindate]=vbdate($registereddateformat,$post[joindate]);

If that doesn't work try looking for } else {
$postsperday = sprintf("%.2f",($post[posts] / $jointime));
} its just below that.

Lesane
24 Nov 2001, 13:21
Originally posted by AJR
Version 2.0 - September 6, 2001
====================================================
This is the second release of the Country Hack. I have
converted it to make it work with Bain's vBStats hack
that will be released sometime in the near future. Bain
and I have been working together because both the Country
Hack and vBStats Hack require all the flags. We didn't
want you to have to have double images with different
names (which would mean over 450 files in the flags
directory!)

By changing the flag names from their country code to
their country name, it is now possible to have the ALT
tag show the name of the country when you put your mouse
pointer over the flag image.

Changes from v1.0:
- Images have been changed from country codes to country names


Loox like a great hack but i dont understand one thingy that you said above. You said:
We didn't want you to have to have double images with different names (which would mean over 450 files in the flags
directory!)

But the flags of the vbstats hack of bane have country codes and you use the country names :confused:
So we have now double images with different names or do i c this wrong? :confused:

Bane
24 Nov 2001, 18:49
The problem was that in the original version of the flags hack there were all lowercase flag names etc.. then these. Orignally the same system as is used here was used for vbstats however vbstats ended up being a little too popular so for language abstraction purposes I decided to make the switch to country codes. (Now its much easier to change the country names for other language users of vbstats) There is an easy way to change the image settings for flags in vbstats if you want to use the same set. Or optionally you can wait for the next release of vbstats where I will release a compatible Flag Hack if AJ isnt back yet.

Lesane
25 Nov 2001, 09:11
Okey, that makes things clear. Do you know already the deadline of the next Vbstats release?

aldamon
28 Nov 2001, 14:11
nm

xug
28 Nov 2001, 17:58
I got it finally working, thanks to all who did a great job here !

xug
28 Nov 2001, 21:56
I thought that everything was working, but there is a little bug.

When people want to sign up and they fill up all the required information right and submit it, it will give an error message that they have to check again because something wasn't filled up right.

I did it myself also a few times and for sure I did what was required but gave me the error too.

When I installed this hack I did every file step by step and uploaded it back to my site, checked if there where no errors and all looked ok.

So I think there must be something wrong with the last file, register.php

Can please somebody advise me what this could be.

Thank you.

nighteyes
29 Nov 2001, 18:37
Yes, you got it in one. The error is in register.php, I had the same problem. Just download the updated instructions for the 2.2.1 sourcecode a few messages up kindly put together by a generous soul. Extract the original register.php from the ZIP (if needed) and then apply the instructions in step 4 all over again... upload and it *should* work. It did for me.

aldamon
29 Nov 2001, 18:54
There are actually 3 updated sections for 2.2.1. I noticed in my previous text file that I used two different phrases to indicate changes, *** Updated for vB 2.2.1 *** AND *** Modified for vB2.2.1 ***. I just changed the text file so all 3 changes are marked by:

*** Modified for vb 2.2.1 ***

Here it is again and remember there are 3 changes. I have fully updated the affected sections with the 2.2.1 source code.

Enjoy!

trilOByte
05 Dec 2001, 09:23
Great hack, works fine on 2.20 once I had modded the register.php as mentioned.

One small issue - you don't have my country :mad: :

England.

trilOByte
05 Dec 2001, 09:24
Oh yeah, here's Wales too ;)

Lionel
19 Dec 2001, 11:32
Great hack! I installed it one shot on 2.21.

Stretchr
15 Jan 2002, 03:39
Bane,
I would very much like the hack to use the same flags for vbStats if you mean that vbStats can use the flags with the full country name. That would be great, even if I would have to upload these, I prefer having the alt tag capability. Think I'll wait till I get a reply to this before installing but it's a great hack. Thanks!

Originally posted by Bane
The problem was that in the original version of the flags hack there were all lowercase flag names etc..There is an easy way to change the image settings for flags in vbstats if you want to use the same set. Or optionally you can wait for the next release of vbstats where I will release a compatible Flag Hack if AJ isnt back yet.

Stretchr
15 Jan 2002, 07:51
I'd still like to hear from Bane regarding integrating with vbStats but I couldn't wait to install this one. Great job on the hack and documentation.

I'm running 2.2.1 and did your step-by-step and it went flawlessly. Guess it pays to RTFM, though I'd hate to make a habit of it. :D Thank you AJR!

Erwin
15 Jan 2002, 09:06
Wow... I had to do a small bit of modifications to the hack to make it comply with the mood hack, gender hack and and all my other user hacks - I was getting database errors, and had to sort it out. Took a while, no one was able to register or change their profile, but I persevered, and it is now working. I made it non-compulsory when a new user registers too. I could not be bothered making any changes to the vbstats flags, so I just uploaded the long name ones.

Good job! :)

Now to try to get it working from CP...

Erwin
15 Jan 2002, 09:11
Yup, CP is working.

Whew... :)

And the addition to the memberlist was sweet too. Thanks!

Dex
21 Jan 2002, 02:59
Thanks for the great hack :)

Dex

Dex
21 Jan 2002, 09:14
Bane it'd be great if you'd take off that faulty version of yours or at least replace it with aldamon's updated version.

Your text file had me busy for 2 hrs figuring out why people couldn't register. And that's right after I told people that my site is online. They all got knocked back, pretty embarrassing.

It's the missing 'country' string in the register.php.

I guess I didn't really understand aldamon, I thought he had just a version that indicated all the changes from 2.0.3 to 2.2.1 or something like that, which I didn't need. That's why I DL the original file.

Just trying to save other newbies from this experience.

;)

Dex

aliraqi
21 Jan 2002, 10:42
why hasnt webhost replied to the fact that the string he said is found twice in usercp.php only occurs in it once?

what are we supposed to do?

PhotoGenie
02 Feb 2002, 22:01
I installed this hack on 2.2.2 and the flags show fine. I had trouble with not being able to register after making changes to the register.php .. I decided to leave the register changes out and everything else is working fine. You can add flags in your edit profile still. I was getting a parse error on the very last line of the register.php file. It could have been my error because I didn't try it again, but I do plan too. This is a great hack and I'll take it anyway I can get it. Thanks!

KISS
02 Feb 2002, 22:26
does this work and and avatars together? or it replaces the avatars?

PhotoGenie
02 Feb 2002, 22:56
With avatars:)

PhotoGenie
02 Feb 2002, 23:54
I went back and made the changes in my register.php file again and apparently I made a mistake changing the code.. This hack is completly compatible with 2.2.2.. I have tested it thouroughly.

KISS
03 Feb 2002, 02:46
ok cool gonna install this then hehe :)

TheComputerGuy
04 Feb 2002, 05:14
I have this installed for 2.21, it works great for new people, but me, I can not edit my flag and it show......any idea.....Thanks for a great hack

PhotoGenie
04 Feb 2002, 12:55
Have you looked at your user table in phpMyAdmin in the country field to see if its adding it to the database?

TheComputerGuy
04 Feb 2002, 14:57
I edited it in the admin CP and it started to work...but the flag is not, so the images arent quite yet but I think it is workign )

TheComputerGuy
04 Feb 2002, 14:57
thanks for the help :)

khan
10 Feb 2002, 15:22
I got an error :surprised
Parse error: parse error in /home/virtual/site35/fst/var/www/html/vportal/forums/member.php on line 528

anybody know what that means
and btw I have 2.2.2
oh yea forgot when I go to user control panel and go to edit profile, edit options or edit password

X-Fan
11 Feb 2002, 03:40
How would one get the country flags to appear on the memberlist.php page?

I know that would require code added to the memberlist.php file as well as modfying the memberlist templates, but I'm not sure what would need adding to memberlist.php.

X-Fan
11 Feb 2002, 03:55
Hey all,

This hack has proven so popular on my forums that I've done my own update to it to include ever-so-slightly larger-sized flags, updates to several flags from the original release (like Rwanda, whose flag changed on December 31, 2001, Martinique, Reunion, Tuvalu, etc), and to include several flags that weren't in the original, such as the British countries (England, Ireland, Wales, Scotland, Isle of Man, Channel Islands, etc), countries in dispute (like Northern Cyprus, Tibet, French Guiana, etc), and more.

All it takes is an upload of the new flag image files as well as a modification to the modifyprofile_country template. I've attached a text file containing the mods to this post and will attach two zips with the new flag images to my next two posts.

Hope y'all like it!

X-Fan
11 Feb 2002, 04:00
Here's the first zip (74k) containing the updated flags for 2002 from A-M.

X-Fan
11 Feb 2002, 04:01
And here's the second zip (54k) containing the updated flags for 2002 from N-Z!

X-Fan
12 Feb 2002, 09:52
Bump...

Massiel
16 Feb 2002, 11:20
I want to add this hack for my flags, use the avatar for photos and the medals for medals, is this possible? Thanks in advance! I am also wanting to add the star hack. Any known complications?

X-Fan
16 Feb 2002, 11:33
Originally posted by Massiel
I want to add this hack for my flags, use the avatar for photos and the medals for medals, is this possible? Thanks in advance! I am also wanting to add the star hack. Any known complications?

I'm using the flags hack, the medals hack, and avatars without a hitch.

Massiel
17 Feb 2002, 01:50
How do I run a query? I am new at this, was ready to install hack and got stuck here...

====================================================

1 - Add to database-Table user, field named: country
properties: ( country varchar(50) NOT NULL )

In phpMyAdmin, you can run this query:
ALTER TABLE user ADD country VARCHAR (50) NOT NULL

====================================================

aldamon
07 Mar 2002, 14:17
Works with 2.2.3! Updated instructions attached!

freehtml
10 Mar 2002, 04:30
can we had the flag name be reflected in text format so that if I select SIngapore flag..

It will display the GIF file as well as display "Country : Singapore" ?

freehtml
10 Mar 2002, 04:31
Originally posted by X-Fan
How would one get the country flags to appear on the memberlist.php page?

I know that would require code added to the memberlist.php file as well as modfying the memberlist templates, but I'm not sure what would need adding to memberlist.php.

What about include also in the "forum leader" list?

AJR
11 Mar 2002, 12:35
Hey all... I have updated the Country Flag Hack to v2.1. This version should work with all 2.2.x versions. See other additions and download v2.1 in the first post of this thread.

Erwin
11 Mar 2002, 19:15
Updated! Thanks!

freehtml
12 Mar 2002, 03:44
somehow it appears under my profile and all that but not in the Member list... I am using vB 2.2.4

Lucky
12 Mar 2002, 07:15
Great work my friend!!!

Dez_U
14 Mar 2002, 11:43
I am using version 2.2.4 and it works great for NEW MEMBERS ONLY. ??

A new member can register and the flag will show

Exsisting members can see the drop down in their user cp and select their country flag. but it does not show ??

Also none of the flags show on the members list.

Any help, thanks

PS, very <--COOL--> hack :D

Erwin
15 Mar 2002, 00:06
Make the modifyprofile_country template default by making it (-1) using phpmyadmin as per the instructions.

Dez_U
15 Mar 2002, 00:19
sorry newbe here .... how do I do that then ??

I am in the phpMyAdmin area, what do I do next ?

Dez_U
15 Mar 2002, 00:49
OK, I followed the instructions :) and did the search and changed the template to -1

BUT it still don't work for oldtimers on the board. Is it something to do with 2.2.4 ??

Dez_U
15 Mar 2002, 23:59
does anyone have an answer to this as its driving my members nuts :)

Hamsh
17 Mar 2002, 03:15
Most of it works fine on my 2.2.4, will display flags for old members no problems.

Whenever I try to logout or view a member profile I get a parse error in member.php, line 500 and something. Everything seems to be replaced and added OK, and I thought I'd followed all instructions. I don't have access to anything other than notepad to count the lines. Before I count them all on the screen, anyone got any ideas on what might be causing this?

freehtml
17 Mar 2002, 16:13
Originally posted by Hamsh
I don't have access to anything other than notepad to count the lines.

Try using NoteTab (http://www.notetab.com) ,a well good replacement for Notepad.

Dez_U
17 Mar 2002, 17:20
so does anyone have any suggestions as to how i can get this cool hack working 100% ?

Demascus
21 Apr 2002, 16:51
anyone got this working on vbb2.2.5 yet?

Chris M
21 Apr 2002, 18:22
I noticed a syntax error...

4 - Open member.php

find:
$templatesused .= "register_birthday,modifyprofile_customtext,register_customfields,usercpnav,modif yprofile";

Should be :

4 - Open member.php

find:
$templatesused = 'register_birthday,modifyprofile_customtext,register_customfields,usercpnav,modi fyprofile';

Satan

Chris M
21 Apr 2002, 18:23
Another one :

// Country Hack Replace
// $templatesused .= "register_birthday,modifyprofile_customtext,register_customfields,usercpnav,modif yprofile";
$templatesused .= "register_birthday,modifyprofile_customtext,modifyprofile_country,register_custom fields,usercpnav,modifyprofile";
// Country Hack End

Should be :

// Country Hack Replace
// $templatesused = 'register_birthday,modifyprofile_customtext,register_customfields,usercpnav,modi fyprofile';
$templatesused = 'register_birthday,modifyprofile_customtext,modifyprofile_country,register_custo mfields,usercpnav,modifyprofile';
// Country Hack End

Satan

Chris M
21 Apr 2002, 18:25
eval("\$customtext.= \"".gettemplate("modifyprofile_customtext")."\";");
}
}

Should be :

eval("\$customtext = \"".gettemplate("modifyprofile_customtext")."\";");
}
}

Chris M
21 Apr 2002, 18:48
I think that is all the syntax errors there were...

Satan

Erwin
22 Apr 2002, 01:28
Defnitely works on 2.2.5.

aldamon
22 Apr 2002, 13:30
I'm going to miss this in vb3.0. I hope it is ported!

mashby
22 Apr 2002, 17:45
Just wanted to let you know that I followed your directions to a "T" and your hack installed just as described. Although the instructions were lengthy, the result was on the money. :cool:

Thanks for making such a GREAT hack!

212rikanmofo
25 Apr 2002, 04:43
the hack works great, but one thing thats not working is the user registering part, when a user submits, it keeps saying please filled all required fields, and ALL fields are filled out... i think it has to do with the registrationadult template, but the dropdown menu where you select your country doesnt even show up at all under the registration form, under enter your email...

here's what part of my registrationadult template looks like:

<td bgcolor="{secondaltcolor}"><normalfont><b>Email:</b></normalfont><br>
<smallfont>Please enter a valid email address. You can choose to hide it below in the preferences section.</smallfont></td>
<td bgcolor="{secondaltcolor}"><normalfont><input type="text" class="bginput" name="email" size="25" maxlength="50"></normalfont></td>
</tr>
<tr>
<td bgcolor="{secondaltcolor}"><normalfont><b>Enter Email Again:</b></normalfont></td>
<td bgcolor="{secondaltcolor}"><normalfont><input type="text" class="bginput" name="emailconfirm" size="25" maxlength="50"></normalfont></td>
</tr>
<!-- Country Hack Code Begin -->
<tr>
<td bgcolor={firstaltcolor}><normalfont><b>Select your Country:</b></normalfont><br>
<smallfont>If you select your country, your country flag image will appear next to your name on your posts.</smallfont></td>
<td bgcolor={firstaltcolor}><smallfont>
$countrytext</td>
</tr>
<!-- Country Hack Code End -->
$customfields_required
<!-- *** -->
<tr>
<td bgcolor="{tableheadbgcolor}" colspan="2"><normalfont color="{tableheadtextcolor}" class="thtcolor"><b>Optional Information</b></normalfont>


why isn't it showing up at all? any reasons, other than that, the hack works great, but i need to fix this, cause it wont let users register cause it keeps saying please fill in all fields, thats cause the dropdown menu for the country isnt even available to them...

mashby
25 Apr 2002, 08:17
Well, I spoke too soon as well. I ran into a similar problem. I'm in the process of removing the hack so that I can get my registeration back. Everything worked, but I got a SQL error everytime someone tried to register.

UPDATE:
Well, after un-installing the hack the error is still there. So, I'm going to have to take more drastic measures to get my board back to 100%. FYI, this is the SQL Error I'm getting.

Database error in vBulletin 2.2.5:

Invalid SQL: INSERT INTO userfield (userid,field5,field6,field7,field1,field2,field3,field4) VALUES (,'Demo
Account','Demo','Demo','','','','')
mysql error: You have an error in your SQL syntax near ''Demo Account','Demo','Demo','','','','')' at line 1

mysql error number: 1064

Date: Thursday 25th of April 2002 02:22:37 AM
Script: http://www.interpug.com/private/forum/private/forum/register.php
Referer: http://www.interpug.com/private/forum/register.php

mashby
25 Apr 2002, 08:47
I downloaded a fresh copy of vBulletin 2.2.5 and uploaded a clean copy of register.php and everything is back to normal. So, obviously something is up with the register.php changes. Too many people are complaining about it to be a fluke, or a typo on the installer's part.

If the register.php worked properly, it would be a GREAT hack.

Does anyone know if I can install everything BUT the register.php changes? I don't really care to make the user choose their flag when they join.

212rikanmofo
30 Apr 2002, 06:17
mashby, i also need a fix for this

something is wrong with the register.php

when i have the hack, when a user registers, there is no drop down box where they can choose there country, it wont show up at all. and therefore they cant register since it's a required field, so i had to take it out, but the rest of the hack works great. just that one fault, is there a fix for this please?

mashby
30 Apr 2002, 06:23
My error was that the register just didn't work. Everything appeared ok, but register.php just didn't work.

Since my problem was a little different. I would check through the code that you have to alter in your templates and in register.php again. It sounds like you may just be missing something in the template you have to create.

212rikanmofo
30 Apr 2002, 06:28
i checked the template so many times, and thats not the problem
... i dont know why its not showing up at all when a user registers

Erwin
30 Apr 2002, 07:05
Make sure you've made the template -1 so that it's default. This hack is temperamental like that. Also make sure that you database inserts in register.php includes the country variable as well.

Erwin
30 Apr 2002, 07:13
Remember, each time you upgrade vB, you need to run the database query again to make that country select list template -1 again. This is the only hack that I know of that requires this.

212rikanmofo
30 Apr 2002, 08:34
i already ran that -1 query already, and what do you mean include register.php? im not understanding, do i have to include it in a template? clarify this for me please...

scsa20
02 May 2002, 19:49
I keep getting this:

Database error in vBulletin 2.2.5:

Invalid SQL: SELECT country FROM user WHERE userid=1
mysql error: Unknown column 'country' in 'field list'

mysql error number: 1054

Date: Thursday 02nd of May 2002 02:36:08 PM
Script: http://forums.simon-soft.com/member.php?action=editprofile
Referer: http://forums.simon-soft.com/usercp.php?


how do I fix this??

wot-Mike
02 May 2002, 20:45
Looks like you didn't run a querie. The user table needs to be altered, the country field needs to be added.

Look inside the install.txt for that info :)
It's step 1 I believe...

scsa20
02 May 2002, 21:18
doh, stupid me, all I look for is the code to put in, plus the beging part of the install.txt file is nothing but info about it...maybe I should open up my eyes more :rolleyes:

Sketch
03 May 2002, 00:31
okay, all is hitchless for me except one thing. In the memberlist, the flag is not displayed. Everywhere else it is displayed okay.

Here is a link to where it is not showing---http://www.livetheworship.com/vb/memberlist.php?s=

Here is a link to where it is showing---
http://www.livetheworship.com/vb/showthread.php?s=&threadid=89

Here is my memberlistbit (fragment):
<tr align="center">
<td bgcolor="{firstaltcolor}">$flag</td>
<td bgcolor="{secondaltcolor}" align="left">
<span style="font-size: 11px;">
<a href="member.php?s=$session[sessionhash]&action=getinfo&userid=$userinfo[userid]">$userinfo[username]</a>
</td>


Any ideas why it won't show up here?

Sketch

scsa20
03 May 2002, 04:34
did you add $flag ??

DWZ
03 May 2002, 11:39
Can someone tell me how I can make it so a users must select a flag when they sign up?

ie. You get a message saying "You must select a country to register" if they keep the box blank.

Thanks :)

DWZ
07 May 2002, 03:19
Originally posted by DWZ
Can someone tell me how I can make it so a users must select a flag when they sign up?

ie. You get a message saying "You must select a country to register" if they keep the box blank.

Thanks :) http://members.optushome.com.au/megabaz3/forums/BUMP.gif

DWZ
13 May 2002, 01:26
awww... come on, please, anyone?

DWZ
18 May 2002, 13:52
Originally posted by DWZ
awww... come on, please, anyone? it isn't that hard... is it?

webhost
18 May 2002, 18:24
In register.php find this



if ($action=="register") {

if (!$allowregistration) {

eval("standarderror(\"".gettemplate("error_noregister")."\");");

exit;

}



if ($bbuserinfo[userid]!=0 and !$allowmultiregs) {

$getuser=$DB_site->query_first("SELECT username FROM user WHERE userid='$bbuserinfo[userid]'");

$username=$getuser[username];



eval("standarderror(\"".gettemplate("error_alreadyregistered")."\");");



exit;

}




After it put this




" if($country==""){
eval("standarderror('Please select your country.');");
exit;
}"

DWZ
18 May 2002, 23:25
Originally posted by webhost
In register.php find this



if ($action=="register") {

if (!$allowregistration) {

eval("standarderror(\"".gettemplate("error_noregister")."\");");

exit;

}



if ($bbuserinfo[userid]!=0 and !$allowmultiregs) {

$getuser=$DB_site->query_first("SELECT username FROM user WHERE userid='$bbuserinfo[userid]'");

$username=$getuser[username];



eval("standarderror(\"".gettemplate("error_alreadyregistered")."\");");



exit;

}




After it put this




" if($country==""){
eval("standarderror('Please select your country.');");
exit;
}"


Great :D

Thanks for that :)

But just to check, should those " at the start and end be there in the code I'm puting in be there?

webhost
18 May 2002, 23:33
if($country==""){
eval("standarderror('Please select your country.');");
exit;
}

DWZ
19 May 2002, 01:59
Originally posted by webhost

if($country==""){
eval("standarderror('Please select your country.');");
exit;
}
yep, thats what I thought :)

Will test it now

DWZ
19 May 2002, 02:05
OK, just tried it, didn't work :(

As soon as I hit the register link, it says "Please select your country."

I hadn't even got to the signup page yet before it said it...

Any ideas?

webhost
19 May 2002, 03:28
remove that and place here.

Find

// Country Hack

$country = trim($country);
// Country Hack End



and place this after it


if($country==""){
eval("standarderror('Please select your country.');");
exit;
}



so it should like this when finished


// Country Hack

$country = trim($country);
if($country==""){
eval("standarderror('Please select your country.');");
exit;
}
// Country Hack End

DWZ
19 May 2002, 03:41
That worked great :D

Thanks for all your help webhost.

refertech
03 Jun 2002, 03:49
Great work man. I would it be possible to see the country name in the users profile. I dont reconize alot of the flags.
Installed great for me in 2.2.6. :)

aldamon
07 Jun 2002, 16:31
I'm so attached to this hack that I probably won't upgrade to vB 3.0 until it is ported.

freehtml
08 Jun 2002, 15:24
I can't seems to find find:
$templatesused .= "register_birthday,modifyprofile_customtext,register_customfields,usercpnav,modif yprofile";

In my member.php (version 2.2.6)...

ciscoman
07 Jul 2002, 23:22
It should be this
$templatesused = 'register_birthday,modifyprofile_customtext,register_customfields,usercpnav,modi fyprofile';

freehtml
14 Jul 2002, 02:35
thanks, I think I will not install any hack till vB 3 is out

MarkG
16 Jul 2002, 20:05
great hack

two errors: europe flag is not there(but it's here http://apolyton.net/forums/images/flags/Europe.gif) and Tajikistan.gif is mispelled

streamzone
27 Jul 2002, 01:16
k...

Hack works wonderfully - EXCEPT. It displays the flag everywhere it's supposed to except under or next to my members name when showing threads. I've checked and rechecked the code so many times in postbit template... everything looks fine. Any idea what the problem could be? Thanks in advance.

Jean147
09 Aug 2002, 03:10
Originally posted by streamzone
k...

Hack works wonderfully - EXCEPT. It displays the flag everywhere it's supposed to except under or next to my members name when showing threads. I've checked and rechecked the code so many times in postbit template... everything looks fine. Any idea what the problem could be? Thanks in advance.

same problem for me here. :( Hack works great in memberlistbit and getinfo. But the flag is not shwon in the postbit template, although $flag is in.

Any help would be really apreciated. :)

Congrats on this hack. It is really great. Just fix the problem please. :p :D

Jean147
09 Aug 2002, 03:29
The user.php code also does not work. I really tried everything :(

Parse error: parse error in /homepages/15/d42020741/htdocs/gtn/forums/admin/user.php on line 391

ExAvIoUr
09 Aug 2002, 23:10
1 - Add to database-Table user, field named: country
properties: ( country varchar(50) NOT NULL )

i don't get that.

does it mean that the name is Table and the field is country?

Erwin
10 Aug 2002, 02:06
No, the table name is "User" - add a field called "Country" with those variables using phpmyadmin.

ExAvIoUr
10 Aug 2002, 02:10
how do i do that in phpmyadmin?

Erwin
10 Aug 2002, 02:20
In the query box, run this:

ALTER TABLE user ADD country VARCHAR (50) NOT NULL

Jean147
10 Aug 2002, 13:59
maybe somone may help me too with my problem?

carpman
23 Aug 2002, 14:38
i can get this to work for admin but registered users just see blank space where country list/menu should be!!


note this is only in user cp, is ok when they register!!

any ideas

carpman
24 Aug 2002, 19:43
ok i have a problem in user.php, it says to add:

// $DB_site->query("UPDATE user SET birthday='".addslashes($birthday)."',signature='".addslashes($signature)."',customtitle='".intval($customtitle)."',usertitle='".addslashes($customtext)."',email='".addslashes(htmlspecialchars($email))."',parentemail='".addslashes(htmlspecialchars($parentemail))."',coppauser='$coppauser',homepage='".addslashes(htmlspecialchars($homepage))."',icq='".addslashes(htmlspecialchars($icq))."',aim='".addslashes(htmlspecialchars($aim))."',yahoo='".addslashes(htmlspecialchars($yahoo))."',usergroupid='$bbuserinfo[usergroupid]',country='".addslashes($country)."' WHERE userid='$bbuserinfo[userid]'");


But i already have user away hack installed which changed this entry to:

$DB_site->query("UPDATE user SET away='$away',awaydate=$awaydate,returndate='$returndate',awayreason='".addslashes(htmlspecialchars($awayreason))."',birthday='$birthday',options='$options',usergroupid='$usergroupid',username='".addslashes(htmlspecialchars($ausername))."'$pwdinclude,email='".addslashes(htmlspecialchars($email))."',styleid='$userstyleid',parentemail='".addslashes(htmlspecialchars($parentemail))."',coppauser=$coppauser,homepage='".addslashes(htmlspecialchars($homepage))."',icq='".addslashes(htmlspecialchars($icq))."',aim='".addslashes(htmlspecialchars($aim))."',yahoo='".addslashes(htmlspecialchars($yahoo))."',signature='".addslashes($signature)."',adminemail=$adminemail,showemail=$showemail,invisible=$invisible,usertitle='".addslashes($usertitle)."',customtitle=$customtitle,joindate=$joindate,cookieuser=$cookieuser,nosessionha sh=$nosessionhash,daysprune='$daysprune',lastvisit=$lastvisit,lastactivity=$last activity,lastpost=$lastpost,posts='$posts',timezoneoffset='$timezoneoffset',emai lnotification=$emailnotification,receivepm='$receivepm',emailonpm='$emailonpm',i paddress='".addslashes($aipaddress)."',pmpopup=IF(pmpopup=2 AND $pmpopup=1,pmpopup,'$pmpopup') WHERE userid=$userid");


i have looked but am unclear as to changes i should make?


anyone help?

carpman
24 Aug 2002, 21:01
i am going to try this, any feedback?

$DB_site->query("UPDATE user SET away='$away',awaydate=$awaydate,returndate='$returndate',awayreason='".addslashes(htmlspecialchars($awayreason))."',birthday='".addslashes($birthday)."',options='$options',usertitle='".addslashes($customtext)."',usergroupid='$bbuserinfo[usergroupid]',username='".addslashes(htmlspecialchars($ausername))."'$pwdinclude,email='".addslashes(htmlspecialchars($email))."',styleid='$userstyleid',parentemail='".addslashes(htmlspecialchars($parentemail))."',coppauser=$coppauser,homepage='".addslashes(htmlspecialchars($homepage))."',icq='".addslashes(htmlspecialchars($icq))."',aim='".addslashes(htmlspecialchars($aim))."',yahoo='".addslashes(htmlspecialchars($yahoo))."',signature='".addslashes($signature)."',adminemail=$adminemail,showemail=$showemail,invisible=$invisible,usertitle='".addslashes($usertitle)."',customtitle='".intval($customtitle)."',country='".addslashes($country)."',joindate=$joindate,cookieuser=$cookieuser,nosessionhash=$nosessionhash,dayspru ne='$daysprune',lastvisit=$lastvisit,lastactivity=$lastactivity,lastpost=$lastpo st,posts='$posts',timezoneoffset='$timezoneoffset',emailnotification=$emailnotif ication,receivepm='$receivepm',emailonpm='$emailonpm',ipaddress='".addslashes($aipaddress)."',pmpopup=IF(pmpopup=2 AND $pmpopup=1,pmpopup,'$pmpopup') WHERE userid='$bbuserinfo[userid]'");

carpman
24 Aug 2002, 21:51
hello, modifyprofile_country tempate is set to -1 but users still cannot see the drop down list of coutries in their user-cp, they can when they register though


the code should be ok as when logged in as admin i can see and change country from user-cp


could use some help, only thing not sure of is user.php editing see above posts

carpman
26 Aug 2002, 23:12
hello, back again.

I have been through re-install of hack, except database entries as not sure if i should duplicate them.


I have done all php pages and tempates and have run the change_template.php, checked with myphadmin and it is set to -1

New users can register with flag and is displays everwhere it should.

However, older user and current users (withflag) cannot access country list via user_cp, it is just blank space.

The other problem is in admin cp, when i try and edit a user the user ID 1 (admin) gets set to the user details (name, profile etc) of who i was trying edit, so i end with two users with same name but different ID.

The the only thing i can think of is a conflick with 'leave away message' which also has changes to entries $DB_site->query("UPDATE user SET

the two pages affected are member.php and user.php below is what i have for each page, i have tried to compare and get things as should be, but might have missed something.

help really appreciated


member.php
$DB_site->query("UPDATE user SET birthday='".addslashes($birthday)."',signature='".addslashes($signature)."',customtitle='".intval($customtitle)."',usertitle='".addslashes($customtext)."',email='".addslashes(htmlspecialchars($email))."',parentemail='".addslashes(htmlspecialchars($parentemail))."',coppauser='$coppauser',homepage='".addslashes(htmlspecialchars($homepage))."',icq='".addslashes(htmlspecialchars($icq))."',aim='".addslashes(htmlspecialchars($aim))."',yahoo='".addslashes(htmlspecialchars($yahoo))."',usergroupid='$bbuserinfo[usergroupid]',country='".addslashes($country)."' $awaysql WHERE userid='$bbuserinfo[userid]'");




admin/user.php
$DB_site->query("UPDATE user SET away='$away',awaydate=$awaydate,returndate='$returndate',awayreason='".addslashes(htmlspecialchars($awayreason))."',birthday='".addslashes($birthday)."',options='$options',usertitle='".addslashes($customtext)."',usergroupid='$bbuserinfo[usergroupid]',username='".addslashes(htmlspecialchars($ausername))."'$pwdinclude,email='".addslashes(htmlspecialchars($email))."',styleid='$userstyleid',parentemail='".addslashes(htmlspecialchars($parentemail))."',coppauser=$coppauser,homepage='".addslashes(htmlspecialchars($homepage))."',icq='".addslashes(htmlspecialchars($icq))."',aim='".addslashes(htmlspecialchars($aim))."',yahoo='".addslashes(htmlspecialchars($yahoo))."',signature='".addslashes($signature)."',adminemail=$adminemail,showemail=$showemail,invisible=$invisible,usertitle='".addslashes($usertitle)."',customtitle='".intval($customtitle)."',country='".addslashes($country)."',joindate=$joindate,cookieuser=$cookieuser,nosessionhash=$nosessionhash,dayspru ne='$daysprune',lastvisit=$lastvisit,lastactivity=$lastactivity,lastpost=$lastpo st,posts='$posts',timezoneoffset='$timezoneoffset',emailnotification=$emailnotif ication,receivepm='$receivepm',emailonpm='$emailonpm',ipaddress='".addslashes($aipaddress)."',pmpopup=IF(pmpopup=2 AND $pmpopup=1,pmpopup,'$pmpopup') WHERE userid='$bbuserinfo[userid]'");

DWZ
03 Sep 2002, 06:52
I tried to run the SQL commandUPDATE template SET templatesetid="-1" where title="modifyprofile_country"With FireFly's run sql query from admin cp hack and I get a database error:Database error in vBulletin Control Panel 2.2.7:

Invalid SQL: UPDATE template SET templatesetid=
mysql error: You have an error in your SQL syntax near '' at line 1

mysql error number: 1064

Date: Tuesday 03rd of September 2002 05:50:41 AM
Script: http://www.consoleradar.com/forums/forums/admin/query.php
Referer: http://www.consoleradar.com/forums/admin/query.phpIs that his hack or this hack that is having this problem? :confused:

kira
03 Sep 2002, 22:42
Just wanted to say I installed this hack on 2.2.6 and it worked flawlessly. I did take care to tweak the syntax in the hack that, as I think HellSatan mentioned earlier, seems to have been made for an older version of vB -- maybe some of you who are having problems the code can make sure you do the same?

In the instructions relating to member.php, make note of these changes:

When the instructions tell you to ...

find:
$templatesused .= "register_birthday,modifyprofile_customtext,register_customfields,usercpnav,modif yprofile";

Replace it with
// Country Hack Replace
// $templatesused .= "register_birthday,modifyprofile_customtext,register_customfields,usercpnav,modif yprofile";
$templatesused .= "register_birthday,modifyprofile_customtext,modifyprofile_country,register_custom fields,usercpnav,modifyprofile";
// Country Hack End




Do this instead:


find:
$templatesused = "register_birthday,modifyprofile_customtext,register_customfields,usercpnav,modif yprofile";

Replace it with

// Country Hack Replace
// $templatesused = "register_birthday,modifyprofile_customtext,register_customfields,usercpnav,modif yprofile";
$templatesused = "register_birthday,modifyprofile_customtext,modifyprofile_country,register_custom fields,usercpnav,modifyprofile";
// Country Hack End

and (also in the member.php instructions) where it says to:


find:
eval("\$customtext.= \"".gettemplate("modifyprofile_customtext")."\";");
}
}

Below it add:
// Country Hack
if (!$getcountry = $DB_site->query_first("SELECT country FROM user WHERE userid=$bbuserinfo[userid]")) {
$country="";
$ctrdefaultselected = "selected";
} else {
$country="$getcountry[country]";
$countryalt = str_replace("%20"," ",$country);
$countrysel = str_replace("%20","_",$country);
$flag="<img src=\"images/flags/$country.gif\" alt=\"$countryalt\" align=\"absmiddle\" border=\"0\">";
$ctryname = "ctry".$countrysel."selected";
$$ctryname = "selected";
}
eval("\$countrytext. = \"".gettemplate("modifyprofile_country")."\";");
// Country Hack End


instead of that, do this...


find:
eval("\$customtext= \"".gettemplate("modifyprofile_customtext")."\";");
}
}

Below it add:
// Country Hack
if (!$getcountry = $DB_site->query_first("SELECT country FROM user WHERE userid=$bbuserinfo[userid]")) {
$country="";
$ctrdefaultselected = "selected";
} else {
$country="$getcountry[country]";
$countryalt = str_replace("%20"," ",$country);
$countrysel = str_replace("%20","_",$country);
$flag="<img src=\"images/flags/$country.gif\" alt=\"$countryalt\" align=\"absmiddle\" border=\"0\">";
$ctryname = "ctry".$countrysel."selected";
$$ctryname = "selected";
}
eval("\$countrytext = \"".gettemplate("modifyprofile_country")."\";");
// Country Hack End


Hope this makes sense and is correct. Basically, there were extra dots that didn't need to be there. Maybe the instructions could be updated?

Anyway, great hack, thank you very much!

DWZ
09 Sep 2002, 09:01
Originally posted by DWZ
I tried to run the SQL commandUPDATE template SET templatesetid="-1" where title="modifyprofile_country"With FireFly's run sql query from admin cp hack and I get a database error:Is that his hack or this hack that is having this problem? :confused: *bump*

AJR
22 Oct 2002, 10:52
DWZ... try using apostrophes (') instead of quotes (") around the -1 in the query.

DWZ
22 Oct 2002, 11:04
Originally posted by AJR
DWZ... try using apostrophes (') instead of quotes (") around the -1 in the query. that worked!

thanks!

Talisman
03 Nov 2002, 23:32
Thanks, AJR! Ours is an international community, so being able to display our national flags means a lot to everyone.

And thank you, Kira -- I started getting a bit nervous about installing this one and was so happy to see the summary update you posted.

I probably held my breath through the whole thing..... but it works!! What a rush!

Harken
12 Nov 2002, 23:05
hmmm..i installed the country hack..and now when im logged in as admin i see the option in the usercp and it works fine...but if i log in as a registered user..the scroll list is gone in the usercp...but the option for country is still there so its just a blank no bar to scroll or anything. Any ideas?

Erwin
12 Nov 2002, 23:26
Originally posted by Harken
hmmm..i installed the country hack..and now when im logged in as admin i see the option in the usercp and it works fine...but if i log in as a registered user..the scroll list is gone in the usercp...but the option for country is still there so its just a blank no bar to scroll or anything. Any ideas?

You need to run the database query to make the modify_country template default ie. templatesetid=-1

Harken
12 Nov 2002, 23:42
i ran that before and i show it under the User Option Templates....there is 3 of them...weird...should there be only 1 right? but it still doesnt work..

Erwin
12 Nov 2002, 23:45
Delete all of them.

Add a new one.

Then run the query.

Harken
13 Nov 2002, 16:34
ok i deleted it..the one under templates in phpmy admin..but still i have two showing up when i open templates user options under that style...so i can still only see the list as admin...not under any other kind.

Erwin
13 Nov 2002, 19:54
Can't you remove them from your Admin CP in Templates?

Harken
13 Nov 2002, 20:03
no because the only options i c are Change original...unless im missing something..

TECK
13 Nov 2002, 20:17
hmmm is normal there are so many boards out there with all kind of problems and security issues... due to bad code.
i made for you a little script to add and remove safely one or several templates:
<?php
error_reporting(E_ALL);

require('./global.php');

cpheader('<title>Templates</title>');

function dotemplate($title, $template, $templatesetid=-1) {
global $DB_site;

$DB_site->query("INSERT INTO template (templateid,templatesetid,title,template) VALUES (NULL,'$templatesetid','" . addslashes($title) . "','" . addslashes($template) . "')");
echo "Installing $title template... Done.<br>\n";
}

function killtemplate($title, $templatesetid=-1) {
global $DB_site;

$DB_site->query("DELETE FROM template WHERE title='" . addslashes($title) . "' AND templatesetid=-1");
echo "Removing $title template... Done.<br>\n";
}

$DB_site->reporterror = 1;

// add a template
dotemplate('yourtemplatename', 'yourtemplatehtmlcode');

// remove a template
killtemplate('yourtemplatename');

cpfooter();
?>

Harken
13 Nov 2002, 20:21
im sorry but what do i do with that....today has not been my day...

TECK
13 Nov 2002, 20:24
i hope you will get the rest of it, how to use the installer-uninstaller.
if you are not sure, erwin will be able to smack you in the head... heh, with explanations on how to use it. ;)

Harken
17 Nov 2002, 23:21
can anyone assist me this...im am still lost...

Bison
05 Dec 2002, 02:45
Anyone get this to work with vb 2.2.9?

I can't get past the member.php file before the code blows up!

Erwin
05 Dec 2002, 03:07
Works fine from 2.2.1 all the way to 2.2.9 on my forums.
Tip: Remember, EACH time you upgrade, you need to add the modifyprofile_country template AGAIN, and run the db query AGAIN.

Bison
05 Dec 2002, 04:54
I did that part already, but the member.php file fowls up everything right after uploading the file!

Someone willing to share their file with me?

Logician
05 Dec 2002, 15:42
Firstly great hack and althought installation steps are a little bit long, it works ok in v.2.2.9! Thx for sharing.. :)

And a few comments that might help some people while installing:
If these are already mentioned in the hack thread, my apologies..
VBSTATS and THIS HACK
If you use Bane's vbstat hack the image directory's of these 2 hacks clashes. To use them both, I applied such a method:

1- rename image directory of this hack to cflags and edit these files:

memberlist.php
member.php
functions.php
user.php

find: images/flags/
Replace it AS: images/cflags/

Now you can use 2 hacks together..

ASSIGNING TEMPLATE TO DEFAULT SET:
*** The 'modifyprofile_country' template needs to be changed
to a default original templatesetid of -1 or else the Admin CP addon
will not show the country select list (Any ideas why?).
This is because vb Admin CP logins does not set $templatesetid variable.

To cure this edit user.php and find:
eval("\$countrytext.= \"".gettemplate("modifyprofile_country")."\";");

(There are 2 instances)

Before that add:
$templatesetid=1;

Now you can create your template in the default set and you dont need to run UPDATE template SET templatesetid="-1" where title="modifyprofile_country" query which will be overwritten after you upgrade your board..

Hope this helps..

Enjoy.

Ps. I dont have subscription in this thread, so do not address me here, ty..

stryka
09 Dec 2002, 03:52
there are subtle code differences in 2.2.9 vs the documentation for the country hack... so here's the members.php instructions to match 2.2.9


4 - Open member.php

find:
$templatesused = 'register_birthday,modifyprofile_customtext,register_customfields,usercpnav,modi fyprofile';

Replace it with
// Country Hack Replace
// $templatesused .= "register_birthday,modifyprofile_customtext,register_customfields,usercpnav,modif yprofile";
$templatesused .= "register_birthday,modifyprofile_customtext,modifyprofile_country,register_custom fields,usercpnav,modifyprofile";
// Country Hack End


find:
eval("\$customtext = \"".gettemplate("modifyprofile_customtext")."\";");
}
}
Below it add:
// Country Hack
if (!$getcountry=$DB_site->query_first("SELECT country FROM user WHERE userid=$bbuserinfo[userid]")) {
$country="";
$ctrdefaultselected = "selected";
} else {
$country="$getcountry[country]";
$countryalt = str_replace("%20"," ",$country);
$countrysel = str_replace("%20","_",$country);
$flag="<img src=\"images/flags/$country.gif\" alt=\"$countryalt\" align=\"absmiddle\" border=\"0\">";
$ctryname = "ctry".$countrysel."selected";
$$ctryname = "selected";
}
eval("\$countrytext.= \"".gettemplate("modifyprofile_country")."\";");
// Country Hack End


find:
$DB_site->query("UPDATE user SET birthday='".addslashes($birthday)."',signature='".addslashes($signature)."',customtitle='".intval($customtitle)."',usertitle='".addslashes($customtext)."',email='".addslashes(htmlspecialchars($email))."',parentemail='".addslashes(htmlspecialchars($parentemail))."',coppauser='$coppauser',homepage='".addslashes(htmlspecialchars($homepage))."',icq='".addslashes(htmlspecialchars($icq))."',aim='".addslashes(htmlspecialchars($aim))."',yahoo='".addslashes(htmlspecialchars($yahoo))."',usergroupid='$bbuserinfo[usergroupid]' WHERE userid='$bbuserinfo[userid]'");

Replace it with:
// Country Hack Replace
// $DB_site->query("UPDATE user SET birthday='".addslashes($birthday)."',signature='".addslashes($signature)."',customtitle='".intval($customtitle)."',usertitle='".addslashes($customtext)."',email='".addslashes(htmlspecialchars($email))."',parentemail='".addslashes(htmlspecialchars($parentemail))."',coppauser='$coppauser',homepage='".addslashes(htmlspecialchars($homepage))."',icq='".addslashes(htmlspecialchars($icq))."',aim='".addslashes(htmlspecialchars($aim))."',yahoo='".addslashes(htmlspecialchars($yahoo))."',usergroupid='$bbuserinfo[usergroupid]' WHERE userid='$bbuserinfo[userid]'");
$DB_site->query("UPDATE user SET birthday='".addslashes($birthday)."',signature='".addslashes($signature)."',customtitle='".intval($customtitle)."',usertitle='".addslashes($customtext)."',email='".addslashes(htmlspecialchars($email))."',parentemail='".addslashes(htmlspecialchars($parentemail))."',coppauser='$coppauser',homepage='".addslashes(htmlspecialchars($homepage))."',icq='".addslashes(htmlspecialchars($icq))."',aim='".addslashes(htmlspecialchars($aim))."',yahoo='".addslashes(htmlspecialchars($yahoo))."',usergroupid='$bbuserinfo[usergroupid]',country='".addslashes($country)."' WHERE userid='$bbuserinfo[userid]'");
// Country Hack End


find:
if ($userinfo[yahoo]!="") {
eval("\$userinfo[yahooicon] = \"".gettemplate("yahoo")."\";");
} else {
$userinfo[yahoo]="&nbsp;";
}

Below it add:
// Country Hack
$getctry=$DB_site->query_first("SELECT country FROM user WHERE userid=$userid");
$country=$getctry[country];
$countryalt = str_replace("%20"," ",$country);
if ($country!="") {
$flag = "<img src=\"images/flags/$country.gif\" alt=\"$countryalt\" align=\"absmiddle\" border=\"0\">";
} else {
$flag = "";
}
// Country Hack End

Bison
09 Dec 2002, 04:33
BINGO! ... that worked like a charm!

Thanks, you two! :D

0zone
25 Jan 2003, 18:22
Hey everyone, I'm new to vB, I pruchased it yesterday, and I would really like this hack. I'm so unfamiliar with all of these hacks but I am trying to learn.

Would someone be able to possibly help me install this hack?

Tony DiMera
27 Jan 2003, 00:10
Thanks a lot

ajk
22 Feb 2003, 08:27
Hi, the usuers on my BBS like this hack.

They asked if I can get one made with the US state flags and territories. Have one line for the state flag and another line for the country.

Thanks in adavance

Mr H
28 Feb 2003, 05:20
I installed this hack and now when users try to change the "location" in their profile it says "Thanks for updating your profile" but the location doesnt show up.

Any ideas on where I messed up?

Funkie
13 Mar 2003, 07:37
hi,
I have read right through this rather large post now:)

I got it working fine in all of the templates,but it will not show up in the postbit:(:(
Can any1 help please


Thanx in advance

forget that.sorted now,just added some txt to the showthread,and its working fine:)
Many thanx to you all

Mr L
30 Mar 2003, 16:53
Can anyone offer any advice who has added additional flags.

One of my members wanted an Ex-Pat flag that I called "United Kingdom Ex Pat.gif" and put into the flags directory.

I modified the template and added this line...

<option value="United%20Kingdom%20Ex%20Pat" $ctryUnited_Kingdom_Ex_Patselected>United Kingdom Ex Pat</option>

...under the User Control panel all works well. They can select their flag.

However under the Admin options I cannot see the new flag, when you look at their profile it appears with a blank name on the right hand side in the country field drop down box. At no point is that flag selectable by Admins.

I'd appricahte any help on this.

Thanks.

leitel
01 Apr 2003, 16:03
Has anyone modified the member search to include an option to search by country?

Tim Wheatley
02 Apr 2003, 19:56
03-30-03 at 04:53 PM HLodder said this in Post #224 (http://www.vbulletin.org/forum/showthread.php?postid=375524#post375524)
Can anyone offer any advice who has added additional flags.

One of my members wanted an Ex-Pat flag that I called "United Kingdom Ex Pat.gif" and put into the flags directory.

I modified the template and added this line...

<option value="United%20Kingdom%20Ex%20Pat" $ctryUnited_Kingdom_Ex_Patselected>United Kingdom Ex Pat</option>

...under the User Control panel all works well. They can select their flag.

However under the Admin options I cannot see the new flag, when you look at their profile it appears with a blank name on the right hand side in the country field drop down box. At no point is that flag selectable by Admins.

I'd appricahte any help on this.

Thanks.


user.php needs the line adding too.

Splitfyre
12 Apr 2003, 18:43
I don't seem to see the following in adminfunctions.php:

$post[joindate]=vbdate($registereddateformat,$post[joindate]);

We're running 2.28

Dean C
12 Apr 2003, 19:53
Spitfyre - you may want to consider upgrading to the latest stable release of vbulletin (2.3.0) as the previous versions have many bug fixes which could leave a big security hole in your board :)

I have just checked in a clean 2.2.8 in functions.php and that line is there :)

- miSt

Splitfyre
13 Apr 2003, 00:11
I was looking at the wrong file because I read the script instructions wrong. I thought he was referring to adminfunctions not functions.php

Splitfyre
13 Apr 2003, 01:04
Ack.. someone help: http://www.futurelooksforums.com/forums/showthread.php?postid=58418#post58418

2. With the tweak it moved my ICQ button to the next line? How can I fix that?

Splitfyre
13 Apr 2003, 01:19
Anyone know how to ensure that this gets stuck at the bottom right for each post:

Report this post to a moderator | IP: Logged
Warning Level: 0 [ View User Warnings ] [ Warn This User ]

For some reason it won't sit there in certain posts. Thoughts?

X-Fan
27 May 2003, 05:59
Hey all, I just searched through the thread but couldn't find an answer - how would I get a user's flag to show up in the welcome panel on the forumhome page?

reismarktq2
06 Jun 2003, 16:40
Have it installed and working great on 2.3.0 WITH the store hack add-on. Thanks!

Vinney
09 Jun 2003, 18:11
ok ... i've installed this ok. Well it seems ok. But, the images are broken :

and are linked like :

/images/flags/Un.gif

instead of

/images/flags/United Kingdom.gif

Why is this happening ?? ( Also the alt text is the same )

Sc0rp
09 Jun 2003, 18:39
is there any way to have this work automated.. so the script will trace where the user origins from..

Rasbelin
10 Jun 2003, 10:54
Splitfyre,

you didn't put the code in the correct place in memberlist or/and memberlistbit. Both codes for the flag has to be at the same spot, e.g. before AIM icon. Should work. As for your second question, it's related to the warning system add-on. See the right support thread for info about it.

X-Fan,

I assume you need to tweak the code similar to member.php and then use $flag in the appropriate template. Try to figure it out yourself. Should be quite easy. I haven't had the welcome panel in use, so I can't test it now.

Vinney,

double check your code. You must have made some misstake. Works perfect here with a hacked vB 2.3.0.

Sc0rp,

that would require quite much work and yet it wouldn't be accurate.

CRego3D
15 Jun 2003, 20:26
thanks for this great hack

I have modify it to display Linux Distro's instead of flags in my forum http://linuxcult.com

now ..

is there a way I can tie a URL to each "flag" ?

CRego3D
16 Jun 2003, 18:29
One last request :)

http://www.linuxcult.com/forum/memberlist.php?&what=datejoined

as you see, the "distro" images is where the flags woudl be .. is there a way I can "sort" by them ? :)

love this hack .. hehe

Splitfyre
22 Jun 2003, 04:26
Just updated to 2.30 and now it won't show the drop down to select a flag when you try to register :(

I went and re-hacked it from scratch. Check it out here:

www.futurelooks.com/forums/register.php

Splitfyre
22 Jun 2003, 23:06
Got it installed fine now. I think it was just due to the time I was hacking it, I was near fallin asleep :P

Now my question is that in the postbit it shows the country flag squished.

See my forums: www.futurelooks.com/forums for more on this.

Please and thanks!

DPoole
22 Jun 2003, 23:30
flag dont look squashed to me - thats the way its shows and looks ok

add <br> before and after it to make a space

Splitfyre
23 Jun 2003, 00:19
Thanks. Ya I found that it was just the Australia flag that's squished in that flag icon set.

Splitfyre
26 Jun 2003, 06:34
Quick Question: I have Country showing up twice in my registration.

I've checked the register.php file and I've also checked the registration templates. Why would the Country selection showup twice?

http://www.futurelooks.com/forums/register.php

Ninth Dimension
28 Jun 2003, 04:24
Just installed this hack on a 2.3.0 board, and it's working a charm, thank you very much

09-06-01 at 10:46 AM AJR said this in Post #1 (http://www.vbulletin.org/forum/showthread.php?postid=167581#post167581)
Known Problems:
- Countries with a dash (-) or comma (,) will not show up
automatically in as selected when you or the member edit
their profile (Congo, Korea, and Micronesia are the only 3)
Anyone know a fix please let me know.


Taking a very quick glance as your code, I think it's not working because you are using variables named after the countries to call whichever country needs to be selected. In thory this works, until an invalid char comes into the arrangement, amnd breaks the variable.

In other words $ctryTogoselected - $ctryUnited_Kingdomselected & even $ctryBritish_Indian_Ocean_Territoryselected are all valid variable names, but $ctryUmm_al-Qaiwanselected is not. (all the computer see's is $ctryUmm_al).

Update the variables to remove the hyphens and comma's and it will work

(sorry if someone else has already posted this soloution, i've not read the thread or anything, i just knew this was the problem from looking at the code.

anyway, like i said, great hack, thank you very much.

Ninth Dimension
28 Jun 2003, 04:33
06-26-03 at 06:34 AM Splitfyre said this in Post #243 (http://www.vbulletin.org/forum/showthread.php?postid=412830#post412830)
Quick Question: I have Country showing up twice in my registration.

I've checked the register.php file and I've also checked the registration templates. Why would the Country selection showup twice?

http://www.futurelooks.com/forums/register.php


It's controled by the template, i can't see a mistake in the file edit causing this, all I can suggest is that you maybe use my template, it's unmodified (bar the flag hack that is).

it's attached as a .txt

Sin City
29 Jun 2003, 02:57
great hack.... i used it along with the store ... only problem is.... when i buy the flag... it shows up in the "Your Country Flag" option in the store in the "Country" field.... but i don't see a flag anywhere in my posts, or in the member list... what's wrong?

also, when a new user tries to sign up it says to make sure and fill out all necessary fields, even though they have filled them all in (there is no profile field for the flag either since its in the store)... what can i do to fix that?

ajk
29 Jun 2003, 02:59
The users at Drumsmith.com really like the Country Flag hack.

Is there a way I can use the small flags in one place, then use the large in another?

Thanks

Sin City
30 Jun 2003, 08:10
Yesterday at 02:57 AM Sin City said this in Post #246 (http://www.vbulletin.org/forum/showthread.php?postid=413792#post413792)
great hack.... i used it along with the store ... only problem is.... when i buy the flag... it shows up in the "Your Country Flag" option in the store in the "Country" field.... but i don't see a flag anywhere in my posts, or in the member list... what's wrong?

also, when a new user tries to sign up it says to make sure and fill out all necessary fields, even though they have filled them all in (there is no profile field for the flag either since its in the store)... what can i do to fix that?

bump

Sin City
01 Jul 2003, 04:45
can anyone help me please?

Ninth Dimension
01 Jul 2003, 10:04
06-29-03 at 02:57 AM Sin City said this in Post #246 (http://www.vbulletin.org/forum/showthread.php?postid=413792#post413792)
great hack.... i used it along with the store ... only problem is.... when i buy the flag... it shows up in the "Your Country Flag" option in the store in the "Country" field.... but i don't see a flag anywhere in my posts, or in the member list... what's wrong?

also, when a new user tries to sign up it says to make sure and fill out all necessary fields, even though they have filled them all in (there is no profile field for the flag either since its in the store)... what can i do to fix that?

From the sounds of it you have not made any of the template changes, i recomend going back to the instructions and following them again.