Gossamer Forum
Home : Products : Others : Gossamer Community :

Sharing Creation Date with Links SQL

Quote Reply
Sharing Creation Date with Links SQL
I'm beating myself on the head over this, but I can't seem to find where I can link the internally produced Creation Date timestamp (indicating the date a user account was created) to a field in the Users table of Links SQL.

I can link fields I create, but none of the system fields.

Any thoughts on this? I need to have the account creation date recorded in the Links SQL Users table for easy reference.

Alan Frayer
Don't just read the news - make the news!
Your World News - http://yourworldnews.frayernet.com
Quote Reply
Re: [afrayer] Sharing Creation Date with Links SQL In reply to
User creation time? You could do this using new GT::SQL /path/to/admin;

If this is what you want, I can provide some working code, that we use on our site, to connect between GComm and LSQL (works quite well =)).

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Sharing Creation Date with Links SQL In reply to
In Reply To:
User creation time? You could do this using new GT::SQL /path/to/admin;

If this is what you want, I can provide some working code, that we use on our site, to connect between GComm and LSQL (works quite well =)).

Cheers
Not yet really familiar with GT::SQL /path/to/admin; I'll be happy to look at (and possibly try) the code. Just be sure to give my novice self some explanation on what to do with it, as most of this Perl stuff is still over my head (I'm learning it as fast as I can)!

Alan Frayer
Don't just read the news - make the news!
Your World News - http://yourworldnews.frayernet.com
Quote Reply
Re: [afrayer] Sharing Creation Date with Links SQL In reply to
Something like this should work :)

Code:
sub {

my $db = new GT::SQL '/full/path/to/cgi-bin/admin/defs';
$db->set_connect ({
driver => "mysql",
host => 'localhost',
#port => 3243,
database => 'DBNAME',
login => 'DBUSER',
password => 'DBPASS'
}) || die $GT::SQL::error;

$db->prefix('comm_');

# do whatever you need to do here .. .
# same as a normal GT::SQL object....

return \$users_table;

}

Wish I had a bit more time to help out ... .Basically, all you need to do, is something like;

my $value = $db->table('Users')->select( ['FieldToGrab'], { comm_username => 'foobar' )->fetchrow;


Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Sharing Creation Date with Links SQL In reply to
Interesting... but Greek to me without context... Is the large chunk of code a global inder Community? If so, what should I name it? If not, where does it go?

And the small length of code goes in a template where I want to use the information (Links SQL)? Or in Community somewhere?

I'm sorry to be such a pain!

Alan Frayer
Don't just read the news - make the news!
Your World News - http://yourworldnews.frayernet.com
Quote Reply
Re: [afrayer] Sharing Creation Date with Links SQL In reply to
Try something like this;

Code:
sub {

use GT::Date;
my $user = $_[0];

my $db = new GT::SQL '/full/path/to/cgi-bin/admin/defs';
$db->set_connect ({
driver => "mysql",
host => 'localhost',
#port => 3243,
database => 'DBNAME',
login => 'DBUSER',
password => 'DBPASS'
}) || die $GT::SQL::error;

$db->prefix('comm_');

my $value = $db->table('users')->select( ['comm_created'], { comm_username => $user )->fetchrow
return GT::Date::date_get date_get_gm($value);

}

Call with: <%global_name('User_to_Find_Creation')%>.

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!