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
Jan 31, 2012 - 6:42 am

Mr Papa said

yes.  Just place the custom profile field template tag in the theme template file where you want to display it... 

sp_CustomProfileFieldsDisplay($name, $userid=0);

where $name is the name of the custom profile field and pass the user who made the post, $spThisPost->user_id I think...

What template file it is?  It will get overwrited on a future update, right?  Do you plan to add more control from the Forum option to what Admins want to display about users on the left of evey post?

<---

 

It would be nice to havve toggles, I would toggle the Member since OFF, it takes 2 lines and I think if someone want to know, he could look at profile.  Also, a toggle for Show social icons and web site.  That's a suggestion for a later version.

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

template file depends on where you want it...  each template file is for a different page view type (ie group, forum, topic, etc)...

if you want it on the topic view, user post info, then it would be spTopicView.php

if you want to remove elements, just remove them from your theme... we are not going to provide switches for all display elements when they can simply be removed...  same for user post data, just add it to the template file...

Avatar
SPQC
Member
Free Members
sp_UserOfflineSmall Offline
Jan 31, 2012 - 7:52 pm

So I should look for spPostView?  What you're looking at right now are posts?

 

<--- I want to mod what is hown under the user name here.

 

With evey updates, it will get overwritten?  Yet no problem, it's the firn php file I plan to look at and possibly mod.  Save with or without BOM?

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Jan 31, 2012 - 7:57 pm

there is no spPostView... this page is a topic view, its a single topic displaying many posts... but its topic view...

BOM?

I understand where you want it...  and its in the spTopiView.php template file...  this where all that stuff is output:

                        sp_ColumnStart('tagClass=spUserSection spLeft&width=15%&height=50px');
                            sp_PostIndexUserDate('tagClass=spPostUserDate spCenter');
                            sp_UserAvatar('tagClass=spPostUserAvatar spCenter&context=user', $spThisPostUser);
                            sp_PostIndexUserName('tagClass=spPostUserName spCenter');
                            sp_PostIndexUserRank('tagClass=spPostUserRank spCenter');
                            sp_PostIndexUserSpecialRank('tagClass=spPostUserSpecialRank spCenter');
                            sp_PostIndexUserPosts('tagClass=spPostUserPosts spCenter', __sp('Forum Posts: %COUNT%'));
                            sp_PostIndexUserRegistered('tagClass=spPostUserRegistered spCenter', __sp('Member Since:<br /> %DATE%'));
                            sp_PostIndexUserStatus('tagClass=spCenter spPostUserStatus', __sp('Online'), __sp('Offline'));
                            sp_SectionStart('tagClass=spCenter', 'user-identities');
                                sp_PostIndexUserWebsite('', __sp('Visit my website'));
                                sp_PostIndexUserTwitter('', __sp('Follow me on Twitter'));
                                sp_PostIndexUserFacebook('', __sp('Connect with me on Facebook'));
                                sp_PostIndexUserMySpace('', __sp('See MySpace'));
                                sp_PostIndexUserLinkedIn('', __sp('My LinkedIn network'));
                                sp_PostIndexUserYouTube('', __sp('View my YouTube channel'));
                            sp_SectionEnd('', 'user-identities');
                        sp_ColumnEnd();

you can add, delete or modify whatever you want in there

Avatar
SPQC
Member
Free Members
sp_UserOfflineSmall Offline
Jan 31, 2012 - 8:36 pm

Ok I gave this a try and can't display the Custom field.  Let's say the custom field name is "Zip Code", I tried :

 

sp_CustomProfileFieldsDisplay('$Zip Code, $spThisPost->user_id spCenter');

sp_CustomProfileFieldsDisplay('Zip Code, $spThisPost->user_id spCenter');

 

Maybe the space is the problem?  Was surprised there wasn't a slug name for it.

Sorry if I look like a noob here...  confused 

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Jan 31, 2012 - 9:01 pm

sp_CustomProfileFieldsDisplay('Zip Code', $spThisPost->user_id);

assuming the custom profile field is name Zip Code

Avatar
SPQC
Member
Free Members
sp_UserOfflineSmall Offline
Jan 31, 2012 - 9:31 pm

Ok got it but this does not output the Custom field name so I tried to add it by looking at other lines around and tried this :

 

__sp('Zip Code :<br />');

sp_CustomProfileFieldsDisplay('Zip Code', $spThisPost->user_id);

 

But Zip Code text does not show up.  I will also ask right away that I want to center all this, just like the Member since line and I would guess 'spCenter' is needed somwhere?

 

Finally,  I tried looking at it with Firebug because the text is too big and had hope to find how to set the size but I can't target it like other lines, I only get a big box when I hover it.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Jan 31, 2012 - 10:38 pm

of course all the users have to fill in the zip code on their sp profile form...

you can simply do:

echo '<div class="spCenter">Zip Code:<br />';

of course, div could be p, span or any other html element...

and make sure Zip Code including case matches the name you entered on the custom profile fields admin panel...

Avatar
SPQC
Member
Free Members
sp_UserOfflineSmall Offline
Feb 1, 2012 - 9:54 pm

Finally got it to work!  And now I'm trying to not show it if it's empty and I'm almost there but there is something wrong.

 

if (sp_CustomProfileFieldsDisplay('Code ami ', $spThisPost->user_id)) {
                                echo '<p style="font-size: 80%;" class="spCenter">Zip Code : ';
                                sp_CustomProfileFieldsDisplay('Zip Code', $spThisPost->user_id);
                                echo '</p>';
                                }

Before adding the if statement, the echo was showing, now it does not.

Avatar
VikingBrent
Guest
Guests
Feb 2, 2012 - 5:06 am

I've got something working, though I'm very much a php novice so someone else may have a more elegant solution to suggest. Here's my code:

 

#Start buffer to capture output of sp_CustomProfileFieldsDisplay function

ob_start(); 

#execute the function

sp_CustomProfileFieldsDisplay('Zip Code', $spThisPost->user_id); 

#assign the function output to a variable

$zip_code = ob_get_contents(); 

#dump the buffer

ob_end_clean(); 

 

# Use isset to check if the contents of the variable are blank; if not echo variable, else echo error message (or anything else)

if (isset($zip_code['Zip Code'])) {

echo '

';

echo $zip_code;

echo '';

}

else {

echo "No zip code found";

}

 

I've been trying to do something very similar to SPQC, so many thanks to the helpful insight in this thread; its helped enormously. 

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: 619
Members: 17362
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625