Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
plugins-topic
Custom Profile Field
Avatar
SPQC
Member
Free Members
sp_UserOfflineSmall Offline
Feb 3, 2012 - 8:40 am

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!

Avatar
VikingBrent
Rookie
Free Members
sp_UserOfflineSmall Offline
Feb 3, 2012 - 9:13 am

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:

Screen-shot-2012-02-03-at-10.02.40-AM.png

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!

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Feb 3, 2012 - 8:11 pm

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...

Avatar
SPQC
Member
Free Members
sp_UserOfflineSmall Offline
Feb 3, 2012 - 8:28 pm

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...

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Feb 3, 2012 - 8:33 pm

no surprise... was never used before the 5.0 plugin... so its a new ability to actually use it...

changes have already been committed...

Avatar
Ivan Fræer
Member
Free Members
sp_UserOfflineSmall Offline
Mar 3, 2012 - 12:59 pm

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...

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Mar 3, 2012 - 7:30 pm

how about $spThisPostUser->user_id???

Avatar
Ivan Fræer
Member
Free Members
sp_UserOfflineSmall Offline
Mar 3, 2012 - 7:40 pm

No, unfortunately, does nothing

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Mar 3, 2012 - 7:54 pm

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...

Avatar
Ivan Fræer
Member
Free Members
sp_UserOfflineSmall Offline
Mar 3, 2012 - 8:01 pm

OK here it is.

In the file "spTopicView.php":
sp_CustomProfileFieldsDisplay('gps', $spThisPost->user_id);

Snap1.gifImage Enlarger

 

--------------------------------------

 

In "Profiles - Custom Profile Fields":
NAME: GPS | SLUG: gps

 

Snap2.gifImage Enlarger

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 620
Members: 17366
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10128
Posts: 79626