ColorizePost

Started by Bulakbol, January 15, 2008, 09:45:48 PM

Previous topic - Next topic

Bulakbol

Quote from: JimM on January 30, 2008, 03:26:04 PM
Added the edits you suggested last night and no errors today.  I think that may have fixed it.  Thanks for a great mod.   :)

Cool. That's good because I am worried.  :)
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

Sakae

Hey JohnnyB, two things:

1) On this piece of code, on the second line (here), I think it should be if ($message..., with a space between if and [/b]($messag[/b]..., shouldn't? It only works when I add a space on my display.template.php manual edit.

// Show the post itself, finally!
if($message['member']['theme'] == $settings['theme_id'] || $message['member']['id'] == $context['user']['id'])
{
echo '
</td>
</tr></table>
<hr width="100%" size="1" class="hrcolor" />
<div class="post"', $message['can_modify'] ? ' id="msg_' . $message['id'] . '"' : '', '>';
if (!empty($message['member']['post_color']))
echo '<span style="color: '. $message['member']['post_color']. ';">';
elseif (!empty($message['member']['group_color']))
echo '<span style="color: '. $message['member']['group_color']. ';">';
elseif (!empty($message['member']['post_group_color']))
echo '<span style="color: '. $message['member']['post_group_color']. ';">';
echo $message['body'], (!empty($message['member']['post_color']) || !empty($message['member']['group_color']) || !empty($message['member']['post_group_color']) ? '</span>' : ''), '</div>', $message['can_modify'] ?
'<img src="' . $settings['images_url'] . '/icons/modify_inline.gif" alt="" align="right" id="modify_button_' . $message['id'] . '" style="cursor: pointer; display: none;" onclick="modify_msg(\'' . $message['id'] . '\', \'' . $context['session_id'] . '\')" />' : '' , '
</td>
</tr>';
}
else


2) Is it possible to add two fields, one for front color and second for back color? I'm using KarlBenson's mod Color & BgColor Clickable BBCode Bar v3.3, that might be useful to integrate..
http://www.tigrelog.com.br
l: simple p: machines

Bulakbol

#62
Hi softcore. I usually use space between the "if" and the opening bracket but I guess I missed that one.  My live site and test site didn't throw any error so I assumed the space does not really matter. Maybe I am wrong but I will stand corrected. :)  To avoid errors for the next users, I will update the file now. Thank you for letting me know.

Yes, it will be nice if I can integrate Karlbenson's BBCode bar. If I can do the integration, then I will as well integrate to the other colorize mods. I don't know if I can because I know very little about javascript.
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

lexi_be

thx for this lovely mod!!!!

But with some users the color is not shown? In the profile a color is selected, in the post it is not shown. What can be wrong?

thx Lexi

Bulakbol

Quote from: lexi_be on February 01, 2008, 02:09:26 AM
thx for this lovely mod!!!!

But with some users the color is not shown? In the profile a color is selected, in the post it is not shown. What can be wrong?

thx Lexi

Hi Lexi. You are welcome. And thank you too for using this mod.

Are you using more than one theme?  The color in their profile willl be used only if the user (reader) is using the same theme as the message' poster. The color will show if they are both using the same theme.
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

angelsluver

I don't know if i am in the right place to ask. But i want to add text modifications like bold, italics and different fonts and sizes. Is it possible with this mod? What i want is not only to automate the color but also the font, sizes and the bold/italics of the post, to lessen the work of members who post, they will not have to click the icons in the reply page to make the modification.

I'm sorry because i only have limited knowledge about mods and php, I only apply mods thru the package uploader in the admin panel.

Bulakbol

Hi angelluver. I wish I could extend the mod to parse bbc but it is limited to colors only. If I will take it out of the body of the code, it will generate a lot of errors and to fix it, I have to rewrite the whole mod. I'm sorry angelluver.  :(
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

angelsluver

I see. I guess what i want require a lot of work. I will have to forget about it.

Thanks so much JohnnyB.

Bulakbol

Quote from: angelsluver on March 13, 2008, 08:50:16 AM
I see. I guess what i want require a lot of work. I will have to forget about it.

Thanks so much JohnnyB.

No worries angelluver.  ;)
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

Lasalle

OK, colors with nneonneo's shoutbox work. But what i have to do to turn off colors in posts? I want diffrent colors only on SB.

Bulakbol

Quote from: Lasalle on March 21, 2008, 05:14:33 AM
OK, colors with nneonneo's shoutbox work. But what i have to do to turn off colors in posts? I want diffrent colors only on SB.

Hi Lasalle. If you don't want it in post, you have to edit your Display.template.php. This mod, will use the color in their profile in any. If none, it will use the primary group color. If none, it will use the post group color.

Do you like to remove them all? In Display.template.php, find the following block of code and comment out or delete.
if($message['member']['theme'] == $settings['theme_id'] || $message['member']['id'] == $context['user']['id'])
{
echo '
</td>
</tr></table>
<hr width="100%" size="1" class="hrcolor" />';
if (!empty($message['member']['post_color']))
echo '<div style="color: '. $message['member']['post_color']. ';" class="post"', $message['can_modify'] ? ' id="msg_' . $message['id'] . '"' : '', '>';
elseif (!empty($message['member']['group_color']))
echo '<div style="color: '. $message['member']['group_color']. ';" class="post"', $message['can_modify'] ? ' id="msg_' . $message['id'] . '"' : '', '>';
elseif (!empty($message['member']['post_group_color']))
echo '<div style="color: '. $message['member']['post_group_color']. ';" class="post"', $message['can_modify'] ? ' id="msg_' . $message['id'] . '"' : '', '>';
echo $message['body'], '</div>', $message['can_modify'] ?
'<img src="' . $settings['images_url'] . '/icons/modify_inline.gif" alt="" align="right" id="modify_button_' . $message['id'] . '" style="cursor: pointer; display: none;" onclick="modify_msg(\'' . $message['id'] . '\', \'' . $context['session_id'] . '\')" />' : '' , '
</td>
</tr>';
}
else


Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

Lasalle


Bulakbol

Quote from: Lasalle on March 23, 2008, 04:42:57 PM
:) Thanks

No worries LaSalle.  ;) Thanks for trying/using this mod.
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

Bulakbol

Updated today for SMF 2.0 Beta 3 Public.  Please post error if there's any.

Colorize Post 1.2.2 - for SMF 2.0 Beta 3 Public
- This mod will optionally colorize an individual member's messages if his/her group is given permission.
- To give a group permission to enter their own color, tick the checkbox in
    ~ Admin > Permissions > Allow this group to colorize their messages?
- To enable color, enter color name (e.g. red) or hex (e.g. #ff0000) in
    ~ Profile > Look and Layout Preference > Enter color for your messages.
- Color will be used in Message index, Recent posts, Profile Show Posts and Personal messages if both user
     and poster use the same theme. If no color is specified in their profile, primary group or post
     group online color will be used instead.

Supported Themes
- Babylon
- Classic
- Default Core


Thanks for trying this mod.
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

Manu.G

I had installed the mod and it worked perfect, but there is only a little problem and I hope you can help me to solve it.

We have different member groups in our forum, with different online colors.
After I have installed the mod, the default font color of the members group changed into
the color of the member group. Is it possible to switch this off?

I really don't know how to explain.
The mod was using automatic the color of the member group for the color font, but
I wont have it. The default color font for the member groups should be the default color of the forum,
cause we wanna allow only different member groups to use this mod.

Hope you can understand what I'm asking for.  :-\
Version SMF 2.0.8
SimplePortal 2.3.5

Bulakbol

#75
Hi Menu0372. So you want only cetain groups to use the color? We have to change a bit of code. You have to hardcode the group id who can use the color. Tell me more. Right now, the mod will look for color in their profile. If none, it will look for primary group color (admin GM etc.) and if not available, it will use the post group color.  What would you like mo to do for you?

Would you like the mod only to check for members who have colors in their profile? And if none, it will use the default color? I'll get back to you.

[edit]
Display.template.php
Code (look for) Select
$color = !empty($message['member']['post_color']) ? $message['member']['post_color'] : (!empty($message['member']['group_color']) ? $message['member']['group_color'] : (!empty($message['member']['post_group_color']) ? $message['member']['post_group_color'] : ''));

Code (replace) Select
$color = !empty($message['member']['post_color']);

Only those who enter color in their profile will get the color. Meaning, if you don't give them permission, they can't enter a color. No color, mod will use the default one.

[/edit]
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

Manu.G

#76
Quote from: JohnyB on March 27, 2008, 03:04:15 PM
Would you like the mod only to check for members who have colors in their profile? And if none, it will use the default color? I'll get back to you.

That's exactly what I want to have.
As long the member hasn't add a color code in the profile, the color font of his/her
postings should be the default color font of the forum and not of the member group
the member is.
After I had installed the mod, the text in my postings were red, cause the color of
my group "Administrator" is red, as in most of the forums. I hadn't add a color code
in my profile. To be honest when I saw this I was shocked.

So I have to change some codes to the codes you showed? Is this correct?

[edit]
Display.template.php
Code (look for) Select
$color = !empty($message['member']['post_color']) ? $message['member']['post_color'] :   (!empty($message['member']['group_color']) ? $message['member']['group_color'] : (!empty($message['member']['post_group_color']) ? $message['member']['post_group_color'] : ''));

Code (replace) Select
$color = !empty($message['member']['post_color']);
[/edit]
Version SMF 2.0.8
SimplePortal 2.3.5

Bulakbol

Yes Menu0372. Find the long line and replace it with the short one. Let me know how it goes. It it doesn't work (it should work) then we'll use different approach.
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

Manu.G

#78
Works perfect  :D

JohnyB, thanks for your quick help!!! :D
Version SMF 2.0.8
SimplePortal 2.3.5

Bulakbol

awww are you okay now? You're welcome. Thank you too for using this mod.  ;D

BTW, recent post and profile page use the same logic, so if you want to edit them too, you can search for the variable $color and replace with the code I gave you. Recent.template.php and Profile.template.php. If you need assistance, just post here.
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

Advertisement: