Click anywhere to close this dialog

Farewell

Great is the art of beginning, but greater is the art of ending
Henry Wadsworth Longfellow

I announce that I cease all development and activity in the programming universe indefinitely. My career has reached the turning point I was not expecting for at least another year, leaving me highly off guard and without laid-out plans for this hobby's continuity. I have begun a 5-year residency program in Neurosurgery which is clearly not compatible, time-wise, with programming.

I gave in all my passion for developing, and you gave me back your loyalty and trust, even when I did not deserve that much. Now it is the time for payback. I release all my present and past work as Open Source software, in the hope some talented developer will continue maintaining and expanding my vision of a modern, sleek forum software. The intrinsic flexibility of MyBB is the true hidden gem of an otherwise outdated codebase; I do hope the project can continue and be updated complying to the latest coding standards.

I hereby thank Euan, kawaii, andrewjs18, Ben, Matt, Omar G., effone, Eric J., Devilshakerz, Wildcard, JordanMussi and all the other team members I have had the opportunity to work with when I was a MyBB team member. I thank Tomm M, my mentor, who inspired me to pick up coding with his piece-of-art plugins. And finally, I thank all of you MyBBoost subscribers who have helped me getting through my toughest university years economically.

Yours sincerely, Filippo

Show hovercard with "last poster avatar" plugin

2 Jan 2019
#1
This issue is marked as solved
Hi,
First of all a big thank you for this fantastic plugin. I should have it tried earlier!

It works very well on my installation. Just one thing I would like to get done.
I am using the plugin last poster avatar from whiteneo.
It would be great if the card appears when hovering over the plugins avatar.

I am not sure how to achieve this. The variable for the avatar with this plugin is:
{$thread['avatarep']}

The default variable is:
{$thread['profilelink']}

Currently the hovercard only shows with the default variable.
Is there a way to modify hovercard so that it is triggered as well with the other variable?

Thanks for any pointer!

Best answer

Shade 24 Jan 2019
Here are the culprits:
1) disable "Modal box Popup" settings from Avatarep settings;

2) inc/plugins/avatarep.php, line 726, find:
$user['avatar'] = '<div class="avatarep_fd">' $user['avatar'] . '</div>'
Replace with:
$user['avatar'] = "<a data-uid='{$user['uid']}' href='{$avatar['profilelink']}'>" $user['avatar'] . '</a>'
3) inc/plugins/avatarep.php, lines 704-706, find:
}else{
    
$user['avatar'] = "<a href=\""$avatar['profilelink'] . "\" title=\"".$user['avatarep_title']."\">".$user['avatar']."</a>";

Replace with:

Basically the last step is just a removal of everything after "else".

All replies

Shade 2 Jan 2019
#2
Hello, thank you for supporting me by buying Hovercards. As stated in the release thread, cards are triggered by links with the data-uid attribute. The uid is a unique identifier which MyBB uses to recognize users across the board. Therefore, all third party plugins are compatible with Hovercards as long as you perform the necessary edits: in your case, you should wrap the last poster avatar variable into a HTML "a" element with the data-uid attribute. Example:

<a data-uid="{$thread['lastposteruid']}">{$thread['avatarep']}</a>
Note that I don't know how does the plugin work, so I just suppose the avatar is evaluated within the avatarep key. Adjust as needed. If you need further help, feel free to ask.
stefan72 likes this post
stefan72 2 Jan 2019
#3
Thanks for the prompt and useful suggestion. Tried a few ways to wrap an "a" element but was not successful.
The code that renders the avatar of the thread starter (viewing the list of threads)  is:
<avatarep_uid_[{$thread['uid']}]>{$thread['avatarep']}
Tried with this but it's not working, probably because data-uid and avatar_uid "collision"?
<a data-uid="{$thread['uid']}"><avatarep_uid_[{$thread['uid']}]>{$thread['avatarep']}</a>
Many thanks for your support.
Shade 3 Jan 2019
#4
I will have a look to the plugin and get back at you as soon as possible.
Shade 3 Jan 2019 Edited
#5
The following edit should do the trick. Find in inc/plugins/avatarep.php, line 723:

$user['avatar'] = '<div class="avatarep_fd">' $user['avatar'] . '</div>'
Replace with:

$user['avatar'] = "<a data-uid='{$user['uid']}'>{$user['avatar']}</a>"
The edit is necessary for this plugin since the avatar is wrapped in an hardcoded "div", which can't semantically be inside an "a" element. AFAIK, LPA adds its own profile popup, which is removed by the edit.
stefan72 3 Jan 2019
#6
Thank you for checking about it on the LPA plugin. This feature seems to be a tricky one ;)
I've replaced the code as shown above and used
<a data-uid="{$thread['lastposteruid']}">{$thread['avatarep']}</a>
to call the hovercard. Tried also
<a data-uid="{$thread['uid']}">{$thread['avatarep']}</a>
But something is still not right. Sorry if I use your time with this! After all it is somewhat cosmetic. If it would work, I could remove the username and just display the avatar. It would make the forum a bit less cluttered.
Shade 3 Jan 2019
#7
Ah sorry, forgot to mention that you don’t need to alter the template if you have applied the edit. So just {$thread[‘avatarep’]} should suffice.
stefan72 4 Jan 2019
#8
Thanks Shade,
With the fix in avatarep.php applied, and original code <avatarep_uid_[{$thread['uid']}]>{$thread['avatarep']} the avatar is rendered, but no hovercard.
With only, {$thread['avatarep']} the avatar is not shown.
The full line of code as it stands now looks like this:
<span>{$prefix} {$gotounread}{$thread['threadprefix']}<span class="{$inline_edit_class} {$new_class}" id="tid_{$inline_edit_tid}"><avatarep_uid_[{$thread['uid']}]>{$thread['avatarep']}<a href="{$thread['threadlink']}">{$attachment_count} {$thread['subject']}</a></span>{$thread['multipage']}</span>
Perhaps this holds the key to the solution?
Shade 5 Jan 2019
#9
I’ll install the plugin on a test board and let you know ASAP.
stefan72 5 Jan 2019 Edited
#10
The modified avatarep.php actually produces in MyBB admin the following error when cklicking on "Plugins":
Fatal error: Cannot redeclare avatarep_info() (previously declared in /kunden/xyz/hosting/9999/2345/magento_staging/forum/inc/plugins/avatarep.php:66) in/kunden/xyz/hosting/9999/2345/magento_staging/forum/inc/plugins/orig_avatarep.php on line 93