Uutiset:

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

Main Menu
Advertisement:

Custom titles.

Aloittaja pariahdog, huhtikuu 16, 2004, 11:03:03 AP

« edellinen - seuraava »

pariahdog

Is it possible to use BBCode in the custom titles? I would really like to be able to edit size and color.

also, is there a way to replace the membergroup title with a custom title? thanks a lot.

Oldiesmann

#1
Yes, you could do both.

To add UBBC functionality to the custom title:

In Themes/classic/Display.template.php

Search for
// Show the member's custom title, if they have one.
if (isset($message['member']['title']) && $message['member']['title'] != '')
echo '
', $message['member']['title'], '<br />';


Replace with
// Show the member's custom title, if they have one.
if (isset($message['member']['title']) && $message['member']['title'] != '')
echo '
', doUBBC($message['member']['title']), '<br />';


In Themes/default/Display.template.php

Search for
// Show the member's custom title, if they have one.
if (isset($message['member']['title']) && $message['member']['title'] != '')
echo '
', $message['member']['title'], '<br />';


Replace with
// Show the member's custom title, if they have one.
if (isset($message['member']['title']) && $message['member']['title'] != '')
echo '
', doUBBC($message['member']['title']), '<br />';


In Themes/default/Profile.template.php

Search for
if (!empty($modSettings['titlesEnable']) && $context['member']['title'] != '')
{
echo '
<tr>
<td><b>', $txt['title1'], ': </b></td>
<td>', $context['member']['title'], '</td>
</tr>';
}


Replace with
if (!empty($modSettings['titlesEnable']) && $context['member']['title'] != '')
{
echo '
<tr>
<td><b>', $txt['title1'], ': </b></td>
<td>', doUBBC($context['member']['title']), '</td>
</tr>';
}


Now, to replace the membergroup title with the custome title (not sure why you'd wanna do this, though):

In Themes/classic/Display.template.php

Search for:
// Show the member's primary group (like 'Administrator') if they have one.
if (isset($message['member']['group']) && $message['member']['group'] != '')
echo '
', $message['member']['group'], '<br />';

// Don't show these things for guests.
if (!$message['member']['is_guest'])
{
echo '
', $message['member']['post_group'], '<br />
', $message['member']['group_stars'], '<br />';


Replace with:
// Show the member's primary group (like 'Administrator') if they have one.
if (isset($message['member']['group']) && $message['member']['group'] != '')
echo '
', $message['member']['group'], '<br />';

// Don't show these things for guests.
if (!$message['member']['is_guest'])
{
echo '
', $message['member']['group_stars'], '<br />';


In Themes/default/Display.template.php:

Search for
// Show the member's primary group (like 'Administrator') if they have one.
if (isset($message['member']['group']) && $message['member']['group'] != '')
echo '
', $message['member']['group'], '<br />';

// Don't show these things for guests.
if (!$message['member']['is_guest'])
{
echo '
', $message['member']['post_group'], '<br />
', $message['member']['group_stars'], '<br />';


Replace with
// Show the member's primary group (like 'Administrator') if they have one.
if (isset($message['member']['group']) && $message['member']['group'] != '')
echo '
', $message['member']['group'], '<br />';

// Don't show these things for guests.
if (!$message['member']['is_guest'])
{
echo '
', $message['member']['group_stars'], '<br />';


In Themes/default/Profile.template.php

Search for
<td><b>', $txt[87], ': </b></td>
<td>', (!empty($context['member']['group']) ? $context['member']['group'] : $context['member']['post_group']), '</td>


Replace with
<td><b>', $txt[87], ': </b></td>
<td>', (!empty($context['member']['group']) ? $context['member']['group'] : ''), '</td>
Michael Eshom
Christian Metal Fans

pariahdog


Oldiesmann

Michael Eshom
Christian Metal Fans

Tristan Perry

Hmm....I tried the 2nd thing (If a member has a custom title, it replaces their member group) although I just got a parse error and it didn't work......I followed everything correctly.... :-[

Oldiesmann

#5
I changed one minor thing. I don't think it should have caused a parse error, but it might have. If you get a parse error again, please post the error message here. It's much easier to help that way.
Michael Eshom
Christian Metal Fans

Tristan Perry

LainaaParse error: parse error in /home/yxdvfheq/public_html/forums/Themes/default/Profile.template.php on line 525



When I view someones profile and then I get:

LainaaUnable to load the 'X' template.

When I try to edit something of a members...

Oldiesmann

Ok... Well, try this.

In the last step, change the '' to "" and see what happens. I haven't actually tested this, but I think it will work.
Michael Eshom
Christian Metal Fans

Oldiesmann

Actually, I just realized something. I'm making this more complicated than it needs to be. I'm basically saying "If $context['member']['group'] isn't empty, display it, otherwise display nothing". But, if it's empty, that's the same as nothing.. So, change that last step to

Find:
<td><b>', $txt[87], ': </b></td>
<td>', (!empty($context['member']['group']) ? $context['member']['group'] : $context['member']['post_group']), '</td>


Replace:
<td><b>', $txt[87], ': </b></td>
<td>', $context['member']['group'], '</td>

Michael Eshom
Christian Metal Fans

Tristan Perry

Lainaus käyttäjältä: Oldiesmann - huhtikuu 20, 2004, 02:17:46 IP
Ok... Well, try this.

In the last step, change the '' to "" and see what happens. I haven't actually tested this, but I think it will work.

Thanks but still:

LainaaParse error: parse error in /home/yxdvfheq/public_html/forums/Themes/default/Profile.template.php on line 525



In profile.... :-\

Oldiesmann

Find:

<td><b>', $txt[87], ': </b></td>
<td>', (!empty($context['member']['group']) ? $context['member']['group'] : ""), '</td>


Replace:
<td><b>', $txt[87], ': </b></td>
<td>', $context['member']['group'], '</td>


That should fix it.
Michael Eshom
Christian Metal Fans

Tristan Perry

Lainaus käyttäjältä: Oldiesmann - huhtikuu 20, 2004, 02:32:59 IP
Find:

<td><b>', $txt[87], ': </b></td>
<td>', (!empty($context['member']['group']) ? $context['member']['group'] : ""), '</td>


Replace:
<td><b>', $txt[87], ': </b></td>
<td>', $context['member']['group'], '</td>


That should fix it.

Thanks but:

LainaaParse error: parse error, expecting `','' or `';'' in /home/yxdvfheq/public_html/forums/Themes/default/Profile.template.php on line 108



LainaaAn Error Has Occurred!
Unable to load the 'summary' template. 

And the custom title and the member group shows.... :-[

   Sorry for all of this, if it's not possible then that's okay.

Oldiesmann

Please post line 108 of that file here...
Michael Eshom
Christian Metal Fans

scottb

Hmm would it be possible to change the color of the membergroup title?

Tristan Perry

Lainaus käyttäjältä: Oldiesmann - huhtikuu 20, 2004, 02:36:42 IP
Please post line 108 of that file here...

Um....

Lainaaif ($user_info['is_admin'])

Oldiesmann

Look at the lines above that. Including the code changes I just told you about, you should see this:

</tr><tr>
<td><b>', $txt[87], ': </b></td>
<td>', $context['member']['group'], '</td>
</tr>';
Michael Eshom
Christian Metal Fans

Tristan Perry

Lainaus käyttäjältä: Oldiesmann - huhtikuu 20, 2004, 02:41:33 IP
Look at the lines above that. Including the code changes I just told you about, you should see this:

</tr><tr>
<td><b>', $txt[87], ': </b></td>
<td>', $context['member']['group'], '</td>
</tr>';


Yeah I see that.....


Oldiesmann

I don't know what's causing that problem then...
Michael Eshom
Christian Metal Fans

Tristan Perry

Lainaus käyttäjältä: Oldiesmann - huhtikuu 20, 2004, 02:45:29 IP
I don't know what's causing that problem then...

This is the file I have with the changes you said, if it helps:

http://myweb.tiscali.co.uk/gamersplace/Profile.template.php

Oldiesmann

That helps a lot. Here's your problem right here...

</tr><tr>
<td><b>', $txt[87], ': </b></td>
<td>', $context['member']['group'], '</td>


That should be
</tr><tr>
<td><b>', $txt[87], ': </b></td>
<td>', $context['member']['group'], '</td>
</tr>';
Michael Eshom
Christian Metal Fans

Advertisement: