ALERT!
Click here to register with a few steps and explore all our cool stuff we have to offer!
Home
Upgrade
Credits
Help
Search
Awards
Achievements
 1578

Automatic Subscriptions for all members - The Short Version

by sliverboi - 10-10-2017 - 07:08 PM
#1
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
Code:
<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

Code:
<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>

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
Code:
<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

Code:
<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

Code:
<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


Code:
<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"....

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


Please keep your comments relevant. Please let me know if you think anything is missing from this tutorial.
Reply

Users browsing: 1 Guest(s)