Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

MetaModding with User Profile

MetaModding with User Profile

Joomla 2.5.3
Metamod 3.9

Hi MetaModders,

I've searched the forums and this thread http://www.metamodpro.com/forums/topic?id=478 is the closest I could find but it doesn't quite answer my question.


I have created a new Joomla User Profile plugin to include a selection of interests, and further user details like address etc. (see here: http://docs.joomla.org/Creating_a_profile_plugin

I'd like to be able to include modules based on those extra details.

Can help mo on how to call in my new fields?

Thank you in advance!

igolfniray
Beginner Modder
ranks
useravatar
Offline
16 Posts
Administrator has disabled public posting

Re: MetaModding with User Profile

Unfortunately the values do not show up automatically in the $user object. So you can use the following to query on a particular field in the additional profile plugin:

if ($user->id > 0) {
  $query = "select profile_value from #__user_profiles where profile_key = 'profile.city' and user_id = " . (int)$user->id;
  $db->setQuery($query);
  $result = $db->loadResult();
  if ($result == "Tokyo") return XXX;
}

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3328 Posts
User info in posts
Administrator has disabled public posting

Re: MetaModding with User Profile

Do I need "#" with my database prefix or does # cover whatever the prefix is?

Sorry if this a stupid question Stephen, it's just that I'm not familiar with SQL queries.


I'm asking because I'm trying lots of different values and nothings happening.


I'm pulling my hair out a bit with this site because I've inherited it from a Dev who recklessly hacked the core like a machete wielding maniac and I'm trying to use Metamod to do what his old hacks did.

igolfniray
Beginner Modder
ranks
useravatar
Offline
16 Posts
Administrator has disabled public posting

Re: MetaModding with User Profile

Hi,

the #_ gets replaced with the database prefix automatically.

I'd suggest that you take a look at the (prefix)_user_profiles table in your database and double check what the profile_key and profile_value values are that you're relying on. "profile.city" is one of the keys in the Joomla-supplied user plugin, but yours may be different.

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3328 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1679
Total Polls:
6
Total Posts:
5933
Total Posts Today:
2
User Info:
 
Total Users:
4367
Newest User:
dixon45621
Members Online:
3
Guests Online:
239


Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked