1 (edited by binou 2006-09-26 22:27)

Topic: Forum Subscriber

##
##
##        Mod title:  Forum Subscriber
##
##      Mod version:  1.2
##   Works on PunBB:  1.2, 1.2.1 to 1.2.12
##     Release date:  2006-04-25
##           Author:  Fabien Appert (appertfabien-web@yahoo.fr)
##
##      Description:  This mod allow users to subscribe to a forum
##
##   Affected files:  post.php
##                    misc.php
##                    viewtopic.php
##                    viewforum.php
##                    lang/XXX/misc.php
##                    lang/XXX/topic.php
##                    lang/XXX/forum.php
##
##       Affects DB:  Yes
##
##            Notes:  This mod allow users to subscribe to a forum, exactly 
##                    as they can subscribe to a topic. If they subscribe, 
##                    they will be notify by email of all post reply or new
##                    post in this forum (the message of the post could be 
##                    included depending on the same user profil option as 
##                    original topic subscription).
##                    Subscription to a topic is disabled when the user has
##                    already subscribe to the topic's forum.
##
##              For upgrade from 1.1 to 1.2, just execute step 8 to 15
##
##       DISCLAIMER:  Please note that "mods" are not officially supported by
##                    PunBB. Installation of this modification is done at your
##                    own risk. Backup your forum database and any and all
##                    applicable files before proceeding.
##
##

This mod works exactly like the punBB native subscription for topics, except that I have make changes to work with forum.
So it will behave exactly like topic subscription :
- depend on activation of subscription in punBB configuration
- depend on user choice to show message in email or not

Features :
- subscribe / unsubscribe
- receive notification on topic response
- receive notification on new topic too
- prevent topic subscription when a user has already subscribed to forum
-

1.0.1 :
- Fix an incomptatibility with mod "Mark As Read"

1.1 :
- Add an admin plugin in order to view current subscriptions

1.1.1 :
- Only add 1.2.12 support, if you have version 1.1 ... keep it, nothing change wink

1.2
This version correct the bug of multiple mail notification when user where topic-subscribed before being forum-subscribed. Now when a user subscribe to a forum, all his topic subscriptions will be disable (not deleted) during the forum subscription.

For upgrade from 1.1 to 1.2, just execute step 8 to 15


Download : http://www.punres.org/files.php?pid=240

2

Re: Forum Subscriber

Here is an quick preview :

http://www.gundya.fr/pub/PunBB_ForumSubscriber/Screenshot_ForumSubscriber.jpg

3

Re: Forum Subscriber

I already have released a 1.0.1 to correct an incomptatibility with the mod "Mark As Read"

You will have to take care and follow instructions in readme :

don't forget to invert comment if you use this mod

#
#---------[ 6. REPLACE WITH ]-------------------------------------------------
# !!! TAKE CARE !!! If you have the mod "MARK AS READ" you will have to uncomment a line et comment an other one

// Fetch some info about the topic
if (!$pun_user['is_guest'])
    // MOD: FORUM SUBSCRIBER - line modified
    $result = $db->query('SELECT t.subject, t.closed, t.num_replies, t.sticky, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, s.topic_id AS is_subscribed, s.forum_id AS is_subscribed_forum FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'subscriptions AS s ON ( (t.id=s.topic_id OR t.forum_id=s.forum_id) AND s.user_id='.$pun_user['id'].') LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$id.' AND t.moved_to IS NULL') or error('Impossible de retrouver les informations de la discussion', __FILE__, __LINE__, $db->error());
    // If you use MARK TOPIC AS READ MOD uncomment the line after this message and comment the one above
    // $result = $db->query('SELECT t.subject, t.closed, t.num_replies, t.sticky, t.last_post, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, s.topic_id AS is_subscribed, s.forum_id AS is_subscribed_forum FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'subscriptions AS s ON ( (t.id=s.topic_id OR t.forum_id=s.forum_id) AND s.user_id='.$pun_user['id'].') LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$id.' AND t.moved_to IS NULL') or error('Impossible de retrouver les informations de la discussion', __FILE__, __LINE__, $db->error());

Re: Forum Subscriber

This is wonderful.  I'm using it on 1.2.11.

Any chance you'd be up to making an admin pluging to manage subscriptions for users?  If not manage... at least see what topics & forums users are subscribed to?

5

Re: Forum Subscriber

Hi Rustin,

I was thinking to had a mass subscriptions option in an admin plugin, but I don't have enough time for the moment :-/
What kind of features do you think about when you say "manage subscriptions for users". Is it to add and remove a subscription for every user ? or anything else ?

Re: Forum Subscriber

Actually, what I'm looking for is even simpler then that.  I would just like to know what forums & topics are being subscribed to.  Just a list would be fine.

the icing on the cake would be to have the option to subscribe/unsubscribe a user from both forums and topics from the admin.

7

Re: Forum Subscriber

Well, as the user is able to do it by himself, I don't think it is administrator's work to subscribe/unsubscribe for him. But a list of current subscriptions could be usefull, just for informations.

Re: Forum Subscriber

I would love to at least be able to see what forums and topics are being subscribed to.  I'm using pluging that never had an acutal release, I just found it in another thread.  It's exactly what I need, but I have no idea how to make it pull forum names as well as topic names. 

Can you give it a look and see what edits would be needed to make it pull both kinds of subscriptions?

I'm using this:

<?php
/***********************************************************************

  Copyright (C) 2005  Connor Dunn (Connorhd@mypunbb.com)

  This software is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published
  by the Free Software Foundation; either version 2 of the License,
  or (at your option) any later version.

  This software is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  MA  02111-1307  USA

************************************************************************/
// Make sure no one attempts to run this script "directly"
if (!defined('PUN'))
    exit;

// Tell admin_loader.php that this is indeed a plugin and that it is loaded
define('PUN_PLUGIN_LOADED', 1);

    generate_admin_menu($plugin);
?>
    <div class="block"> 
        <h2><span>User Subscriptions</span></h2> 
        <div class="box"> 
            <div class="inbox"> 
                <p>Shows you what topics users are subscribed to, grouped by username</p>
            </div> 
        </div> 
    </div> 
    <div class="block">
        <h2 class="block2"><span>User Subscriptions</span></h2>
        <div class="box">
            <div class="inbox">
                <table class="aligntop" cellspacing="0">
                    <?php
$result = $db->query('SELECT u.username, t.subject FROM '.$db->prefix.'subscriptions AS s LEFT JOIN '.$db->prefix.'users AS u ON s.user_id=u.id LEFT JOIN '.$db->prefix.'topics AS t ON s.topic_id=t.id ORDER BY u.username;');

while ($row = $db->fetch_assoc($result))
{
    if (!isset($last_user)) {
        echo "<tr>\n\t\t\t\t\t\t<th scope=\"row\">\n\t\t\t\t\t\t\t".$row['username']."\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<span>";
        echo $row['subject'];
    }
    elseif ($last_user == $row['username']) {
        echo ', '.$row['subject'];
    }
    else
    {
        echo "</span>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th scope=\"row\">\n\t\t\t\t\t\t\t".$row['username']."\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<span>";
        echo $row['subject'];
    }
    $last_user = $row['username'];
}
echo "\n"
?></span>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>

9

Re: Forum Subscriber

Hi Rustin

okay I will have a look and see what I can do

If I don't give you a feedback at the end of last week, feel free to contact me again wink

10

Re: Forum Subscriber

Hi binou,  Any chance you had some time to look at this?

11

Re: Forum Subscriber

Hi Rustin !

I had totally forgotten smile So I have done it this morning

So version 1.1 is now released. For those who had previous version just had the "plugins/AP_Forum_Subscriber.php" files

12

Re: Forum Subscriber

Awesome!  This is wonderful. 

Now the last bit to edit is the list that shows up with a user clicks "Show your subscribed topics".  Since forum titles don't show up in that list either.

This has been a wonderful thing for my users.  They've been asking for this feature since the biginning.  Thank you Thank you Thank you!

13

Re: Forum Subscriber

Rustin wrote:

Now the last bit to edit is the list that shows up with a user clicks "Show your subscribed topics".  Since forum titles don't show up in that list either.

Sorry Rustin I didn't understand what you mean... you want a link for a user ("Show your subscribed topics") to allow him to see his subscriptions ?

14

Re: Forum Subscriber

There actually already is a link (bottom left of index) for users to see what topics they are subscribed to.    It only shows results for topics that are subscribed.

It would be great if this link would also display subscribed forums.  Not at all urgent... just one of those little things that would help the user manage subscriptions.

15

Re: Forum Subscriber

ok sorry I was totally in the wrong way

I never use this feature and I see what you mean now wink I'll see what I can do.

16

Re: Forum Subscriber

Hello,

I try Forum Subscriber 1.1 with PunBB 1.2.12.
I can subscribe to forum.
When I go to Forum Subscriber Viewer, I see my subscribe.
But I do not receive any mail when there are new posts !

Someone can say me which lines can I verify ?

Regards
2j_

17

Re: Forum Subscriber

Ok excuse me it was a problem with my sendmail ...
All works

18

Re: Forum Subscriber

binou wrote:

ok sorry I was totally in the wrong way

I never use this feature and I see what you mean now wink I'll see what I can do.

Were you ever able to move this any futher?

BTW You're mod is running great, and quite popular on my forum.

19

Re: Forum Subscriber

Well ... version 1.2 has been released, look at the first post for more information wink


Rustin : I have take a look to your request and I know how to do it, sorry for the wait but I don't forget you wink It will be done in the next release

20 (edited by craigatcrow 2007-04-11 16:21)

Re: Forum Subscriber

Hello

I've installed forum subscriber1.2 and it is sort of working.

It sends e-mail notification when a new topic is posted, but not when a reply is added to a topic.

I'm using SMTP with Gmail

I had some trouble getting e-mail to send at all, but this was fixed by allowing email to be sent by SSL, is this related?

Other than that, this is a great MOD for people who neglet to check on the forum, I'm a huge fan of e-mail notifications.

21

Re: Forum Subscriber

hello craigatcrow,

sorry for the waiting time , I didn't see your post :-/ Do you you still have the problem ?

There should be no problem with SSL, the mod use the same email functions as punbb does.

Re: Forum Subscriber

Hi Binou,

I have the same problem, it does not notify replies, only new topics.

Also, I need to see the full message in the notification email. Right now, there is just the topic title and the link. Possible to fix?

Otherwise, great mod!! It could be really powerful.