Gossamer Forum
Home : Products : Others : Gossamer Community :

Displaying user profile data in dbman SQL

Quote Reply
Displaying user profile data in dbman SQL
I would like to display data from the community profile, in my dbman sql 2.0. I have it working properly with Community, but can't figure this out. I found this code on the forums, but it just returns an error when I put it in one of my dbman sql templates:

<%Plugins::Auth_Community::get_profile%> - imports the user profile data as template tags, then:
<%prof_city%> - displays city data from the user's profile
<%comm_username%> - displays username from the user's profile

Is this the right code to make this work? Any help would be greatly appreciated. Thanks
Quote Reply
Re: [Dempsey] Displaying user profile data in dbman SQL In reply to
Hi,

Mmm.. I've never had anyt luck with the built in function for "loading" the profile. I don't use DBMan, but something like this should work:

get_gcomm_profile
Code:
sub {

my $user = $_[0];

my $cfg = DBMan::Plugins->get_plugin_user_cfg('Auth_Community');

my $NEWDB = new GT::SQL (
def_path => "$cfg->{community_private}/defs",
cache => 0,
debug => 0,
subclass => 1
);


require GT::SQL::Condition;
my $db = $NEWDB->table('comm_users');

return $db->select( { comm_username => $user } )->fetchrow_hashref;

}
...then call with:

<%get_gcomm_profile($USERNAME)%> - where $USERNAME is the one you wanna load.

The bit in red may need changing - cos I don't actually know where the equivelant of Links::Plugins is stored =))

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!