Posted on: 08/28/02 12:50pm
By: Tony
Maybe somebody has already done it but here is a PHP block for showing who's new on your site:
function phpblock_whos_new()
{
global $_CONF,$_TABLES;
// Set the number of new members to show
$numToShow = 5;
$result = DB_query("SELECT uid,username,photo FROM {$_TABLES['users']} ORDER BY regdate DESC limit $numToShow");
$nrows = DB_numRows($result);
for ($i = 1; $i <= $nrows; $i++) {
$A = DB_fetchArray($result);
$retval .= '<a href="' . $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $A['uid'] . '">' . $A['username'] .
'</a>';
if (!empty($A['photo']) AND $_CONF['allow_user_photo'] == 1) {
$retval .= ' <a href="' . $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $A['uid'] . '"><img src="
' . $_CONF['layout_url'] . '/images/smallcamera.gif" border="0"></a>';
}
$retval .= '<br>';
}
return $retval;
}
Who's New
Posted on: 08/29/02 09:57pm
By: Knightsabre
Ok, I've tried this block on my site, but something isn't quite right...Where did the come from, in front of the ' ?
(Who's New)
You can see it on my site
HERE[*1]
I'm trying this on my GL server at work as well, only it puts an entire ROW of 's in front of the '!
(Who\\\\\'s New)
At work I just changed the name of the block to New Users, but I'd like to know if anyone else is having this problem, and what they have done to fix it.
I'm running geeklog-1.3.5sr2 on a fresh Mandrake Linux 8.2 install at home, and on Mandrake 8.0 at work.
Thanks in advance,
Knightsabre
Who's New
Posted on: 08/30/02 12:43am
By: Dirk
Yeah, that's a bug in 1.3.5sr2 and should be fixed in 1.3.6rc1.
As a workaround, search for this line in public_html/admin/block.php
$title = addslashes ($title);
and comment it out (add two // in front of it). See if that helps.
bye, Dirk
Who's New
Posted on: 08/30/02 06:32am
By: Knightsabre
Thanks, Dirk. That did it!
Knightsabre
Who's New - sql error
Posted on: 08/30/02 07:12am
By: Robin
Not sure but there is missing the table gl_users in the sql query.
I've tried the block it's super but works after adding this table.
Tony give us more blocks!!!
Who's New
Posted on: 09/01/02 02:45am
By: ndarlow
This looks good on the Geeklog site. Is it going to be included in 1.3.6?
-- Neil Darlow M.Sc.
Who's New - sql error
Posted on: 09/02/02 08:55am
By: ndarlow
Yes, I think the query should read ... FROM ORDER BY ...
-- Neil Darlow M.Sc.
Re:Who's New
Posted on: 12/03/03 04:36pm
By: pernas
Great, that's almost what i'm looking for - i'm just curios, does it show users that are in the que of being approved by the moderator? and what field in the table tells me if they are? also, if someone could give me some hints about the correct (SQL) syntax to convert this block into a "last logged in users" by sorting the field "lastlogin" from gl_userinfo i would be very
Who's New
Posted on: 07/02/05 03:23pm
By: loculus
I tried this using the code above but I get the following error when I load my site:
function phpblock_whos_new() { global $_CONF,$_TABLES; // Set the number of new members to show $numToShow = 5; $result = DB_query("SELECT uid,username,photo FROM {$_TABLES['users']} ORDER BY regdate DESC limit $numToShow"); $nrows = DB_numRows($result); for ($i = 1; $i
'; } return $retval; }
Warning: Cannot modify header information - headers already sent by (output started at /home/archaic/public_html/system/lib-custom.php:387) in /home/archaic/public_html/system/lib-sessions.php on line 188
Warning: Cannot modify header information - headers already sent by (output started at /home/archaic/public_html/system/lib-custom.php:387) in /home/archaic/public_html/system/lib-sessions.php on line 200
Warning: Cannot modify header information - headers already sent by (output started at /home/archaic/public_html/system/lib-custom.php:387) in /home/archaic/public_html/lib-common.php(973) : eval()'d code on line 1
Perhaps I am not placing the code in the correct area of the lib-custom.php? I tried it at the beginning, and at the end of the existing code but I still get the message.
Who's New
Posted on: 07/05/05 02:08am
By: r_f_o_t
Who's New
Posted on: 07/05/05 02:49pm
By: loculus
Hi Chuck,
Thanks for the assist, unfortunatly I have been using Crimson Editor and still had the problem. I did figure out the problem though and I will provide the solution here for anyone else that may need it in a future search.
When adding the function to lib-custom.php, enter it at the end of the code but before the last line that reads "?>". I'm not sure if that was mentioned already or if it is considered common knowledge for PHP coders but it fixed my errors regardless.
Who's New
Posted on: 12/22/05 04:18pm
By: Dirk
[QUOTE BY= Tony] Maybe somebody has already done it but here is a PHP block for showing who's new on your site:[/QUOTE]
A minor modification / addition for Geeklog 1.4.0 and up to hide banned users from the block:
$result = DB_query("SELECT uid,username,photo FROM {$_TABLES['users']} WHERE status <> 0 ORDER BY regdate DESC limit $numToShow");
bye, Dirk
Who's New
Posted on: 02/01/06 02:14am
By: Anonymous (zephyr)
I added the code to lib-custom.php and created phpblock_whos_new but this is what it shows
Error in PHP Block. Function, phpblock_whos_new, does not exist.
any ideas why?
its right there in front staring me in the face and gls telling me its not there.
this is what i pasted.
function phpblock_whos_new()
{
global $_CONF,$_TABLES;
// Set the number of new members to show
$numToShow = 5;
$result = DB_query("SELECT uid,username,photo FROM ORDER BY regdate DESC limit $numToShow");
$nrows = DB_numRows($result);
for ($i = 1; $i <= $nrows; $i++) {
$A = DB_fetchArray($result);
$retval .= '<a href="' . $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $A['uid'] . '">' . $A['username'] .
'</a>';
if (!empty($A['photo']) AND $_CONF['allow_user_photo'] == 1) {
$retval .= ' <a href="' . $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $A['uid'] . '"><img src="
' . $_CONF['layout_url'] . '/images/smallcamera.gif" border="0"></a>';
}
$retval .= '<br>';
}
return $retval;
}
help?
Who's New
Posted on: 02/01/06 02:03pm
By: Dirk
Check the usual: Make sure you've edited the right file, uploaded it again, and that the new code is between the <?php ... ?> tags.
bye, Dirk
Who's New
Posted on: 02/17/06 09:44am
By: donm1021
Thanks!
They are now working
Who's New
Posted on: 04/24/06 08:16pm
By: Cobro
this dose not work for me ??
Re: Who's New
Posted on: 11/11/09 09:33am
By: ::Ben
Hello,
The complete code working
Text Formatted Code
function phpblock_whos_new ()
{
global $_CONF,$_TABLES;
// Set the number of new members to show
$numToShow = 5;
$result = DB_query("SELECT uid,username,photo FROM {$_TABLES['users']} WHERE status <> 0 ORDER BY regdate DESC limit $numToShow");
$nrows = DB_numRows($result);
for ($i = 1; $i <= $nrows; $i++) {
$A = DB_fetchArray($result);
$retval .= '<a href="' . $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $A['uid'] . '">' . $A['username'] .
'</a>';
if (!empty($A['photo']) AND $_CONF['allow_user_photo'] == 1) {
$retval .= ' <a href="' . $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $A['uid'] . '"><img src="
' . $_CONF['layout_url'] . '/images/smallcamera.gif" border="0"></a>';
}
$retval .= '<br>';
}
return $retval;
}
::Ben
Re: Who's New
Posted on: 11/28/09 08:09am
By: nrvncanada
Great work done! I did similar thing in shell scripting for Linux platform. The script actually parsed the shadow and login file data mixed up with some pattern matching awk code to find out who is new. Though I am not concerned with php development, it will be a great help in my company's development department.
Re: Who's New
Posted on: 03/19/10 01:20am
By: Anonymous (Lizard)
:doh:
I have just been informed that this PHP block is not showing up correctly on IE8.
I normally use Firefox all the time, but I have just viewed my page on IE8 and I am seeing a white box with a red cross in it next to the names. I am assuming they should be pictures. No pictures come up on Firefox so I did not know until I was told about it.
Any suggestions?
Thanks in advance.
Lizard.
Re: Who's New
Posted on: 03/19/10 04:32am
By: ::Ben
You may need a /images/smallcamera.gif file in your layout folder.
::Ben
Re: Who's New
Posted on: 03/19/10 07:56am
By: Anonymous (Lizard)
Quote by: cordisteYou may need a /images/smallcamera.gif file in your layout folder.
::Ben
Ben.
You are a star. I had a smallcamera.png file in that folder so I copied the file and changed the png to gif and it is now working beautifully.
Thank you. :banana: