National Flags

help - National Flags

help

by php_bb » Fri Mar 12, 2021 10:19 pm

hi,

1. mysite.com/app.php/flags displays the user numbers under the flags based on only active users, which is good.
but on index page, displays the user numbers under the flags based on both active and inactive users.
sometimes on index page, displays a flag with user-numbers under it, but when you click on it, the page is empty. because mysite.com/app.php/flags is correctly displays the flags based on only active users.
how can i fix this to display the user numbers under the flags based on only active users on index page too?

Thank you,
Last edited by php_bb on Fri Mar 19, 2021 5:33 am
php_bb
I've Been Banned!
Posts: 86
Joined: Sun Feb 07, 2021 5:47 am

Re: help

by php_bb » Tue Mar 16, 2021 7:11 pm

i think the question number 1 is a bug.
anyone knows how to fix this?
php_bb
I've Been Banned!
Posts: 86
Joined: Sun Feb 07, 2021 5:47 am

Re: help

by RMcGirr83 » Tue Mar 16, 2021 9:48 pm

Doesn't make a difference if their active or not. Not even sure what determines a user being active.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then you can support me by buying a beer 🍺
User avatar
RMcGirr83
Former Team Member
Posts: 22092
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: help

by php_bb » Tue Mar 16, 2021 11:23 pm

RMcGirr83 wrote:Doesn't make a difference if their active or not. Not even sure what determines a user being active.
it makes a difference.
active user = activated with email or by Admin = phpbb_users -> user_type is: 0 or 3
inactive user = phpbb_users -> user_type is: 1

please test this:
step1: register two users with test-country. user1 is active and user2 is not.
step2: now enable the extension to display flags on index page.
step3: now you see that it displays 2-users under test-country flag. [it supposed to display 1-user]
step4: when you click on it, it only displays user1 on the page. [here is correct. because only user1 is active.]

- these is a bug on [step3]. it should display 1-user under the flag.
Last edited by php_bb on Tue Mar 16, 2021 11:28 pm
php_bb
I've Been Banned!
Posts: 86
Joined: Sun Feb 07, 2021 5:47 am

Re: help

by RMcGirr83 » Tue Mar 16, 2021 11:27 pm

Those are user types, sort of helps to be clear. I'll take a look.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then you can support me by buying a beer 🍺
User avatar
RMcGirr83
Former Team Member
Posts: 22092
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: help

by RMcGirr83 » Tue Mar 16, 2021 11:39 pm

Try,

disable the extension and find this in core/national_flags.php

Code: Select all

	public function build_users_and_flags()
	{
		if (($this->cache->get('_users_and_flags')) === false)
		{
			$sql = 'SELECT user_id, user_flag
				FROM ' . USERS_TABLE . '
			WHERE user_flag > 0';
			$result = $this->db->sql_query($sql);
replace with this

Code: Select all

	public function build_users_and_flags()
	{
		if (($this->cache->get('_users_and_flags')) === false)
		{
			$sql = 'SELECT user_id, user_flag
				FROM ' . USERS_TABLE . '
				WHERE user_flag > 0
					AND ' . $this->db->sql_in_set('user_type', [USER_NORMAL, USER_FOUNDER]);
			$result = $this->db->sql_query($sql);
purge the cache after making that change.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then you can support me by buying a beer 🍺
User avatar
RMcGirr83
Former Team Member
Posts: 22092
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: help

by php_bb » Thu Mar 18, 2021 4:49 am

RMcGirr83 wrote: Try,
thank you very much. its working now.
would you please help me not to show for guests.
Last edited by php_bb on Fri Mar 19, 2021 5:35 am
php_bb
I've Been Banned!
Posts: 86
Joined: Sun Feb 07, 2021 5:47 am

Re: help

by RMcGirr83 » Thu Mar 18, 2021 11:34 am

Just set the ACP option "Display flags to guests" to no
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then you can support me by buying a beer 🍺
User avatar
RMcGirr83
Former Team Member
Posts: 22092
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: help

by php_bb » Thu Mar 18, 2021 7:19 pm

RMcGirr83 wrote:Just set the ACP option "Display flags to guests" to no
but i want guests to see the flags too!
php_bb
I've Been Banned!
Posts: 86
Joined: Sun Feb 07, 2021 5:47 am

Re: help

by RMcGirr83 » Thu Mar 18, 2021 8:56 pm

Then why does it matter if they can see join date or post count? You are free to take the code and modify it to suit your needs.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then you can support me by buying a beer 🍺
User avatar
RMcGirr83
Former Team Member
Posts: 22092
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: help

by php_bb » Fri Mar 19, 2021 4:53 am

RMcGirr83 wrote:You are free to take the code and modify it to suit your needs.
okay, i will figure it out. thanks.
php_bb
I've Been Banned!
Posts: 86
Joined: Sun Feb 07, 2021 5:47 am