[ABD] Country Flags 2.0.5

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
Locked
Nuttzy99
Former Team Member
Posts: 4917
Joined: Fri Aug 03, 2001 7:09 am
Location: the 11th dimension
Contact:

[ABD] Country Flags 2.0.5

Post by Nuttzy99 »

EDIT: 5/18/02 - released 2.0.5

Revised for phpBB 2.0.0. Image Image Image This mod will allow the registered members of your board to select their country flag to be displayed in their profile, posting info, and members listing. Originally written by John Abela for 1.x, I have revived it for 2.0. Many users enjoy using this mod to show their national pride. Others find it interesting to see at a glance how diverse a board can be.

Download the files here until they are available from the phpBB mods database: download
If you previously installed 2.0.4, download the upgrade script

NOTE: The install instructions format will be slightly different from what you have seen in the past. Although I don't think folks will have a hard time understanding them, let me know if you have problems. This is the first mod to be compliant with my new automatic mod installer. However the installer is still in alpha development and not released.

Code: Select all

########################################################
## Mod Title:   Member Country Flags   (aka: Flags)
## Mod Version: 2.0.5
## Rev Date:    May 18, 2002
##
## Updated By:   Nuttzy < [email protected] >
## Original By:  John B. Abela < [email protected] >
## Description:  This mod allows your registered board
##               members to select the flag country of
##               their residence.  Their flag will then
##               display thoughout the phpBB system.
## 
## Installation Level:  Advanced Moders Only
## Installation Time:   20-30 Minutes
## Files To Edit:       12
## Included Files:      193 .gif Files
##                      Flags.sql
##                      Flags-2-0-5.txt
##			upgrade-Flags-2-0-5.txt
########################################################
## EasyMod v0.4alpha compliant (automatic mod installer)
########################################################
##
##
## UPGRADING FROM 1.X and 2.0 RC versions:
##   If you had flaghack installed on phpBB 1.x then and
##   then upgraded to 2.0, then you are in luck!  You
##   will need to rename some table field names, but all
##   your data from 1.x should still be there and the
##   new flaghack will use it!  Just skip the flag.sql
##   step and follow the rest of the install directions.
##
##
## UPGRADING FROM 2.0.4:
##   If you installed the previous version, you should
##   ignore ALL of the directions here and instead use
##   the upgrade-Flags-2.0.5.txt to more simply upgrade
##   what you already have.
##
##
## NEW INSTALLATION:
##   Upload the /flag/ images to your server.  Place
##   them in a "flags" folder in the images folder.  You
##   should also have an "avatars" and "smilies" folders
##   there.
##
##   To execute the flag.sql file for MySQL, you can
##   either have phpMyAdmin run it, or exexute the UNIX
##   command line.
##
########################################################
##
## Version History:
##    02/28/02 - Updated for phpBB 2.0 RC2 by Nuttzy
##    04/01/02 - Made RC4 complaint
##               right justified flags in members listing
##    04/14/02 - version 2.0.4
##               release for phpBB 2.0 final
##    05/18/02 - version 2.0.5
##		 fixed a bug with edit profile sometimes
##		   reinitializing the settings - thanks sj26!
##		 display flag when selecting from edit
##		   profile - coded by sj26
##		 flags can be changed when editing a
##		   user in the admin panel
##		 upgrade script from 2.0.4 released
##
########################################################
## Author Notes: 
## This MOD is not to be listed, downloaded or posted at
## -any- site except Official phpBB Web Sites.
##                  Thank You. JbA 
########################################################
-Nuttzy :cool:
Last edited by Nuttzy99 on Sat May 18, 2002 8:44 pm, edited 1 time in total.
SpellingCow.com - Free spell check service for your forums or any web form!
No Support via PM please!
leeuniverse
Registered User
Posts: 16
Joined: Sat Apr 06, 2002 7:27 pm

Post by leeuniverse »

Can you modify the code, so there can be a: "WARNING When Editing Profile, please Reselect your Country Flag, or it will revert to the default flag."

Place this warning above the Flags selection place, or at the top of the Profile page or something.

Can you do this, at least until that problem is fixed?
Do you think this would work?

Thanks..... :)
User avatar
Klaus2000
Registered User
Posts: 67
Joined: Sat Apr 06, 2002 2:19 pm
Location: somewhere in nowhere in good old Germany ;-)
Contact:

Run flags.sql - This will setup your db table - how?

Post by Klaus2000 »

I am a newbie in SQL - please tell me how to

Run flags.sql ??
Last edited by Klaus2000 on Mon Apr 15, 2002 11:36 pm, edited 1 time in total.
Nuttzy99
Former Team Member
Posts: 4917
Joined: Fri Aug 03, 2001 7:09 am
Location: the 11th dimension
Contact:

Post by Nuttzy99 »

leeuniverse wrote: When Editing Profile, please Reselect your Country Flag, or it will revert to the default flag.


BLAH! Is this true!?!?!? This is not a problem on WinMe/Xitami or FreeBSD/apache systems!! I use IE 5.5. Someone please confirm this is a problem!!!!

-Nuttzy :cool:
SpellingCow.com - Free spell check service for your forums or any web form!
No Support via PM please!
Iron-Monkey
Registered User
Posts: 284
Joined: Sat Nov 17, 2001 12:18 am
Location: California, USA

Post by Iron-Monkey »

This is confusing to me:
#
#-----[ FIND ]------------------------------------------
#
$pm_img = '<a href="


#
#-----[ AFTER, ADD ]------------------------------------------
#

// FLAGHACK-start
$location = ( $profiledata['user_from'] ) ? $profiledata['user_from'] : '&nbsp;' ;
$flag = ( !empty($profiledata['user_from_flag']) ) ? "&nbsp;<img src=\"images/flags/" . $profiledata['user_from_flag'] . "\" alt=\"" . $profiledata['user_from_flag'] . "\">" : "";
$location .= $flag ;
// FLAGHACK-end


In the instruction you only had the $pm_img = '<a href=" so I added it right after this but it gave me a parse error when I click on the user's Profile button. So I had to go back and add it right after :
$pm_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_pm'] . '" alt="' . $lang['Send_private_message'] . '" title="' . $lang['Send_private_message'] . '" border="0" /></a>';


and it work o.k. now. You may want to edit your intructions again.

Other than that, it works great.
Nuttzy99
Former Team Member
Posts: 4917
Joined: Fri Aug 03, 2001 7:09 am
Location: the 11th dimension
Contact:

Post by Nuttzy99 »

Iron-Monkey wrote: This is confusing to me:
#
#-----[ FIND ]------------------------------------------
#
$pm_img = '<a href="


#
#-----[ AFTER, ADD ]------------------------------------------
#

// FLAGHACK-start
$location = ( $profiledata['user_from'] ) ? $profiledata['user_from'] : '&nbsp;' ;
$flag = ( !empty($profiledata['user_from_flag']) ) ? "&nbsp;<img src=\"images/flags/" . $profiledata['user_from_flag'] . "\" alt=\"" . $profiledata['user_from_flag'] . "\">" : "";
$location .= $flag ;
// FLAGHACK-end


Yeah, I can see why it could be confusing. I made it like that so it would be EasyMod compliant. I think that just as you did, most people will figure it out ;) Plus hopefully in a month or two, everyone will be using EasyMod for installations and no one will be manually editing files, hehehe :D

-Nuttzy :cool:
SpellingCow.com - Free spell check service for your forums or any web form!
No Support via PM please!
User avatar
Klaus2000
Registered User
Posts: 67
Joined: Sat Apr 06, 2002 2:19 pm
Location: somewhere in nowhere in good old Germany ;-)
Contact:

Re: Run flags.sql - This will setup your db table - how?

Post by Klaus2000 »

Klaus2000 wrote: I am a newbie in SQL - please tell me how to

Run flags.sql ??



No help for a newbie!????
User avatar
Platinum
Registered User
Posts: 31
Joined: Mon Dec 10, 2001 8:32 pm
Location: Calgary, AB
Contact:

Re: Run flags.sql - This will setup your db table - how?

Post by Platinum »

Klaus2000 wrote:
Klaus2000 wrote:I am a newbie in SQL - please tell me how to

Run flags.sql ??



No help for a newbie!????


Easiest way to learn SQL for a newbie is to go download "MySQL Frontend" .. very nice peice of software and very helpful .. .SQL files are like Batch files .. when you run them, they do an assortment of commands that normally would have to be done one by one. The Frontend is a windows client that allows you to remotely (or locally) connect to your mySQL and perform a variety of tasks, including running .SQL batches.. hope this helps !
1stGEAR
Registered User
Posts: 2
Joined: Sun Apr 14, 2002 6:44 pm
Location: Dalton-in-Furness, Cumbria. Uk
Contact:

Re: Run flags.sql - This will setup your db table - how?

Post by 1stGEAR »

Klaus2000 wrote:
Klaus2000 wrote:I am a newbie in SQL - please tell me how to

Run flags.sql ??



No help for a newbie!????


This is my first post so I am a newbie as well.
I didn't know how to run this file either, but i found a way through trial and error. This may not be correct but it worked for me.

Open flags.sql in a text editor and "select all" and "copy".
Run phpMyAdmin and go to your database.
In the righthand window scroll down to nearly the bottom where you will see "Run SQL query/queries on database"
Paste the copied text into the box below and click "GO"
sj26
Registered User
Posts: 447
Joined: Fri Dec 14, 2001 4:06 pm
Location: /dev/cpu/[0-9]+ :D
Contact:

Post by sj26 »

Nuty, I had the same problem with the 'selected="selected"' not coming up, but I've been heavily changing mt board. If you want to have a look, it's at http://www.wyvern.com.au/~sam . The difference is that I got rid of the table. I use the image name without the path and extension so for me it's 'australia'. for the images I do an admin-like search through the directory for (.*)(.gif|.jpg|.jpeg|.png) and make these select items using ucwords to capitalise the filename as the thing that the user sees. I also made it so the image changes via js (it displays next to the select) so the user can 'preview' their flag. This way it is much easier because you just compare $userdata['user_from_flag'] with $match[1].

Anyway, that's my two cents for today ;)
[ Working on: It's a secret! ]
[ Links: My Mods | My Site | PALGN ]
User avatar
Klaus2000
Registered User
Posts: 67
Joined: Sat Apr 06, 2002 2:19 pm
Location: somewhere in nowhere in good old Germany ;-)
Contact:

Post by Klaus2000 »

I managed nearly all...


One thing was, that in memberlist.php i found 2 lines of:
$from = ( !empty($row['user_from']) ) ? $row['user_from'] : '&nbsp;';

Any ideas?


Also - need to have a field in admin-profile to set the flag for the user.
Bear_nG
Registered User
Posts: 125
Joined: Fri Apr 05, 2002 9:22 am
Location: Brisbane, Australia
Contact:

Re: Run flags.sql - This will setup your db table - how?

Post by Bear_nG »

1stGEAR wrote: This is my first post so I am a newbie as well.
I didn't know how to run this file either, but i found a way through trial and error. This may not be correct but it worked for me.

Open flags.sql in a text editor and "select all" and "copy".
Run phpMyAdmin and go to your database.
In the righthand window scroll down to nearly the bottom where you will see "Run SQL query/queries on database"
Paste the copied text into the box below and click "GO"


If you have access to the mysql shell it is easier

open mysql (c:\mysql\bin\mysql.exe) with the following command
mysql <database name>

at the mysql prompt ( mysql> )

copy the .sql file over to the bin dir, rename it to flags.sql and run:

mysql \. flags.sql

takes less than a second
1stGEAR
Registered User
Posts: 2
Joined: Sun Apr 14, 2002 6:44 pm
Location: Dalton-in-Furness, Cumbria. Uk
Contact:

Re: Run flags.sql - This will setup your db table - how?

Post by 1stGEAR »

Bear_nG wrote: If you have access to the mysql shell it is easier

open mysql (c:\mysql\bin\mysql.exe) with the following command
mysql <database name>

at the mysql prompt ( mysql> )

copy the .sql file over to the bin dir, rename it to flags.sql and run:

mysql \. flags.sql

takes less than a second


Thanks Bear_nG, but I'm struggling to understand what you mean.
I'm used to using YaBB, perl based and databases are a bit of a mystery to me at the moment, but I'm trying to learn.

How do I know if I have access to the mysql shell?

You say it takes less than a second your way, but it didn't take long doing what I did. Is my way not the prefered method?

I really appreciate your reply to my post and hope that you can help further.
TIA
Nuttzy99
Former Team Member
Posts: 4917
Joined: Fri Aug 03, 2001 7:09 am
Location: the 11th dimension
Contact:

Post by Nuttzy99 »

sj26 wrote: I also made it so the image changes via js (it displays next to the select) so the user can 'preview' their flag.


Cool! Send me the code for that and you'll see it in 2.0.5 (with credit to you of course ;)) Also I will promise to fix any problems with the damn pull down list!!! I think it works fine for now, unless you go to the avatar gallery. No one has shown me otherwise yet.
Klaus2000 wrote: One thing was, that in memberlist.php i found 2 lines of:
$from = ( !empty($row['user_from']) ) ? $row['user_from'] : '&nbsp;';

All I can say is that a fresh copy of memberlist.php has only on instance of "$from =" by itself, let alone the rest of the line. You either installed another mod, or made a goof while editing. Not too many mods change memberlist.php, so maybe you want to get a fresh copy and try again.
Klaus2000 wrote: Also - need to have a field in admin-profile to set the flag for the user.

Doh! Forgot about that one. Will be in there for 2.0.5. Thanks ;)

Bear_nG and 1stGEAR: Both methods are fine. 1stGEAR, while most folks probably have phpMyAdmin, maybe not everyone does. Or some are like me and have a super old version that can only do one-liner SQL statements :evil: :evil: I use Bear's but would prefer to use yours ;)

-Nuttzy :cool:
SpellingCow.com - Free spell check service for your forums or any web form!
No Support via PM please!
Nuttzy99
Former Team Member
Posts: 4917
Joined: Fri Aug 03, 2001 7:09 am
Location: the 11th dimension
Contact:

Post by Nuttzy99 »

sj26: Just wanted to let you know that I did get to read your replies before the forum rolled back and lost your posts. I'll fix the county_flag vs. user_flag thing. Thank you so much!!!!!!!!!

-Nuttzy :cool:
SpellingCow.com - Free spell check service for your forums or any web form!
No Support via PM please!
Locked

Return to “[2.0.x] MODs in Development”