Re: Simple Forum 1.03 Released
2 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: October 26, 2021 (RSS)
By JeffC - October 8, 2021
In response to: https://www.interactivetools.com/forum/forum-posts.php?postNum=2242362#post2242362
The default in the plugin is to subscribe to a forum that you have commented on. Is it possible to disable this feature? I still want to offer the ‘subscribe to thread’ but make it opt-in.
thanks
By Michael - October 26, 2021
Hi Jeff,
You could add a condition to the "auto-subscribe to thread" function call in the forums-topics-create.php file and the forum-posts-reply.php file and a checkbox field to the form itself. That way a user could check the box to subscribe and leave it blank if they didn't want to. Or default to checked and the user could uncheck if they didn't want to subscribe. Example code below.
Replace this code
// auto-subscribe to thread
sforum_db_setUserFollowingTopic($CURRENT_USER['num'], $topic['num'], 1);
With this code
// auto-subscribe to thread
if(!empty($_REQUEST['subscribe'])) {
sforum_db_setUserFollowingTopic($CURRENT_USER['num'], $topic['num'], 1);
}
And add this code to the form
<div class="row vertical-spacer-10">
<div class="col-xs-12 text-right">
<input type="hidden" name="subscribe" value="0">
<input type="checkbox" name="subscribe" id="subscribe" value="1">
<label for="subscribe">Subscribe to thread updates</label>
</div>
</div>
After this line in the forums-topics-create.php file
<?php echo sforum_html_post_editor(@$_REQUEST['subject'], @$_REQUEST['message'], null, @$_REQUEST['showPoll']); ?>
And after this line in the forum-posts-reply.php file
<?php echo sforum_html_post_editor(@$_REQUEST['subject'], @$_REQUEST['message']); ?>
Programmer
interactivetools.com