Please or Register to create posts and topics.

RESOLVED: How Can I Put Default Text In Every New Post?

I need to provide some structure inside posts as a reminder to users to include useful info in their posts. So, when a users clicks the New Topic button I want the editor to already contain several labels to remind the user to include certain info. I don’t care if they choose to erase the text and strictly enter their own but I want the initial presentation of a blank new Topic to include some text I provide.

I can easily do this in regular Wordpress posts with this code,

add_filter( ‘default_content’, ‘my_editor_content’ );
function my_editor_content( $content ) {
$content = “Please help us share the love; consider sharing this on Facebook.”;
return $content;
}

But this doesn’t work with the Asgaros Forum editor.

How can I do this in Asgaros Forum?

To further clarify, I only want this in the first post (topic?) Any replies to the post should NOT have this default text.

I partially figured this out by changing plugin code directly (yes, I know, not the best approach!) I put the following code in forum-editor.php,

if ($editor_view === ‘addpost’) {
if($message == “”){
$message = “Please help us share the love; consider sharing this on Facebook.” . $message;
}
}

right before this,

echo ‘<div class=”editor-row no-padding”>’;
wp_editor(stripslashes($message), ‘message’, $this->asgarosforum->options_editor);
echo ‘</div>’;

That works perfectly EXCEPT, it also inserts the default text on replies and I need it to only be on the first post!

Any ideas?

Got it! Below is the correct code to make this work for my needs,

if ($editor_view === ‘addtopic’ && $message == “”) {
$message = “Please help us share the love; consider sharing this on Facebook.” . $message;
}

Jim has reacted to this post.
Jim