Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Widget - Show random members with picture Details »»
Widget - Show random members with picture
Version: 1.01, by slumbermann slumbermann is offline
Developer Last Online: Jun 2010 Show Printable Version Email this Page

Category: vBulletin CMS Widgets - Version: 4.0.1 Rating:
Released: 02-09-2010 Last Update: Never Installs: 106
Auto-Templates
Re-useable Code Translations  
No support by the author.

#Function:
  • Show random members which have profile picture
  • 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 to use custom profile picture as the source of picture

Code:
$member_count = 3;

  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."customprofilepic.dateline AS dateline FROM ".TABLE_PREFIX."customprofilepic
	LEFT JOIN ".TABLE_PREFIX."user
			ON ".TABLE_PREFIX."customprofilepic.userid=".TABLE_PREFIX."user.userid
    WHERE ".TABLE_PREFIX."customprofilepic.visible = 1
   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="image.php?u='.$newuser[userid].'&dateline='.$newuser[dateline].'&type=profile" alt="'.$newuser[username].'"/><br />'.$newuser[username].'</a><br />';
  }
  $output_bits .= '</p>';
  $output = $output_bits;
  ob_end_clean();
#code if you want to use custom avatar as the main source for the picture

Code:
$member_count = 3;

  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."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
   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="image.php?u='.$newuser[userid].'&dateline='.$newuser[dateline].'" 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.

Screenshots

File Type: jpg random-members.jpg (16.0 KB, 0 views)

Supporters / CoAuthors

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #82  
Old 04-29-2011, 04:43 AM
rob01 rob01 is offline
 
Join Date: Sep 2008
Location: Mexico
Posts: 410
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

is possible to show 3 random users per month?

i mean the same 3 users during a whole month
Reply With Quote
  #83  
Old 05-01-2011, 08:17 PM
jgt58 jgt58 is offline
 
Join Date: May 2010
Posts: 57
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This works on vb 4.1.1 and by the way works as a sideblock when used as php
Reply With Quote
  #84  
Old 05-07-2011, 10:59 AM
Wordplay Wordplay is offline
 
Join Date: Nov 2001
Location: Dengoku
Posts: 864
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@rob just set the cache time to a month (do the math to figure out how many minutes are in 30 days), then clear the cache on the 1st of next month.

i have the same problem as dooch the first user has no link.
Reply With Quote
  #85  
Old 05-17-2011, 09:07 PM
Savage Circuits's Avatar
Savage Circuits Savage Circuits is offline
 
Join Date: Jan 2010
Location: Plumas Lake, CA
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I know this thread is old and all, but for those that were having problems with the first item not being linked I have solved the problem with the help of my Super Moderator on my website. He noticed that the following line was malformed. I am showing the original and the corrected versions in the hope it helps some of you. Take care!

PHP Code:
$output_bits '<p align="center"'
And the corrected version:

PHP Code:
$output_bits '<p align="center">'
Reply With Quote
Благодарность от:
Konsolenheld
  #86  
Old 05-19-2011, 07:40 PM
rob01 rob01 is offline
 
Join Date: Sep 2008
Location: Mexico
Posts: 410
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

avatars dosnt seem to show up, and neither the catch up, also i apply the fix savage mentions.. but still im having the same problem (the first dosnt show up)
Reply With Quote
  #87  
Old 05-23-2011, 05:11 PM
Savage Circuits's Avatar
Savage Circuits Savage Circuits is offline
 
Join Date: Jan 2010
Location: Plumas Lake, CA
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

rob01, your avatars are stored in the DB, yes?
Reply With Quote
  #88  
Old 05-26-2011, 11:59 PM
DNN DNN is offline
 
Join Date: Mar 2011
Posts: 125
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

good stuff, SON!
Reply With Quote
  #89  
Old 05-27-2011, 01:34 PM
dune3000 dune3000 is offline
 
Join Date: Apr 2007
Posts: 48
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I can't get this work. I my widget window I have only this:
Quote:
05-27-2011

Any help please?
Reply With Quote
  #90  
Old 06-08-2011, 07:02 PM
voter's Avatar
voter voter is offline
 
Join Date: Dec 2006
Posts: 192
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by tattooz View Post
Ok, this is for a block in the forum or the CMS widget, assuming that you have avatars set to filesystem, NOT database

Be sure to change the member count to however many you want to show. Also, look down at the bottom of the code where the <img src= tag is and make sure the path to the forums directory is right for your board.

I hope this works for you.

PHP Code:
$member_count 1;

  
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="/forums/customavatars/avatar'.$newuser[userid].'_'.$newuser[avatarrevision].'.gif" alt="'.$newuser[username].'"/ width="125" height="125"><br />'.$newuser[username].'</a><br />';
  }
  
$output_bits .= '</p>';
  
$output $output_bits;
  
ob_end_clean(); 
You forgot to include the line
$usergroup_limit=something
Reply With Quote
  #91  
Old 06-19-2011, 07:38 AM
Anopheles's Avatar
Anopheles Anopheles is offline
 
Join Date: Sep 2008
Location: Stadtallendorf / Germany
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Savage Circuits View Post
I know this thread is old and all, but for those that were having problems with the first item not being linked I have solved the problem with the help of my Super Moderator on my website. He noticed that the following line was malformed. I am showing the original and the corrected versions in the hope it helps some of you. Take care!

PHP Code:
$output_bits '<p align="center"'
And the corrected version:

PHP Code:
$output_bits '<p align="center">'
It doesn't work!
The first item not being linked!
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 08:49 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.09875 seconds
  • Memory Usage 2,361KB
  • Queries Executed 29 (?)
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
  • (2)bbcode_code
  • (5)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (1)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)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_postinfo_query
  • fetch_postinfo
  • 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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete