Support Forum
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.
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...
Visit Cruise Talk Central and Mr Papa's World
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?
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
Visit Cruise Talk Central and Mr Papa's World
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...
sp_CustomProfileFieldsDisplay('Zip Code', $spThisPost->user_id);
assuming the custom profile field is name Zip Code
Visit Cruise Talk Central and Mr Papa's World
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.
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...
Visit Cruise Talk Central and Mr Papa's World
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.
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.
1 Guest(s)