• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.5 For cycle question and username colour

#1
Hello,

I have a few questions about Xenforo 1.5 code part.

1) Is there a way to directly call the colour property of the username of some user for example user with id .colour

I am asking that cause i wanna let each person choose a colour without needing to be in certain group since i use group priorities for user titles already

2) How can i call the value of a custom user field so i can for example check if it's value is equal to something and do something if it is or to directly replace the text of it for example for the colour prop (if i can call that prop)

3) Is there "FOR" cycle in xenforo and if it is what is it's write up

I wanna do somethnig of sort

For (int i = 1, i < 100 , i++)
{
if (user in group with id i) then
user.title = src="../resources/folderName/i.png"
}

I checked the custom user field help page already, but didn't exactly get the idea of how to call it's value somewhere so i can use it to check or fill a field

Thanks before hand for the answer.
 

Mike

XenForo developer
Staff member
#3
1. As in user name CSS? No, this is only stored as CSS.

2. The context varies, but you may want to use something along the lines of (in a template) {$user.customFields.field_name}. You can use the {xen:helper dump, $var} tool to allow you to inspect what's in a variable.

3. I don't really follow. If it's PHP, then it's just PHP. If it's in a template, then you would generally need something to loop through but there are plenty of examples of this in templates.
 
#4
3. I don't really follow. If it's PHP, then it's just PHP. If it's in a template, then you would generally need something to loop through but there are plenty of examples of this in templates.
Yeah it was about in the template. What i saw for examples around the templates were foreach cycles only maybe i have missed if there were others.