1 (edited by charless 2009-05-31 01:28)

Topic: Can I make "Subscribe to this topic" checked by default?

Is it possible to make the default setting for "Subscribe to this topic" checked instead of unchecked?

I find that many people do not check this box, so they do not know if someone has responded to the post. It would also generate more forum activity.

If this is possible, please let me know how I would do this.

Thanks for your help!

-Charles

2

Re: Can I make "Subscribe to this topic" checked by default?

Hi charles,

This is very similar to my request a few days ago:)

Forum, Art, Architecture, Passion.

Have you ever visited the textpattern forum?

3 (edited by charless 2009-05-31 20:02)

Re: Can I make "Subscribe to this topic" checked by default?

Hi Colak,

There is an overlap between our requests, but I think my request is much easier. I don't want every user to be subscribed to all threads, I just want the "Subscribe to this topic" check box in each post to be checked by default, so that users are auto-subscribed to any topics where they have posted (or they can uncheck the box if they do not want this). Your request would require an extension, but I have a feeling that mine is just a small change to a config file since the functionality is already built into the app.

-Charles

Re: Can I make "Subscribe to this topic" checked by default?

You just need to edit the line 495 of "<FORUM_ROOT>/post.php", it should be:

$subscr_checked = true;

Re: Can I make "Subscribe to this topic" checked by default?

Excellent! I had a feeling it was a simple task, but this is even easier than I thought. Thanks.

6 (edited by charless 2009-06-01 16:27)

Re: Can I make "Subscribe to this topic" checked by default?

Thanks again Slavok, but I noticed another issue:

I just noticed that the "Subscribe to this topic" check box only appears when a new post is created - if I use the "Quick reply to this topic" text box in an existing post there is no way to have it subscribe the user to the post.

I would like this subscribe check box and option to also appear every time someone replies to an existing post. Is this possible? If so, how can I do this?

Re: Can I make "Subscribe to this topic" checked by default?

You need to edit file "<FORUM_ROOT>viewtopic.php". Add this code

if (isset($forum_page['hidden_fields']['subscribe']))
    unset($forum_page['hidden_fields']['subscribe']);
// Load the post.php language file
require FORUM_ROOT.'lang/'.$forum_user['language'].'/post.php';

$forum_page['fld_count'] = 0;
$forum_page['checkboxes'] = array();
if ($forum_config['o_smilies'] == '1')
    $forum_page['checkboxes']['hide_smilies'] = '<div class="mf-item"><span class="fld-input"><input type="checkbox" id="fld'.(++$forum_page['fld_count']).'" name="hide_smilies" value="1" /></span> <label for="fld'.$forum_page['fld_count'].'">'.$lang_post['Hide smilies'].'</label></div>';

// Check/uncheck the checkbox for subscriptions depending on scenario
if (!$forum_user['is_guest'] && $forum_config['o_subscriptions'] == '1')
{
    $subscr_checked = true;

    // If auto subscribed
    if ($forum_user['auto_notify'])
        $subscr_checked = true;
    // If already subscribed to the topic
    else if ($cur_topic['is_subscribed'])
        $subscr_checked = true;

    $forum_page['checkboxes']['subscribe'] = '<div class="mf-item"><span class="fld-input"><input type="checkbox" id="fld'.(++$forum_page['fld_count']).'" name="subscribe" value="1"'.($subscr_checked ? ' checked="checked"' : '').' /></span> <label for="fld'.$forum_page['fld_count'].'">'.($cur_topic['is_subscribed'] ? $lang_post['Stay subscribed'] : $lang_post['Subscribe']).'</label></div>';
}

after hook "vt_quickpost_pre_display". And this

<?php
if (!empty($forum_page['checkboxes']))
{

?>
            <fieldset class="mf-set set<?php echo ++$forum_page['item_count'] ?>">
                <legend><span><?php echo $lang_post['Post settings'] ?></span></legend>
                <div class="mf-box checkbox">
                    <?php echo implode("\n\t\t\t\t\t", $forum_page['checkboxes'])."\n"; ?>
                </div>
            </fieldset>
<?php

}?>

after hook "vt_quickpost_pre_fieldset_end". Or you can create an extension based on this code. There is also an option "Subscribe to topics by default when posting" in user's profile. Another solution of your first problem can be setting this option as checked by default.

Re: Can I make "Subscribe to this topic" checked by default?

Thank you for your very helpful reply!

Regarding your suggested fix, if I update the software will I have to redo this fix each time?

Regarding this: There is also an option "Subscribe to topics by default when posting" in user's profile

This seems like the best solution to my problem. Would this change also make "Subscribe to this topic" true and allow users to uncheck this option if they do not want to subscribe?

If you don't mind, could you tell me how to make this change as well? Hopefully this will also help other users interested in doing the same things.

Re: Can I make "Subscribe to this topic" checked by default?

charless wrote:

Regarding your suggested fix, if I update the software will I have to redo this fix each time?

Yes, you should. That is why creating an extension based on this code will be more convenient for you.

charless wrote:

Would this change also make "Subscribe to this topic" true and allow users to uncheck this option if they do not want to subscribe?

Yes, it would. You can set the default value of the "auto_notify" column in the "users" table to 1. Or set it when a user is registered, examine the function "add_user" of "<FORUM_ROOT>/include/functions.php" (lines 1658-1709)

Re: Can I make "Subscribe to this topic" checked by default?

Thank you!