vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   v2.0 Email new thread notifications to subscribed users (https://vborg.vbsupport.ru/showthread.php?t=18718)

chrispadfield 05-29-2001 10:00 PM

A few have requested this, me especially so i made it.

What it does: Emails all those who have subscribed to a forum an email telling them about a new thread.

Extra queries: 1 upon every new thread. Extra time processing new threads as emails must be sent.

code changes, 1 in newthread.php and 2 new templates.




CODE CHANGE:

Add:

PHP Code:

// This emails a new thread notification to those subscribed to the forum
    
if ($enableemail) {
      
// do emails

      
$useremails=$DB_site->query("SELECT user.*
                                   FROM subscribeforum,user
                                   WHERE subscribeforum.forumid='
$forumid'
                                     AND subscribeforum.userid=user.userid
                                     AND user.userid<>'
$bbuserinfo[userid]'
                                    "
);

              
$toemail=$val;
              
$forumtitle $foruminfo['title'];
              
$threadinfo['title'] = $subject;

      
$bbuserinfo['username']=unhtmlspecialchars($bbuserinfo['username']);
      while (
$touser=$DB_site->fetch_array($useremails)) {
        
$touser['username']=unhtmlspecialchars($touser['username']);

        eval(
"\$emailmsg = \"".gettemplate("email_newthread",1,0)."\";");
        eval(
"\$emailsubject = \"".gettemplate("email_newthreadsubject",1,0)."\";");

        
mail($touser[email],$emailsubject,$emailmsg,"From: \"$bbtitle Mailer\" <$webmasteremail>");
      }


below the section //send email to moderators which ends with

}
}
}
}

add two templates:

i) email_newthread

Code:

Hello $touser[username],

$bbuserinfo[username] has just started a new thread: in $foruminfo[title]
This is a forum you have subscribed to at $bbtitle

The thread title is: $threadinfo[title]
This thread is located at:
$bburl/showthread.php?threadid=$threadid&goto=newpost

Yours,
$bbtitle team

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unsubscription information:

You are receiving these "new thread" notifications because
you are subscribed to the $foruminfo[title] forum.

To unsubscribe, please visit:
$bburl/usercp.php

and secondly

email_newthreadsubject

Code:

New Thread in $foruminfo[title]
any you are away :)

chrispadfield 05-30-2001 03:41 PM

please note if you are testing this you need two users because it will NOT send an email to the person who started the thread. Either remove the last line of the query

PHP Code:

AND user.userid<>'$bbuserinfo[userid]' 

or use two different users.

chrispadfield 05-30-2001 04:21 PM

oops, i left a line of debug code in.

if you have already installed this, remove this line
echo $touser;
the code change had been updated so if you have not installed it yet don't worry.

MrLister 05-30-2001 06:05 PM

is it possible to make it so it does this every hour and every hour lists all the new threads within the thread.

chrispadfield 05-30-2001 08:08 PM

i am not sure what you mean. Why would you want to send them every hour when they can be done instantly? by the sounds of it you want something more like the community bulletin thing made by Kier/tubedog

chrispadfield 05-31-2001 01:32 PM

sorry, another fix

you need to change $threadinfo[threadid] to $threadid

Joe 06-02-2001 05:57 AM

The emails this sends out are from "nobody" at : nobody@snoturtle.serverhost.com

How do i change this to Bike Forums with my real email addy? :)

chrispadfield 06-02-2001 11:58 AM

mail($touser[email],$emailsubject,$emailmsg,"From: \"$bbtitle Mailer\" <$webmasteremail>");

is the line that generates that and it is copied straight from the newreply.php code (which is where most of this code came from). I can't see how it can work in one place and not the other. sorry, not a clue.

Kevin Green 10-15-2001 02:23 PM

Hi,

Very interested in this thread for user support purposes.

Will it email users subscribed to the Forum when there are additions to any of the existing threads

Will it email users if there are additions to the thread it has already notified them of?

I ask because I am interested in having users emailed if there is a new thread or if there are any additions to existing threads regardless of whether they have been previously notified but perhaps failed to check the Forum.

Many thanks

kevin

Pie'oh'pah 10-15-2001 04:48 PM

Hi,

we have the same problem as Joe, when unregistered users are involved.

-Pie

Pie'oh'pah 10-15-2001 05:13 PM

No i must stand corrected: It's happening even if users are registered...

-Pie

claytonp 10-16-2001 09:19 AM

Hello,

I thought I would attempt this code hack myself, however I cannot locate the following in newthread.php

below the section //send email to moderators which ends with

}
}
}
}

as indicated by chrispadfield. Am I doing something wrong.

I have already created the two templates.

Regards,

Clayton

webhost 10-16-2001 03:10 PM

Below This


PHP Code:


// send email to moderators
      
if ($enableemail) {
        
$moderators=$DB_site->query_first("SELECT CONCAT(newthreademail,' ',newpostemail) AS newthreademail FROM forum WHERE forumid='$forumid'");

        
$modtable=$DB_site->query("SELECT DISTINCT user.email FROM moderator,user WHERE moderator.userid=user.userid AND forumid IN ($foruminfo[parentlist]) AND (newthreademail=1 OR newpostemail=1)");
        while(
$thismod=$DB_site->fetch_array($modtable)) {
          
$moderators['newthreademail'].=$thismod[email]";
        }

        if (
$moderators['newthreademail']!="") {
          
$mods=explode(" ",trim($moderators['newthreademail']));
          while (list(
$key,$val)=each($mods)) {

            if (
trim($val)!="") {
              
$toemail=$val;
              
$forumtitle $foruminfo['title'];
              
$threadinfo['title'] = $subject;

              eval(
"\$emailmsg = \"".gettemplate("email_moderator",1,0)."\";");
              eval(
"\$emailsubject = \"".gettemplate("emailsubject_moderator",1,0)."\";");
              
mail($toemail,$emailsubject,$emailmsg,"From: \"$bbtitle Mailer\" <$webmasteremail>");
            }
          }
        }
      } 


Stasik 10-16-2001 05:42 PM

to fix "nobody" problem replace"
Code:

eval("\$emailsubject = \"".gettemplate("email_newthreadsubject",1,0)."\";");
with:
Code:

eval("\$emailsubject = \"".gettemplate("emailsubject_moderator",1,0)."\";");
then you can delete teplate called "email_newthreadsubject"

chrispadfield 10-16-2001 06:51 PM

not quite sure how that will help as that edits the subject of the email not where it is from. Unless you have a linebreak in the subject template, that might make it not work.

Stasik 10-16-2001 06:55 PM

that was linebrake

webhost 10-16-2001 09:11 PM

Tested and works great on my board and 2 others.

VirtueTech 10-17-2001 12:39 AM

I can't believe I overlooked this.

WizyWyg 10-17-2001 01:09 AM

Hi can someone repost the code in its entirety with all the corrections. looking through the coding and this site is somewhat driving me cross eyed

chrispadfield 10-17-2001 08:41 AM

Quote:

Originally posted by WizyWyg
Hi can someone repost the code in its entirety with all the corrections. looking through the coding and this site is somewhat driving me cross eyed
my code in the 1st post still works for me :)

Kevin Green 10-17-2001 09:39 AM

As stated in the subject I would like to implement this hack but my 2.0.3 vBulletin newthread.php does not contain the line:-

// send email to moderators

here is the listing of my newthread.php (this is the original one I got with my vBulletin package as far as I am aware):-

{htmldoctype}
<html>
<head>
<title>$bbtitle - Post New Thread</title>
$headinclude
<!--<script type="text/javascript" language="javascript" src="$bburl/spellcheck/spch.js"></script>-->
<script language="javascript">
<!--
var postmaxchars = $postmaxchars;
function validate(theform) {
if (theform.message.value=="" || theform.subject.value=="") {
alert("Please complete the subject and message fields.");
return false; }
if (postmaxchars != 0) {
if (theform.message.value.length > $postmaxchars) {
alert("Your message is too long.\n\nReduce your message to $postmaxchars characters.\nIt is currently "+theform.message.value.length+" characters long.");
return false; }
else { return true; }
} else { return true; }
}
function checklength(theform) {
if (postmaxchars != 0) { message = "\nThe maximum permitted length is $postmaxchars characters."; }
else { message = ""; }
alert("Your message is "+theform.message.value.length+" characters long."+message);
}
//-->
</script>
</head>
<body>
$header

<!-- breadcrumb -->
<table cellpadding="2" cellspacing="0" border="0" width="{contenttablewidth}" {tableinvisibleextra} align="center">
<tr>
<td width="100%">$navbar</td>
</tr>
</table>
<!-- /breadcrumb -->

$postpreview

<br>

<form enctype="multipart/form-data" action="newthread.php" method="POST" name="vbform" onSubmit="return validate(this)">
<input type="hidden" name="s" value="$session[sessionhash]">
<input type="hidden" name="forumid" value="$forumid">
<input type="hidden" name="action" value="postthread">

<table cellpadding="{tableouterborderwidth}" cellspacing="0" border="0" bgcolor="{tablebordercolor}" {tableouterextra} width="{contenttablewidth}" align="center"><tr><td>
<table cellpadding="4" cellspacing="{tableinnerborderwidth}" border="0" {tableinnerextra} width="100%">
<tr>
<td bgcolor="{tableheadbgcolor}" colspan="2"><normalfont color="{tableheadtextcolor}" class="thtcolor"><b>Post New Thread</b></normalfont></td>
</tr>
$logincode
<tr bgcolor="{secondaltcolor}">
<td bgcolor="{secondaltcolor}"><normalfont><b>Subject: </b></normalfont></td>
<td bgcolor="{secondaltcolor}"><normalfont><input type="text" class="bginput" name="subject" value="$subject" size="40" maxlength="85" tabindex="1"></normalfont></td>
</tr>
$posticons
$vbcode_buttons
<tr>
<td bgcolor="{secondaltcolor}" valign="top" nowrap><normalfont><b>Message:</b></normalfont>
<p><smallfont>
See Forum Rules (below) for<br>
more information about what<br>
codes you are allowed to use<br>
in your posts.
</smallfont></p>
$vbcode_smilies</td>
<td bgcolor="{secondaltcolor}">
<table cellpadding="0" cellspacing="0" border="0">
<tr valign="top">
<td><textarea name="message" rows="20" cols="$textareacols" wrap="virtual" tabindex="2">$message</textarea><br>
<smallfont><a href="javascript:checklength(document.vbform);">[check message length]</a></smallfont></td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="{firstaltcolor}" valign="top"><normalfont><b>Options:</b></normalfont></td>
<td bgcolor="{firstaltcolor}" valign="top"><smallfont>
<input type="checkbox" name="parseurl" value="yes" $parseurlchecked> <b>Automatically parse URLs:</b> automatically adds and around internet addresses.
<br><input type="checkbox" name="email" value="yes" $emailchecked> <b>Email Notification:</b> emails sent to you whenever someone replies. Only registered users are eligible.
$disablesmiliesoption
<br><input type="checkbox" name="signature" value="yes" $signaturechecked> <b>Show Signature:</b> include your profile signature. Only registered users may have signatures.
</smallfont></td>
</tr>
$attachmentoption
$postpolloption
</table>
</td></tr></table>

<br>

<table cellpadding="2" cellspacing="0" border="0" width="{contenttablewidth}" {tableinvisibleextra} align="center">
<tr>
<td align="center"><normalfont>
<input type="submit" class="bginput" name="submit" value="Submit New Thread" accesskey="s" tabindex="3">
<input type="submit" class="bginput" name="preview" value="Preview Post" accesskey="p" tabindex="4">
<!--<input type="button" class="bginput" value="Spell Check" onclick="var f=document.forms['vbform']; doSpell( '$spellchecklang', f.message, '$bburl/spellcheck/sproxy.php', true);" tabindex="5">-->
</normalfont></td>
</tr>
</table>

</form>

<table cellpadding="2" cellspacing="0" border="0" width="{contenttablewidth}" {tableinvisibleextra} align="center">
<tr>
<td><smallfont><b>Forum Rules:</b><br>$forumrules</smallfont></td>
</tr>
</table>

$footer

</body>
</html>


:confused:

Fred Manteghian 10-17-2001 01:48 PM

Quote:

Originally posted by chrispadfield
mail($touser[email],$emailsubject,$emailmsg,"From: \"$bbtitle Mailer\" <$webmasteremail>");

is the line that generates that and it is copied straight from the newreply.php code (which is where most of this code came from). I can't see how it can work in one place and not the other. sorry, not a clue.


Hi Chris,

this is a wonderful bit of code, thanks so much.

I too have the problem where the template's use of the $bbtitle varialbe works fine, but when my email is received the "from" field is blank.

I'm new to PHP3 and scripts (groan...i'll let ya :D ), but I see identical code in Newreply.php3 and that seems to work fine?

Thanks again.

webhost 10-17-2001 02:27 PM

Fred Manteghian

install Chris's code then make the change in Stasik post and then delete this template

email_newthreadsubject

webhost 10-22-2001 07:29 PM

Seen a couple of people asking about this, so I figured I would bump it up again.

chrispadfield 10-22-2001 09:12 PM

p.s. a word of warning with this hack, if you have very busy forums don't install it :) This is because if, say you had 500 people subscribed to a forum then ever new thread they are going to get an email, this will slow down newticket creation quite a lot.

Eventually, i am going to be working on a proper system that sends emails after a delayed period so your users do not notice it.

claytonp 10-23-2001 07:44 AM

Hello Chris,

Many thanks for the advice concerning the large number of users on the forum, I finally got the hack to work.
Just to give you a little bit of background: We have set up a forum for Urgent problems - so rather than worry about my email distribution list, all I have to do now is post a message on the forum and those people who have registered will now receive the email - great.
However, if I then want to post a "followup" message to say that everything is OK, I would then POST REPLY which would contain the appropriate message, but this is NOT emailed to the registered users.

Is there a hack around this - is it the file newreply.php ?

Please help, because we need to get this up and running as soon as possible.

Your help is greatly appreciated.

chrispadfield 10-23-2001 08:49 AM

you mean you want everyone to get ever reply or just your replies? it requries some hacking of reply.php but I don't think it exists of yet.

claytonp 10-23-2001 10:01 AM

Hello Chris,

Many thanks for your reply. In this case I would want the following:

For ALL post replies in the forum, EVERYBODY (who has subscribed to that forum) would be notified via email.

As I said, this forum is for Urgent issues and we need to keep customers informed of every development.

Hope this helps.

WizyWyg 11-14-2001 01:50 AM

Could someone show me a working example cause I haven't been able to get this to work or pass along their modified php files to get this to work?

I get no emails whatsoever on anything being posted to any forum Im subscribed to.

Can you also repost the code in its entirety correctly with all "corrections' included along with any new templates?

Does this work for 2.2.0 as well?

chrispadfield 11-15-2001 09:08 AM

- I have not tested it on 2.2
- Remember when testing it that it will not send you notifications if you are the one that started the thread, you need to test with 2 people.
- You can not distribute it as a hacked file if you got it to work.

When i do the almighty upgrade to 2.2 I will revisit the hack.

WizyWyg 11-15-2001 06:01 PM

Quote:

Originally posted by chrispadfield
- I have not tested it on 2.2
- Remember when testing it that it will not send you notifications if you are the one that started the thread, you need to test with 2 people.
- You can not distribute it as a hacked file if you got it to work.


When i do the almighty upgrade to 2.2 I will revisit the hack.

I am testing it with 2 different id's

One id is "subscribed" to the foum
The other isn't.
The other posts a new thread in the forum.
The first id doesn't get any notices via email saying that there is a "new thread" in that subscribed forum.

hadley 03-05-2002 04:52 PM

Chris, I just want to add my voice (whine?) to those who hope you revisit this hack soon. It's very cool -- exactly what my users are clamoring for -- and, unfortunately, I found out about your hack after I upgraded to vB 2.2.

(No thanks to vB support on that :cry: -- had I known about your hack, I wouldn't have upgraded. E-mail notification to forum subscribers is far more important to me than the minor fixes I got with 2.2.)

Anyway -- godspeed, break a leg, bless you, and all of that. :cool:

Bruce Hadley
www.softwareCEO.com

kippesp 03-13-2002 08:26 PM

Has anyone installed this hack where a subscription would trigger 500 or so emails? Have there been any problems?

I've considered modifying it so that emails go out as a single BCCed email.

Quote:

Originally posted by hadley
[B]...unfortunately, I found out about your hack after I upgraded to vB 2.2.

(No thanks to vB support on that :cry: -- had I known about your hack, I wouldn't have upgraded. E-mail notification to forum subscribers is far more important to me than the minor fixes I got with 2.2.)
Can someone elaborate on this comment? I have no knowledge of anything prior to 2.2.1. Were forum subscriptions once implemented in vB pre-2.2.0? And it was removed?

hadley 03-13-2002 09:28 PM

What I meant by my comment is this:

Chris's hack did work on vB 2.1, so, had I stayed with that version of vB, I could now have email notification going out to my users who want that feature.

But I upgraded to vB 2.2 before I found out about Chris's hack, and from reading through this thread I discovered that it won't work with versions past 2.1. I am trying to beg or bribe Chris to update the hack to work on vB 2.2.4, but so far have had no luck. :cry:

My snipe at vB was this:
The sales conversation I had with them pre-purchase led me to believe that vB's "subscribe to forum" feature did exactly what I want: notify the person subscribed, via email, whenever there's a post to that forum. It makes sense; after all, that's what "subscribe to thread" does.

When I started talking to vB tech support about this issue a month ago, they told me the "subscribe to forum" feature does not provide any email notification -- it's only there so that users can build "hot lists" they can access directly through their control panels.

Now, had they told me a month ago that there was a hack out there, I would have grabbed Chris's hack, and it would have worked, because I was still running vB 2.1 quite happily. But vB tech didn't respond for weeks, until I finally prodded them with a follow-up email -- and it was only then that they suggested I look here for a hack. (Prior to that, I didn't even know about this board.) But by then I'd already upgraded to vB 2.2, which I didn't need -- I'd much rather have the hack.

Chris's hack does what I believed the vB product would do, and what I strongly think the vB product should do -- but in fact it was never built that way, at least not to my knowledge.

kippesp 03-13-2002 09:54 PM

Quote:

Originally posted by hadley
But I upgraded to vB 2.2 before I found out about Chris's hack, and from reading through this thread I discovered that it won't work with versions past 2.1.
Okay. That's a relief. I was worried that a major problem was found and vB just took out a feature.

I'm still testing this on my board and we're at 2.2.2. I have made some small modifications, but I didn't see any glaring issues that were 2.2.x specific. I can post my revision here if you like.

I've also looked at 2.2.4 to know there will be no problems once I upgrade. I still need to fix a few things to make this hack work like I want it to, but I can certainly release my revision. (But it would be done as a new hack to prevent confusion. I didn't make my extensions compatible with Chris's.)

WizyWyg 03-13-2002 10:21 PM

Quote:

Originally posted by hadley

My snipe at vB was this:
The sales conversation I had with them pre-purchase led me to believe that vB's "subscribe to forum" feature did exactly what I want: notify the person subscribed, via email, whenever there's a post to that forum. It makes sense; after all, that's what "subscribe to thread" does.

Then you're conclusions to this was wrong, because it was never mentioned specifically that an email would be sent out (dont you think it would have been stated?). When I read over the features, I never came to that conclusion.

Quote:

When I started talking to vB tech support about this issue a month ago, they told me the "subscribe to forum" feature does not provide any email notification -- it's only there so that users can build "hot lists" they can access directly through their control panels.
Exactly as it does and was said in the features of the software. Again, nowhere did it state that it would email anyone.

Quote:

Now, had they told me a month ago that there was a hack out there, I would have grabbed Chris's hack, and it would have worked, because I was still running vB 2.1 quite happily. But vB tech didn't respond for weeks, until I finally prodded them with a follow-up email -- and it was only then that they suggested I look here for a hack. (Prior to that, I didn't even know about this board.) But by then I'd already upgraded to vB 2.2, which I didn't need -- I'd much rather have the hack.
Please re=read Vb's policy about support to hacked boards (summarize, they dont offer it)
The Hack forum (on vb's site) has a direct link to this site.

Quote:

Chris's hack does what I believed the vB product would do, and what I strongly think the vB product should do -- but in fact it was never built that way, at least not to my knowledge.
What you believed it would do, and what it states in the features are two different things. You just came to the wrong conclusion.

hadley 03-14-2002 02:35 PM

WoozyWog,
You were not, as far as I know, privvy to my e-mail and telephone conversations with the vB people -- you don't know what they told me re: features -- so your conclusions are just as flawed as mine. But, hey, if it makes you feel better to slog me in these boards, have at it -- I was just looking for a software enhancement, not an indictment of vB or its employees.

hadley 03-15-2002 04:52 PM

kippesp,
I'm very interested in your hack -- I've got users screaming for e-mail notification, but I need something that works with vB 2.2.4.

Please let me know, either here or offline.

Many thanks,
hadley@softwareCEO.com

kippesp 03-20-2002 09:45 PM

I've post my variation on this. See this thread for how things differ:

https://vborg.vbsupport.ru/showthrea...threadid=36365


All times are GMT. The time now is 02:46 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01612 seconds
  • Memory Usage 1,900KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (3)bbcode_php_printable
  • (9)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (39)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete