listing members
-
Hi there
is there a way of listing members on a certain pages of my wordpress site under different headings. One heading would be venue, the other dj, and the other would be promoters.
Thank you in advance
-
You can do this by writing your own custom profile loops: https://codex.buddypress.org/developer-docs/custom-buddypress-loops/the-members-loop/
You could incorporate a search term to filter each loop, but I suspect you are better to have a field in the profile for venues, djs and promoters, and query that field during the loop.
For each type of member, it might be an idea to have different profile field groups, and hide them when they are not appropriate.
okay i think i’ve figured a part of this out. The plugin ‘Members List@ by TernStyle http://www.ternstyle.us will allow you to list members. No i have to figure out how i can filter this list.
The code is:
‘members(array(‘search’=>true,’pagination’=>true,’sort’=>true));?> ‘
so i think i should be able to put something in there. Any help would be much appriciated!Thank you Roger!! Your a star! I will try this out now.
so i pasted code from webpage you recommended into members.php file which i am using as a template for one of the pages (promoters). i put a field in the profile of two of the members called business type, and gave each member a different business type – dj and venue. Then added this code “ to the code in members.php where it said to but… nothing has changed… any ideas where i have gone wrong.
Thank you!Hi there
I’m still looking for some help with listing members based on certain perameters. Can anyone help me please. Thank youbp_member_profile_data will echo out as the example in the file shows to get a field you would do:
bp_member_profile_data( ‘field=business type’)
if I wanted to see what a particular member had for that field then I might use:
bp_get_member_profile_data() and do something like:`$member_business_type = bp_get_member_profile_data(‘field=business type’);`
`if ( $member_business_type == ‘dj’ ) :
do stuff here;
endif;`Not sure how you might apply that to your requirements but it will get you further along; also there may well be a better approach than I have outlined.
thankyou Hnla I’ll give it a go! Cheers
Hi Hnla
I gave it a go but the members list just disapears now.
This is what i typed in:`
<?php if ($member_business_type == 'dj'):
do stuff here;
endif ; ?>`Did i type it in wrong?
CheersNo that looks as though you typed it correctly, so not sure why it would cause issues, it works for me, try though outputting real data, to test just echo $member_business_type in place of that bear text as it would cause script issues.
sorry hnla didn’t mean to cause any trouble by posting in another thread. I thought the two issues were slightly different. 1) to do with member directory and 2) to do with listing particular members on a certian wordpress page – not members page. will try above. Thank you.
Maybe I missed the difference seemed to me we were still essentially discussing the same issue, but I may well have been wrong, if that’s the case let me know and I’ll reopen that other thread.
The members list might be disappearing now because you have “do stuff here”, which is not valid PHP. Try this:
`<a href="”>
`
Hi Hnla, thankyou for your reply.
With regards to the other thread i think that is solved now thankyou. Still having a few problems with the issue on this thread. I’m putting in the code you gave me in every place i can think of but still no luck. I hope it’s ok if i explain what i have done here and you can see if i’ve missed anything. Thank you in advance.
I have a members page on my wordpress/buddypress site – all working wonderfully. I have set up 3 other pages in wordpress which i want to show only specific members on. These pages are called DJs, Venues and Promoters. Each member when registering has to fill out the field of Business type. There are 3 business types – djs, venues and promoters. I want all the members who put in DJ on business type to show on the DJ page, the members who put venue as business type to go on the venue page etc.
So far i have 3 template .php files for each of the 3 pages. The code on the template pages is the same as the members.php file with the exeption of the directory name and the “ code. The loop directory here varies for each page.
With each of the loop directories i have copied the members-loop.php file and all i want to do is make each directory show its specific members. I’ve tried so hard to put in your code above into each of the respecitive loop directories but i’m obvoiusly missing something. Can you tell me where exactly i should be putting the code in each of these loop directories.
Many thanks!Try this:
` if( bp_get_member_profile_data( ‘field=busines type’ ) == ‘dj’) : `
place it after the while loop on a members page and use it to wrap the looped member li elements. it tested as working on a version I ran up quickly but that’s no guarantee
Wow you are so amazing!!! I can’t thank you enough! You are my star!!!! I am so so so so so so happy!!!!
I’m guessing that worked then ?
Had meant to add that it was tested setting a series of radio buttons and is why I had to change things around in that fashion. as field = the three radio options but also the parent radio as well
it worked wonderfully! thank you ever so much!
- The topic ‘listing members’ is closed to new replies.