[2.0.21] Country Flags MOD

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in here. No new MODs will be accepted into the MOD Database for phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.

Rating:

Excellent!
26
57%
Very Good
8
17%
Good
5
11%
Fair
2
4%
Poor
5
11%
 
Total votes: 46

ycl6
Translator
Posts: 5696
Joined: Sat Feb 15, 2003 10:35 am
Location: Taiwan
Contact:

Re: MOD doesn't work

Post by ycl6 » Mon Aug 28, 2006 1:27 pm

cronos42 wrote: OK...I tried step 1) of the DIY instructions. The result:

1) I had an extra table called phpbb_flag_table
2) I had the extra field user_from_flag in the phpbb_users table

When I went to the admin console, 'flags' option, I got an error message that the table FLAG_TABLE was not present. I thought it was a little weird that the flag mod installer instructions take the phpbb prefix as default, but the code inside its PHP files doesn't.

To fix this, I copied table and contents to a table called FLAG_TABLE (even though that does waste space a little). The result:

1) The admin 'flags' option now works, though the button at the bottom has no text and when I edit a flag there is only ":" in front of the country name and the flag image.

The worst thing is that I cannot choose a flag in my profiles. So I can view the flags in the admin console but other than that the mod does nothing.

Can anyone please help?

(And can I now safely throw away the phpbb_flag_table?)

cronos42, renaming it to FLAG_TABLE isn't a correct way to do it. By using the db_update_en.php file, it should detect the correct table prefix you are using and create the table with the correct prefix.

Have you perform the edits in install_en.txt? If the database tables and fields are added correctly, maybe you missing the changes required for includes/constants.php? Also, you mentioned that the text is not showing up, have you make changes to language/lang_english/lang_main.php and language/lang_english/lang_admin.php?

~Mac

cronos42
Registered User
Posts: 9
Joined: Tue Jan 11, 2005 7:55 am

Re: MOD doesn't work

Post by cronos42 » Mon Aug 28, 2006 1:47 pm

ycl6 wrote:
cronos42 wrote:OK...I tried step 1) of the DIY instructions. The result:

1) I had an extra table called phpbb_flag_table
2) I had the extra field user_from_flag in the phpbb_users table

When I went to the admin console, 'flags' option, I got an error message that the table FLAG_TABLE was not present. I thought it was a little weird that the flag mod installer instructions take the phpbb prefix as default, but the code inside its PHP files doesn't.

To fix this, I copied table and contents to a table called FLAG_TABLE (even though that does waste space a little). The result:

1) The admin 'flags' option now works, though the button at the bottom has no text and when I edit a flag there is only ":" in front of the country name and the flag image.

The worst thing is that I cannot choose a flag in my profiles. So I can view the flags in the admin console but other than that the mod does nothing.

Can anyone please help?

(And can I now safely throw away the phpbb_flag_table?)

cronos42, renaming it to FLAG_TABLE isn't a correct way to do it. By using the db_update_en.php file, it should detect the correct table prefix you are using and create the table with the correct prefix.

Have you perform the edits in install_en.txt? If the database tables and fields are added correctly, maybe you missing the changes required for includes/constants.php? Also, you mentioned that the text is not showing up, have you make changes to language/lang_english/lang_main.php and language/lang_english/lang_admin.php?

~Mac


Thanks for your reply!

I have performed one of the three methods of installation such as mentioned in install_en.txt. I don't recall which one I used, but it wasn't the automated one with the MOD Installer.

ycl6
Translator
Posts: 5696
Joined: Sat Feb 15, 2003 10:35 am
Location: Taiwan
Contact:

Post by ycl6 » Mon Aug 28, 2006 2:41 pm

Try again by renaming your flag table to phpbb_flags, and check the changes you've made to these files

Code: Select all

##	viewtopic.php
##	memberlist.php
##	admin/admin_users.php
##	includes/constants.php
##	includes/usercp_viewprofile.php
##	includes/usercp_register.php
##	includes/usercp_avatar.php
##	language/lang_english/lang_main.php
##	language/lang_english/lang_admin.php
##	templates/subSilver/profile_add_body.tpl
##	templates/subSilver/admin/user_edit_body.tpl
~Mac

phasar
Registered User
Posts: 15
Joined: Sun Aug 27, 2006 10:20 pm

Post by phasar » Tue Aug 29, 2006 3:53 am

phasar wrote: Well, I just did everything in the Step 3 instructions and I get this error when you try to view a post in the forums. :cry:
Parse error: syntax error, unexpected '.', expecting ')' in /home/franksre/public_html/forums/viewtopic.php on line 1171


And I don't get the left colume or scroll bar anymore in the Admin panel. Instead I get this. :evil:
Parse error: syntax error, unexpected T_VARIABLE in /home/franksre/public_html/forums/admin/admin_users.php on line 993





NOW WHAT???


The problem I'm getting in viewtopic.php is this: . $poster_from_flag

The instructions read:
#-----[ FIND ]------------------------------------------
#
'POSTER_FROM' => $poster_from,
#
#-----[ IN-LINE FIND ]------------------------------------------
#
$poster_from
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
. $poster_from_flag

I didn't think it looked right. The code looks like


'POSTER_FROM' => $poster_from,
. $poster_from_flag
'POSTER_AVATAR' => $poster_avatar,
Is this how that code is supposed to look?

Thanks
Frank

phasar
Registered User
Posts: 15
Joined: Sun Aug 27, 2006 10:20 pm

Post by phasar » Tue Aug 29, 2006 5:35 am

Here's where I'm getting the problem in admin_users.php
$ini_val = ( phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var';
$form_enctype = ( !@$ini_val('file_uploads') // Country/Location Flags
// Query to get the list of flags
$sql = "SELECT *
FROM " . FLAG_TABLE . "
ORDER BY flag_name";
if(!$flags_result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Couldn't obtain flags information.", "", __LINE__, __FILE__, $sql);
}

// Build the html select statement
$flag_start_image = 'blank.gif';
$flag_select = '<select name="user_flag" onChange="document.images[\'user_flag\'].src = \'../images/flags/\' + this.value;">';
$flag_select .= '<option value="blank.gif">' . $lang['Select_country'] . '</option>';
while ( $flag_row = $db->sql_fetchrow($flags_result) )
{
$flag_name = $flag_row['flag_name'];
$flag_image = $flag_row['flag_image'];
$selected = ( $user_flag == $flag_image ) ? ' selected="selected"' : '';
$flag_select .= '&nbsp;&nbsp;&nbsp;<option value="' . $flag_image . '"' . $selected . '">' . $flag_name . '</option>';
if ( isset( $user_flag) && ($user_flag == $flag_image))
{
$flag_start_image = $flag_image;
}
}
$flag_select .= '</select>'; || phpversion() == '4.0.4pl1' || !$board_config['allow_avatar_upload'] || ( phpversion() < '4.0.3' && @$ini_val('open_basedir') != '' ) ) ? '' : 'enctype="multipart/form-data"';

phasar
Registered User
Posts: 15
Joined: Sun Aug 27, 2006 10:20 pm

Post by phasar » Tue Aug 29, 2006 5:40 am

Ok, I fixed that problem. The install text says to add
// Country/Location Flags
// Query to get the list of flags
$sql = "SELECT *
FROM " . FLAG_TABLE . "
ORDER BY flag_name";
if(!$flags_result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Couldn't obtain flags information.", "", __LINE__, __FILE__, $sql);
}

// Build the html select statement
$flag_start_image = 'blank.gif';
$flag_select = '<select name="user_flag" onChange="document.images[\'user_flag\'].src = \'../images/flags/\' + this.value;">';
$flag_select .= '<option value="blank.gif">' . $lang['Select_country'] . '</option>';
while ( $flag_row = $db->sql_fetchrow($flags_result) )
{
$flag_name = $flag_row['flag_name'];
$flag_image = $flag_row['flag_image'];
$selected = ( $user_flag == $flag_image ) ? ' selected="selected"' : '';
$flag_select .= '&nbsp;&nbsp;&nbsp;<option value="' . $flag_image . '"' . $selected . '">' . $flag_name . '</option>';
if ( isset( $user_flag) && ($user_flag == $flag_image))
{
$flag_start_image = $flag_image;
}
}
$flag_select .= '</select>';


After
$form_enctype = ( !@$ini_val('file_uploads')


That caused the error. It should be placed after
$form_enctype = ( !@$ini_val('file_uploads') || phpversion() == '4.0.4pl1' || !$board_config['allow_avatar_upload'] || ( phpversion() < '4.0.3' && @$ini_val('open_basedir') != '' ) ) ? '' : 'enctype="multipart/form-data"';


But I'm still at a loss as to the problem with viewtopic.php.

I still can't view a topic

Help???

phasar
Registered User
Posts: 15
Joined: Sun Aug 27, 2006 10:20 pm

Post by phasar » Tue Aug 29, 2006 5:54 am

I fixed the viewtopic.php problem.

The complete line should read as
'POSTER_FROM' => $poster_from . $poster_from_flag,


:D

ycl6
Translator
Posts: 5696
Joined: Sat Feb 15, 2003 10:35 am
Location: Taiwan
Contact:

Post by ycl6 » Tue Aug 29, 2006 12:22 pm

Hi phasar, if you aren't familiar with MOD actions, you may take a look at this tutorial

~Mac

phasar
Registered User
Posts: 15
Joined: Sun Aug 27, 2006 10:20 pm

Post by phasar » Tue Aug 29, 2006 12:32 pm

It was pretty self explanatory, but there were a couple of directions, as noted above, that could have been a little clearer.

While we're on the subject... I downloaded a couple of other MODS that don't have directions, but have files with an MOD extension. Will EasyMOD install those? There were no text files or directions of any type in the zip files

ycl6
Translator
Posts: 5696
Joined: Sat Feb 15, 2003 10:35 am
Location: Taiwan
Contact:

Post by ycl6 » Tue Aug 29, 2006 12:39 pm

phasar wrote: While we're on the subject... I downloaded a couple of other MODS that don't have directions, but have files with an MOD extension. Will EasyMOD install those? There were no text files or directions of any type in the zip files

Actually, if you open the *.mod file with a text editor, you will see the same text-based MOD template. EM will recongise it alright.

~Mac

pong38
Registered User
Posts: 11
Joined: Mon Jun 19, 2006 7:07 pm

Post by pong38 » Wed Aug 30, 2006 8:10 pm

Cool mod :D
Just installed the whole thing but I'm not sure if everything runs well and maybe someone can help.

First of all (and most important)..
I have an error while running the forum...

Image

which is :

$lang['Country_flag'] = 'Flag'; // Country/Location Flags
$lang['Select_country'] = 'SELECT COUNTRY/LOCATION'; // Country/Location Flags

:oops: :oops: :oops: What can be wrong with such a simple statement ??


I also have something weird while diplaying a userprofile. There is no text on that row. Look at this please.

Image

What could be the cause of this ??


Besides this the mod works well. Having selected a flag in the profile will display a picture of the flag in the postings.

I also would like to make the choice of a flag mandatory will registering.
Is that possible and how to make this happen.

ycl6
Translator
Posts: 5696
Joined: Sat Feb 15, 2003 10:35 am
Location: Taiwan
Contact:

Post by ycl6 » Thu Aug 31, 2006 12:31 am

pong38 wrote: First of all (and most important)..
I have an error while running the forum...

Image

which is :

$lang['Country_flag'] = 'Flag'; // Country/Location Flags
$lang['Select_country'] = 'SELECT COUNTRY/LOCATION'; // Country/Location Flags

:oops: :oops: :oops: What can be wrong with such a simple statement ?

Did you add the $lang code ABOVE the "?>" sign? What's the surrounding codes looks like?

~Mac

carpetrug01
Registered User
Posts: 13
Joined: Thu Aug 31, 2006 1:58 am

Post by carpetrug01 » Thu Aug 31, 2006 4:12 am

it says this after i install it with easymod..



* Method 1: Copy root/install/db_update_en.php to install/db_update_en.php. Execute and delete after it has been run
* Method 2: Use EasyMOD to run contrib/install/db_update_en.txt
* Method 3: Copy the SQL query from contrib/install/db_update_en.txt and execute it manually



How would i do method 2? I dont see how to tell easymod to run db_update_en.txt

Thanks :)

User avatar
FORDification
Registered User
Posts: 112
Joined: Fri Jul 23, 2004 4:12 am
Location: Nebraska
Contact:

Post by FORDification » Thu Aug 31, 2006 5:40 am

I'm hoping someone can help me with this situation.

I had to do a phpbb re-install, due to some issues that I thought I had with my board (but turned out to be server security issues instead). Since I also had the Attachment mod installed, and I didn't want to lose the attachment tables which would match up the attachments to the specific posts, I used Vic D'Elfant's 'Clean phpBB SQL Tables' script to remove all tables not created with the vanilla phpBB install, except that I only kept the mod tables dealing with the attachment mod. Everything else (or so I thought) got deleted.

Now I'm reinstalling my mods. I had the Country flags (and State flags add-on) v. 2.0.5 installed on my forum previously and was planning on reusing it, since it worked great. However, after doing all the edits, uploading the flag images, etc., I got the following error message:
Could not obtain post/user information.

DEBUG MODE

SQL Error : 1054 Unknown column 'u.user_from_flag' in 'field list'

SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_from_flag, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, u.user_avatar, u.user_avatar_type, u.user_allowavatar, u.user_allowsmile, p.*, pt.post_text, pt.post_subject, pt.bbcode_uid FROM phpbb_posts p, phpbb_users u, phpbb_posts_text pt WHERE p.topic_id = 13551 AND pt.post_id = p.post_id AND u.user_id = p.poster_id ORDER BY p.post_time ASC LIMIT 0, 15

Line : 399
File : viewtopic.php


I went into myAdmin and could see that all flag tables appear to be there, including the 'user_from_flag' table in the phpbb_users. Here's what I can see in myAdmin:

In the phpbb_flags I see:
- flag_ID
- flag_name
- flag_image

...and under the phpbb_users, I see:

- user_from_flag

So what's going on? Why am I being told that the 'user_from_flag' column is 'unknown'?

ycl6
Translator
Posts: 5696
Joined: Sat Feb 15, 2003 10:35 am
Location: Taiwan
Contact:

Post by ycl6 » Thu Aug 31, 2006 12:31 pm

carpetrug01 wrote: How would i do method 2? I dont see how to tell easymod to run db_update_en.txt

Simply copy the file (db_update_en.txt) to the MOD's root folder, i.e.

Code: Select all

admin/mods/Country Flags MOD/db_update_en.txt
Then refresh the EM's MOD list, you should see the new file available for installation.

~Mac

Post Reply

Return to “[2.0.x] MOD Database Releases”