1 (edited by elbekko 2006-03-20 15:20)

Topic: Group Forum Subscribe 1.4

This mods gives you the possibility to assign groups to subscribe to a forum. Whenever a new topic is posted, all members in the groups subscribed to this forum will get an email with a link to this new topic. Groups are assigned to the forums through an admin plugin.

##
##
##        Mod title:  Group Forum Subscribe
##
##      Mod version:  1.4
##   Works on PunBB:  Should work on every version
##     Release date:  2006-03-20
##           Author:  El Bekko (elbekko@gmail.com)
##
##      Description:  Mails users in a group whenever
##                      a new topic is posted.
##
##     Difference with  
## previous version:  Now sends plain text mail through pun_mail().
##
##   Affected files:  functions.php
##                      post.php
##                      AP_Subscribe_Groups.php
##                      viewforum.php (optional)
##                    
##       Affects DB:  Yes
##
##            Notes:  None
##
##       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.
##
##

Download v1.4

Re: Group Forum Subscribe 1.4

This mod is broken.

First of all, there is a mistake in the download. The file AP_Subscribe_Groups.php does not exist. There is, however, a file called install_mod.php. I tried renaming that, and it then appeared in the Admin menu, but it still wouldn't load. I get a blank screen.

Re: Group Forum Subscribe 1.4

Grab the version off of PunRes: it seems to have all the files
http://www.punres.org/download.php?id=663

Re: Group Forum Subscribe 1.4

Not only are all the files there, but the instructions are different. DON'T use this version, make sure you get the PunRes version!

Re: Group Forum Subscribe 1.4

I can't get it to work. I'm using the latest version of PunBB, but nothing happens. First of all, I couldn't run install_mod.php. I get a blank screen when I load the page. Instead I ran the SQL function manually in PHP MyAdmin. However, even then, nothing works. I get the admin interface, and the viewtopic page shows which groups are subscribed, but no e-mail is sent out to members of the subscribed group.

Re: Group Forum Subscribe 1.4

Well, make sure you have access to the mail() function.

7 (edited by Luhmann 2006-03-09 04:48)

Re: Group Forum Subscribe 1.4

How do I check?

It sends a message to admin when I sub a new member, and I get mail notifications for new posts to subscribed topics.

Re: Group Forum Subscribe 1.4

Then it should work... I have no clue why it doesn't, as it works fine for me and the guy I made it for, so yah...

9 (edited by Luhmann 2006-03-10 02:36)

Re: Group Forum Subscribe 1.4

Well, lets see:

Table exists - check.
Admin interface exists - check.
ViewForum.php shows that group is subscribed - check.

Members of group receive e-mail notification on new topic - No.

Perhaps a step is missing in the instructions for the mod? I went through them twice...

I'm using 1.2.11. Perhaps something changed in that version? (although I see it still says I'm using 1.2.10)

Re: Group Forum Subscribe 1.4

Nothing important to this mods has changed in .11. Are you sure you've put the functions in functions.php and call them in post.php?

Re: Group Forum Subscribe 1.4

elbekko wrote:

Nothing important to this mods has changed in .11. Are you sure you've put the functions in functions.php and call them in post.php?

Yup. Double checked a few times.

One thing I noticed was that the downloaded files had DOS line endings. I tried converting to UNIX line endings and re-doing the changes, but it didn't make any difference. Don't know if DOS and UNIX differs in any important way. (I'm an OSX user myself but I use TextWrangler which can handle all different types of line endings.)

Re: Group Forum Subscribe 1.4

I have absolutely no idea what can be wrong... Make sure your SMTP server is set in php.ini

Re: Group Forum Subscribe 1.4

I don't recall having to set my SMTP settings during any part of the install process.

Like I said, I get mails sent regularly on new registrations and subscribed threads, so while PUNBB is sending mail just fine - your mod is not. Does your Mod require different SMTP settings?

Re: Group Forum Subscribe 1.4

It should use the settings set in php.ini... I see that PunBB has options in its adminconsole to set the SMTP server/port/... If you have those filled in, I guess there's your problem :S I'll take a look at it wink

Re: Group Forum Subscribe 1.4

I dont' see any file named php.ini in the directory. It doesn't seem to be part of the standard PunBB install...

Re: Group Forum Subscribe 1.4

No. I don't have the SMTP settings defined via the admin interface. Like I said, PunBB is sending e-mails to me just fine, except for this mod. Does this mod need separate mail settings or can't it use the same as PunBB?

Re: Group Forum Subscribe 1.4

php.ini is the PHP config file, you won't find it in PunBB tongue
Anyways, this might fix it (although the code should really be rewritten to send one email per person, so I'm not sure it will work):
In functions.php
FIND

mail($recipients,$subject,$message,$headers);

REPLACE WITH

pun_mail($recipients,$subject,$message);

18 (edited by elbekko 2006-03-12 15:31)

Re: Group Forum Subscribe 1.4

Smartys: nono, n00by tongue It needs to send HTML mail, so I need those headers wink

EDIT: And if the SMTP settings aren't set, it'll just use mail() anyways.

19 (edited by elbekko 2006-03-12 16:00)

Re: Group Forum Subscribe 1.4

Could you try replacing

mail($recipients,$subject,$message,$headers);

with

$mailres = mail($recipients,$subject,$message,$headers);
    if(!$mailres)
        {
        error("Something went oopsie with the mail... ", __FILE__, __LINE__);
        }

Maybe it'll show an error...

The code you've sent me looks fine, so yah... no idea what's wrong there :S

20 (edited by Smartys 2006-03-13 00:09)

Re: Group Forum Subscribe 1.4

Bekko: pun_mail uses PunBB's SMTP settings, not the ones in php.ini tongue
If someone put their SMTP settings in PunBB (which is I think what's happening here) because they need to for the mails to send, then the sending will fail your way tongue

And why in the world do you need to send HTML email when nothing else in PunBB does? n00b tongue

Re: Group Forum Subscribe 1.4

Smartys wrote:

If someone put their SMTP settings in PunBB (which is I think what's happening here)

Didn't I say that I didn't do that? If not, let me say it now: The SMTP settings in PuBB are not set. THey are blank, but PunBB sends mail just fine without them! And I never created any kind of PHP.ini file. I'm on TextDrive, I don't know how they manage things like that, though I suppose I can check if I need to.

I'll create the version that outputs an error message.

I really need this functionality!

Re: Group Forum Subscribe 1.4

OK. It showed an error when I posted a new topic. But there were no details in the error...

Re: Group Forum Subscribe 1.4

Smartys wrote:

And why in the world do you need to send HTML email when nothing else in PunBB does? n00b tongue

I would like it if this could be re-written to use the same e-mail standard and calls that PunBB uses.

Re: Group Forum Subscribe 1.4

I dont' know if it matters, but I see that your headers read:

charset=iso-8859-1

I use UTF-8. A lot of my forums are in Chinese...

Re: Group Forum Subscribe 1.4

Shouldn't really matter, but you can easily change it smile

Bekko: pun_mail uses PunBB's SMTP settings, not the ones in php.ini tongue
If someone put their SMTP settings in PunBB (which is I think what's happening here) because they need to for the mails to send, then the sending will fail your way tongue

And why in the world do you need to send HTML email when nothing else in PunBB does? n00b tongue

For the link... I can take it out ofcourse, but yah... And as he said, his SMTP settings aren't set, so he uses the standard mail(); command wink If you really want, I'll rewrite it a bit to not use HTML mail and just send it through pun_mail();