PDA

View Full Version : Order results by VIP Members first


KimK
02-02-2013, 12:03 AM
Hello.

I want to add an option to the order results combo box so the user can order the search results by VIP members (which the group ID for them = 10) and that's mean the VIP members appear first in the search results page before the other members in the other groups.

Thanks.

--------------- Added 1359814388 at 1359814388 ---------------

Does anyone know how to do this?

LifesGreatestGift
02-05-2013, 03:45 AM
Only put vip posts at the top if it is the thread starter post? (post 1)

KimK
02-06-2013, 01:00 PM
I would like the featured members to show up first on the the member search results, maybe highlighted in a different color in the result indicated as a featured member.
http://www.agentlinkus.com/memberlist.php?do=search
and the members list page:
http://www.agentlinkus.com/members/list/

Thanks

LifesGreatestGift
02-07-2013, 02:35 AM
Open template memberlist

Find
<vb:each from="memberlistbits" value="userinfo">
<tr>
<td class="alt1 username">

Replace With:
<vb:each from="memberlistbits" value="userinfo">
<tr<vb:if condition="is_member_of($userinfo, 6)"> style="background:red;"</vb:if>>
<td class="alt1 username"<vb:if condition="is_member_of($userinfo, 6)"> style="background:red;"</vb:if>>

Enter your usergroup ID in the is_member_of function. It is currently set for usergroup 6. you can add additional groups separated by commas. Also change the style="background:red;" to what suites you.

KimK
02-07-2013, 10:09 AM
Thank you so much LifesGreatestGift but how can I get the featured members to show up first on the the member list page?

LifesGreatestGift
02-07-2013, 12:21 PM
you would probably need to look into the queries that memberlist.php makes

KimK
02-07-2013, 12:58 PM
I don't know anything about the queries in the memberlist.php. Can you help me?

LifesGreatestGift
02-07-2013, 02:50 PM
Create a new plugin

Product: vBulletin
Hook Location: memberlist_fetch
Title: Sort admin first
Code:
$sqlsort = 'user.usergroupid=6';
$sortorder = 'desc';

Where 6 is the group id you want to show first.

KimK
02-11-2013, 08:30 AM
A million billion thanks to you LifesGreatestGift for your help.

Thank you sooooo much :)

KimK
02-16-2013, 06:00 PM
Sorry for disturbing you again. Can I create a featured members widget to include the same VIP group (group id = 10)?

Thanks :)

LifesGreatestGift
02-16-2013, 06:24 PM
what all do you want displayed? Username, register date? etc...

KimK
02-16-2013, 07:12 PM
No, just the username and the avatar for each member.

KimK
03-01-2013, 10:58 PM
I found the solution for how to show random members with picture from specific group.
The following code will allow you to:

1- Show random members which have profile picture from specific group.
2- Clickable picture and username to go to member's profile page.

Installation:

1- Go to Admin CP > vBulletin CMS > Widgets > create new widget.
2- Widget type > PHP Direct Execution . Title > Random Members . Description > Show random members.
3- Click save.
4- Then click configure and put the code below.

Code:



$member_count = 3;
$usergroup_limit = 6;

ob_start();
require_once('./includes/functions_user.php');
require_once('./includes/functions_bigthree.php');
// Get Random Members
$newusers_get = vB::$db->query_read("
SELECT ".TABLE_PREFIX."user.userid AS userid, ".TABLE_PREFIX."user.username AS username, ".TABLE_PREFIX."user.avatarrevision AS avatarrevision, ".TABLE_PREFIX."customavatar.dateline AS dateline FROM ".TABLE_PREFIX."customavatar
LEFT JOIN ".TABLE_PREFIX."user
ON ".TABLE_PREFIX."customavatar.userid=".TABLE_PREFIX."user.userid

WHERE ".TABLE_PREFIX."customavatar.visible = 1 AND ".TABLE_PREFIX."user.usergroupid = $usergroup_limit
ORDER BY RAND()
LIMIT $member_count");
$output_bits = '<p align="center">';
while($newuser = vB::$db->fetch_array($newusers_get))
{
$output_bits .= '<a href="member.php?u='.$newuser[userid].'"><img src="/customavatars/avatar'.$newuser[userid].'_'.$newuser[avatarrevision].'.gif" alt="'.$newuser[username].'"/><br />'.$newuser[username].'</a><br />';
}
$output_bits .= '</p>';
$output = $output_bits;
ob_end_clean();




Note: You can edit the amount of members you want to show by changing the $member_count from 3 to whatever value you want. Also you can change the usergroup_limit number to match the usergroup you want to display. 6 for example is Administrators.

Reference: https://vborg.vbsupport.ru/showthread.php?t=235460

Finally: Share what you know, learn what you don't.

Thanks

daniel_pet
04-10-2013, 07:34 AM
I found the solution for how to show random members with picture from specific group.
The following code will allow you to:

1- Show random members which have profile picture from specific group.
2- Clickable picture and username to go to member's profile page.

Installation:

1- Go to Admin CP > vBulletin CMS > Widgets > create new widget.
2- Widget type > PHP Direct Execution . Title > Random Members . Description > Show random members.
3- Click save.
4- Then click configure and put the code below.

Code:



$member_count = 3;
$usergroup_limit = 6;

ob_start();
require_once('./includes/functions_user.php');
require_once('./includes/functions_bigthree.php');
// Get Random Members
$newusers_get = vB::$db->query_read("
SELECT ".TABLE_PREFIX."user.userid AS userid, ".TABLE_PREFIX."user.username AS username, ".TABLE_PREFIX."user.avatarrevision AS avatarrevision, ".TABLE_PREFIX."customavatar.dateline AS dateline FROM ".TABLE_PREFIX."customavatar
LEFT JOIN ".TABLE_PREFIX."user
ON ".TABLE_PREFIX."customavatar.userid=".TABLE_PREFIX."user.userid

WHERE ".TABLE_PREFIX."customavatar.visible = 1 AND ".TABLE_PREFIX."user.usergroupid = $usergroup_limit
ORDER BY RAND()
LIMIT $member_count");
$output_bits = '<p align="center">';
while($newuser = vB::$db->fetch_array($newusers_get))
{
$output_bits .= '<a href="member.php?u='.$newuser[userid].'"><img src="/customavatars/avatar'.$newuser[userid].'_'.$newuser[avatarrevision].'.gif" alt="'.$newuser[username].'"/><br />'.$newuser[username].'</a><br />';
}
$output_bits .= '</p>';
$output = $output_bits;
ob_end_clean();




Note: You can edit the amount of members you want to show by changing the $member_count from 3 to whatever value you want. Also you can change the usergroup_limit number to match the usergroup you want to display. 6 for example is Administrators.

Reference: https://vborg.vbsupport.ru/showthread.php?t=235460

Finally: Share what you know, learn what you don't.

Thanks

Please help me to get with this script and user custom fields, like location, Biography, etc..
Thanks in advance.