Avatar bug on last topics: non registered user's post associated with actual logged in user (in certain conditions)

User avatar
axew3
w3all User
w3all User
Posts: 2689
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Avatar bug on last topics: non registered user's post associated with actual logged in user (in certain conditions)

Post by axew3 »

Manual fix (or download the ready file more below)
file
/wp-content/plugins\/wp-w3all-phpbb-integration/views/phpbb_last_topics.php
search for:

Code: Select all

$w3all_avatar_display = ( is_email( $phpbbUAVA ) !== false ) ? get_avatar($phpbbUAVA, $w3all_last_t_avatar_dim) : '<img alt="" src="'.$phpbbUAVA.'" class="avatar" width="'.$w3all_last_t_avatar_dim.'" height="'.$w3all_last_t_avatar_dim.'">';
change into:

Code: Select all

      if(is_email( $phpbbUAVA )){
      	$w3all_avatar_display = get_avatar($phpbbUAVA, $w3all_last_t_avatar_dim);
      } elseif(!empty($phpbbUAVA)){
      	$w3all_avatar_display = '<img alt="" src="'.$phpbbUAVA.'" class="avatar" width="'.$w3all_last_t_avatar_dim.'" height="'.$w3all_last_t_avatar_dim.'">';
      } else {
      	$w3all_avatar_display = get_avatar(0, $w3all_last_t_avatar_dim);
       }
then search for

Code: Select all

$countn++;
change into:

Code: Select all

  $phpbbUAVA = '';
  $countn++;

or download the ready and updated file on repo:

https://plugins.trac.wordpress.org/expo ... topics.php
and substitute it into folder:
/wp-content/plugins/wp-w3all-phpbb-integration/views/phpbb_last_topics.php

Result: if an user is not existent into wordpress, and own an avatar in phpBB his phpBB avatar will display.
If the user exist in WP and own an avatar, the avatar will display.
It the user do not own any avatar that can display, both in wp and phpBB, then the dafault WP gravatar, based on WP Settings -> Discussion -> Gravatar will display for the user.