XF 1.5 Verified Badge next to the nickname. [Help]

rafass

Well-known member
Hello. I want to put a badge next to the nickname. Something like verified accounts in Twitter or FB:

1.gif 2.gif

I've been playing around in message_user_info with the conditional:
Rich (BB code):
<xen:if is="!{$isQuickReply} AND {xen:helper ismemberof, $user, 5}">
<div class="userInfoDot Tooltip" title="{xen:phrase verified}" data-offsetx="-11"></div>
</xen:if>
Where the group of "Verified Members" is the group #5

That's working fine:

4.gif

But:
1.
How can I show the horizontal Tooltip like in member page? (but without that effect):

5.gif

2. How can I keep the badge always next to the username and avoid this jump when the username is long?:

9.gif
--
Appreciate some help with this. :coffee:
 
Last edited:
@Snog: can be easily made available by extending XenForo_DataWriter_Alert and let it store the user group ids. That'll require no additional queries.
That's true, but why modify a table when you don't have to? Extending the function in the model to include the user groups makes more sense to me. But, that's just me. ;)
 
There's already forced redundancy by storing the username in the alert database, so the logical step for me would be to extend the existing forced redundancy to save queries.
 
The XenForo_Model_Alert doesn't allow to join any tables, so unless you want to overwrite the function, I couldn't think of any way to merge the usergroups in without an additional query. :confused:
 
The XenForo_Model_Alert doesn't allow to join any tables, so unless you want to overwrite the function, I couldn't think of any way to merge the usergroups in without an additional query. :confused:
Correct. I believe you would have to replace the _getAlertsFromSource function.
 
Which could lead to potential incompatibilities with other addons that extend this function in whatever way. I'd rather extend a table than risk incompatibilities.
 
The way he was determining if the icon should be shown is by user group membership.

So? I believe most of the times, the user array in the helperUserNameHtml will contains the user_group_id & secondary_group_ids unless you remove them from the array.

And there are tons of resources out there. Are you willing to extend and add the template modifications for them.
 
So? I believe most of the times, the user array in the helperUserNameHtml will contains the user_group_id & secondary_group_ids unless you remove them from the array.
You are correct. But they are not in the alert system, so not available to the helper. The array I showed is the $user array sent by the alert templates.

Code:
Array ( [user_id] => 11 [username] => MTest [gender] => male [gravatar] => [avatar_date] => 1405082762 )

So your options are

1) Add a query for each alert
2) Extend the model
3) Extend the datawriter

2 or 3 would be the logical choices. Which you prefer is up to you.
 
Last edited:
I see, try this way, not sure if it would be the best way.

PHP:
<?php

class ....Model_Alert extends XFCP_...._Model_Alert
{
    protected $alertFromSource = false;

    protected function _getAlertsFromSource($userId, $fetchMode, array $fetchOptions = array())
    {
        $this->alertFromSource = true;

        return parent::_getAlertsFromSource($userId, $fetchMode, $fetchOptions);
    }

    public function limitQueryResults($query, $limit, $offset = 0)
    {
        if ($this->alertFromSource)
        {
            $query = str_replace('user.gravatar,', 'user.gravatar, user.user_group_id, user.secondary_group_ids, ', $query);
        }

        return parent::limitQueryResults($query, $limit, $offset);
    }
 
One addon with this customization is coming.
All Rights Reserved.
It seems abusively a paid addon of this customization has been released by someone else and without ask for permission. not sure if that's fine.
This is very easy to achieve with few template modifications (depends where you want to show the badge) and CSS.
really it doesn't need a specific addon, but if someone want to distribute an addon, should request permission and release it absolutely free.

You're not the first person to think of this idea, and won't be the last.

You can't own something like this and prevent others from creating their own versions of it.
 
That's not mine.
Its on you to choose whether to use it or not. I'm just a user of that add-on, and just gave you its link to see there is such add-on.
If you don't want to pay, just don't do that.
 
Top Bottom