• Welcome to Simple Machines Community Forum. Please login or sign up.
January 26, 2022, 03:30:37 AM

News:

Check out the SMF Function DB!


CountryFlags

Started by SMFHacks.com Team, August 14, 2006, 01:07:43 PM

Previous topic - Next topic

SMFHacks.com Team

August 14, 2006, 01:07:43 PM Last Edit: April 17, 2012, 09:13:25 PM by vbgamer45
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


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

kezayah

Very good ...
but it doesn't appear when a guest want to register ...  :(

James Woodcock

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.

JayBachatero

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

Assistance

August 14, 2006, 06:37:51 PM #4 Last Edit: August 14, 2006, 06:48:37 PM by Assistance
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']], '" /> '
~playing poker~

JayBachatero

Replace that with this.

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

Assistance

~playing poker~

JayBachatero

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

Parijs

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?


zigzag

August 15, 2006, 08:34:30 AM #9 Last Edit: August 15, 2006, 08:53:07 AM by zigzag
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 :

8: Undefined index: country_flag
File: me\smf\Themes\default\Register.template.php (before sub template - eval?)
Line: 90

This is line 90:

// 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.

JayBachatero

Parijs add this to the /Themes/wow/languages/Modifications.engligh.php

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

zigzag

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:

// 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>';

Parijs

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

JayBachatero

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

Parijs

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?

zigzag

QuoteIn the mean time try this file.

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

Deaks

Jay how do you add a new country to the list?

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

zigzag

Quotewould 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.

JayBachatero

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

James Woodcock

England, Scotland and Wales are not in the list.

Advertisement: