vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Beta Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=34)
-   -   Random avator for a specific user (https://vborg.vbsupport.ru/showthread.php?t=66911)

Thomas Heretic 07-05-2004 10:00 PM

Random avator for a specific user
 
I use this for changing a specific user. It goes in functions_showthread.php after line.
Code:

}
                        else
                        {
                                $avatarurl = '';
                        }
                       
                }

Code:

if ($post['userid']==##) {
                       
                                header("Expires: " . gmdate("D, d M Y H:i:s",time()) . "GMT");
                                header("Last-Modified: " . gmdate("D, d M Y H:i:s",time()) . "GMT");
                                if ($dir = @opendir('{full directory path}')) {
                                $filecount=0;
                        while (($file = readdir($dir)) !== false) {
                            if ($file != ".." && $file != ".") {
                                $filelist[] = $file;
                                                $filecount++; //Keep track of the total number of files.

                            }
                        }
                            closedir($dir);
                            }
                          mt_srand ((double) microtime() * 1000000);
     
                $filebreak = rand(1,$filecount);
                $filecount2=0;

                         
                            while (list ($key, $val) = each ($filelist)) {
                                $val;
                                        $filecount2++;
                                        if ($filebreak==$filecount2) {
                                            $avatarurl = '{relative path}'.$val;
                                        }
                            }
                       

                         
                }

Does anybody else do something similiar or have a better way to do it?

Gaffer 07-06-2004 04:46 PM

i can't tell just yet cause i've not installed it (plus i'm tired as) but i made a random avatar for vb2..... i'd have trandscribed it to vb3 but i've been to busy to do it.

so if i can't find the time to convert it i might just use yours.....

RixiuS 07-06-2004 06:45 PM

Quote:

Originally Posted by Gaffer
i can't tell just yet cause i've not installed it (plus i'm tired as) but i made a random avatar for vb2..... i'd have trandscribed it to vb3 but i've been to busy to do it.

so if i can't find the time to convert it i might just use yours.....

I used to just do this with template modifications, to give people with no avatar, a random one.

Thomas Heretic 07-06-2004 07:08 PM

Quote:

Originally Posted by RixiuS
I used to just do this with template modifications, to give people with no avatar, a random one.

How did you do it with pure template modification?
One of the things I like with this is it reads the file list so it you don't need to change anything to add new files and they don't need to be named anything special. It also is random per post.

To see a specific example go Here* Look at the user Squirrel Nutkin.

*There is swearing in that thread.

Bad Bunny 07-07-2004 03:06 AM

Quote:

Originally Posted by Thomas Heretic
How did you do it with pure template modification?
One of the things I like with this is it reads the file list so it you don't need to change anything to add new files and they don't need to be named anything special. It also is random per post.

To see a specific example go Here* Look at the user Squirrel Nutkin.

*There is swearing in that thread.

I gotta say...it didn't seem like all that special at first, but knowing it works for a random pic for each post in the same thread...well, that is cool!

Gaffer 07-07-2004 04:56 PM

thought it would be similar to the one i did.... mine was Java script though.....

looks like i don't need to remake it then.... thanks tom.... *wishes weekend would hurry up so it can be installed.*

rinkrat 07-20-2004 05:30 PM

This would be good for a certain usergroup so I could give it to usenet posts. How can I limit it to one usergroup?

Thomas Heretic 07-20-2004 05:50 PM

Quote:

Originally Posted by rinkrat
This would be good for a certain usergroup so I could give it to usenet posts. How can I limit it to one usergroup?

Change ($post['userid']==##) to ($post['displaygroupid'] = ##)

Where ## is the usergroup id that you want to target.

Berethorn 01-31-2005 12:19 AM

Hmm.I'm having a problem...in a thread it says:

Quote:

Warning: Variable passed to each() is not an array or object in /home/bere/public_html/forum/includes/functions_showthread.php on line 430


All times are GMT. The time now is 08:43 AM.

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.01728 seconds
  • Memory Usage 1,740KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete