Notifications
Clear all

Limited Support

Our support team is currently on holiday from December 25, 2025 to January 7, 2026, and replies may be delayed during this period.

We appreciate your patience and understanding while our team is away. Thank you for being part of the wpForo community!

Merry Christmas and Happy Holidays! 🎄

Script [Solved] How to get the "groupid" of a wpforo user (PHP/HTML)

3 Posts
2 Users
1 Reactions
2,059 Views
Posts: 9
Topic starter
(@forronix)
Active Member
Joined: 7 years ago

Hello all,

I hope my question is in the right place. I am currently programming and am always faced with puzzles.

What do I want to do: Find out the "groupid" of a user.
What do I want it for: We are a gaming community and I want to create an "automated" member overview in the form of a table. Our forum uses different groups to show the affiliation/hierarchy of various members within the community. For each of these "groupid" there is an individual picture. Based on this ID, I would like to load the corresponding image.

Although I am a programmer, my knowledge is limited to LabVIEW and other machines. What I want and how it should work is clear to me, but how to implement it in PHP/HTML is a mystery to me.

For example, I load the displayed user name like this:
$user = get_user_by( 'id', $id );
echo $user->display_name;
($id is a sample variable, as my WIP code is not nice at the moment).

Now I thought a "$user->groupid" can help me as well. Unfortunately this is not the case.

How do I get the groupid?
Is it even called groupid?
And is there a source I can find out myself without having to steal your valuable time on a forum?

Attached are two screenshots to show the object of desire. Sorry it's German.

FYI why "PHP/HTML": The code itself is PHP but creates a table with HTML via "echo".

With kind regards
Forro


Topic Tags
2 Replies
Robert
Posts: 10603
Admin
(@robert)
Support Team
Joined: 10 years ago

Hi @forronix,

Current login user GroupID:

WPF()->current_user_groupid

 

Groupid by UserID:

wpforo_member($userid, 'groupid');

 

Returns the whole info by userid:

wpforo_member($userid);

 


Posts: 9
Topic starter
(@forronix)
Active Member
Joined: 7 years ago

That was easy.
Works wonderfully! Many thanks.