News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Adding more info under number of posts area

Started by Malibuz0r, August 29, 2012, 01:34:25 PM

Previous topic - Next topic

Malibuz0r


As you can see there, I would like to add custom lines below the "Posts" line. Where can I edit this?

Thanks.

All Colours Sam

Does this custom lines would be filled by users themselves?  if so, there is the custom profile fields.
Oh, wouldn't it be great if I *was* crazy? ...then the world would be okay
Suki

Malibuz0r

No, I will "hard code" the fields so it will be shown for everyone.

All Colours Sam

So, does this field will be the same for every user?

If so, you will have to edit your theme's Display.template.php file, this is the post line on the default theme:


// Show how many posts they have made.
if (!isset($context['disabled_fields']['posts']))
echo '
<li class="postcount">', $txt['member_postcount'], ': ', $message['member']['posts'], '</li>';


just add yours below:


// Show how many posts they have made.
if (!isset($context['disabled_fields']['posts']))
echo '
<li class="postcount">', $txt['member_postcount'], ': ', $message['member']['posts'], '</li>';

/* My custom hard-coded field */
echo '
<li class="hardcoded_field">something here</li>';



replace "something here"  with whatever you want to appear
Oh, wouldn't it be great if I *was* crazy? ...then the world would be okay
Suki

Malibuz0r

Thank you so much, just what I needed. Just one last question:

"$txt['member_postcount'], ': ', $message['member']['posts']"

How does the script know what "$txt['member_postcount']" is? Is it defined somewhere?

All Colours Sam

Yes it is a text string and is defined on the language  files located at /Themes/default/languages/

That particular string is located at the index.yourlanguage..php  where yourlanguage is the actual language you are using, most likely "english", so index.english.php
Oh, wouldn't it be great if I *was* crazy? ...then the world would be okay
Suki

Malibuz0r


Advertisement: