Finally! In post 15 I was close, I said that I was surprised there wasn’t a slug name for every custom field while in fact you telling that there is really one but it’s hidden!
Support Forum
Thank you!
$spThisPostUser->cutomfieldslug was the solution to all the issues I’d been having. I’ve been able to finish my code and have it running as a custom function within my theme that acts as an extension of the existing profile identities . Here’s a preview of it in action on my local install:
One other issue that I was able to address was the output of $spThisPostUser->cutomfieldslug being wrapped in <p></p> tags. In my custom function I used strip_tags to sanitize the variable so I could pass it as a tooltip for the custom images appearing below the avatar but also into a url so the images link to that member’s profile on the appropriate gaming network.
So, the final function looks something like this:
function spSteam() {
global $spThisPost, $spThisPostUser;
$spThisPostUser->steamid = strip_tags($spThisPostUser->steamid);
if (!empty($spThisPostUser->steamid)) echo “<a id=’steamid’ class=’steam-class game-id vtip spImg’ href=’http://steamcommunity.com/id/$spThisPostUser->steamid’ title=’$spThisPostUser->steamid on Steam’><img src='”.SPTHEMEICONS.”sp_Steam.png’/></a>”;
}
Thanks everyone for the input, I’m delighted to finally have completed work on my first custom theme!
well of course, you do not have to use the custom field slug, but if you do know it, you can short circuit the use of the template tag WHEN you have a user class object available…
What I can do though is add a column display of the field slug on the admin page… so its easier to know what it is when using the user object…
Mr Papa said
What I can do though is add a column display of the field slug on the admin page… so its easier to know what it is when using the user object…
Exactly what I was trying to say… in many other panel we see the slug so I was suprised to NOT find it when I installed that plugin. I think this could help a few in the later run…
no surprise… was never used before the 5.0 plugin… so its a new ability to actually use it…
changes have already been committed…
I have a custom profile field “gps” and this in my “spTopicView.php”:
sp_CustomProfileFieldsDisplay(‘gps’, $spThisPost->user_id);
But it shows nothing on the site…
you will have to provide more info then… cause that is how it works… just tested it too…
make sure the name is right, case and all… screenshot of custom profile admin panel?
and you are looking on topic view since you changed spTopicView.php, right?
you might go to forum – toolbox – data inspector and for the topic view, turn on the spThisPostUser data and then look at the output in blue for the user in question and see if its in the list…
OK here it is.
In the file “spTopicView.php”:
sp_CustomProfileFieldsDisplay(‘gps’, $spThisPost->user_id);
————————————–
In “Profiles – Custom Profile Fields”:
NAME: GPS | SLUG: gps
You need to carefully read what we said…
its $spThisPostUser->user_id and not what you have…
and its GPS not gps…
sp_CustomProfileFieldsDisplay(‘GPS’, $spThisPostUser->user_id);
Yes, and thank you
However, I can not customize the font size so it fits with the other lines ![]()
you will have to style it… cant tell from an image…
if you need to get at specific styling, around the template tag you could add something like
echo "<div class='my-custom-profile'>";
sp_CustomProfileFieldsDisplay('GPS', $spThisPostUser->user_id);
echo "</div>";
and then style that class…




