[ABD] Country Flags 1.0.0

Any abandoned MODs will be moved to this forum.

WARNING: MODs in this forum are not currently being supported or maintained by the original MOD author. Proceed at your own risk.
Forum rules
IMPORTANT: MOD Development Forum rules

WARNING: MODs in this forum are not currently being supported nor updated by the original MOD author. Proceed at your own risk.
Elite Troopers
Registered User
Posts: 23
Joined: Thu Sep 11, 2008 11:46 am

Re: [RC] Country Flags 1.0.0

Post by Elite Troopers » Mon Sep 29, 2008 3:27 pm

I'm getting this same error...

Code: Select all

Erro Geral
SQL ERROR [ mysqli ]

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND user_id = 19820' at line 6 [1064]

SQL

UPDATE phpbb_users SET user_flag = '' WHERE group_id = 35413 AND user_flag <> '' AND user_flag = AND user_id = 19820

BACKTRACE

FILE: includes/db/mysqli.php
LINE: 143
CALL: dbal->sql_error()

FILE: includes/functions_user.php
LINE: 2906
CALL: dbal_mysqli->sql_query()

FILE: includes/functions_user.php
LINE: 2796
CALL: remove_default_flag()

FILE: includes/acp/acp_groups.php
LINE: 205
CALL: group_user_del()

FILE: includes/functions_module.php
LINE: 471
CALL: acp_groups->main()

FILE: adm/index.php
LINE: 78
CALL: p_master->load_active()
---edit

Nvm, this instructions fixed the problem:

http://www.phpbb.com/community/viewtopi ... 5#p6104405

User avatar
oddfish
Registered User
Posts: 839
Joined: Mon Mar 19, 2007 8:45 pm
Location: Testing 3.1
Contact:

Re: [RC] Country Flags 1.0.0

Post by oddfish » Mon Sep 29, 2008 8:45 pm

hmmm, perhaps not commenting out code that should work and change the function to make it work ?

Open includes/functions_user.php
Find

Code: Select all

/**
* Removes the group flag of the default group from the users in user_ids who have that group as default.
*/
function remove_default_flag($group_id, $user_ids)
{
    global $db;

    if (!is_array($user_ids))
    {
        $user_ids = array($user_ids);
    }

    if (empty($user_ids))
    {
        return false;
    }

    $user_ids = array_map('intval', $user_ids);

    $sql = 'SELECT *
        FROM ' . GROUPS_TABLE . '
        WHERE group_id = ' . (int) $group_id;
    $result = $db->sql_query($sql);

    if (!$row = $db->sql_fetchrow($result))
    {
        $db->sql_freeresult($result);
        return false;
    }
    $db->sql_freeresult($result);

    $sql = 'UPDATE ' . USERS_TABLE . "
        SET user_flag = ''
        WHERE group_id = " . (int) $group_id . "
            AND user_flag <> ''
            AND user_flag = " . (string) $row['group_flag'] . '
        AND ' . $db->sql_in_set('user_id', $user_ids);
    $db->sql_query($sql);
}
    
Replace with

Code: Select all

/**
* Removes the group flag of the default group from the users in user_ids who have that group as default.
*/
function remove_default_flag($group_id, $user_ids)
{
    global $db;

    if (!is_array($user_ids))
    {
        $user_ids = array($user_ids);
    }
    if (empty($user_ids))
    {
        return false;
    }

    $user_ids = array_map('intval', $user_ids);

    $sql = 'SELECT *
        FROM ' . GROUPS_TABLE . '
        WHERE group_id = ' . (int) $group_id;
    $result = $db->sql_query($sql);
    if (!$row = $db->sql_fetchrow($result))
    {
        $db->sql_freeresult($result);
        return false;
    }
    $db->sql_freeresult($result);

    $sql = 'UPDATE ' . USERS_TABLE . "
        SET user_flag = ''
        WHERE group_id = " . (int) $group_id . "
        AND user_flag = '" . $db->sql_escape($row['group_flag']) . "'
        AND " . $db->sql_in_set('user_id', $user_ids);
    $db->sql_query($sql);
}    
if someone would like to verify this, it might be the better option ;)

EDIT*** - Would there be a way to keep the default users flag if ever wanting to apply a default group flag? If you remove the default group flag, and set back to user default, then the users do not have a default flag any more.

cheers,
oddfish.
Country Flag User Edition Clickable Post Count Link

... another record broken without breaking any records ...
Testing phpBB3.1 dark style based on prosilver ... http://www.oddmods.net

User avatar
Gremlinn
Registered User
Posts: 2133
Joined: Mon Aug 04, 2003 12:13 am
Location: Rochester, NY
Name: Nathan

Re: [RC] Country Flags 1.0.0

Post by Gremlinn » Tue Sep 30, 2008 11:48 am

Making it work would be better, I agree. Removing it was (for me) just easier while we waited for the author to finish it. But, at last. No fix has come. I for one don't think I would use a group flag as this mod intends.

I could see more use in a group flag being used for something other than a country and perhaps not selectable by a user. Perhaps just a bolt on piece to this mod because it would be able to use 95% of the existing code. example: For say a military site, one might use the group flag to represent the user's assigned unit (i.e. 82nd Airborne, 4th Armor Division, etc...) or perhaps more generic and represent a branch (i.e. Air Force, Army, Navy, Marines, etc...)

I think you are right Oddfish. Having a way of falling back to a user's flag if a group flag is removed would be good. That would mean that their original would need to be saved somewhere while the group one is used in the users_flag. Perhaps another column to hold a group flag set for a user and having the option to use one, or the other, or both for display? I know, more coding, but I think people would like that. If one does not have a value, either display a default or don't display it?

I'll be willing to help package something together...

User avatar
oddfish
Registered User
Posts: 839
Joined: Mon Mar 19, 2007 8:45 pm
Location: Testing 3.1
Contact:

Re: [RC] Country Flags 1.0.0

Post by oddfish » Tue Sep 30, 2008 8:10 pm

yeah, it is something that I'd not use myself (unless, for example, wanting to assign a flag to a banned, warned or waiting for validation group) but the function replacement above makes it work for those that want to use it without commenting out any code.

The way it is, the code changes user_flag to the assigned group_flag. might not be too difficult to sort - perhaps a user_group_flag? a default flag would work but on registration, users have already selected one. 2 flags for any group assigned to the group_flag? - yeah, why not. 8-)

**EDIT** even though a group flag is assigned, users can still change it in their profile :roll: - defeats the purpose really.

cheers,
oddfish.
Country Flag User Edition Clickable Post Count Link

... another record broken without breaking any records ...
Testing phpBB3.1 dark style based on prosilver ... http://www.oddmods.net

User avatar
Gremlinn
Registered User
Posts: 2133
Joined: Mon Aug 04, 2003 12:13 am
Location: Rochester, NY
Name: Nathan

Re: [RC] Country Flags 1.0.0

Post by Gremlinn » Wed Oct 01, 2008 11:48 am

In the UCP, the "group flag" would need to be a non edit field. Slight change would be need there too.

User avatar
idanbe
Registered User
Posts: 77
Joined: Thu Apr 03, 2008 7:13 am
Location: Israel, Jerusalem
Name: Idan Ben Ezra

Re: [RC] Country Flags 1.0.0

Post by idanbe » Sun Oct 05, 2008 5:30 pm

hi,

i'm useing this mod and i want the country names will change by the user default lang

this is possible?

thanks idan
phpBB israel Styles Team Leader • phpBB.co.il

User avatar
Gremlinn
Registered User
Posts: 2133
Joined: Mon Aug 04, 2003 12:13 am
Location: Rochester, NY
Name: Nathan

Re: [RC] Country Flags 1.0.0

Post by Gremlinn » Mon Oct 06, 2008 12:29 pm

FYI: Oddfish and I are working out a repackaged version with the known fixes, well, fixed.

levy
Registered User
Posts: 15
Joined: Fri Jan 18, 2008 4:17 am

Re: [BETA] Country Flags 0.9.0

Post by levy » Sat Oct 11, 2008 6:10 pm

Highway of Life wrote:It’s there, just a little different. :P

Code: Select all

<a href="{U_SWATCH}" onclick="popup(this.href, 636, 150, '_swatch'); return false;"> 
Could tell you what to do if you post the action after the find. :)
So how would you add this code that is supposed to follow? How do I format it?

Code: Select all

/**
	* Change country flags
	*/
	function update_flag(newflag)
	{
		document.getElementById('flag_image').src = (newflag) ? "{FLAGS_PATH}/" + newflag: "./images/spacer.gif";
	}
Will this reply be viewed since I´m posting it a year after it was active?

Peace.

Levy.

User avatar
oddfish
Registered User
Posts: 839
Joined: Mon Mar 19, 2007 8:45 pm
Location: Testing 3.1
Contact:

Re: [RC] Country Flags 1.0.0

Post by oddfish » Sat Oct 11, 2008 10:09 pm

Hi levy.

you could try adding

Code: Select all

		/**
		* Change country flags
		*/
		function update_flag(newflag)
		{
			document.getElementById('flag_image').src = (newflag) ? "{FLAGS_PATH}/" + newflag: "./images/spacer.gif";
		}
after <!-- INCLUDE ucp_header.html --> and see how you get on.
there is a change to that code using version 1.0.0 in the same location - this relates only to the group flag so should not be a problem for users in general (unless, of course, wanting to apply group flags).

cheers,
oddfish
Country Flag User Edition Clickable Post Count Link

... another record broken without breaking any records ...
Testing phpBB3.1 dark style based on prosilver ... http://www.oddmods.net

eleni25
Registered User
Posts: 198
Joined: Wed Apr 26, 2006 10:30 am

Re: [RC] Country Flags 1.0.0

Post by eleni25 » Sun Oct 19, 2008 8:48 pm

hello. when i try to remove a member for a group i get this error:

Code: Select all

SQL ERROR [ mysql4 ]

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND user_id = 117' at line 6 [1064]

SQL

UPDATE phpbb3_users SET user_flag = '' WHERE group_id = 8 AND user_flag <> '' AND user_flag = AND user_id = 117

BACKTRACE

FILE: includes/db/mysql.php
LINE: 158
CALL: dbal->sql_error()

FILE: includes/functions_user.php
LINE: 2909
CALL: dbal_mysql->sql_query()

FILE: includes/functions_user.php
LINE: 2799
CALL: remove_default_flag()

FILE: includes/acp/acp_groups.php
LINE: 204
CALL: group_user_del()

FILE: includes/functions_module.php
LINE: 471
CALL: acp_groups->main()

FILE: adm/index.php
LINE: 74
CALL: p_master->load_active()

User avatar
oddfish
Registered User
Posts: 839
Joined: Mon Mar 19, 2007 8:45 pm
Location: Testing 3.1
Contact:

Re: [RC] Country Flags 1.0.0

Post by oddfish » Sun Oct 19, 2008 9:09 pm

Hello eleni25

try this code replacement and let me know how you get on :

http://www.phpbb.com/community/viewtopi ... 5#p7208035

cheers,
oddfish.
Country Flag User Edition Clickable Post Count Link

... another record broken without breaking any records ...
Testing phpBB3.1 dark style based on prosilver ... http://www.oddmods.net

eleni25
Registered User
Posts: 198
Joined: Wed Apr 26, 2006 10:30 am

Re: [RC] Country Flags 1.0.0

Post by eleni25 » Mon Oct 20, 2008 5:10 am

it s work fine! thanks :):):)

Karl1987
Registered User
Posts: 106
Joined: Thu Jan 17, 2008 11:29 pm
Location: México

Re: [RC] Country Flags 1.0.0

Post by Karl1987 » Tue Nov 04, 2008 4:26 pm

i have a error when delete users of groups from my acp the error is:

Code: Select all

Error General
SQL ERROR [ mysqli ]

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND user_id = 56' at line 6 [1064]

SQL

UPDATE phpbb_users SET user_flag = '' WHERE group_id = 13 AND user_flag <> '' AND user_flag = AND user_id = 56

BACKTRACE

FILE: includes/db/mysqli.php
LINE: 143
CALL: dbal->sql_error()

FILE: includes/functions_user.php
LINE: 2903
CALL: dbal_mysqli->sql_query()

FILE: includes/functions_user.php
LINE: 2793
CALL: remove_default_flag()

FILE: includes/acp/acp_groups.php
LINE: 205
CALL: group_user_del()

FILE: includes/functions_module.php
LINE: 471
CALL: acp_groups->main()

FILE: adm/index.php
LINE: 74
CALL: p_master->load_active()
please helpme :cry:

User avatar
Gremlinn
Registered User
Posts: 2133
Joined: Mon Aug 04, 2003 12:13 am
Location: Rochester, NY
Name: Nathan

Re: [RC] Country Flags 1.0.0

Post by Gremlinn » Tue Nov 04, 2008 4:50 pm

Karl1987: You have two options... Read back in this topic to find an answer/solution. Or, if you can give me a day or two, I will have a branched version setup that OddFish and I are are working out. I will setup a new topic here and it will be on my Mod test site.

Karl1987
Registered User
Posts: 106
Joined: Thu Jan 17, 2008 11:29 pm
Location: México

Re: [RC] Country Flags 1.0.0

Post by Karl1987 » Tue Nov 04, 2008 4:59 pm

no problem gremlinn i wait your answer ^^

Locked

Return to “[3.0.x] Abandoned MODs”