Topics

User Functions

Events

There are no upcoming events

What's New

Stories

1 new Stories in the last 2 weeks

Comments last 2 weeks

No new comments

Trackbacks last 2 weeks

No new trackback comments

Links last 2 weeks

No recent new links

NEW FILES last 14 days

No new files

Welcome to Geeklog Friday, May 24 2013 @ 06:23 PM EDT


 Forum Index > Extensions > PHP Blocks New Topic Post Reply
 Who's new 2
   
robot-penguin
 12/06/02 11:34AM (Read 2911 times)  
+----
Newbie

Status: offline


Registered: 07/29/02
Posts: 9

I've made another "Who's New" block. It displays all new members in an ordered list starting with the newest member.

PHP 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;
}

Penguin
 
Profile Email Website
 Quote
Dirk
 12/06/02 02:11PM  
AAAAA
Admin

Status: offline


Registered: 01/12/02
Posts: 13027
Just wanted to remind everyone that you can use the
PHP Formatted Code
 ... |/code] pseudo-tags when posting sections of code. It also makes your moderator's life a bit easier ;-)

bye, Dirk

 
Profile Email Website
 Quote
rkozsan
 12/06/02 04:05PM  
+----
Newbie

Status: offline


Registered: 11/14/02
Posts: 1
Nice work.


Looks like a small typo in :

PHP Formatted Code
elseif (empty($A['photo']) || $_CONF['allow_uer_photo'] == 0) {
 

Should be 'allow_user_photo'... no?


rk


 
Profile Email
 Quote
robot-penguin
 12/07/02 03:47AM  
+----
Newbie

Status: offline


Registered: 07/29/02
Posts: 9
Yes that should be allow_user_photo. Sorry about that. Guess I should have double-checked it all.---Penguin

Penguin
 
Profile Email Website
 Quote
thedude
 01/04/03 01:51AM  
++++-
Regular Poster

Status: offline


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

 
Profile Email
 Quote
thedude
 01/04/03 02:24AM  
++++-
Regular Poster

Status: offline


Registered: 12/28/02
Posts: 90
Please ignore the question. Thanks

 
Profile Email
 Quote
Anonymous: Ryan
 07/26/04 07:32PM  



I would like to know where you add that code?

 
 Quote
TechSys
 07/26/04 09:22PM  
++++-
Regular Poster

Status: offline


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
PHP Formatted Code
<br> or <p>
 
codes.

http://70.145.174.180/
 
Profile Email Website
 Quote
Anonymous: Ryan
 07/26/04 09:27PM  



Well i cant fine that file so can you be more spacific?

 
 Quote
TechSys
 07/26/04 09:33PM  
++++-
Regular Poster

Status: offline


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)
PHP 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/
 
Profile Email Website
 Quote
Content generated in: 1.51 seconds
New Topic Post Reply

Normal Topic Normal Topic
Sticky Topic Sticky Topic
Locked Topic Locked Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Able to post 
Filtered HTML Allowed 
Censored Content