Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: Malibuz0r on August 29, 2012, 01:34:25 PM

Title: Adding more info under number of posts area
Post by: Malibuz0r on August 29, 2012, 01:34:25 PM
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi47.tinypic.com%2Fejfr54.png&hash=838f3151b880e08f2c10f3543adccb55070a476a)
As you can see there, I would like to add custom lines below the "Posts" line. Where can I edit this?

Thanks.
Title: Re: Adding more info under number of posts area
Post by: Suki on August 29, 2012, 01:54:26 PM
Does this custom lines would be filled by users themselves?  if so, there is the custom profile fields (http://wiki.simplemachines.org/smf/Features_and_Options#Profile_Fields).
Title: Re: Adding more info under number of posts area
Post by: Malibuz0r on August 29, 2012, 02:02:27 PM
No, I will "hard code" the fields so it will be shown for everyone.
Title: Re: Adding more info under number of posts area
Post by: Suki on August 29, 2012, 02:08:12 PM
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
Title: Re: Adding more info under number of posts area
Post by: Malibuz0r on August 29, 2012, 02:15:43 PM
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?
Title: Re: Adding more info under number of posts area
Post by: Suki on August 29, 2012, 02:21:37 PM
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
Title: Re: Adding more info under number of posts area
Post by: Malibuz0r on August 29, 2012, 02:22:20 PM
Thanks once again. Topic solved.