News:

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

Main Menu

I just need a little guidance with how things work, please.

Started by Grammy, February 14, 2025, 06:07:55 PM

Previous topic - Next topic

Grammy

Before moving to 2.14, we were at 2.07. (I think.  I've slept since then.)  Default, though; always default.  We were using Kays old Signature Dropdown Choices and it was dead easy.  It only edited one file.  In Profile.template.php, find

echo '
</dt>
<dd>
<textarea class="editor" onkeyup="calcCharLeft();" name="signature" rows="5" cols="50">', $context['member']['signature'], '</textarea><br />';

// If there is a limit at all!

and replace with

echo '
</dt>
<dd>';

// Start Signature Dropdown mod
loadLanguage('Post');
echo '
<script language="JavaScript" type="text/javascript"><!-- // --><!','[CDATA[
function bbc_highlight(something, mode)
{
something.style.backgroundImage = "url(" + smf_images_url + (mode ? "/bbc/bbc_hoverbg.gif)" : "/bbc/bbc_bg.gif)");
}
// ]]', '></script>';

$context['bbc_tags'] = array(
'img' => array('code' => 'img', 'before' => '[img]', 'after' => '[/img]', 'description' => $txt['image']),
'quote' => array('code' => 'quote', 'before' => '[quote]', 'after' => '[/quote]', 'description' => $txt['bbc_quote']),
);

foreach ($context['bbc_tags'] as $image => $tag) {
echo '
<a href="javascript:void(0);" onclick="surroundText(\'', $tag['before'], '\', \'', $tag['after'], '\', document.forms.creator.signature); return false;">'.
'<img onmouseover="bbc_highlight(this, true);" onmouseout="if (window.bbc_highlight) bbc_highlight(this, false);" src="', $settings['images_url'], '/bbc/', $image, '.gif" align="bottom" width="23" height="22" alt="', $tag['description'], '" title="', $tag['description'], '" style="background-image: url(', $settings['images_url'], '/bbc/bbc_bg.gif); margin: 1px 2px 1px 1px;" /></a>';
}

// Begin font dropdown
echo '
<select onchange="surroundText(\'[font=\' + this.options[this.selectedIndex].value.toLowerCase() + \']\', \'[/font]\', document.forms.creator.signature); this.selectedIndex = 0; document.forms.creator.signature.focus(document.forms.creator.signature.caretPos);" style="margin-bottom: 1ex;">
<option value="" selected="selected">', $txt['font_face'], '</option>
<option value="courier">Courier</option>
<option value="arial">Arial</option>
<option value="arial black">Arial Black</option>
<option value="impact">Impact</option>
<option value="times new roman">Times New Roman</option>
<option value="georgia">Georgia</option>
<option value="andale mono">Andale Nono</option>
<option value="trebuchet ms">Trebuchet MS</option>
<option value="comic ms">Comic MS</option>
</select>';

// Begin color dropdown
echo '
<select onchange="surroundText(\'[color=\' + this.options[this.selectedIndex].value.toLowerCase() + \']\', \'[/color]\', document.forms.creator.signature); this.selectedIndex = 0; document.forms.creator.signature.focus(document.forms.creator.signature.caretPos);" style="margin-bottom: 1ex;">
<option value="" selected="selected">', $txt['change_color'], '</option>
<option value="black">', $txt['black'], '</option>
<option value="red">', $txt['red'], '</option>
<option value="yellow">', $txt['yellow'], '</option>
<option value="pink">', $txt['pink'], '</option>
<option value="green">', $txt['green'], '</option>
<option value="orange">', $txt['orange'], '</option>
<option value="purple">', $txt['purple'], '</option>
<option value="blue">', $txt['blue'], '</option>
<option value="beige">', $txt['beige'], '</option>
<option value="brown">', $txt['brown'], '</option>
<option value="teal">', $txt['teal'], '</option>
<option value="navy">', $txt['navy'], '</option>
<option value="maroon">', $txt['maroon'], '</option>
<option value="limeGreen">', $txt['lime_green'], '</option>
<option value="white">', $txt['white'], '</option>
</select>';

// Begin size dropdown
echo '
<select onchange="surroundText(\'[size=\' + this.options[this.selectedIndex].value.toLowerCase() + \']\', \'[/size]\', document.forms.creator.signature); this.selectedIndex = 0; document.forms.creator.signature.focus(document.forms.creator.signature.caretPos);" style="margin-bottom: 1ex;">
<option value="" selected="selected">', $txt['font_size'], '</option>
<option value="1">8pt</option>
<option value="2">10pt</option>
<option value="3">12pt</option>
<option value="4">14pt</option>
<option value="5">18pt</option>
<option value="6">24pt</option>
<option value="7">36pt</option>
</select><br />';

// End Signature Dropdown mod
echo '
<textarea class="editor" onkeyup="calcCharLeft();" name="signature" rows="5" cols="50">', $context['member']['signature'], '</textarea><br />';

// If there is a limit at all!

and Bob's your uncle!  Short and sweet.

Of course, moving to 2.1.4 means everyone's pretty, colorful little signatures are all jacked up.  (And my members are not coders in any sense of the word.  If they can't click it, they can't use it.)

The colors, font family and the font sizes were all in drop-downs.  What I want to ask about 2.1.4 is this... 

How are color choices, a specified font family and font size inserted now?  I wasn't too surprised with everything in the code above throwing a ton of undefined variable errors, and I can see that the $txt and $tag have to be changed. I'm told that 'before' and 'after' are deprecated.  So what specifically determines, once a selection is made, not only how the tags land in the posting area, but how your actual selection (i.e., color, size...) is located and then inserted into the box?  If I can just get my head around that, maybe I can figure out how to restore these options to the signature area. I do realize there are a couple of other signature bbc mods, but nothing for 2.1, so I'd be in the same shape, as far as having to learn how to modify it. 

(Not everyone who runs a forum is a coder, as you can see.  I just try to learn as versions change.  For some reason, bbc is really challenging to me, in 2.1.  I'd appreciate being educated, if anyone drops by and has the time. 

Kindred

What do you mean by "jacked up"?


If it's just showing the bbc instead of processing it -- did you turn ON the ability to use bbc in signatures?
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Grammy

Quote from: Kindred on February 22, 2025, 10:37:24 AMWhat do you mean by "jacked up"?


If it's just showing the bbc instead of processing it -- did you turn ON the ability to use bbc in signatures?

I did make sure that setting was turned on.  I hadn't realized this would happen moving from 2.0 to 2.1 at the time, but I guess everything is an undefined variable, pretty much, now.  You can click all day and the bbc tags no longer insert into the text box.  For the most part, I guess the undefined variables could be sorted easily enough.  "font_face" is now "font-family", "change_color" is, I guess, "font_color", etc.  The log is filled with pages of undefined variables. I guess "before" and "after" are deprecated, which I'm assuming is why no tags insert. (In fact, as far as undefined variables, I did rename everything to match up with Subs-Editor.php, and then I got an "array to string conversion" error.)

I'm still want to mess around with it, but in the meantime, I got the other 2.0 mod "Signature Area BBCode Buttons" to work with 2.1.4, but as you can see, following my ramblings down the thread, vbgamer45 took a look at my files, because of the weird "Preview" behavior and says that he thinks it's not the code, but a conflict with the Javascript file (profile.js) that is called for.  He suggested that I post in the Coding Discussions boards to ask about it (which I have).

I do wonder, though, what the trigger is that actually causes tags to insert into the post box (since "before" and "after" are deprecated)?

(Thanks for the reply!)   :)

Advertisement: