Support

  1. Tony85
  2. Support
  3. Saturday, September 10 2016, 05:43 PM
Hello Support,
I need some help.
Easy Profile allow to create many different custom fields, to use in registration forms.
Very nice. But....
I need to 'extract' from user profile (when he logged to the site) its information to use in some html code.
Usually, I create a new variable where I store user array using Joomla command:

$user = JFactory::getUser();

Doing this, I dump content of this array to get value of a custom field I created (my-custom-lastname field), but I don't see any of the custom fields I make.
I see only core Joomla fields!
Because I can always know user_id through command:

$user_id=var_dump(JFactory::getUser()->get('id'));

How Can I subsequently get all custom fields I created?
Thanks!!
Accepted Answer
admin Accepted Answer
Admin
So, it's working!!
But this point break the code (page is not loaded at all):
....code...
I tried to put $author_id with "", or '' or without quotes, but I always get the page break!
Mmmm.. I'm getting angry :angry: :angry: :dry:


As I said the correct function is "getValue" and not "get"

Still, you need to use integer for ID, so remove "" or ''

NOTE:
the code below not make sense, you already have ID of user and it is $item->created_by
$author = JFactory::getUser( $item->created_by ); //get 'object' author of the event
$author_id =$author->get( 'id' ); //<-this should give me author ID
  1. more than a month ago
  2. Support
  3. # Permalink
Tony85 Accepted Answer
Basic
Content Protected
  1. more than a month ago
  2. Support
  3. # 1
Tony85 Accepted Answer
Basic
Content Protected
  1. more than a month ago
  2. Support
  3. # 2
Tony85 Accepted Answer
Basic
The problem is here:
$author= JFactory::getUser($item->created_by); //get 'object' author of the event
$author_id=$author->get('id'); //<-this should give me author ID

If I simply print:
echo ("Author ID is: ".$author_id);

I get:
Author ID is: 158.
So, it's working!!
But this point break the code (page is not loaded at all):
$surname=JsnHelper::getUser("$author_id")->get('custom_lastname'); //retrieve custom last_name field

I tried to put $author_id with "", or '' or without quotes, but I always get the page break!
Mmmm.. I'm getting angry :angry: :angry: :dry:
  1. more than a month ago
  2. Support
  3. # 3
admin Accepted Answer
Admin
Hi
$author_id=$author->getValue('id');

Is $author var an object of type JsnUser? if not getValue function will not works.

$author_id=JFactory::getUser("$author")->getValue('id');

This do not make a sense, JFactory::getUser() accept ID of user as parameter, you pass as parameter $author, so I assume that $author is already ID of user.

Main question are: what is $author var? how to get user ID from $author?
  1. more than a month ago
  2. Support
  3. # 4
Tony85 Accepted Answer
Basic
Content Protected
  1. more than a month ago
  2. Support
  3. # 5
admin Accepted Answer
Admin
Hi,
sorry for late reply, it's a weekend for us.

function is $user->getValue not $user->get
  1. more than a month ago
  2. Support
  3. # 6
Tony85 Accepted Answer
Basic
Content Protected
  1. more than a month ago
  2. Support
  3. # 7
admin Accepted Answer
Admin
Hi,
sorry for late reply, it's a weekend for us, try to docs at http://docs.easy-profile.com/index.php/article/jsnuser-object ;)
  1. more than a month ago
  2. Support
  3. # 8
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Request Support

Support is currently Offline

Support Availability

Working days: Monday to Friday. The support staff is not available on weekends; in the most of cases tickets will not be answered during that time.

Reply time: Depending on the complexity of your support issue it's usually between a few minutes and 24 hours for paid members and about one week for free members. When we expect longer delays we will notify you.

Guidelines

Before you post: read the documentation and search the forums for an answer to your question.

When you post: include Site Details if you request a support (you can use the form below the reply in Site Details tab).

Auto Solved Question: If after a week the author of the post does not reply to a request by moderator, the question will be marked as resolved.

Language: only English

Search Users

Easy Profile® is not affiliated with or endorsed by Open Source Matters or the Joomla Project. Joomla is Free Software released under the GNU/GPL License.