Advertisement:

Author Topic: CountryFlags  (Read 407482 times)

Offline SMFHacks.com Team

  • Jr. Member
  • **
  • Posts: 332
    • smfhacks on Facebook
    • @smfhacks on Twitter
    • SMFHacks.com
CountryFlags
« on: August 14, 2006, 01:07:43 PM »
Link to Mod

CountryFlags v1.1.3

Author: vbgamer45
Original Author: JayBachatero
Current Version: 2.0
Compatibility: SMF 2.0.x, 1.1.x
 Donate                          
Homepage: SMFHacks
Type: Profile
Languages:



Introduction

This mod allows your members to select from a list the countries to denote where they live.  This will include a country flag in their posts and profile.

You can select where to ask for their country.  Upon registration, profile page or both.  Also you can make it mandatory.

To enable this mod you must go to Admin > Features and Options > Last set of options.
This was a mod request by James Woodcock.

The credits for this mod go to gobalopper's Location mod.  The flags and idea were taken from his mod.

Flags by famfamfam Flag Icons



Features
Select Country Flag on profile
Show Country Flag on post display
Option to require/show on registration



Installation
Any previous versions of this mod MUST be uninstalled BEFORE installing this version.

Simply install the package to install on the SMF Default Core Theme ONLY.

If your theme has its own versions of the language files Modifications.english.php and/or Modifications.english-utf8.php, OR if your using a language other than those supported (listed above) by the mod then you will need to copy the language strings into each custom version of those files.

Useful Links
Manual Installation Of Mods
How Do I Modify Files?



Support
Please use the modification thread for support with this modification.
(Please don't ask me to do the edits for you)



Changelog
Legend:
! = Bugfix
- = Removed
+ = New Feature
o = Update
> = New Language
^ = Initial/New Release

Code: [Select]
Version 3.0
!Fixed an XSS issue on registration for flags update for SMF 2.0.x and SMF 1.1.x Reported by Jaume Llopis

2.0.1
Separated Serbia and Montenegro

12/23/2011 v2.0
!Fixed for SMF 2.0 selecting flag on registration was not saving.
!Added some alt tags for SMF 2.0 version

12/5/2011 v1.1.3
!Fixed missing Antarctica image
!Fixed skipping on Babylon theme if does not  exist.

9/24/2009 - v1.0.3
o Taken over by JBlaze
o Added new flag images
! Fixed version error

8/29/2006 - v1.0.2
! Fixed the bug that I thought I had fixed.

8/28/2006 - v1.0.1
! Fixed error when no flag is selected

8/26/2006 - v1.0
^ Initial release.
« Last Edit: April 17, 2012, 09:13:25 PM by vbgamer45 »
Disclaimer: SMFHacks.com Team is not affiliated with the SMF Team or the SimpleMachines NPO.

http://ForumRankings.net - Get Forum Ranked!
SMFHacks.com -  Paid Modifications for SMF
Latest Mods:
Community Suite
Newsletter Pro SMF Gallery Pro SMF Classifieds SMF Store

Offline kezayah

  • Jr. Member
  • **
  • Posts: 107
    • http://ze-forum.org
Re: CountryFlags
« Reply #1 on: August 14, 2006, 02:35:39 PM »
Very good ...
but it doesn't appear when a guest want to register ...  :(

Offline James Woodcock

  • SMF Friend
  • Full Member
  • *
  • Posts: 528
  • Gender: Male
  • Freelance Journalist
    • James Woodcock's Blog
Re: CountryFlags
« Reply #2 on: August 14, 2006, 03:26:50 PM »
I think he may have fixed that already if you re-download the package.  Also make sure that 'Both' is selected in the options for this mod within the Admin area.

Offline JayBachatero

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,562
  • Gender: Male
    • @jaycreations on Twitter
    • JayBachatero.com
Re: CountryFlags
« Reply #3 on: August 14, 2006, 05:49:28 PM »
As James said I fixed that and reuploaded the package.  Uninstall the other one delete it and install the new one.  It has the same name.
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Offline Assistance

  • Jr. Member
  • **
  • Posts: 343
  • Gender: Male
Re: CountryFlags
« Reply #4 on: August 14, 2006, 06:37:51 PM »
hmmm

what would I need to edit to not show the text beside the flag?
search
Quote
	
	
	
{
	
	
	
	
$flags CountryFlag();
	
	
	
	
echo 
'
	
	
	
	
	
	
	
	
<img src="'
$settings['default_theme_url'], '/images/flags/'$message['member']['options']['country'], '.png" alt="'$flags[$message['member']['options']['country']], '<br /><br />';
	
	
	
}


remove
, $flags[$message['member']['options']['country']], '" /> '
« Last Edit: August 14, 2006, 06:48:37 PM by Assistance »
~playing poker~

Offline JayBachatero

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,562
  • Gender: Male
    • @jaycreations on Twitter
    • JayBachatero.com
Re: CountryFlags
« Reply #5 on: August 14, 2006, 09:38:41 PM »
Replace that with this.
Code: [Select]
// Did they select a flag?
if(isset($message['member']['options']['country']) && !empty($modSettings['country_flag_show']))
{
$flags = CountryFlag();
echo '
<img src="', $settings['default_theme_url'], '/images/flags/', $message['member']['options']['country'], '.png" alt="', $flags[$message['member']['options']['country']], '" /><br /><br />';
}
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Offline Assistance

  • Jr. Member
  • **
  • Posts: 343
  • Gender: Male
Re: CountryFlags
« Reply #6 on: August 15, 2006, 12:24:40 AM »
whats the difference?
~playing poker~

Offline JayBachatero

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,562
  • Gender: Male
    • @jaycreations on Twitter
    • JayBachatero.com
Re: CountryFlags
« Reply #7 on: August 15, 2006, 01:22:47 AM »
You removed the closing > for img tag.
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Offline Parijs

  • Semi-Newbie
  • *
  • Posts: 41
  • Gender: Female
Re: CountryFlags
« Reply #8 on: August 15, 2006, 07:48:28 AM »
Im using the wow dk theme for my smf 1.1 rc2 and I installed this mod and when I go to the Admin, Features & Options section, this is all I see at the bottom.   I cant read anything.  How can I fix this?


Offline zigzag

  • Jr. Member
  • **
  • Posts: 251
Re: CountryFlags
« Reply #9 on: August 15, 2006, 08:34:30 AM »
Hello,
Really nice Mod :D and it works well  except I'm getting this error in my error log whenever someone goes to the registration page, I've tried all the settings on the mod but still get the same error :

Code: [Select]
8: Undefined index: country_flag
File: me\smf\Themes\default\Register.template.php (before sub template - eval?)
Line: 90
This is line 90:

Code: [Select]
// If flags is set for registration show it.
if (!empty($modSettings['country_flag']) && $modSettings['country_flag'] == 2 || $modSettings['country_flag'] == 3)


I've modified the mod ever so slightly so that it shows regions rather than countries but I don't think that's causing it, any ideas on how to fix it? I'm using the default smf theme

<EDIT> I too have the problem where it doesn't show up on the Register page if I use that setting - but I'm not really worried as I only want it to show up under profile.
« Last Edit: August 15, 2006, 08:53:07 AM by zigzag »

Offline JayBachatero

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,562
  • Gender: Male
    • @jaycreations on Twitter
    • JayBachatero.com
Re: CountryFlags
« Reply #10 on: August 15, 2006, 01:24:01 PM »
Parijs add this to the /Themes/wow/languages/Modifications.engligh.php
Code: [Select]
// Country Flag mod
$txt['country_flag_label'] = 'Please select your country';
$txt['country_flag_error_required'] = 'You must select the country that you visit us from';
$txt['country_flag_ask'] = 'Ask for country flag on';
$txt['country_flag_disabled'] = 'Don\'t show (Disabled)';
$txt['country_flag_profile'] = 'Profile';
$txt['country_flag_registration'] = 'Registration';
$txt['country_flag_both'] = 'Both';
$txt['country_flag_required'] = 'Require a member to select a location?';
$txt['country_flag_show'] = 'Show flags on Display page (Where posts are shown).';
$txt['country_flag'] = 'Country';

zigzag it seems like you installed the first package that I released.  What you have to do is uninstall that mod.  Delete it and redownload the package that I have there now.  That should fixed the issues that you are having.
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Offline zigzag

  • Jr. Member
  • **
  • Posts: 251
Re: CountryFlags
« Reply #11 on: August 15, 2006, 02:23:27 PM »
Hi, I've tried that and it's the same, I tried also installing it without the modifications I made to the countries just in case it was something I'd done but I still get the same error and it doesn't show up on the Register.template.php even though the code is there:

Code: [Select]
// If flags is set for registration show it.
if (!empty($modSettings['country_flag']) && $modSettings['country_flag'] == 2 || $modSettings['country_flag'] == 3)
{
// Call the function that has all the flag info
$flags = CountryFlag();

echo '
<script language="JavaScript" type="text/javascript">
function showflags()
{
document.images.flags.src = document.forms.creator.country.options[document.forms.creator.country.selectedIndex].value != \'\' ? \'' . $settings['default_theme_url'] . '/images/flags/\' + document.forms.creator.country.options[document.forms.creator.country.selectedIndex].value + \'.png\' : \'' . $settings['default_theme_url'] . '/images/flags/blank.gif\';
}
</script>
<tr>
<td width="40%" align="top">
<b>', $txt['country_flag_label'], ':</b>
</td>
<td>
<select name="country" onchange="showflags()">
<option value=""></option>';

// Loop and show the drop down.
foreach ($flags as $key => $name)
echo '
<option value="', $key, '">', $name, '</option>';

echo '
</select>
<img id="flags" src="', $settings['default_theme_url'], '/images/blank.gif" width="25" height="15" align="top" />
</td>
</tr>';

Offline Parijs

  • Semi-Newbie
  • *
  • Posts: 41
  • Gender: Female
Re: CountryFlags
« Reply #12 on: August 15, 2006, 02:45:47 PM »
Awesome Jay, thanks that worked...but is there something else I must modify in my wow dk theme files in order for this to show up in peoples profile menues and also on the register page?  cause I got all the settings correct in my Admin Panel but its not showing up.

Parijs

Offline JayBachatero

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,562
  • Gender: Male
    • @jaycreations on Twitter
    • JayBachatero.com
Re: CountryFlags
« Reply #13 on: August 15, 2006, 02:53:52 PM »
Paris that should be correct.  zigzag I'll look into it when I get home form work tonight.  In the mean time try this file.
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Offline Parijs

  • Semi-Newbie
  • *
  • Posts: 41
  • Gender: Female
Re: CountryFlags
« Reply #14 on: August 15, 2006, 03:07:38 PM »
Jay.....can I ask for u to take a look at my admin panel to make sure i got this done correctly?  I can PM u the link to my forum and I will give u admin access.  I hope u dont think I am being forward.  But this Mod would be rockin on my forum as my members are loving all the mods I am adding from u guys.  Pretty please?

Offline zigzag

  • Jr. Member
  • **
  • Posts: 251
Re: CountryFlags
« Reply #15 on: August 15, 2006, 03:55:04 PM »
Quote
In the mean time try this file.

Yes that fixed it, no errors and it shows up on the registration page.
Thank you :D

Offline BryanD

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 22,023
  • Gender: Male
    • BryanRunicDeakin on Facebook
    • @bryandeakin on Twitter
    • Bryan Deakin dot Com
Re: CountryFlags
« Reply #16 on: August 15, 2006, 07:49:29 PM »
Jay how do you add a new country to the list?

would it just be as simple as adding
Code: [Select]
'so' => 'Scotland', in the install and add a Scotland flag to the images directory?

Offline zigzag

  • Jr. Member
  • **
  • Posts: 251
Re: CountryFlags
« Reply #17 on: August 15, 2006, 08:05:25 PM »
Quote
would it just be as simple as adding
'so' => 'Scotland',
in the install and add a Scotland flag to the images directory?

Hello, Yes it seems to work ok and also in reverse if you want to remove countries from the list.

Offline JayBachatero

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,562
  • Gender: Male
    • @jaycreations on Twitter
    • JayBachatero.com
Re: CountryFlags
« Reply #18 on: August 16, 2006, 01:46:46 AM »
Paris yea just send me a PM

sloopz that's how you add it.  Scotland is not in the list?
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Offline James Woodcock

  • SMF Friend
  • Full Member
  • *
  • Posts: 528
  • Gender: Male
  • Freelance Journalist
    • James Woodcock's Blog
Re: CountryFlags
« Reply #19 on: August 16, 2006, 07:29:50 AM »
England, Scotland and Wales are not in the list.