XF 1.5 Find the usergroup of thread starter?


Active member
My goal is to show a message in the thread_view template if the thread starter is part of a certain usergroup. Example: "thread starter is a new user, take caution"

I've come across the ismbemberof function which may be useful, but don't know how to pass {$thread.user_id} and {$thread.username} to the function.
Last edited:

Jeremy P

Well-known member
If $thread contains the full user record, you can just pass it as-is:
{xen:helper ismemberof, $thread, x}


Active member
it must not contain the full user record :(

this returns nothing:

<xen:if is="{xen:helper ismemberof, $thread, 3}">
<p>thread starter is an admin</p>
if I could somehow pass {$thread.user_id} and {$thread.username} to the function, maybe it would work.


Active member
Params of $thread...

array(41) {
  ["thread_id"] => int(3)
  ["node_id"] => int(2)
  ["title"] => string(4) "test"
  ["reply_count"] => int(1)
  ["view_count"] => int(13)
  ["user_id"] => int(1)
  ["username"] => string(6) "sububi"
  ["post_date"] => int(1519550347)
  ["sticky"] => int(0)
  ["discussion_state"] => string(7) "visible"
  ["discussion_open"] => int(1)
  ["discussion_type"] => string(0) ""
  ["first_post_id"] => int(3)
  ["first_post_likes"] => int(0)
  ["last_post_date"] => int(1520235187)
  ["last_post_id"] => int(6)
  ["last_post_user_id"] => int(1)
  ["last_post_username"] => string(6) "sububi"
  ["prefix_id"] => int(0)
  ["tags"] => string(6) "a:0:{}"
  ["gender"] => string(0) ""
  ["avatar_date"] => int(0)
  ["gravatar"] => string(0) ""
  ["thread_read_date"] => int(1520235187)
  ["thread_reply_banned"] => int(0)
  ["thread_is_watched"] => string(1) "0"
  ["draft_message"] => NULL
  ["draft_extra"] => NULL
  ["canInlineMod"] => bool(true)
  ["canEditThread"] => bool(true)
  ["isNew"] => bool(false)
  ["haveReadData"] => bool(false)
  ["hasPreview"] => bool(true)
  ["canViewContent"] => bool(true)
  ["isRedirect"] => bool(false)
  ["isDeleted"] => bool(false)
  ["isModerated"] => bool(false)
  ["titleCensored"] => bool(true)
  ["lastPageNumbers"] => bool(false)
  ["lastPostInfo"] => array(5) {
    ["post_date"] => int(1520235187)
    ["post_id"] => int(6)
    ["user_id"] => int(1)
    ["username"] => string(6) "sububi"
    ["isIgnoring"] => bool(false)
  ["tagsList"] => array(0) {
ismemberof needs user_id (int) and username (string) and $thread has both of those, so not sure why it's not working.


Well-known member
Try with $firstPost
<xen:if is="{xen:helper ismemberof, $firstPost, 3}">
<p>thread starter is an admin</p>