WP_w3all phpBB wordpress: not linked users mode or (still not) not added phpBB user in WP and avatars problem
Posted: 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:
there is this code:
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:
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:
immediately after, this should be added:
and where:
immediately after add:
then where:
should be changed in:
If nothing wrong should work on any situation now but i've still not test on all configuration, so appreciated any possible report.
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()
Code: Select all
if($usid):
$wp_user_phpbb_avatar[] = array("wpuid" => $usid->ID, "phpbbavaurl" => $ava_set_x['uavaurl'], "phpbbuid" => 0);
endif;
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;
(so these changes needs to be applied on each views/ folder files that display shortcodes etc )
where:
Code: Select all
if(!empty($last_topics)){
Code: Select all
// added
$w3phpbbuava = unserialize(W3ALLPHPBBUAVA);
Code: Select all
$countn = 0;
foreach ($last_topics as $key => $value) {
Code: Select all
// added
if(!empty($w3phpbbuava)){
foreach($w3phpbbuava as $k){
if($k['phpbbuid'] == $value->user_id && $k['phpbbuid'] > 1){
$phpbbUAVA = $k['phpbbavaurl'];
}
}
}
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);
}
}
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);
}
}