MyBB Community Forums

Full Version: Editor For Textarea Profile Fields
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I managed to get the codebuttons/editor to show on one textarea profile field but it won't show for any of the others.

I'm using PHP in templates plugin.

usercp_profile_profilefields_textarea
<?php $codebuttons = build_mycode_inserter(); ?>
<textarea id="message" name="profile_fields[$field]" rows="15" cols="70" tabindex="2" style="width: 100%;">{$value}</textarea>
{$codebuttons}

It works for one but not for all.

How would I make the editor appear in all of the textareas?
I guess you have to set different IDs for $codebuttons, eg:
<?php $codebuttons = build_mycode_inserter('message_' . $field); ?>
<textarea id="message_{$field}" name="profile_fields[$field]" rows="15" cols="70" tabindex="2" style="width: 100%;">{$value}</textarea>
{$codebuttons}

!! untested !!
<?php $codebuttons = build_mycode_inserter(); ?>
<textarea id="message{$profilefield['fid']}" name="profile_fields[$field]" rows="15" cols="70" tabindex="2" style="width: 100%;">{$value}</textarea>
{$codebuttons}
<script type="text/javascript">
$(function() {
	$("#message{$profilefield['fid']}").sceditor(opt_editor);

	MyBBEditor = $("#message{$profilefield['fid']}").sceditor("instance");
	//{ $ sourcemode }
	MyBBEditor.sourceMode(true);
});
</script>

ended up going with this because for some odd reason it completely stopped working when trying it with {$field}.