Code to call user's phpBB Avatar

teebling
User w
User w
Posts: 11
Joined: Wed Jun 10, 2020 4:26 pm

Code to call user's phpBB Avatar

Post by teebling »

Hello,

I'm trying to call the current user's phpBB avatar in a template file.

I have tried the default WP get_avatar_url() function but it just returns the default WP 'No Avatar' image.

I can see that the user's phpBB avatar is successfully rendered in the Admin Toolbar, and in the w3all Login/User Info widget. I also see that avatars are working successfully on the Latest Topics Widget. So - the phpBB avatars working correctly on the rest of my site.

I just don't have the PHP code to call the user's phpBB avatar anywhere else in a template file - can you please provide it? It seems to me like a different call than the default get_avatar function.

Thanks

teebling
User w
User w
Posts: 11
Joined: Wed Jun 10, 2020 4:26 pm

Re: Code to call user's phpBB Avatar

Post by teebling »

Nevermind, I managed to figure it out myself. For anyone else reading use this:

Code: Select all

<?php
global $w3all_last_t_avatar_dim;
$user = wp_get_current_user();
 
if ( $user ) :
    ?>
   <?php echo '' . get_avatar(get_current_user_id(), $w3all_last_t_avatar_dim); ?>
<?php endif; ?>
This will grab the 'Last Topic' avatar - so unfortunately also any dimensions you set for that in the w3all configuration. But it's still pretty good and did the job for me.

Post Reply