Welcome to Geeklog, Anonymous Wednesday, November 27 2024 @ 08:34 pm EST

Geeklog Forums

Who's New

Page navigation


Status: offline

Tony

Site Admin
Admin
Registered: 12/17/01
Posts: 405
Location:Urbandale, Iowa
Maybe somebody has already done it but here is a PHP block for showing who's new on your site:

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']} 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;
}
 

The reason people blame things on previous generations is that there's only one other choice.
 Quote

Status: offline

Knightsabre

Forum User
Newbie
Registered: 08/18/02
Posts: 2

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

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

 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
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
 Quote

Status: offline

Knightsabre

Forum User
Newbie
Registered: 08/18/02
Posts: 2
Thanks, Dirk. That did it! Knightsabre
 Quote

Status: offline

Robin

Forum User
Full Member
Registered: 02/15/02
Posts: 725
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!!!
Geeklog Polish Support Team
 Quote

Status: offline

ndarlow

Forum User
Junior
Registered: 06/30/02
Posts: 31
This looks good on the Geeklog site. Is it going to be included in 1.3.6? -- Neil Darlow M.Sc.
 Quote

Status: offline

ndarlow

Forum User
Junior
Registered: 06/30/02
Posts: 31
Yes, I think the query should read ... FROM ORDER BY ... -- Neil Darlow M.Sc.
 Quote

Status: offline

pernas

Forum User
Newbie
Registered: 11/15/03
Posts: 7
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 Laughing Out Loud
 Quote

Status: offline

loculus

Forum User
Newbie
Registered: 07/01/05
Posts: 14
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.
 Quote

Status: offline

r_f_o_t

Forum User
Full Member
Registered: 07/30/03
Posts: 241
Location:Illinois
Try the FAQ Cannot modify header information - headers already sent by ... , which a search on the error message would have brought up for you.

HTH,

Chuck
Too many hands on my time.
 Quote

Status: offline

loculus

Forum User
Newbie
Registered: 07/01/05
Posts: 14
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.
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Quote by Tony: Maybe somebody has already done it but here is a PHP block for showing who's new on your site:

A minor modification / addition for Geeklog 1.4.0 and up to hide banned users from the block:

Text Formatted Code
$result = DB_query("SELECT uid,username,photo FROM {$_TABLES['users']} WHERE status <> 0 ORDER BY regdate DESC limit $numToShow");
 

bye, Dirk
 Quote

zephyr

Anonymous
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.

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 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?
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Check the usual: Make sure you've edited the right file, uploaded it again, and that the new code is between the &lt;?php ... ?&gt; tags.

bye, Dirk
 Quote

Status: offline

donm1021

Forum User
Chatty
Registered: 12/31/05
Posts: 56
Thanks!

They are now working
 Quote

Status: offline

Cobro

Forum User
Chatty
Registered: 03/17/06
Posts: 57
Location:Iceland
this dose not work for me ??
 Quote

Status: offline

::Ben

Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
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
I'm available to customise your themes or plugins for your Geeklog CMS
 Quote

Status: offline

nrvncanada

Forum User
Newbie
Registered: 11/27/09
Posts: 1
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.
 Quote

Lizard

Anonymous
: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.
 Quote

Status: offline

::Ben

Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
You may need a /images/smallcamera.gif file in your layout folder.

::Ben
I'm available to customise your themes or plugins for your Geeklog CMS
 Quote

Page navigation

All times are EST. The time is now 08:34 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