3.1.x Extensions Database 3.1 / 3.2Online users avatar

<span class="qte-attr qte_31_32-qte">3.1.x &amp; 3.2.x</span>
User avatar

Topic Author
dmzx Online
Founder
Founder
Posts: 6466
Joined: 13 Jan 2014, 21:45
    Windows 10 Chrome

Re: Online users avatar

Post by dmzx »

ninowebs wrote: 10 Jan 2019, 15:33
ninowebs wrote: 08 Jan 2019, 03:25 hi I have a little problem sometimes, maybe if I do not flip and when there is google bot I see it
no help, for this annoying
please :eyes2:
try this listener.php

Code: Select all

<?php
/**
*
* @package phpBB Extension - Online users avatar
* @copyright (c) 2016 dmzx - http://www.dmzx-web.net
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/

namespace dmzx\onlineusersavatar\event;

use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class listener implements EventSubscriberInterface
{
	/** @var \phpbb\user */
	protected $user;

	/**
	* Constructor
	*
	* @param \phpbb\user		$user
	*
	*/
	public function __construct(\phpbb\user $user)
	{
		$this->user = $user;
	}

	static public function getSubscribedEvents()
	{
		return array(
			'core.obtain_users_online_string_sql'		=> 'obtain_users_online_string_sql',
			'core.obtain_users_online_string_modify'	=> 'obtain_users_online_string_modify',
		);
	}

	public function obtain_users_online_string_sql($event)
	{
		$sql_ary = $event['sql_ary'];
		$sql_ary['SELECT'] .= ', u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height';
		$event['sql_ary'] = $sql_ary;
	}

	public function obtain_users_online_string_modify($event)
	{
		$u_online = $event['user_online_link'];
		$online_users = $event['online_users'];
		$online_userlist = $event['online_userlist'];

		$username = $replace = array();
		foreach ($event['rowset'] as $row)
		{
			if (!isset($u_online[$row['user_id']]))
			{
				continue;
			}

			// User is logged in and therefore not a guest
			if ($row['user_id'] != ANONYMOUS)
			{
				if (isset($online_users['hidden_users'][$row['user_id']]))
				{
					$row['username'] = '<em>' . $row['username'] . '</em>';
				}
			}

			if (!empty($row['user_avatar']))
			{
				$replace_avatar = '<span class="useravatar">' . phpbb_get_user_avatar($row) . '</span> ' . $row['username'] .	'';
			}
			else
			{
				$no_avatar = generate_board_url() . "/styles/" . rawurlencode($this->user->style['style_path']) . '/theme/images/no_avatar.gif';
				$replace_avatar = '<span class="useravatar"><img src="' . phpbb_get_user_avatar($row) . '" alt="" /></span> ' . $row['username'];  // $no_avatar
			}

			$username[] = $row['username'];
			$replace[] = $replace_avatar;
		}

		if (sizeof($username))
		{
			$online_userlist = str_replace($username, $replace, $online_userlist);
		}
		$event['online_userlist'] = $online_userlist;
	}
}
backup old listener.php first :P
Clear cache and try

User avatar

ninowebs
Users
Users
Posts: 29
Joined: 04 Jun 2015, 23:44
    Windows 10 Chrome

Re: Online users avatar

Post by ninowebs »

Ok lo testo, grazie mille,, vi farò sapere :buigen:

User avatar

ninowebs
Users
Users
Posts: 29
Joined: 04 Jun 2015, 23:44
    Windows 10 Chrome

Re: Online users avatar

Post by ninowebs »

Now you see it so, not annoying, even if the bots have no image no avatar
You do not have the required permissions to view the files attached to this post! Maybe your post count is too low.

User avatar

Sniper_E
VIP
VIP
Posts: 1157
Joined: 14 Oct 2014, 19:01
    Windows 10 Firefox

Re: Online users avatar

Post by Sniper_E »

My bots have an avatar Image Find one you like and give your bots an avatar.
Image
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!™

User avatar

ninowebs
Users
Users
Posts: 29
Joined: 04 Jun 2015, 23:44
    Windows 10 Chrome

Re: Online users avatar

Post by ninowebs »

Yes, it is good idea, thank you :tumbsyes:

User avatar

Fast_Eddie
Users
Users
Posts: 279
Joined: 15 Aug 2015, 20:25
    Windows 7 Firefox

Re: Online users avatar

Post by Fast_Eddie »

kaspir wrote: 22 Jan 2017, 13:32 Looks like this still works on 3.2, however I can't use it until I figure out what structure and field names to use for CAMO SSL Image Proxy Configuration. Any idea mate? Some image exts are easier than others to figure out. :(

Would love to use this!
Has anyone had any luck using this in 3.2x ?
:beers: Retirement 2024!

User avatar

martin
Admin
Admin
Posts: 5105
Joined: 06 Apr 2014, 16:12
    Linux Chrome

Re: Online users avatar

Post by martin »

Just tested it yes it works on 3.2.7 :tumbsyes:
Image

User avatar

Fast_Eddie
Users
Users
Posts: 279
Joined: 15 Aug 2015, 20:25
    Windows 7 Firefox

Re: Online users avatar

Post by Fast_Eddie »

Thank you Martin. Worked for me also. ( Need to install a test board for this kind of stuff )

User avatar

TheDjRider
Users
Users
Posts: 13
Joined: 13 May 2019, 18:24
    Windows 10 Chrome

Re: Online users avatar

Post by TheDjRider »

I've encounter strange glitch where my avatar duplicate - Image
:arrow: EternalNetwork TM - news, tutorials and sharing
:arrow: Forum • EternalNetworkTM - discouse, ask and enjoy
:arrow: EternalRadio - best music is here
:arrow: Biograpy site - my Personal website

Image

User avatar

TheDjRider
Users
Users
Posts: 13
Joined: 13 May 2019, 18:24
    Windows 10 Chrome

Re: Online users avatar

Post by TheDjRider »

TheDjRider wrote: 04 Sep 2021, 00:29 I've encounter strange glitch where my avatar duplicate - Image
Somehow after updating Gravatar now show properly only 1 image.

User avatar

BBBenj
Users
Users
Posts: 48
Joined: 10 Mar 2017, 10:59
    Windows 10 Opera

Re: Online users avatar

Post by BBBenj »

Thanks,

Also works for me in phpBB 3.3.5.

Post Reply Previous topicNext topic