News:

Wondering if this will always be free?  See why free is better.

Main Menu

RESOLVED Display member number on 2.0 RC3

Started by poperodger, May 17, 2010, 02:04:19 PM

Previous topic - Next topic

poperodger

My searches thus far have turned up nothing useful so I figured I would ask.  Is there a way to display the member number under a user's avatar?  I know there used to be a mod that does this but it doesn't seem to work in the newer versions of SMF.  Any help with a snippet of code or something would be appreciated.  Thanks!

poperodger

Prodded around and I think I figured it out.

Find this:

// Show how many posts they have made.

Then add this above it (or where-ever you like).

//Member ID
                        echo ' <b>Member ID:</b> ', $message['id'], '<br />';

Matthew K.

Try this instead

//Member ID
echo ' <span style="font-weight: bold;">Member ID:</span>&nbsp;', $message['id'], '<br />';


Since your issue has been resolved, please feel free to mark Topic as Resolved if you have no further questions.

poperodger

Cool, thanks.  Stupid question:  How do I make the word "Posts:" right below where I have the member id bold?  I have the join date and the member id bold but not posts and looking at the code I can't quite figure out where I would insert the text.

Matthew K.

I apologize, after considering the code and noticing it didn't look correct I reviewed the actual code on a test forum.

Here is the proper edit.

./Themes/default/Display.template.php
Code (Find) Select

// Show avatars, images, etc.?
if (!empty($settings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image']))
echo '
<li class="avatar" style="overflow: auto;">', $message['member']['avatar']['image'], '</li>';

Code (Add After) Select

// Show Their Member ID
echo ' <span style="font-weight: bold;">', $txt['member_id'], '</span>&nbsp;', $message['member']['id'], '<br />';


./Themes/default/languages/Modifications.english.php
Code (Add Before Document End) Select

$txt['member_id'] = 'Member ID:';

Matthew K.

Note the change in the actual code - By specifying "['member']['id']" rather than ['id'] it refers to the members id; before it was outputting the post id.

Matthew K.

To bold that text make the following edit.

./Themes/default/Display.template.php
Code (Find) Select

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

Code (Replace) Select

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

poperodger

Now the words "Member ID" do not show up. :(

Matthew K.

That is because you added it as a language string; rather than inline.

Please go to your forums admin panel > Maintenance and clear your forums cache. The text will then appear. :)

poperodger

Or I was modding the wrong file.   Whoops.  Need to pay attention to where I click. lol.

Matthew K.

Haha, not a problem; it happens. Glad to see you have resolved your issue.

Marking topic as resolved.

Advertisement: