I create some custom user profile fields, I just create a edit user profile plugin (adding the fields in profile.xml etc). Now when I create a user or edit it, I have classic profile fields(city, addres etc..) and my own fields.
I create user profile page that display all the fields, but I’d like to edit this page. I’d like display only my fields or add some css class etc..
How can I edit it? Where can i found it?
In another way I create another page, with a php plugin I can add some code. How can I access to my custom fields?
I tryed with
http://docs.joomla.org/Accessing_the_current_user_object
but I can only access to the default fields.
Does anyone know how to access these variables?
ps this is what I write in my article with php:
$user =& JFactory::getUser();
$userId = $user->id;
$db = &JFactory::getDbo();
$db->setQuery(
'SELECT * FROM phs_user_profiles WHERE user_id = '.$userId.' AND profile_key LIKE \'myfilevalue1.%\''
);
$results = $db->loadAssocList();
if($results) echo $results[0]['profile_value'];
else echo "dont work";
it display “dont work” 🙁
what’s wrong with this code?
A simple way you need to edit com_users view (profile) and in the profile view you can access user on this by :-
also check the link http://docs.joomla.org/Accessing_the_database_using_JDatabase