Thread Rating:
  • 3 Vote(s) - 4.33 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Code Modification] 244 Countries Flags with Wiki Links in Postbit
#1
I was looking for away to have peoples flags show up in their post bits (if they wanted to, didn't want to use a IP based system and force it on users). After looking around it seems like everyone is charging for this feature, what I think is a bit wrong. So I decided to do my own but make it better than anything on offer and share it for free. My little way of saying thank you for all the free great plugins people have made for MyBB.

This has every know country and there flag. For an example for the UK it has flags for England, Scotland, Wales, Northern Ireland and United Kingdom.

Also the flag plugins people are charging for the images are pretty poor. Here is a couple of examples of the flags in this pack.

               

To install this download the attached flags.zip and extract it somewhere easy to find.

Then:

1. Upload the flags folder to root/images so the flag icons are in root/images/flags
2. In admincp create a new Custom Profile Field. (ACP > Configuration > Custom Profile Fields > Add New Profile Field)
  • Title: Country
  • Short Description: Select your Country Flag
  • Make is a "select box"
  • Paste the countrys.txt text into the select field (this is inside the flags folder)
  • Required? yes.
To make sure it looks neat make sure that Country is above Location.

3. Edit your Post Bit Template with the instructions below
(ACP > Templates & Style > Templates > "Theme in use" > Post Bit Templates > postbit or postbit_classic)

Find
<strong><span class="largetext">{$post['profilelink']}</span></strong> [Place Flag Code Here]

Place this bit of code next to it with a space between it (change the X of fidX to your custom profile ID for the country flag i.e fid4 instead of fidX)

[Image: workspace1067.png]

<a target="blank" href="http://en.wikipedia.org/wiki/Especial:Search?search={$post['fidX']}&fulltext=&go=Go" title="Look up {$post['fidX']} on wikipedia"
 style="cursor:help;" class="wiki"><img src="images/flags/{$post['fidX']}.png" ALIGN=ABSBOTTOM></img></a>

You should now be all set. If you don't want to use the Wiki links just remove that part from the PHP/HTML code. Copy from <img to just show the flags without the wiki link. The Wiki link is completely optional and does not effect the showing of the flags.

[Image: workspace1065.png]

I have no clue how to make plugins for MyBB so if someone wants to turn this into a plugin so people can easily install it please feel free to do so. All I ask for is for you to place a link in the description of the plugin to this thread.

Demo: http://forum.pinguyos.com

EDIT#

To add the flags to user profiles

Edit your Member Templates with the instructions below
(ACP > Templates & Style > Templates > "Theme in use" > Member Templates > member_profile)

Find
<span class="largetext"><strong>{$formattedname}</strong> [Place Flag Code Here]

Place this bit of code next to it with a space between it (change the X of fidX to your custom profile ID for the country flag i.e fid4 instead of fidX)

<a target="blank" href="http://en.wikipedia.org/wiki/Especial:Search?search={$userfields['fidX']}&fulltext=&go=Go" title="Look up {$userfields['fidX']} on wikipedia"
 style="cursor:help;" class="wiki"><img src="images/flags/{$userfields['fidX']}.png" ALIGN=ABSBOTTOM></img></a>

[Image: Selection_403.png]

To add the flags to memberlist page

Edit your Member Templates with the instructions below
(ACP > Templates & Style > Templates > "Theme in use" > Member List Templates > memberlist_user)

Find
<td class="{$alt_bg}">{$user['profilelink'] [Place Flag Code Here]

Place this bit of code next to it with a space between it (change the X of fidX to your custom profile ID for the country flag i.e fid4 instead of fidX)

<a target="blank" href="http://en.wikipedia.org/wiki/Especial:Search?search={$user['fidX']}&fulltext=&go=Go" title="Look up {$user['fidX']} on wikipedia"
 style="cursor:help;" class="wiki"><img src="images/flags/{$user['fidX']}.png" ALIGN=ABSMIDDLE></img></a>

[Image: Selection_406.png]


Attached Files
.zip   flags.zip (Size: 202.85 KB / Downloads: 561)
[Image: Jn29h.png]
DONATE TO PINGUY OS or show some love on Flattr.com
Reply


Messages In This Thread
[Code Modification] 244 Countries Flags with Wiki Links in Postbit - by pinguy - 02-07-2011, 03:12 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)