WP_w3all phpBB wordpress: not linked users mode or (still not) not added phpBB user in WP and avatars problem

Post a reply


This question is a means of preventing automated form submissions by spambots.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

If you wish to attach one or more files enter the details below.

Maximum filesize per attachment: 1 MiB.

Expand view Topic review: WP_w3all phpBB wordpress: not linked users mode or (still not) not added phpBB user in WP and avatars problem

Re: WP_w3all phpBB wordpress: not linked users mode or (still not) not added phpBB user in WP and avatars problem

by axew3 » Wed Jan 02, 2019 6:06 pm

the above will be now patched, because the code was failing if the user had a gravatar instead then an url,
THEN the above code for:
/wp-content/plugins/wp-w3all-phpbb-integration/views/phpbb_last_topics.php
where this line:

Code: Select all

$w3all_avatar_display = '<img alt="" src="'.$phpbbUAVA.'" class="avatar" width="'.$w3all_last_t_avatar_dim.'" height="'.$w3all_last_t_avatar_dim.'">';
has been changed into:

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.'">';
now seem to work as expected in any case.

WP_w3all phpBB wordpress: not linked users mode or (still not) not added phpBB user in WP and avatars problem

by axew3 » Wed Jan 02, 2019 5:18 pm

On integration plugin WP_w3all phpBB WordPress, at date of this post, the code do not return correct avatars results, if the user that the avatar need to be retrieved for, isn't already also registered member in WordPress, or the plugin run as "No linked users".

To resolve this issue, on file:
/wp-content/plugins/wp-w3all-phpbb-integration/class.wp.w3all-phpbb.php
function:

Code: Select all

wp_w3all_assoc_phpbb_wp_users()
there is this code:

Code: Select all

if($usid):
      	$wp_user_phpbb_avatar[] = array("wpuid" => $usid->ID, "phpbbavaurl" => $ava_set_x['uavaurl'], "phpbbuid" => 0);
      endif;
that lead to fill the array, but only if it is a wp user, and will not be possible to check against nothing to assign after the avatar for a specific post.
Then this may need to be changed into:

Code: Select all

	if($usid):
      	$wp_user_phpbb_avatar[] = array("wpuid" => $usid->ID, "phpbbavaurl" => $ava_set_x['uavaurl'], "phpbbuid" => 0);
      else:
      	$wp_user_phpbb_avatar[] = array("wpuid" => 0, "phpbbavaurl" => $ava_set_x['uavaurl'], "phpbbuid" => $ava_set_x['puid']);
      endif;
Then on /wp-content/plugins/wp-w3all-phpbb-integration/views/phpbb_last_topics.php for example
(so these changes needs to be applied on each views/ folder files that display shortcodes etc )
where:

Code: Select all

if(!empty($last_topics)){
immediately after, this should be added:

Code: Select all

// added	
$w3phpbbuava = unserialize(W3ALLPHPBBUAVA);
and where:

Code: Select all

$countn = 0;
foreach ($last_topics as $key => $value) {
immediately after add:

Code: Select all

// added 
if(!empty($w3phpbbuava)){
	foreach($w3phpbbuava as $k){
		if($k['phpbbuid'] == $value->user_id && $k['phpbbuid'] > 1){
			$phpbbUAVA = $k['phpbbavaurl'];
		}
  }
}
then where:

Code: Select all

   if( ! $wpu ){
			$w3all_avatar_display = get_avatar(0, $w3all_last_t_avatar_dim);
		} else {
     	      $w3all_avatar_display = get_avatar($wpu->ID, $w3all_last_t_avatar_dim);
          }
  } 
should be changed in:

Code: Select all

   if( ! $wpu && isset($phpbbUAVA) ){
             $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.'">';
		} elseif ( ! $wpu && !isset($phpbbUAVA) ) {
     	      $w3all_avatar_display = get_avatar(0, $w3all_last_t_avatar_dim);
          } else {
     	      $w3all_avatar_display = get_avatar($wpu->ID, $w3all_last_t_avatar_dim);
          }
  } 
result_ava1.png
result_ava1.png (26.32 KiB) Viewed 17876 times
If nothing wrong should work on any situation now but i've still not test on all configuration, so appreciated any possible report.

Top