vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Last Members (https://vborg.vbsupport.ru/showthread.php?t=64051)

Davey-UK 04-18-2004 12:02 PM

Last Members
 
Is there a quite easy way to add a list of say the last 5 members to a none vb page?

Or better still into a vbindex custom block!

Cheers

TouchingVirus 04-18-2004 02:02 PM

PHP Code:


// ### Get vBulletin Backend ###

require_once('./global.php');

// ### Run Query ###

$last5 $DB_site->query("SELECT username FROM `user` ORDER BY joindate DESC LIMIT 5");

// ### Output Results ###

while ($last5members $DB_site->fetch_array($last5))
{
$last5usernames $last5members['username'];
echo 
$last5usernames;
echo 
'<br>';


Of course this is very basic ..it retreives the usernames and just puts them out in plain text..

you could utilize a little template..let me know if you want to if you cant figure it out

Davey-UK 04-18-2004 02:36 PM

Thanks, thats a great response, but when trying to put this in a vbindex custom block, i get this when trying to save the template.
Code:

The following error occurred when attempting to evaluate this template:

Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /hsphere/local/home/contrast/mydomain.co.uk/forum/includes/adminfunctions_template.php(3037) : eval()'d code on line 29

This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish.

Any ideas

TouchingVirus 04-18-2004 02:50 PM

You added that code into a template?

You mad thing, thats a php page in itself :D

TouchingVirus 04-18-2004 02:54 PM

let me get vbindex and sort it out myself and then i will post how to do it :)

TouchingVirus 04-18-2004 04:16 PM

Major thanks to assassingod for giving me the key to this hack, and to my other ones that were in the DEV stage because i didnt know i had to loop :)

Find this in vbindex.php

PHP Code:

$DB_site->free_result($getthreads);


Underneath, add:

PHP Code:

// #################### PROCESS LATEST MEMBERS #######################

$lastlimit 7;
$lastquery $DB_site->query('SELECT username,userid FROM '.TABLE_PREFIX.'user ORDER BY joindate DESC LIMIT '.$lastlimit.'');  
while (
$lastmember $DB_site->fetch_array($lastquery)) 
{
$lastusername $lastmember['username']; 
$lastuserid $lastmember['userid'];
exec_switch_bg();
eval(
"\$lastmemberbits .= \"".fetch_template('vbindex_lastmemberbit')."\";");


Save & Upload!

Next to the templates..go to the custombox you want the information to appear in & change the code to this..

Code:

<table cellpadding="0" cellspacing="0" border="0" class="tborder" width="100%">
        <tr>
                <td>
                        <table cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%">
                                <thead>
                                <tr>
                                        <td class="tcat" style="text-align: center">
                                                <a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('vbindex_customblock$box')"><img id="collapseimg_vbindex_customblock$box" src="$stylevar[imgdir_button]/collapse_tcat$collapseimg_vbindex_customblock.gif" alt="" border="0" /></a>
                                                <strong>Last $lastlimit Members</strong>
                                        </td>
                                </tr>
                                </thead>
                                <tbody id="collapseobj_vbindex_customblock$box" style="$collapseobj_vbindex_customblock">
                                $lastmemberbits                                </tbody>
                        </table>
                </td>
        </tr>
</table>
<br />

Next add in a template named vbindex_lastmemberbit with contents..

Code:

<tr class="$bgclass">
        <td>
                <div class="smallfont">
<a href="member.php?u=$lastuserid"><strong>$lastusername</strong></a>
                </div>
        </td>
</tr>

Leave the php in the vbindex.php file, for some strange reason, if you add it into vbindex_custombox_php it doesnt work..so if this is Custom box 1, make sure that in vbindex_custombox_php under Case 1: is empty ;)

TouchingVirus 04-18-2004 04:18 PM

By the way, change $lastlimit = 7; to whatever you want it to show :)

Davey-UK 04-19-2004 04:30 PM

Excellent!

Works perfectly..........Suberb.

1 thing to note, the link in vbindex_lastmemberbit template should have forum/ before it, or whatever you forums folder is called.

I would release this a s a hack in the addons section if i were you, cos i think it will be popular.

Thanks again :devious:

jiggle 05-19-2004 01:56 PM

Is it also possible to have this for the TOP5 Posters with the most postings ?


All times are GMT. The time now is 01:46 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.01070 seconds
  • Memory Usage 1,742KB
  • 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
  • (3)bbcode_code_printable
  • (3)bbcode_php_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