Gossamer Forum
Home : Products : Others : Gossamer Community :

Access data from profile

Quote Reply
Access data from profile
How can you access information from the profile from other applications?

Ex: I want to pull in the users telephone number in a LinksSQL detail page.

Do I load the Community plugin ? how and with which parameters?

Klaus

http://www.ameinfo.com
Quote Reply
Re: [klauslovgreen] Access data from profile In reply to
You could make a global 'get_community_profile($user)':
Code:
sub {
my $user = shift;
return unless $user;
my $cfg = Links::Plugins->get_plugin_user_cfg('Auth_Community');
lib->import($cfg->{community_private} . '/lib');
require Community;
Community->import(qw/comm_init comm_get_profile/);
comm_init($cfg->{community_private});
retrurn comm_get_profile($user);
}
This should give you all the fields in the users profile.

This is untested code.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Access data from profile In reply to
Hi Ivan,

I tried with the global and called it:
get_community_profile

then used <%get_community_profile($user)%> at the top of the page I wanted to include the information on..

Then I tried to insert ex <%prof_first_name%> - but it is unknown..?

What am I doing wrong?

http://www.ameinfo.com
Quote Reply
Re: [klauslovgreen] Access data from profile In reply to
You probably need to call it as <%get_community_profile($LinkOwner)%>, or something like that. Use <%GT::Template::dump%> to see what tags are available and what they contain.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Access data from profile In reply to
Tried that - in dump there are no community fields at all..

Any ideas?

Klaus

http://www.ameinfo.com
Quote Reply
Re: [klauslovgreen] Access data from profile In reply to
I tested it, and it works here. Make sure that the user exists with that username in the Community database.

Other than that, I don't know.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [klauslovgreen] Access data from profile In reply to
Got it - was a typo in the global..

Thanks Ivan
Klaus

http://www.ameinfo.com
Quote Reply
Re: [yogi] Access data from profile In reply to
That code should be a lot cleaner. I'll look at adding a function to each plugin so that you can just do:

<%Plugins::Auth_Community::get_profile%>

if called with no arguments, looks for $tags->{Username}, if called with an argument, will look up that user's profile.

Cheers,

Alex
--
Gossamer Threads Inc.