[XFA] Custom Username Icons

[XFA] Custom Username Icons [Paid] 3.6.1

No permission to buy (€4.00)
I'm not sure where the changes take place in this add-on, but the last post info that you're referring to in my add-on is handled in the tv_node_forum_level_2 template (at the end of the template).

HTML:
                <span class="lastThreadMeta">
                    <span class="lastThreadUser"><xen:if is="{xen:helper isIgnored, $forum.last_post_user_id}">{xen:phrase ignored_member}<xen:else /><xen:username user="$forum.lastPost" /></xen:if>,</span>
                    <xen:datetime time="$forum.lastPost.date" class="muted lastThreadDate" data-latest="{xen:phrase latest}: " />
                </span>

Are these some posts or threads retrieved from database ?

In that case it's because some fields are needed along with the post from the user table, which are :
  • xfa_cui_type
  • xfa_cui_params
  • display_style_group_id
 
Are these some posts or threads retrieved from database ?

In that case it's because some fields are needed along with the post from the user table, which are :
  • xfa_cui_type
  • xfa_cui_params
  • display_style_group_id
Nothing special is happening when the forums are retrieved to be displayed other than a join to one of my tables and a change in the template used.

Without knowing how your add-on displays the icons, I would have to say that should be something handled either by a join to the forum model or the user table on your end.

The <xen:username user="$forum.lastPost" /> is a built in function from XenForo and that info comes from this array in the $forum variable sent to the template (it exists in all forums, not just ones from the TV add-on)..
Code:
["lastPost"] => array(5) {
    ["post_id"] => int(1520)
    ["date"] => int(1426182353)
    ["user_id"] => int(1)
    ["username"] => string(4) "Snog"
    ["title"] => string(32) "Selfie: S01E02 - Un-Tag My Heart"
  }

Is it possible you're already doing that, but because it's a custom template the changes aren't being added properly?

If it's a case of a template modification, @Gemma is quite capable of doing that. ;)
 
Last edited:
I've looked at the info being returned and it's got me baffled. I've removed some unimportant parts of the info to keep it short. The wrong icon is being returned at the node level (this should be fa-anchor, not fa-adjust)...

Code:
array(84) {
  ["node_id"] => int(334)
  ["title"] => string(21) "How I Met Your Mother"
.....
  ["discussion_count"] => int(2)
  ["message_count"] => int(7)
  ["last_post_id"] => int(2064)
  ["last_post_date"] => int(1453235882)
  ["last_post_user_id"] => int(11)
  ["last_post_username"] => string(5) "NHawk"
  ["last_thread_title"] => string(43) "How I Met Your Mother: S08E02 - The Pre-Nup"
  ["moderate_replies"] => int(0)
  ["allow_posting"] => int(1)
  ["count_messages"] => int(1)
  ["find_new"] => int(1)
  ["prefix_cache"] => string(0) ""
  ["default_prefix_id"] => int(0)
  ["default_sort_order"] => string(14) "last_post_date"
  ["default_sort_direction"] => string(4) "desc"
  ["require_prefix"] => int(0)
  ["allowed_watch_notifications"] => string(3) "all"
.....
  ["xfa_cui_type"] => NULL
  ["xfa_cui_params"] => NULL
  ["display_style_group_id"] => NULL
  ["hasNew"] => bool(true)
  ["prefixCache"] => array(0) {
  }
  ["privateInfo"] => bool(false)
  ["childCount"] => int(8)
  ["lastPost"] => array(8) {
     ["post_id"] => int(2064)
     ["date"] => int(1453235882)
     ["user_id"] => int(11)
     ["username"] => string(5) "NHawk"
     ["title"] => string(43) "How I Met Your Mother: S08E02 - The Pre-Nup"
     ["xfa_cui_type"] => int(0)
     ["xfa_cui_params"] => string(149) "a:6:{s:4:"icon";s:9:"fa-adjust";s:5:"color";s:0:"";s:9:"transform";s:0:"";s:7:"animate";s:0:"";s:11:"uname_color";s:0:"";s:12:"utitle_color";s:0:"";}"
     ["display_style_group_id"] => int(3)
  }
 
What is the join you are having for the lastPost user join ?
I don't join lastPost at all from my add-on. And I don't join the user table at all. The info returned for lastPost is directly from XF.
 
If it helps, the forum in question is in this level...

Entertainment (category)
--- TV Favorites (category)
------ Cartoons (category)
------ How I Met Your Mother (forum)
---------- Season Sub-Forum
---------- Season Sub-Forum
---------- Several more Sub-Forums

Note that I THINK the icon being returned is for the last post in the Cartoons category which is on the same level as the 'How I Met Your Mother' forum.
 
Last edited:
FYI, I disabled all add-ons except this one on my development server (yes I purchased this add-on) and the incorrect icons are still shown. So, it is a problem with this add-on, not one of mine. It seems it doesn't go into the deeper category/forum levels to get the icon. ;)
 
I dug into this a little deeper and what I found is I think your add-on is taking the info for the last item posted in the last sub-forum listed...

Dump from your XFA_CustomUsernameIcons_NodeHandler_Forum routines...
Code:
Array
(
    [discussion_count] => 1
    [message_count] => 1
    [hasNew] => 1
    [privateInfo] =>
    [childCount] => 0
    [last_post_id] => 2064
    [last_post_date] => 1453235882
    [last_post_user_id] => 11
    [last_post_username] => NHawk
    [last_thread_title] => How I Met Your Mother: S08E02 - The Pre-Nup
    [lastPost] => Array
        (
            [post_id] => 2064
            [date] => 1453235882
            [user_id] => 11
            [username] => NHawk
            [title] => How I Met Your Mother: S08E02 - The Pre-Nup
            [xfa_cui_type] => 0
            [xfa_cui_params] => a:6:{s:4:"icon";s:9:"fa-anchor";s:5:"color";s:0:"";s:9:"transform";s:0:"";s:7:"animate";s:0:"";s:11:"uname_color";s:0:"";s:12:"utitle_color";s:0:"";}
            [display_style_group_id] => 2
        )
)
Array
(
    [discussion_count] => 1
    [message_count] => 6
    [hasNew] => 1
    [privateInfo] =>
    [childCount] => 0
    [last_post_id] => 1452
    [last_post_date] => 1422881612
    [last_post_user_id] => 1
    [last_post_username] => Snog
    [last_thread_title] => How I Met Your Mother: S02E01 - Where Were We?
    [lastPost] => Array
        (
            [post_id] => 1452
            [date] => 1422881612
            [user_id] => 1
            [username] => Snog
            [title] => How I Met Your Mother: S02E01 - Where Were We?
            [xfa_cui_type] => 0
            [xfa_cui_params] => a:6:{s:4:"icon";s:6:"fa-adn";s:5:"color";s:0:"";s:9:"transform";s:0:"";s:7:"animate";s:0:"";s:11:"uname_color";s:0:"";s:12:"utitle_color";s:0:"";}
            [display_style_group_id] => 3
        )
)

Note the correct icon in the first forum listed, but the icon from the second forum listed is being used. The first forum listed would be the correct one in this case because it is in fact the newest post.

I could be wrong but I'm just trying to help.
 
The node data is indeed handled in the NodeHandler you pointed out.
This function is called for the forum lists generation through the tree behind the getNodeDataForListDisplay method of the Node model called from the public controller.
This method ensures that all data retrieved at the top level forum is indeed the one corresponding to the username.

How do you get those items displayed above the forums list ?
 
No no, I mean the blocks corresponding to your addon stuff on forumhome.
That's irrelevant. The problem exists with or without other add-ons running.

There is a problem with the drilldown somewhere. The proper info is not being returned in $pushable for categories.
Code:
Array
(
    [discussion_count] => 7
    [message_count] => 13
    [hasNew] => 1
    [privateInfo] =>
    [childCount] => 45
    [last_post_id] => 2064
    [last_post_date] => 1453235882
    [last_post_user_id] => 11
    [last_post_username] => NHawk
    [last_thread_title] => How I Met Your Mother: S08E02 - The Pre-Nup
    [lastPost] => Array
        (
            [post_id] => 2064
            [date] => 1453235882
            [user_id] => 11
            [username] => NHawk
            [title] => How I Met Your Mother: S08E02 - The Pre-Nup
            [xfa_cui_type] => 0
            [xfa_cui_params] => a:6:{s:4:"icon";s:6:"fa-adn";s:5:"color";s:0:"";s:9:"transform";s:0:"";s:7:"animate";s:0:"";s:11:"uname_color";s:0:"";s:12:"utitle_color";s:0:"";}
            [display_style_group_id] => 3
        )
)

Screenshots without any other add-ons running...

Incorrect icon (main forum page)...
wrong1.webp

Incorrect icon (category page)...
wrong2.webp

Correct icon (forum with subforums)...
correct.webp
 
Last edited:
You have the options "Show icon for forum last post" and "Show icon for thread last post" set ?
 
You have the options "Show icon for forum last post" and "Show icon for thread last post" set ?
Yes.

FYI, I'm running through everything from my add-ons just to be certain they are somehow affecting this even if they are disabled. If I find anything, I'll let you know.
 
Taking this to a PC.
Noo. I followed this thriller with excitement and now I don't get to know the ending! Even though I'm not a developer, it was interesting to see you work this out.

(I'm serious too).
 
Noo. I followed this thriller with excitement and now I don't get to know the ending! Even though I'm not a developer, it was interesting to see you work this out.

(I'm serious too).
LOL, the PC was basically a detailed post on how to duplicate what I'm seeing. Somewhere along the line, the icon is being switched and I can't find the exact point it changes. I suspect it's in XF itself. But I don't want to post details without confirmation.
 
Top Bottom