UBB.Dev
Posted By: santana Any hack for: "Welcome to our new user... - 04/09/2001 10:43 AM
Anyone can develop hack for the main page which displays something like:
"Welcome to our newest member: username."
"Total post:###"

Any helps will be appreciate it.

-santanablank-
Posted By: The Team Re: Any hack for: "Welcome to our new user... - 04/09/2001 11:41 PM
Cute idea. I think you'd want to add something like this:


// show last username
if ($config['showreg']) {
$sth = $dbh->do_query("select U_Username from w3t_Users order by U_Number DESC limit 1");
$lastUser = $dbh -> fetch_array($sth);
$lastUserText = "Welcome to our newest member: $lastUser<BR>";
$dbh -> finish_sth($sth);
}


Then right above where he prints $showreg you add $lastUserText.

Let me know if it works, maybe I'll use it on my site. []/w3timages/icons/wink.gif[/]

-F


Posted By: santana Re: Any hack for: "Welcome to our new user... - 04/10/2001 5:59 AM
fmann, thanks, but it doesn't work.
It says: Welcome to our newest member: array

Any idea why?

-santanablank-
Probably beause the code has a bug in it.

// show last username
if ($config['showreg']) {
$sth = $dbh->do_query("select U_Username from w3t_Users order by U_Number DESC limit 1");
list($lastUser) = $dbh -> fetch_array($sth);
$lastUserText = "Welcome to our newest member: $lastUser<BR>";
$dbh -> finish_sth($sth);
}


Should do the trick... But I didn't test it out. That's cause fetch_array() returns an array. And when you try to print out an array and not a member in the array PHP is smart and prints "array" to help you debug..

If that code up there doesn't work then this should.

// show last username
if ($config['showreg']) {
$sth = $dbh->do_query("select U_Username from w3t_Users order by U_Number DESC limit 1");
$lastUser = $dbh -> fetch_array($sth);
$lastUserText = "Welcome to our newest member: $lastUser[0]<BR>";
$dbh -> finish_sth($sth);
}


If not then I use the excuse that I didn't really take a close look at it and I'm sleep deprived. And that I'm assuming that fetch_array() returns an array based on the fact that it printed the word "array".

Doug
http://www.netherworldrpg.net
Posted By: santana Re: Any hack for: "Welcome to our new user... - 04/10/2001 10:47 AM
Doug, that should do the trick!
Well done! It works just fine. []/w3timages/icons/smile.gif[/]

thanks

-santanablank-
Woukd this work for the Perl version too ya think?

Brew
CustomShowCars.com
OldHouseForums.net
PoliticalForums.net

Posted By: caymuc Re: Any hack for: "Welcome to our new user... - 04/11/2001 5:55 PM
I installed it into wwwthreads.php and categories.php



I got this variant of your code working best:

// HACK: show last username
if ($config['showreg']) {
$sth = $dbh->do_query("SELECT U_Username FROM w3t_Users ORDER BY U_Number DESC LIMIT 1");
$lastUser = $dbh -> fetch_array($sth);
$showreg = "$showreg
Welcome to our newest member: $lastUser[0]";
$dbh -> finish_sth($sth);
}
//end hack


My version should be put in right after that chunk of code:

// --------------------------------------------------------------------------
// Let's see how many total registered users there are but only if we want to
// display this information
if ($config['showreg']) {
$sth = $dbh->do_query("SELECT COUNT(*) FROM w3t_Users");
$registered = $dbh -> fetch_array($sth);
$showreg = "$registered[0] $lang[REGED_USERS]";
$dbh -> finish_sth($sth);
}


It can be fine tuned by replacing the text strings with variables from the language file...

Carl

----------
http://www.colour-ize.de/forum (test entry: user: 'test' pw: 'test')
That's not the proper way to concatenate strings in PHP... while that works because of the structure of the langauge... if you run Zend Optimizer that's bad syntax because that code can't be optimized. Proper concatenation is $showreg = $showreg . "Text here";



Doug
http://www.netherworldrpg.net
I haven't run the Perl version of W3T for a long time... but I'll download the Perl version tonight and I'll look at it and try and come up with the code for the Perl version.


Doug
http://www.netherworldrpg.net
In reply to:

I haven't run the Perl version of W3T for a long time... but I'll download the Perl version tonight and I'll look at it and try and come up with the code for the Perl version.



That would be great Doug!

Thanx!

Brew
CustomShowCars.com
OldHouseForums.net
PoliticalForums.net

Posted By: caymuc Re: Any hack for: "Welcome to our new user... - 04/11/2001 7:24 PM
Cool. Good to know. I put that in right away in my code. Thanks... Looks like we are finally getting there :)

Carl

----------
http://www.colour-ize.de/forum (test entry: user: 'test' pw: 'test')
Posted By: amity here is the exact code for all of us newbies! - 07/20/2001 6:10 AM
// HACK: show last username
if ($config['showreg']) {
$sth = $dbh->do_query("SELECT U_Username FROM w3t_Users ORDER BY U_Number DESC LIMIT 1");
$lastUser = $dbh -> fetch_array($sth);
$showreg = $showreg . "Welcome to our newest mama:$lastUser[0]";
$dbh -> finish_sth($sth);
}
//end hack


look into your categories.php and your wwwthreads.php files- you will find this code:

// --------------------------------------------------------------------------
// Let's see how many total registered users there are but only if we want to
// display this information
if ($config['showreg']) {
$sth = $dbh->do_query("SELECT COUNT(*) FROM w3t_Users");
$registered = $dbh -> fetch_array($sth);
$showreg = "$registered[0] $lang[REGED_USERS]";
$dbh -> finish_sth($sth);
}

add the hack right beneath this code (a space in between is ok!)

i know how hard it is to get the feel for hacks and such- like the idea but scared to mess up your script! . smile hope this helps someone!

just seeing if this works...

[]/testimages/icons/wink.gif[/]
Ok This is a cool idea and works great (when you type the codeing in correctly).

Thanks!

Edited by MrFrog on 07/21/01 11:55 AM.

Posted By: amity glad it works for you! of course you need to - 07/22/2001 4:48 AM
um. of course, you would want to substitute the word 'user' in your code for 'mama' in mine. []/testimages/icons/smile.gif[/]

amity

just seeing if this works...

[]/testimages/icons/wink.gif[/]
LOL yes I did notice that the fist time it poped up and went back and changed it.

© UBB.Developers