Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 03-21-2011, 11:42 PM
AFemaleProdigy's Avatar
AFemaleProdigy AFemaleProdigy is offline
 
Join Date: Mar 2006
Location: Murrells Inlet, SC
Posts: 216
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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!
Reply With Quote
  #2  
Old 03-21-2011, 11:51 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #3  
Old 03-22-2011, 02:23 AM
AFemaleProdigy's Avatar
AFemaleProdigy AFemaleProdigy is offline
 
Join Date: Mar 2006
Location: Murrells Inlet, SC
Posts: 216
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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]">
I just tried this too and it seems to hide all users (not show any)...

Code:
<vb:if condition="is_member_of($bbuserinfo, 10)">
I am wondering if I am using the correct type of conditional statement? Just to clarify...

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.
Reply With Quote
  #4  
Old 03-22-2011, 03:22 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #5  
Old 03-22-2011, 03:36 AM
AFemaleProdigy's Avatar
AFemaleProdigy AFemaleProdigy is offline
 
Join Date: Mar 2006
Location: Murrells Inlet, SC
Posts: 216
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Woohoo!! Ok so I finally got a bit farther. This works...

Code:
<vb:if condition="in_array($userinfo[usergroupid],array(10))">
However, it isn't applying that filter to the pagination function. So it's showing the same number of pages as the default memberlist (so too many pages), but has stripped out all other usergroups. How can I apply this so the pagination shows correctly?

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}
Reply With Quote
  #6  
Old 03-22-2011, 04:21 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Look at the query that defines the pagination and modify it for your own needs.
Reply With Quote
  #7  
Old 03-23-2011, 01:20 AM
AFemaleProdigy's Avatar
AFemaleProdigy AFemaleProdigy is offline
 
Join Date: Mar 2006
Location: Murrells Inlet, SC
Posts: 216
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #8  
Old 03-23-2011, 02:59 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #9  
Old 03-23-2011, 03:21 AM
AFemaleProdigy's Avatar
AFemaleProdigy AFemaleProdigy is offline
 
Join Date: Mar 2006
Location: Murrells Inlet, SC
Posts: 216
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #10  
Old 03-23-2011, 03:28 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:31 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05646 seconds
  • Memory Usage 2,259KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (7)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete