Welcome to Geeklog, Anonymous Saturday, December 21 2024 @ 10:41 pm EST
Geeklog Forums
Who's new 2
robot-penguin
Anonymous
I've made another "Who's New" block. It displays all new members in an ordered list starting with the newest member.
Text Formatted Code
function phpblock_whosnew() {global $_CONF,$_TABLES,$_DB_table_prefix;
$retval='<p><center><i>Newest first</i></center></p>';
// Set the number of new members to show
$numToShow = 7;
$result = DB_query("SELECT uid,username,photo FROM `".$_DB_table_prefix."users` ORDER BY regdate DESC limit $numToShow");
$nrows = DB_numRows($result);
for ($i = 1; $i <= $nrows; $i++) {
$A = DB_fetchArray($result);
if (!empty($A['photo']) && $_CONF['allow_user_photo'] == 1) {
$retval .= '<ol compact start='.$i.'><li><a href="' . $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $A['uid'] . '">' .$A['username']
.'</a> <a href="' . $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $A['uid'] . '"><img src="' . $_CONF['layout_url']
. '/images/smallcamera.gif" border="0"></a></li></ol>';
}
elseif (empty($A['photo']) || $_CONF['allow_uer_photo'] == 0) {
$retval .= '<ol compact start='.$i.'><li><a href="' . $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $A['uid'] . '">' .$A['username'] .'</a></li></ol>';
}
}
return $retval;
}
9
9
Quote
Status: offline
Dirk
Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Just wanted to remind everyone that you can use the
bye, Dirk
Text Formatted Code
... |/code] pseudo-tags when posting sections of code. It also makes your moderator's life a bit easier ;-)bye, Dirk
10
10
Quote
robot-penguin
Anonymous
Yes that should be allow_user_photo. Sorry about that. Guess I should have double-checked it all.---Penguin
10
11
Quote
Ryan
Anonymous
I would like to know where you add that code?
9
7
Quote
Status: offline
TechSys
Forum User
Regular Poster
Registered: 12/02/03
Posts: 90
You would add it to you lib-custom.php file. The add a new block, make sure block type is set to PHP block, then call it in the PHP block Option section by putting phpblock_whosnew there. then enable it and put it on the left or right.
there is one thing I do not like though. It has a break between each line of new user. I can't find the
codes.
http://70.145.174.180/
there is one thing I do not like though. It has a break between each line of new user. I can't find the
Text Formatted Code
<br> or <p>http://70.145.174.180/
10
8
Quote
Ryan
Anonymous
Well i cant fine that file so can you be more spacific?
9
10
Quote
Status: offline
TechSys
Forum User
Regular Poster
Registered: 12/02/03
Posts: 90
lib-custom.php is in your geeklog/system directory. you add the code between the } and ?> at the end of it.
I have found out why it have a space between each new user. Not trying to step on any feet here, but this is what I ended up doing (the whole code with my deletions)
function phpblock_whosnew() {
global $_CONF,$_TABLES,$_DB_table_prefix;
$retval='';
// Set the number of new members to show
$numToShow = 7;
$result = DB_query("SELECT uid,username,photo FROM `".$_DB_table_prefix."users` ORDER BY regdate DESC limit $numToShow");
$nrows = DB_numRows($result);
for ($i = 1; $i <= $nrows; $i++) {
$A = DB_fetchArray($result);
if (!empty($A['photo']) && $_CONF['allow_user_photo'] == 0) {
$retval .= '<'.$i.'><a href="' . $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $A['uid'] . '">' .$A['username']
.'</a> <a href="' . $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $A['uid'] . '"><img src="' . $_CONF['layout_url']
. '/images/smallcamera.gif" border="0"></a><br>';
}
elseif (empty($A['photo']) || $_CONF['allow_uer_photo'] == 0) {
$retval .= '<'.$i.'><a href="' . $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $A['uid'] . '">' .$A['username'] .'</a><br>';
}
}
return $retval;
}
http://70.145.174.180/
I have found out why it have a space between each new user. Not trying to step on any feet here, but this is what I ended up doing (the whole code with my deletions)
Text Formatted Code
function phpblock_whosnew() {
global $_CONF,$_TABLES,$_DB_table_prefix;
$retval='';
// Set the number of new members to show
$numToShow = 7;
$result = DB_query("SELECT uid,username,photo FROM `".$_DB_table_prefix."users` ORDER BY regdate DESC limit $numToShow");
$nrows = DB_numRows($result);
for ($i = 1; $i <= $nrows; $i++) {
$A = DB_fetchArray($result);
if (!empty($A['photo']) && $_CONF['allow_user_photo'] == 0) {
$retval .= '<'.$i.'><a href="' . $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $A['uid'] . '">' .$A['username']
.'</a> <a href="' . $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $A['uid'] . '"><img src="' . $_CONF['layout_url']
. '/images/smallcamera.gif" border="0"></a><br>';
}
elseif (empty($A['photo']) || $_CONF['allow_uer_photo'] == 0) {
$retval .= '<'.$i.'><a href="' . $_CONF['site_url'] . '/users.php?mode=profile&uid=' . $A['uid'] . '">' .$A['username'] .'</a><br>';
}
}
return $retval;
}
http://70.145.174.180/
13
11
Quote
All times are EST. The time is now 10:41 pm.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content