vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Country Flag Hack v2.0 (https://vborg.vbsupport.ru/showthread.php?t=27485)

AJR 09-05-2001 10:00 PM

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 09-06-2001 09:14 AM

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 09-06-2001 10:29 AM

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 09-07-2001 10:51 AM

Nevermind, my bad....

Great work! Excellent hack!

redrat 09-08-2001 10:12 AM

Great hack :D
Thanks a lot

TheComputerGuy 09-08-2001 12:24 PM

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 09-08-2001 02:05 PM

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 09-08-2001 04:11 PM

Quote:

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 09-08-2001 07:15 PM

> 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&forum id=31
> Referer: http://www.moneytec.com/forums/index.php?s=

AJR 09-08-2001 07:28 PM

Quote:

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-09-2001 12:14 PM

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-09-2001 04:18 PM

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?

PHP Code:

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,nosessionhash=$nosessionhash,daysprune='$daysprune',lastvisit=$lastvisit,lastactivity=$lastactivity,lastpost=$lastpost,posts='$posts',timezoneoffset='$timezoneoffset',emailnotification=$emailnotification,receivepm='$receivepm',emailonpm='$emailonpm',ipaddress='".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,nosessionhash=$nosessionhash,daysprune='$daysprune',lastvisit=$lastvisit,lastactivity=$lastactivity,lastpost=$lastpost,posts='$posts',timezoneoffset='$timezoneoffset',emailnotification=$emailnotification,receivepm='$receivepm',emailonpm='$emailonpm',ipaddress='".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,nosessionhash=$nosessionhash,daysprune='$daysprune',lastvisit=$lastvisit,lastactivity=$lastactivity,lastpost=$lastpost,posts='$posts',timezoneoffset='$timezoneoffset',country='$country',emailnotification=$emailnotification,receivepm='$receivepm',emailonpm='$emailonpm',ipaddress='".addslashes($aipaddress)."',pmpopup=IF(pmpopup=2 AND $pmpopup=1,pmpopup,'$pmpopup') WHERE userid=$userid");
// Country Hack CP Addon End 


Dunny 09-09-2001 04:37 PM

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-09-2001 04:41 PM

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 09-11-2001 07:44 AM

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 09-11-2001 07:54 AM

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 09-11-2001 07:05 PM

that worked perfect mate, thanks alot!

the file should be added to the release...

MrLister 09-12-2001 02:57 AM

great hack. i just installed it!

Alien 09-13-2001 06:34 PM

Works great, good job. :D

Mark Hewitt 09-15-2001 12:26 PM

A brilliant hack! I've put it on my site and I've also put it on my memberlist.

webhost 09-21-2001 02:56 AM

First of three sets of big flags. 74x37 pixels

webhost 09-21-2001 02:58 AM

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 09-21-2001 03:15 AM

Large Flags finished, you can download all three zip files now, These Flags have full names.

tkhjosh 09-21-2001 04:22 AM

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 09-21-2001 04:33 AM

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 09-21-2001 05:05 AM

i ran the flag.php that webhost gave, not enough? there must be more to do?

AJR 09-21-2001 05:10 AM

I need to know what that email said! Then I can help you.

tkhjosh 09-21-2001 05:11 AM

Quote:

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 09-21-2001 05:17 AM

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 09-21-2001 05:23 AM

Thats why you shouldnt bother supporting your hacks AJR ;):D

tkhjosh 09-21-2001 05:29 AM

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 09-21-2001 05:37 AM

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 09-21-2001 05:48 AM

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

AJR 09-21-2001 05:59 AM

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!!!

Quote:

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 09-21-2001 06:54 AM

Quote:

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 09-21-2001 07:05 AM

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 09-21-2001 08:03 AM

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 09-21-2001 08:11 AM

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 09-21-2001 08:21 AM

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 09-21-2001 08:50 AM

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.


All times are GMT. The time now is 04:50 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01613 seconds
  • Memory Usage 1,868KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete