Forum Email
2 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: February 10, 2022 (RSS)
Hi All,
I'm looking to add more "Placeholders" to a "Forum Notification Post" email.
For example, the client would like the full post message to appear in the email. However, I only see #post.message_snippet# only available. Is there an area in the CMS where I can create my own placeholders, in the CMS, so I can display the entire post?
Another example placeholder I would need is a link to access the #forum# in the email. Currently I'm only able to show the forum name via the #forum# placeholder.
Any help would be greatly appreciated.
Dan
By daniel - February 10, 2022
Hey Dan,
These placeholders for forum notifications are hard-coded, so in order to add more, you would need to update the plugin file directly. These placeholders are defined in two places in simpleForum.php - around lines 803 and 838 (the first for admin notifications, the second for follower notifications). For example, if you wanted to add the full message to the placeholders, you would change from this:
'placeholders' => array(
'admin.email' => $adminEmail,
'post.username' => $CURRENT_USER['username'],
'post.read_link' => realUrl($post['_link']),
'post.reply_link' => realUrl($GLOBALS['SFORUM_POST_REPLY_URL']) . '?postNum=' . $post['num'],
'post.unsubscribe_link' => realUrl($GLOBALS['SFORUM_POSTS_URL']) . '?unfollow=1&topicNum=' . $post['topicNum'],
'post.message_snippet' => sforum_getPostSnippet( $_REQUEST['message'] ),
'topic.subject' => $topic['subject'],
'forum' => $forum['name'],
)
to this:
'placeholders' => array(
'admin.email' => $adminEmail,
'post.username' => $CURRENT_USER['username'],
'post.read_link' => realUrl($post['_link']),
'post.reply_link' => realUrl($GLOBALS['SFORUM_POST_REPLY_URL']) . '?postNum=' . $post['num'],
'post.unsubscribe_link' => realUrl($GLOBALS['SFORUM_POSTS_URL']) . '?unfollow=1&topicNum=' . $post['topicNum'],
'post.message_snippet' => sforum_getPostSnippet( $_REQUEST['message'] ),
'post.message' => $_REQUEST['message'],
'topic.subject' => $topic['subject'],
'forum' => $forum['name'],
)
Which would make "#post.message#" placeholder available.
Note that making changes to the plugin file like this would be overwritten when updating the plugin to a newer version, so I would recommend making notes of what changes you make and/or modifying the plugin folder to something like "simpleForum_custom" and reactivating the plugin to prevent automatic rewriting.
Let me know if you have any other questions!
Thanks,
Technical Lead
interactivetools.com