Integrate Hovercards with LightAVATARs

Offline

Admin
#1
Integrate Hovercards with the LightAVATARs plugin by Niespecjalny
  •  Deactivate & Uninstall the plugin.
  • We need to add the data-uid="id" to the links that the plugin generates. To do this, open lightavatars.php from your plugins directory and find the following(Around Line 362):
Code:
$avatargen='<a href="'.$mybb->settings['bburl'].'/'.get_profile_link($key).'" title="'.$avatar['name'].'" rel="nofollow"><img src="'.$avatar['avatar'].'" alt="'.$mybb->settings['bbname'].'" onError="this.src=\''.$mybb->settings['bburl'].'/'.$mybb->settings['useravatar'].'\';"></a>';
Replace that with:
Code:
$avatargen='<a data-uid="'.$avatar['uid'].'" href="'.$mybb->settings['bburl'].'/'.get_profile_link($key).'" title="'.$avatar['name'].'" rel="nofollow"><img src="'.$avatar['avatar'].'" alt="'.$mybb->settings['bbname'].'" onError="this.src=\''.$mybb->settings['bburl'].'/'.$mybb->settings['useravatar'].'\';"></a>';
  • Now we need to add the ability to get just the UID. Find(Around Line 350): 
Code:
$info[$base['uid']]['name']=$base['username'];
Add below it:
Code:
$info[$base['uid']]['uid']=$base['uid'];
  • Re-upload lightavatars.php, Install & Activate the plugin, and let the magic happen! This works all across your board, index, forumdisplay & search results.
  • Example: 
[Image: 4GC5auT.png]


Extra: Hovercards on Postbit Avatar.
  • Go to postbit_avatar template,  add to the link 
Code:
data-uid="{$post['uid']}"
  • Should look something like this:
Code:
<div class="author_avatar"><a data-uid="{$post['uid']}" href="{$post['profilelink_plain']}"><img src="{$useravatar['image']}" alt="" {$useravatar['width_height']} /></a></div>
  • Save




Users browsing this thread: 1 Guest(s)