Saturday, September 28, 2013

Automatic Subscriptions For All Members On MyBB

Automatic Subscriptions For All Members On MyBB. If you want all your users to be subscribed to every thread and forum, this is for you. This tutorial makes the most minor edits. There are better ways to do this, however they require you to remove and replace code in the templates instead of putting in a few very minor additions.

Step 1: Eliminate the user's ability to change their subscription mode
In User Control Panel Templates->usercp_options

Change:

<tr>
<td colspan="2"><span class="smalltext"><label for="subscriptionmethod">{$lang->subscription_method}</label></span></td>
</tr>
<tr>
<td colspan="2">
    <select name="subscriptionmethod" id="subscriptionmethod">
        <option value="0" {$no_subscribe_selected}>{$lang->no_auto_subscribe}</option>
        <option value="1" {$no_email_subscribe_selected}>{$lang->no_email_subscribe}</option>
        <option value="2" {$instant_email_subscribe_selected}>{$lang->instant_email_subscribe}</option>
    </select>
</td>
</tr>


To:
<tr style="display:none">
<td colspan="2"><span class="smalltext"><label for="subscriptionmethod">{$lang->subscription_method}</label></span></td>
</tr>
<tr style="display:none">
<td colspan="2">
    <select name="subscriptionmethod" id="subscriptionmethod">
        <option value="0" {$no_subscribe_selected}>{$lang->no_auto_subscribe}</option>
        <option value="1" {$no_email_subscribe_selected}>{$lang->no_email_subscribe}</option>
        <option value="2" {$instant_email_subscribe_selected}>{$lang->instant_email_subscribe}</option>
    </select>
</td>
</tr>


Which simply inserts
style="display:none"
for both <tr> tags that house the thread subscriptions code.

Step 2: Set it up so that new members are created with default subscription mode of your choice.
In Member Templates->member_register

Change:

<tr>
<td colspan="2"><span class="smalltext"><label for="subscriptionmethod">{$lang->subscription_method}</label></span></td>
</tr>
<tr>
<td colspan="2">
    <select name="subscriptionmethod" id="subscriptionmethod">
        <option value="0" {$no_subscribe_selected}>{$lang->no_auto_subscribe}</option>
        <option value="1" {$no_email_subscribe_selected}>{$lang->no_email_subscribe}</option>
        <option value="2" {$instant_email_subscribe_selected}>{$lang->instant_email_subscribe}</option>
    </select>
</td>
</tr>
 



To:
 
<tr style="display:none">
<td colspan="2"><span class="smalltext"><label for="subscriptionmethod">{$lang->subscription_method}</label></span></td>
</tr>
<tr style="display:none">
<td colspan="2">
    <select name="subscriptionmethod" id="subscriptionmethod">
        <option value="0">{$lang->no_auto_subscribe}</option>
        <option value="1">{$lang->no_email_subscribe}</option>
        <option value="2" selected="selected">{$lang->instant_email_subscribe}</option>
    </select>
</td>
</tr>



Which is the exact same edit as above. Now however you need to choose which of the subscription methods you want to use. I've put the default to "Instant Email" in the above example.

Step 3: Make it so they cannot unsubscribe on a per-thread basis
In Show Thread Templates->showthread

Change:


<li class="subscription_{$add_remove_subscription}"><a href="usercp2.php?action={$add_remove_subscription}subscription&amp;tid={$tid}&amp;my_post_key={$mybb->post_code}">{$add_remove_subscription_text}</a></li>
 



To :
<li class="subscription_{$add_remove_subscription}" style="display:none"><a href="usercp2.php?action={$add_remove_subscription}subscription&amp;tid={$tid}&amp;my_post_key={$mybb->post_code}">{$add_remove_subscription_text}</a></li>
 



Which, once again simply addes the style="display:none", this time however it is to the li tag.

Step 4: SQL Query to affect all current users
For all users, including your initial Admin account:
UPDATE `mybb_users` SET `subscriptionmethod` = '2' WHERE `subscriptionmethod` != '2';
For all users except the initial Admin account:
UPDATE `mybb_users` SET `subscriptionmethod` = '2' WHERE `uid` != 1 AND `subscriptionmethod` != '2';

In Summary
This is the simplest way to do it. A more proper way would be to replace the various selects with a simple:
Code:

<input type="hidden"....


Automatic Subscriptions For All Members On MyBB


bit of code for the subscription method. However, as stated above, that is a much larger change to each template.


 Is that Automatic Subscriptions For All Members On MyBB, hopefully useful and helpful for you!


thumbnail Title: Automatic Subscriptions For All Members On MyBB
Posted by:Stuard Van
Published :2013-09-28T10:00:00-07:00
Rating: 5
Reviewer: 5 Reviews
Automatic Subscriptions For All Members On MyBB
Share :
Related articles:

1 comment :

  1. If a thread already exists, these steps will not subscribe all users to that thread. Correct? -thx

    ReplyDelete