The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
help with custom memberlist please
I am creating custom memberlist pages and could use some help. I was familiar with the old vB code prior to the publishing suite, but things are different now.
I want to create a custom member list that will show members from a specific usergroup ID only. Then I want to specify which custom profile fields will be displayed (different from the default memberlist display). So, I need to know the code to call users of usergroup ID "x" and load custom profile fields by specific ID "x,y,z". I don't need all of the code for the memberlist template. Just the bits that I need to add or edit to make the content more specific. Thanks for the help! |
#2
|
||||
|
||||
All of that should be the same as when you used vB3 - the php didn't change, it's the template calls and template syntax that changed. is_member_of is still the function to use to find if a user is a member of a usergroup and profile fields are still called by $variable['fieldx'] just like before.
|
#3
|
||||
|
||||
Thanks Lynn!
I got the custom field part down ok. But am having an issue displaying members of a specific usergroup. I have tried the following, but I get an error in admin cp... Code:
<if condition="is_member_of($post, 10)"> Code:
<vb:if condition="is_member_of[$post, 10]"> Code:
<vb:if condition="is_member_of($bbuserinfo, 10)"> I am not trying to show items TO a specific usergroup. I am trying to show a memberlist OF members FROM a specific usergroup. Just wanted to say that in case there was any confusion. |
#4
|
||||
|
||||
Look in the template - what is the variable being used for the users? It's isn't $post (that is in the postbit templates) and it isn't $bbuserinfo (that is you, the viewer), but it will be another variable ($userinfo? I can't remember) and that is the one you want to use.
|
#5
|
||||
|
||||
Woohoo!! Ok so I finally got a bit farther. This works...
Code:
<vb:if condition="in_array($userinfo[usergroupid],array(10))"> So, the usergroupid filter I am trying to apply is not applying to this and I am not sure how best to apply that... Code:
{vb:raw letterbits} Code:
{vb:raw pagenav} |
#6
|
||||
|
||||
Look at the query that defines the pagination and modify it for your own needs.
|
#7
|
||||
|
||||
Any suggestions how to get the memberlist to display these users correctly? It is only showing the users from the usergroup I specified, but the page numbers and layout look like it's still counting the other members from the other groups as well.
I don't know if you would want to look at it or not as it's an adult oriented site with some nudity. |
#8
|
||||
|
||||
It's in your code somewhere - not anything I would see on your site. In the 'real' memberslist.php file, there is a query just to get the userscount which is then used for pagination. If your page is modeled after that page, then it's that query that you need to modify.
|
#9
|
||||
|
||||
I'm guessing that would be this bit of code? Any suggestions as to how I might modify it?
Code:
($hook = vBulletinHook::fetch_hook('memberlist_query_userscount')) ? eval($hook) : false; $userscount = $db->query_first_slave(" SELECT COUNT(*) AS users FROM " . TABLE_PREFIX . "user AS user " . ($include_userfield_join ? "LEFT JOIN " . TABLE_PREFIX . "userfield AS userfield USING (userid)" : '') . " $hook_query_joins WHERE $condition AND (user.usergroupid IN ($ids)" . (defined('MEMBERLIST_INCLUDE_SECONDARY') ? (" OR FIND_IN_SET(" . implode(', user.membergroupids) OR FIND_IN_SET(', $idarray) . ", user.membergroupids)") : '') . ") $hook_query_where "); $totalusers = $userscount['users']; if (!$totalusers) { eval(standard_error(fetch_error('searchnoresults', $displayCommon))); } PS... thanks so much for all your help by the way! I really appreciate it. I'm still learning PHP. I'm actually going back to college the 28th to learn PHP more in depth. |
#10
|
||||
|
||||
You will want to modify the line regarding the where users are in usergroup $ids (etc). Didn't you do the same thing in the main query which has the exact same part in the where statement?
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|