Gossamer Forum
Home : Products : Gossamer Forum : Development, Plugins and Globals :

is there tag like newest_user?

Quote Reply
is there tag like newest_user?
Hi 2 all,

I played a little with GForum and i looked for a stat like "newest_user", like i saw implemented in ikonboard, vbulletin ... and many other forums.

Also tryed to implement in globals like "total_threads" but it seems not easy to do outside GT modules.

rgrdz
Quote Reply
Re: [zaaron] is there tag like newest_user? In reply to
Its very easy to do.

Do you want a global or something for a non-forum page?
Quote Reply
Re: [Paul] is there tag like newest_user? In reply to
Yes ... ;)

I mean global, not a value to use outside. For that played with globals.txt but a little confuzed with GT::SQL codes :(

rgrdz

zaaron

---------
GetLokal Reviews
Quote Reply
Re: [zaaron] is there tag like newest_user? In reply to
You don't touch globals.txt....you use the globals option in the control panel.

eg...

Code:
sub {
my $table = $DB->table('User');
$table->select_options("ORDER BY user_registered DESC", "LIMIT 1");
return $table->select( 'user_username' )->fetchrow;
}

That should give you the newest user.
Quote Reply
Re: [Paul] is there tag like newest_user? In reply to
Hmmmm ... i tryed same like this Frown

But i forgot about fetchrow at the end Blush

10nx Paul it works fine.

zaaron

---------
GetLokal Reviews
Quote Reply
Re: [Paul] is there tag like newest_user? In reply to
Paul I assume this is in Global variables - but which one.

Wayne
Quote Reply
Re: [balita] is there tag like newest_user? In reply to
You can create a new global like "newest_user", and put the following content into it:
Code:
sub {
my $table = $DB->table('User');
$table->select_options("ORDER BY user_registered DESC", "LIMIT 1");
return $table->select( 'user_username' )->fetchrow;
}

Then place the <%newest_user%> tag into the template you want to display.
That's all. Good luck!

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] is there tag like newest_user? In reply to
Many thanks ... it's very easy when you it is explained.

Wayne
Quote Reply
Re: [webmaster33] is there tag like newest_user? In reply to
To use this outside of the forum - say on your homepage, you need to make an action.

1) You need to place a template file in TEMPLATES/DEFAULT

Here is my template:

newest_user.html

<html>
<head>
<%include include_css.html%>
</head>
<%body_tag%>

<%body_table%>
<table cellspacing="0" border="0" width="100%">
<tr><td><B>Our newest member is: <%newest_user%></B></td></tr>
<%/body_table%>
</body>
</html>



2) Through the Admin Panel

----------- click setup

-----------click ACTIONS

-----------click ADD ACTION (I called my display_newest_user)

-----------Insert the name of the template file in field called PAGE

Here is my SSI: <!--#include virtual="/cgi-bin/forum/gforum.cgi?do=display_newest_user"-->



Thanks yogi for pointing me in the right direction...

Last edited by:

shiner: Jun 3, 2002, 1:43 PM
Quote Reply
Re: [Paul] is there tag like newest_user? In reply to
In Reply To:
You don't touch globals.txt....you use the globals option in the control panel.

eg...

Code:
sub {
my $table = $DB->table('User');
$table->select_options("ORDER BY user_registered DESC", "LIMIT 1");
return $table->select( 'user_username' )->fetchrow;
}

That should give you the newest user.

Hello

what ist the sub for the last ten users ?


my global dosent work

Code:
sub { my $tags = shift;my $user_db = $DB->table('User');
$user_db->select_options("ORDER BY user_registered DESC', 'LIMIT 10');
my $sth = $user_db->select;my @output;
while (my $user = $sth->fetchrow_hashref) {push @output, $user;}
return { user_loop => \@output };}


Whats the Reason?

mfg hoefti
linktobuy Web Directory
Ratgeber Recht

Last edited by:

hoefti: Oct 5, 2002, 8:06 AM
Quote Reply
Re: [hoefti] is there tag like newest_user? In reply to
Please can you give more details. Why doesn't it work, what happens, what template tags are you trying to use to display the users?
Quote Reply
Re: [Paul] is there tag like newest_user? In reply to
Hello Paul

Its does not matter in what template i use the global

When i add the global the forum leave blank and shows me a white Site
i call the global new-user-top-ten
but i doesn't put <%new-user-top-ten%> in a template an the forum dosent show me any Site.

mfg hoefti
linktobuy Web Directory
Ratgeber Recht
Quote Reply
Re: [hoefti] is there tag like newest_user? In reply to
Try renaming the tag to:

new_user_top_ten

However the global is setting a loop tag so simply putting the tag name in your template won't work. You need:

Code:
<%new_user_top_ten%>

<%loop user_loop%>
<%Username%><br>
<%endloop%>

Last edited by:

Paul: Oct 5, 2002, 8:35 AM
Quote Reply
Re: [Paul] is there tag like newest_user? In reply to
Hello Paul

i understand you, thanks.
But when i save the globag
new_user_top_ten

i cant see my Forum its a blank Site

Why ?

mfg hoefti
linktobuy Web Directory
Ratgeber Recht