Creator Name
- Tuan Pham Ngoc
- Offline
- Administrator
-
Less
More
8 years 10 months ago #87023
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Creator Name
Try something like this (I don't have Easy Profile installed on my computer to check)
Code:
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('*')
->from('#__jsn_users')
->where('id=' . $item->created_by);
$db->setQuery($query);
$profile = $db->loadObject();
if ($profile)
{
echo $profile->custom_lastname;
}
Please Log in or Create an account to join the conversation.
- Antonello Mancuso
-
Topic Author
- Offline
- Junior Member
-
Less
More
- Posts: 27
- Thank you received: 0
8 years 10 months ago #87028
by Antonello Mancuso
Eng. Antonello Mancuso
Replied by Antonello Mancuso on topic Creator Name
It seems I have an error feeding JsnHelper::getUser with $author_id
If I write:
it works like a charm!
Instead... if I put inside getUser $author_id:
it doesn't work.
Writing on Easy Profile support, they told me that:
"function is $user->getValue not $user->get"
But I haven't understand if I have to apply this to $author_id:
or later to JsnHelper::getUser.
I'll do some trials... if I cannot get the solution, I'll work on your DB get query code.
If I write:
Code:
$surname=JsnHelper::getUser(158)->get('custom_lastname'); //retrieve custom last_name field
Instead... if I put inside getUser $author_id:
Code:
$surname=JsnHelper::getUser("$author_id")->get('custom_lastname'); //retrieve custom last_name field
Writing on Easy Profile support, they told me that:
"function is $user->getValue not $user->get"
But I haven't understand if I have to apply this to $author_id:
Code:
$author_id=$author->getValue('id'); // get author id
I'll do some trials... if I cannot get the solution, I'll work on your DB get query code.
Eng. Antonello Mancuso
Please Log in or Create an account to join the conversation.
- Antonello Mancuso
-
Topic Author
- Offline
- Junior Member
-
Less
More
- Posts: 27
- Thank you received: 0
8 years 10 months ago #87032
by Antonello Mancuso
Eng. Antonello Mancuso
Replied by Antonello Mancuso on topic Creator Name
The problem is here:
If I simply print:
I get:
Author ID is: 158.
So, it's working!!
But this point break the code (page is not loaded at all):
I tried to put $author_id with "", or '' or without quotes, but I always get the page break!
Mmmm.. I'm getting angry
:dry:
Code:
$author= JFactory::getUser($item->created_by); //get 'object' author of the event
$author_id=$author->get('id'); //<-this should give me author ID
Code:
echo ("Author ID is: ".$author_id);
Author ID is: 158.
So, it's working!!
But this point break the code (page is not loaded at all):
Code:
$surname=JsnHelper::getUser("$author_id")->get('custom_lastname'); //retrieve custom last_name field
Mmmm.. I'm getting angry


Eng. Antonello Mancuso
Please Log in or Create an account to join the conversation.
- Antonello Mancuso
-
Topic Author
- Offline
- Junior Member
-
Less
More
- Posts: 27
- Thank you received: 0
8 years 10 months ago #87034
by Antonello Mancuso
Eng. Antonello Mancuso
Replied by Antonello Mancuso on topic Creator Name
OK, solved!
The right code is:
However, I noticed only now that $item->created_by gives me immediately author ID, so also:
works pretty good.
Thanks to everybody and let's mark this topic as SOLVED!!
The right code is:
Code:
$surname=JsnHelper::getUser($author_id)->get('custom_lastname'); //retrieve custom last_name field
Code:
$surname=JsnHelper::getUser($item->created_by)->get('custom_lastname'); //retrieve custom last_name field
Thanks to everybody and let's mark this topic as SOLVED!!
Eng. Antonello Mancuso
Please Log in or Create an account to join the conversation.
Moderators: Tuan Pham Ngoc
Support
Documentation
Information
Copyright © 2025 Joomla Extensions by Joomdonation. All Rights Reserved.
joomdonation.com is not affiliated with or endorsed by the Joomla! Project or Open Source Matters.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.