State Flag mode like this Country flag mod

Started by thefley, September 16, 2009, 06:32:32 PM

Previous topic - Next topic

thefley

I have seen this mod http://custom.simplemachines.org/mods/index.php?mod=1729

where it displays the that members Country flag in there post and profile, however I only have members from the U.S. and Canada.  I would like to know if there is already a mod like this for only States here, of if anyone has changed this mod yet?

SMF 1.1.10
TP 0.9.8
MANY MODS
www.greatplainsriders.com

www.greatplainsriders.com

Arantor

Well, all that mod is is a collection of flag images. If you have a set of images, it's easy enough to make yourself.

Using FTP, just find the avatars directory, then make a new directory called States (or similar), then just add images into that new directory; it'll just work.

thefley

Quote from: Arantor on September 16, 2009, 06:44:36 PM
Well, all that mod is is a collection of flag images. If you have a set of images, it's easy enough to make yourself.

Using FTP, just find the avatars directory, then make a new directory called States (or similar), then just add images into that new directory; it'll just work.
Thanks, I was wondering if I should try that,  I think I will.

www.greatplainsriders.com

Arantor


thefley

I am sorry this is the Mod I was talking about, not the first one I posted.  I saw that other was an AVATAR one.   this is the one I like to use for state maps

http://custom.simplemachines.org/mods/index.php?mod=417

www.greatplainsriders.com

thefley

#5
this is 2 of the files in the mod, the other is just the folder for the flags. 

I can see where I can change the $flags = array to match the maps I change, but not sure just how to change it to state flags from US and Canada. 

I think it pulls from IPs but not sure...

can someone look at the code and see if they could help.  I can test it on my test forum.  I also attached the files to the post

Thanks




www.greatplainsriders.com

Arantor

You didn't actually need to post the full code; it is possible to see the code directly from the mod site with the 'Parse' button. (It's also easier for reviewing the code since it shows it in a nice format, just a useful little tip)

Looking at the full code, it looks like you could replace the edits in Subs.php with a list of states instead of countries, then replace the references to 'country'/'countries' in the edits in Modifications.english.php for displaying the field to users, with the rest of edits just been applied as-is.

thefley

#7
Quote from: Arantor on September 17, 2009, 07:32:36 AM
You didn't actually need to post the full code; it is possible to see the code directly from the mod site with the 'Parse' button. (It's also easier for reviewing the code since it shows it in a nice format, just a useful little tip)

WOW thanks!!! I didn't know this! and that will help me out, now I wont have to try and find the parse sites I had saved some place.   Thanks for the info, I will try and start on this!


should I edit all the template files that have county/countries to say State or would this matter or mess anything up?

www.greatplainsriders.com

Arantor

You can if you replace everything consistently; it's not necessary though. All you need to edit is the list of countries to make them a list of states, plus the entries in the languages/ files to make them say State(s) instead of Country(ies) as that's the bit that is actually displayed in text to your forum members.

thefley

#9
Hey Thanks for the help!  everything worked out great.  just had to spend half a day finding and making the flags, and BACKING up the forum befor makeing the template changes.

HERE IS A COPY OF THE FILES if any one wants to use it.

Just install the mod CountryFlag_1-0-2.tar.gz
change the flags folder with this one in /Themes/default/images
and the 2 template files add before the ?> at the end of the file the info in the 2 templates I attaced. subs.php and Modifications.english.php.


you can see it on my site HERE  see the Admin post named Tracy.

the flage can be turned on under ADMIN/Features and Options

and members can set them from their profile or when new members join n the Registration page.

Here is the link to the files that will need to be moded.  http://custom.simplemachines.org/mods/index.php?mod=417  just click the parse button   ( THANKS Arantor for pointing that out and all the help)

www.greatplainsriders.com

Arantor

Thanks for submitting this information!

I did post a link on the original mod's thread pointing here for anyone who wanted to use it. Unfortunately we wouldn't be able to accept it being packaged as a mod for the mod site without the author's permission.

thefley

Again Thanks for all your help.  :D


can i run one more question by you,   if you look at the screen shot attached you will see the name of the state is showing next to the flag,  is there a way to make it drop down to under the state flag?   

see here on site or see dcreen shot.


www.greatplainsriders.com

Arantor

Wherever in the mod you output the flag followed by the name, just make sure there's a <br /> tag being added too.

thefley

Quote from: Arantor on September 21, 2009, 02:36:41 PM
Wherever in the mod you output the flag followed by the name, just make sure there's a <br /> tag being added too.

Would that be this ./Themes/default/Display.template.php


// Did they select a flag?
if(isset($message['member']['options']['country']) && !empty($modSettings['country_flag_show']) && !empty($message['member']['options']['country']))
{
$flags = CountryFlag();
echo '
<img src="', $settings['default_theme_url'], '/images/flags/', $message['member']['options']['country'], '.png" alt="', $flags[$message['member']['options']['country']], '" /> ', $flags[$message['member']['options']['country']], '<br /><br />';
}


www.greatplainsriders.com

Arantor

That would indeed. Specifically in the third-to-last line:
$flags[$message['member']['options']['country']], '" /> ',

Would become:
$flags[$message['member']['options']['country']], '" /><br /> ',

thefley


www.greatplainsriders.com

Advertisement: