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)

Talisman 11-03-2002 09:32 PM

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 11-12-2002 09:05 PM

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 11-12-2002 09:26 PM

Quote:

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 11-12-2002 09:42 PM

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 11-12-2002 09:45 PM

Delete all of them.

Add a new one.

Then run the query.

Harken 11-13-2002 02:34 PM

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 11-13-2002 05:54 PM

Can't you remove them from your Admin CP in Templates?

Harken 11-13-2002 06:03 PM

no because the only options i c are Change original...unless im missing something..

TECK 11-13-2002 06:17 PM

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:
Code:

<?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 11-13-2002 06:21 PM

im sorry but what do i do with that....today has not been my day...

TECK 11-13-2002 06:24 PM

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 11-17-2002 09:21 PM

can anyone assist me this...im am still lost...

Bison 12-05-2002 12:45 AM

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 12-05-2002 01:07 AM

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 12-05-2002 02:54 AM

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 12-05-2002 01:42 PM

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:
Quote:

*** 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:
PHP Code:

 eval("\$countrytext.= \"".gettemplate("modifyprofile_country")."\";"); 

(There are 2 instances)

Before that add:
PHP Code:

 $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 12-09-2002 01:52 AM

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,regist er_customfields,usercpnav,modi fyprofile';

Replace it with
// Country Hack Replace
// $templatesused .= "register_birthday,modifyprofile_customtext,regist er_customfields,usercpnav,modi fyprofile";
$templatesused .= "register_birthday,modifyprofile_customtext,modify profile_country,register_custo mfields,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)."',cust omtitle='".intval($customtitle)."',usertitle='".ad dslashes($customtext)."',email ='".addslashes(htmlspecialchars($email))."',parent email='".addslashes(htmlspecia lchars($parentemail))."',coppauser='$coppauser',ho mepage='".addslashes(htmlspeci alchars($homepage))."',icq='".addslashes(htmlspeci alchars($icq))."',aim='".addsl ashes(htmlspecialchars($aim))."',yahoo='".addslash es(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)."',cust omtitle='".intval($customtitle)."',usertitle='".ad dslashes($customtext)."',email ='".addslashes(htmlspecialchars($email))."',parent email='".addslashes(htmlspecia lchars($parentemail))."',coppauser='$coppauser',ho mepage='".addslashes(htmlspeci alchars($homepage))."',icq='".addslashes(htmlspeci alchars($icq))."',aim='".addsl ashes(htmlspecialchars($aim))."',yahoo='".addslash es(htmlspecialchars($yahoo))." ',usergroupid='$bbuserinfo[usergroupid]' WHERE userid='$bbuserinfo[userid]'");
$DB_site->query("UPDATE user SET birthday='".addslashes($birthday)."',signature='". addslashes($signature)."',cust omtitle='".intval($customtitle)."',usertitle='".ad dslashes($customtext)."',email ='".addslashes(htmlspecialchars($email))."',parent email='".addslashes(htmlspecia lchars($parentemail))."',coppauser='$coppauser',ho mepage='".addslashes(htmlspeci alchars($homepage))."',icq='".addslashes(htmlspeci alchars($icq))."',aim='".addsl ashes(htmlspecialchars($aim))."',yahoo='".addslash es(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 12-09-2002 02:33 AM

BINGO! ... that worked like a charm!

Thanks, you two! :D

0zone 01-25-2003 04:22 PM

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 01-26-2003 10:10 PM

Thanks a lot

ajk 02-22-2003 06:27 AM

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 02-28-2003 03:20 AM

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 03-13-2003 05:37 AM

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 03-30-2003 02:53 PM

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 04-01-2003 02:03 PM

Has anyone modified the member search to include an option to search by country?

Tim Wheatley 04-02-2003 05:56 PM

Quote:

03-30-03 at 04:53 PM HLodder said this in Post #224
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 04-12-2003 04:43 PM

I don't seem to see the following in adminfunctions.php:

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

We're running 2.28

Dean C 04-12-2003 05:53 PM

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 04-12-2003 10:11 PM

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 04-12-2003 11:04 PM

Ack.. someone help: http://www.futurelooksforums.com/for...8418#post58418

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

Splitfyre 04-12-2003 11:19 PM

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 05-27-2003 03:59 AM

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-06-2003 02:40 PM

Have it installed and working great on 2.3.0 WITH the store hack add-on. Thanks!

Vinney 06-09-2003 04:11 PM

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 06-09-2003 04:39 PM

is there any way to have this work automated.. so the script will trace where the user origins from..

Rasbelin 06-10-2003 08:54 AM

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 06-15-2003 06:26 PM

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 06-16-2003 04:29 PM

One last request :)

http://www.linuxcult.com/forum/membe...hat=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 06-22-2003 02:26 AM

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 06-22-2003 09:06 PM

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!


All times are GMT. The time now is 04:40 AM.

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.01657 seconds
  • Memory Usage 1,838KB
  • 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_code_printable
  • (2)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)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