Developer forum

Forum » Templates » User custom fields by pageview

User custom fields by pageview

Ricardo Pereira
Reply

Hi guys,

Is possible get a customer field from the current user through the Pageview / Pageview.User?

 

Thank you,

Ricardo


Replies

 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer

No, create a User instance with the userid and get the custom fields from that object. Be aware of performance.

Votes for this answer: 1
 
Ricardo Pereira
Reply

The performance is the problem, I wanted to avoid extra calls.
Thank you Nicolai.

 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer

Use User.GetCurentUser() if it is the user, and cache what ever data you take from the custom field. Also I cannot imagine you need the data on every pageview, so just take it when needed.

Votes for this answer: 1
 
Ricardo Pereira
Reply

I was using User.GetUserByID.
Thank you Nicolai.

 

 

You must be logged in to post in the forum