Welcome to Geeklog, Anonymous Friday, March 29 2024 @ 05:49 am EDT

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;
}
 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
Text Formatted Code
 ... |/code] pseudo-tags when posting sections of code. It also makes your moderator's life a bit easier ;-)

bye, Dirk
 Quote

Status: offline

rkozsan

Forum User
Newbie
Registered: 11/14/02
Posts: 1
Nice work.

Looks like a small typo in :

Text Formatted Code
elseif (empty($A['photo']) || $_CONF['allow_uer_photo'] == 0) {
 
Should be 'allow_user_photo'... no?

rk

 Quote

robot-penguin

Anonymous
Yes that should be allow_user_photo. Sorry about that. Guess I should have double-checked it all.---Penguin
 Quote

Status: offline

thedude

Forum User
Regular Poster
Registered: 12/28/02
Posts: 90
Penguin, I've got a silly question for you.. How do I install it or where do I add the code to? Sorry.. Thanks.. Thedude
 Quote

Status: offline

thedude

Forum User
Regular Poster
Registered: 12/28/02
Posts: 90
Please ignore the question. Thanks
 Quote

Ryan

Anonymous
I would like to know where you add that code?
 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
Text Formatted Code
<br> or <p>
 
codes.
http://70.145.174.180/
 Quote

Ryan

Anonymous
Well i cant fine that file so can you be more spacific?
 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)
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/
 Quote

All times are EDT. The time is now 05:49 am.

  • 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