PDA

View Full Version : latest newest x members


LoGan.M
03-06-2009, 02:37 AM
I'm looking for a mod to do the following :

show a welcome message for the last x registered members scrolling under navbar

message simple:

Admin user name: welcome to our newest member (member user name) .............. (icon) ( next message ) and so on

Thanks in Advance :)

Mr-Moo
03-06-2009, 02:57 AM
I can show you how to do a single user :p - possibly someone could elaborate on my "single" user code.

Simply place this code within a marquee or however you are displaying your scroll bar.
<phrase 1="member.php?$session[sessionurl]u=$newuserid" 2="$newusername">$vbphrase[welcome_to_our_newest_member_x]</phrase>

LoGan.M
03-06-2009, 07:36 AM
Thank you Mr-Moo for your reply

i found this code in an older thread (https://vborg.vbsupport.ru/showpost.php?p=1557709&postcount=2)

by kiril_cvetkov (https://vborg.vbsupport.ru/member.php?u=209887)

$sql=$db->query_read("SELECT username,userid FROM ".TABLE_PREFIX." user ORDER BY userid desc LIMIT 5");
while ($get = $db->fetch_array($sql))
{
$theusername = $get['username'];
$userid = $get['userid'];
$latestmembers .= "<a href =member.php?u=$userid>$theusername</a> ";
} but this will give me a single line contain all the last five members , and i need it to look like this:

message simple:

Admin user name: welcome to our newest member (member user name) .............. (icon) ( next message ) and so on ----------

other ways i found:

I don't know a lot about programming but i managed to put this code together from 2 separated mods i found, each one of them was doing half of what i wanted

can someone please tell me if this code is right ? will it work ?

<?xml version="1.0" encoding="ISO-8859-1"?>

<product productid="welcomemessage" active="1">
<title>Welcome Message</title>
<description>Automatically Wellcome New Members</description>
<version>1.00</version>
<url></url>
<versioncheckurl />
<dependencies>
</dependencies>
<codes>
<code version="1">
<installcode><![CDATA[$db->query_write("DROP TABLE IF EXISTS welcomemsg");
$db->query_write("DROP TABLE IF EXISTS " . TABLE_PREFIX . "welcomemsg");
$db->query_write("CREATE TABLE " . TABLE_PREFIX . "welcomemsg
(
`id` int(100) NOT NULL auto_increment,
`usergroupid` INT( 25 ) NOT NULL ,
`userid` int(20) NOT NULL default '0',
`name` text NOT NULL,
`home` text NOT NULL,
`msg` text NOT NULL,
`dateline` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`)
)
");
<uninstallcode><![CDATA[[$db->query_write("DROP TABLE IF EXISTS wellcommsg");
</code>
</codes>
<template name="welcome_Msg" templatetype="template" date="0" username="" version=""><![CDATA[
<if condition="$vboptions[welcomemsg_active]">
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%">
<thead>
<tr>
<td class="thead" align="center">
<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('beebi_welcomemsg')"><img id="collapseimg_forumhome_activeusers" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_forumhome_activeusers].gif" border="0" /></a>$vbphrase[welcomemsg]</td>
</tr>
</thead>
<tbody id="collapseobj_beebi_welcomemsg" style="$vbcollapse[collapseobj_beebi_welcomemsg]">
<tr>
<td class="alt1">
$message_move
</td>
</tr>
</tbody>
</table>
<br />
</if>
]]></template>
<plugins>
<plugin active="1" executionorder="5">
<title>Welcome Message</title>
<hookname>register_addmember_complete</hookname>
<phpcode><![CDATA[$fromuid=$vbulletin->options['welcom_mes_uid'];
$rating=$db->query_first("SELECT username from user where
userid=$fromuid");
$fromuser=$rating[username];
$fromhome=$vbulletin->options[bbtitle];
$wlcommsg=$vbphrase[welcomemsg];
$wlcommsg2=$vbphrase[welcomemsg2];
$nname=$vbulletin->userinfo['username'];
$now = TIMENOW;

if ($vbulletin->options['welcom_message_onoff'])
{

$db->query_write("INSERT INTO " . TABLE_PREFIX . "welcomemsg (userid, name, home,

msg, dateline) VALUES ('$fromuid', '$fromuser', '$fromhome', '$wlcommsg
$nname $wlcommsg2','$now')");
}]]></phpcode>
</plugin>
<plugin active="1" executionorder="5">
<title>Auto Replacment</title>
<hookname>global_start</hookname>
<phpcode><![CDATA[eval('$welcome_message .= "' . fetch_template('welcome_message') . '";');
$vbulletin->templatecache['navbar'] = $vbulletin->templatecache['navbar'].$vbulletin->templatecache['welcome_message'];]]></phpcode>
</plugin>
<plugin active="1" executionorder="5">
<title>All Pages</title>
<hookname>global_start</hookname>
<phpcode><![CDATA[if (!$vbulletin->options['welcome_style'])
{
$welcome_bit .= "<font dir='rtl'><a href='./member.php?u=" . $welcome['userid'] . "'><img src='images/" . $vbulletin->options['welcome_pic_url'] ."' width=" . $vbulletin->options['welcome_pic_wight'] . " height=" . $vbulletin->options['welcome_pic_height'] . " border='0'></a> <font dir='rtl' color=" . $vbulletin->options['welcome_user_color'] . ">" . $welcome['name'] . "</font>" . iif($vbulletin->options['welcome_home_enable']," <font dir='rtl' color=" . $vbulletin->options['welcome_home_color'] . ">" . $vbphrase['form_home'] . " " . $welcome['home'] . "</font> ") . "<font dir='rtl' color=" . $vbulletin->options['welcome_msg_color'] . "> : " . $welcome['msg'] . " </font>";
}
else
{
$welcome_bit .= "<font dir='rtl'><fieldset><legend align='right' style='background-color: #FFFFFF; border: 1px solid #000000;'> <font dir='rtl' color=" . $vbulletin->options['welcome_user_color'] . "><a href=./member.php?u=" . $welcome['userid'] . "></a>" . $welcome['name'] . "</font>" . iif($vbulletin->options['welcome_home_enable']," <font dir='rtl' color=" . $vbulletin->options['welcome_home_color'] . ">" . $vbphrase['form_home'] . " " . $welcome['home'] . "</font>") . " <font dir='rtl' color=" . $vbulletin->options['welcome_date_color'] . ">" . $welcome['date'] . " " . $welcome['time'] . "</font> </legend><div align='right'> <font dir='rtl' color=" . $vbulletin->options['welcome_msg_color'] . ">" . $welcome['msg'] . "</font></div></fieldset><br />";
}
}
if (!$vbulletin->options['welcome_style'])
{
$welcome_move = "<marquee dir='ltr' style='border: " . $vbulletin->options['welcome_bord'] . "px solid " . $vbulletin->options['welcome_bord_color'] . "' onmouseover=this.stop() onmouseout=this.start() scrollAmount=" . $vbulletin->options['welcome_speed'] . " scrollDelay=60 direction=right dir=ltr width=100%>" . $welcome_bit . "</marquee>";
}
else
{
$welcome_move = "<marquee style='border: " . $vbulletin->options['welcome_bord'] . "px solid " . $vbulletin->options['welcome_bord_color'] . "' onmouseover=this.stop() onmouseout=this.start() scrollAmount=" . $vbulletin->options['welcome_speed'] . " scrollDelay=60 direction=up width=100% height=" . $vbulletin->options['welcome_height'] . ">" . $welcome_bit . "</marquee>";
}]]></phpcode>
</plugin>
</plugins>
<phrases>
<phrasetype name="GLOBAL" fieldname="global">
<phrase name="new_welcome_msg" date="1208334220" username="admin" version="1.00"><![CDATA[ ^ 2Welcome^ $username ]]></phrase>
<phrase name="welcomemsg" date="1209287847" username="admin" version="1.00"><![CDATA['some text here']]></phrase>
<phrase name="welcomemsg2" date="1209380285" username="admin" version="1.00"><![CDATA['more text' ]]></phrase>
<phrase name="welcommessage" date="1207515290" username="admin" version="1.00"><![CDATA['even more text']]></phrase>
</phrasetype>
<phrasetype name="vBulletin Settings" fieldname="vbsettings">
<phrase name="setting_welcome_message_onoff_desc" date="1209289830" username="admin" version="1.00"><![CDATA[Press yes to Activate]]></phrase>
<phrase name="setting_welcome_message_onoff_title" date="1209289830" username="admin" version="1.00"><![CDATA[Activate Welcome Message]]></phrase>
<phrase name="setting_welcom_message_uid_desc" date="1209293827" username="admin" version="1.00"><![CDATA[Enter Message poster user id]]></phrase>
<phrase name="setting_welcome_message_uid_title" date="1209293827" username="admin" version="1.00"><![CDATA[User Id]]></phrase>
<phrase name="settinggroup_" date="1207732881" username="admin" version="1.00" />
<phrase name="settinggroup_welcome_message" date="1209420989" username="admin" version="1.00"><![CDATA[Welcome Message Options]]></phrase>
</phrasetype>
</phrases>
<options>
<settinggroup name="welcome_Message" displayorder="241">
<setting varname="welcome_Message_onoff" displayorder="1">
<datatype>free</datatype>
<optioncode>yesno</optioncode>
<defaultvalue>0</defaultvalue>
</setting>
<setting varname="welcome_Message_uid" displayorder="2">
<datatype>number</datatype>
<defaultvalue>1</defaultvalue>
</setting>
</settinggroup>
</options>
<helptopics>
</helptopics>
<cronentries>
</cronentries>
<faqentries>
</faqentries>
</product>

if not any help doing this mod is much appreciated , thank you :)

Gio~Logist
03-06-2009, 08:56 AM
Try something like this ;)

$getnewestmembers = $vbulletin->db->query_read("SELECT username,userid FROM ".TABLE_PREFIX." user ORDER BY userid desc LIMIT 5");
while ($member = $vbulletin->db->fetch_array($getnewestmembers))
{
$latestmembers .= "Welcome to our newest member, <a href='member.php?u=$member[userid]'>$member[username]</a> <br />";
}

Mr-Moo
03-06-2009, 02:26 PM
Yes, indeed that works much better since it pulls a query from the latest 5.

Thank you Gio~Logist,
Everything looks good with Gio~Logist's code, however if you are looking to have it in a marquee, make sure you take out the </ br> and replace it with a "-" or something on those lines. The </ br> will make it drop a line down.

LoGan.M
03-07-2009, 09:20 PM
Great, thank you Geo~Logist and Mr-Moo for your help :up: