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 |
|
||||||
![]() ![]() ![]() ![]() ![]() 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 |
||||||
|
|||||||
| Dirk |
|
||||||
![]() ![]() ![]() ![]() ![]() 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 |
||||||
|
|||||||
| rkozsan |
|
||||||
![]() ![]() ![]() ![]() ![]() Newbie Status: offline ![]() Registered: 11/14/02 Posts: 1 |
Nice work.
Should be 'allow_user_photo'... no?
|
||||||
|
|||||||
| robot-penguin |
|
||||||
![]() ![]() ![]() ![]() ![]() 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 |
||||||
|
|||||||
| thedude |
|
||||||
![]() ![]() ![]() ![]() ![]() 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 |
||||||
|
|||||||
| thedude |
|
||||||
![]() ![]() ![]() ![]() ![]() Regular Poster ![]() Status: offline ![]() Registered: 12/28/02 Posts: 90 |
Please ignore the question. Thanks
|
||||||
|
|||||||
| Anonymous: Ryan |
|
||||||
|
|
I would like to know where you add that code?
|
||||||
|
|||||||
| TechSys |
|
||||||
![]() ![]() ![]() ![]() ![]() 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>http://70.145.174.180/ |
||||||
|
|||||||
| Anonymous: Ryan |
|
||||||
|
|
Well i cant fine that file so can you be more spacific?
|
||||||
|
|||||||
| TechSys |
|
||||||
![]() ![]() ![]() ![]() ![]() 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/ |
||||||
|
|||||||
| Content generated in: 1.51 seconds |
|
|
|