Re: Simple Forum 1.03 Released

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']); ?>
Michael Sams
Programmer
interactivetools.com