News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Adding a Button or Badge to Profile Field in Profile Area

Started by br360, April 20, 2014, 06:54:06 PM

Previous topic - Next topic

br360

I was able to add an image for my custom profile fields which is visible when viewing all of my posts, and also when someone gets a pm from me. The issue that I have is that since I decided to make the links in my profile field white, it isn't showing when someone is looking at my profile. The changes I made to get the image were done in the display and personal messages templates- but I can't seem to find where to change the profile template to have the same image there.

Here are some images that hopefully will explain it better.

This is what is seen in all of my posts and pm's to members-



This is what is shown in my profile that I would like to be able to add the same image to, because it's not visible with the white text-




margarett

That section is really Profile.template.php
// This template displays users details without any option to edit them.
function template_summary()
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

br360

Thanks Margarett. That's actually the area I was trying to edit. I found this code which I'm guessing is what needs to be changed-

// Are there any custom profile fields for the summary?
if (!empty($context['custom_fields']))
{
foreach ($context['custom_fields'] as $field)
if (($field['placement'] == 1 || empty($field['output_html'])) && !empty($field['value']))
echo '
                                        <li class="custom_field">', $field['output_html'], '</li>';


I tried changing the  class="custom_field" to my image name (like I did with the other edits) and nothing is changing. If I try to add this code before or after, I am getting template parse errors.

background: white url(../images/nav.png) no-repeat;

mashby

Where are you trying to add that code? I am hoping it's in a CSS file, not a template file. :)
Always be a little kinder than necessary.
- James M. Barrie

br360

Yes, it is in a css file. Basically what I did was use Joker's vbulletin mod and pretty much gut about 90% of it out. His mod- http://custom.simplemachines.org/mods/index.php?mod=2524

Here is the css code which I added to and changed some things around-

/* VB Style User Profile In Posts */
.rc5 {

        background: white url(../images/nav.png) no-repeat;

border-top;color: black .1px solid;
        border-left: 1px solid;
border-right: 1px solid;
        border-bottom: 2px solid;
        padding: 2px;
text-align: center;
        height: 19px;
width:109px;
        color: white;


then in the display and personal message templates, I changed this-

<li class="custom">', $custom['title'], ': ', $custom['value'], '</li>';

to this-

<li class="rc5">', $custom['title'], ': ', $custom['value'], '</li>';

mashby

Hey, I'm drunk in NYC, so I might not be following along as well as if I were at home, so my question is this. Is this bit of code what you are adding?
// Are there any custom profile fields for the summary?
if (!empty($context['custom_fields']))
{
foreach ($context['custom_fields'] as $field)
if (($field['placement'] == 1 || empty($field['output_html'])) && !empty($field['value']))
echo '
                                        <li class="custom_field">', $field['output_html'], '</li>';

I am hoping there is more to it than that as you have left that whole custom profile field unfinished. I'm not entirely sure what you're trying to achieve, but I can see this bit as being a bit troublesome:
border-top;color: black .1px solid;
Maybe try this?
border-top:black .1px solid;
Always be a little kinder than necessary.
- James M. Barrie

br360

Drunk in NY sounds like fun. ;)

The first code in your post is what is in the template by default. All I tried to do was change this part-

<li class="custom_field">', $field['output_html'], '</li>';

to this-

<li class="rc5">', $field['output_html'], '</li>';

as that was really the only change that was needed in getting the image/button to display in both my posts and my pm's. Changing that however didn't change the profile part in my profile; which is what I was hoping for as I changed the text in the profile button to white- and it doesn't show well enough in my profile.

I think the second part of the code you posted, would just change the border- and to be honest- I don't even think I need any of the border code I'm using in the css at all; as it doesn't even appear with the image I am using.

Advertisement: