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)
-   -   Contextual Forum Subscriptions Hack (https://vborg.vbsupport.ru/showthread.php?t=36365)

kippesp 03-19-2002 10:00 PM

Contextual Forum Subscriptions Hack
 
This hack is similar to the "2.0 Email new thread notifictions to subscribed users" hack by chrispadfield. My hack is an enhanced replacement to the Padfield hack.

Without this hack, subscribing to a forum does nothing but add the forum to one's user CP. By installing this hack, an email will be sent with the post's content when a new thread is posted.

The major differences between this hack and the Padfield hack are:[list=1][*]Email notification contains the posted text.[*]When posting a new thread to moderated forums, notification will be delayed until the thread is approved. This also works with Wayne Luke's moderate user hack.[/list=1]This hack has been tested on vBulletin 2.2.1 through 2.2.5.

Post any problems/suggestions here. My users like it as is but would appreciate any improvement.

Erwin 03-20-2002 09:46 PM

This is a great idea. I will install it after work. :)

chrispadfield 03-20-2002 10:03 PM

Cheers for doing this :) looks good.

Smoothie 03-21-2002 03:59 AM

installed on ver 2.2.2. Not getting emails to subscribed forums.

Smoothie 03-21-2002 04:20 AM

I did however get an email:

Database error in vBulletin 2.2.2:

Invalid SQL: SELECT user.username,user.email
FROM subscribeforum,fictionalley.user
WHERE subscribeforum.forumid='55'
AND subscribeforum.userid=user.userid
AND user.userid<>'42'
mysql error: Access denied for user: 'xxxx-xxxx@localhost' to database 'fictionalley'

mysql error number: 1044

kippesp 03-21-2002 04:29 AM

YIKES! My board has special queries. Very sorry about that!

I've fixed that now. The new file does not reference a special user database. (My board has userdata in a different DB!) I'll double check my work, but it should work without errors now.

I've also added to the description in case you're unfamilure with the Padfield hack. It won't send notifications of your own posts. And it isn't all posts. Only new threads.

Smoothie 03-21-2002 04:36 AM

ok, I'll give it another shot...

Thanks!

Smoothie 03-21-2002 04:43 AM

Quote:

# When posting a new thread to moderated forums, notification will be delayed until the thread is approved. This also works with Wayne Luke's moderate user hack
Hi-
Is there a way to avoid this step? In other words is there a way for emails to be sent without first having the thread approved?

kippesp 03-21-2002 04:46 AM

Quote:

Originally posted by Smoothie
Hi-
Is there a way to avoid this step? In other words is there a way for emails to be sent without first having the thread approved?

Sure. Take out the check for $visual in newthread.php. So what was:
if ($enableemail and $visible) {

now becomes

if ($enableemail) {

If this is how you want to use it, you would not need any of my changes to mod/moderate.php.

Smoothie 03-21-2002 05:01 AM

Thanks again! Installing now.

Smoothie 03-21-2002 05:15 AM

Still no email, except this:

Database error in vBulletin 2.2.2:

Invalid SQL: SELECT user.username,user.email
FROM subscribeforum,fictionalley.user
WHERE subscribeforum.forumid='55'
AND subscribeforum.userid=user.userid
AND user.userid<>'42'
mysql error: Access denied for user: 'xxxx-xxx@localhost' to database 'fictionalley'

mysql error number: 1044

kippesp 03-21-2002 05:19 AM

Those references to "fictionalley" were removed from the file about 30 min ago. (I think there were 2 of them.) I had to clear my browser cache for some reason before I'd get the file to download right from vb.org.

Smoothie 03-21-2002 05:24 AM

ok, cache cleared.

Smoothie 03-21-2002 05:42 AM

Works great....nice work. :)

kippesp 03-21-2002 05:44 AM

Glad to hear it. Thanks for helping me find my slip ups.

Smoothie 03-21-2002 06:03 AM

Appreciate your help.

hadley 05-01-2002 05:20 PM

kippesp,
We installed your hack on vB 2.2.4, and all was well -- it worked exactly as promised.

But after I upgraded to vB 2.2.5 last week, the hack stopped working -- any idea why? I mean, did I overwrite something that needs to be reinstalled, or is your hack not compatible with 2.2.5?

Also: I would like to set my site default that all users are subscribed to all 8 of my forums when they sign up -- they'd have to go into their CP to unsubscribe. Do you know how I could accomplish this?

kippesp 05-03-2002 06:22 AM

hadley,

Is it still not working?

I've gone through this hack again and applyed it to a fresh 2.2.5 vB. It is compatible with 2.2.5. I've also updated my test forum to 2.2.5 and this hack also worked.

Since the hack is mostly contained in one area of newthread.php, I'd start there. (Changes for moderated threads in mod/moderate.php are independent of the changes in newthread.php.) I assume the board still has emails enabled and other emails are working?

As far as forcing subscriptions on a user: Is it okay to hardcode the forumids? Or should the forumid list be controlled through the admin CP? Should users be subscribed on being activated? Or should users be subscribed on registering? If they are subscribed on registering, they will need to be able to access their user CP or you'll have some mightly "T'd" off users who can't unsubscibe themselves.

hadley 05-03-2002 05:26 PM

Quote:

As far as forcing subscriptions on a user: Is it okay to hardcode the forumids?
I'm not sure what this means...

Quote:

Or should the forumid list be controlled through the admin CP?
Ditto; sorry. I need to be able to see the list and make changes to it occasionally via the admin CP, but I don't need to assign IDs.

Quote:

Should users be subscribed on being activated?
Yes.

Quote:

Or should users be subscribed on registering?
No -- I want them to always have the ability to unsubscribe from any or all forums. I currently permit immediate activation -- no validation of email address or COPPA -- but plan to change that as the forums build mass.

Thanks for your help -- and let me know if you want to take this conversation offline -- I wasn't sure...

mvigod 05-03-2002 11:46 PM

Won't this potentially create a huge amount of emails? What if you have 8000 users and 50 forums. Say 4000 subsribe to an average of 5 forums. That makes 20,000 subscriptions total. Now let's say each of those forums get's an averge of 10 new threads per day. That would generate 200,000 emails! That's alot of server load on an email server along with bandwidth. Even if you half my numbers in the exmaple it's 100,000 emails! This can be a scary one for active boards...

hadley 05-04-2002 12:53 AM

Yes, it could -- but I have 400 users, 10 forums, and about 2 new threads a week (not day) -- total, across all forums. So, I'd be looking at about 800 emails a week.

Most of my audience is accustomed to (and seems to prefer) listservs; I want to use this hack to get a bit more "in their face" -- so that when there is a new thread, they will be (hopefully) encouraged to visit the forums and add their own posts.

Of course, when/if the activity at my forums picks up, I would revert back to making the subscribe feature optional by default -- and then only those who want it could turn it on. (That's the way it runs now.)

chrispadfield 05-04-2002 07:01 AM

Yes, it is not recommended for a very busy forum. If you are getting more than a few hundred subscriptions per forum then you are going to start causing yourself problems when new threads are started.

hadley 05-09-2002 04:12 PM

kippesp, the hack is still not working since I upgraded to 2.2.5.
My techie (Bill Cameron) worked on it, and here's what he sent to me via email:

Okay, as far as I can tell, it should be working. If it's not, I don't know why. All the new templates and edited templates are present, and I can see the changes I made are there, but it's not working.

Now here's the weird part. I downloaded the instructions again, to do a little comparison, and they don't look like the same instructions. Yet I've looked at it again and again. Kippesp's Contextual Forum Subscriptions Hack.

But his instructions say, for example, "Two templates must be added: email_newthread and emailsubject_newthread."

And yet, the templates I had added previously were "emailsubject_threadstarter" and "email_threadstarter". I made edits to the newthread.php template, but can't match the changes he indicates in the instructions with anything I've done.

Furthermore, I reverted the newthread.php template back to the original, then tried to reinstall, but his instructions don't match up with what is in the template.

I am confused, I have to admit. Perhaps I am looking at the wrong instructions, or the wrong templates. But this is just making no sense to me.

kippesp 05-09-2002 04:41 PM

I suspect there may be mixture of hacks and hack instructions going on: mine and chrispadfield's. They are replacements and should not both be installed.

His template names are email_newthread and email_newthreadsubject. We both use email_newthread. But I used emailsubject_newthread because of existing vB conventions.

My instruction file hasn't changed since 21 March--not even to update the version numbers. Double check which install instructions are being used. (Mine starts out "This hack is similar to the "2.0 Email new thread notifictions to subscribed users" hack by chrispadfield. My hack is a replacement to the Padfield hack. The major differences are:")

Keep in mind that even if the templates were mixed or not even there, emails should still go out. If no templates exist, the email will be blank. (I'm using qmail so blank subjects & bodies are okay. This may not translate to other platforms/emailers.) Also, the thread starter is not notified.

If you still don't figure out, email me a diff of your newthread.php against an unmodified v2.2.5 using "diff -cw".

tkeil69575 05-09-2002 07:21 PM

Hi kippesp,

I installed your hack today, unfortunately im not getting emails from subrcribed forums. I looked at your code

if ($enableemail and $visible)

I presume that means, that users must be Visible and must have emails actived. I have my board setup so that emails-Adresses from users are not shown and quite a few users are not visible. Does that mean thats why its not working?

What would happen if I just removed this if clause?

greetings Tina

kippesp 05-09-2002 08:28 PM

Quote:

Originally posted by tkeil69575
I installed your hack today, unfortunately im not getting emails from subrcribed forums. I looked at your code

if ($enableemail and $visible)

I presume that means, that users must be Visible and must have emails actived. I have my board setup so that emails-Adresses from users are not shown and quite a few users are not visible. Does that mean thats why its not working?

What would happen if I just removed this if clause?
$enableemail is controlled from the admin control panel ("Enable Email features?"). The user cp option for admin emails does not matter (as with thread subscriptions).

$visible is generally used for moderated threads. It is true if (the poster is a moderator) OR (the thread is not moderated) OR (the thread is not a poll). If the thread is to be moderated ($visible == false), the hack's notification is delegated to the mod/moderate.php file. If your forums do not moderate new threads, $visible isn't necessary nor the changes to mod/moderate.php.

One error that I do have in this hack is the poll path. Obviously, I made no modifications to poll.php so nothing is sent. I'll put that on my to-do list.

My only suggestion on testing is to (1) subscribe to a forum, (2) log in using an alternate account, (3) post a new thread to the forum subscribed to in (1).

Also, my instructions may be unclear. The inserted code for file newthread.php needs to be outside the braces (i.e immediately before the line "// redirect"). Let me know if my instructions are unclear in this area. If this code is put in the wrong spot, the checks will be in the wrong if clause and highly unlikely to work.

tkeil69575 05-09-2002 08:44 PM

ok thank you for the explanation. now I understand. I did what you said in regard to posting a new thread with an other account and its working!

Thanks for the great hack :)

malcolm fraser 08-22-2002 05:27 PM

I've installed this hack and it works perfectly. Just what I needed!! Thank you! :)

What I need now is a way to see which users have subscribed to which forums - either from the Admin CP or whatever.

I know enough to know that this should be a relatively simple case of looking up tables and displaying them, but I'm afraid I don't know enough to actually do this myself.

Can anyone help??

Thanks,
Malcolm

mkunichi 10-31-2002 10:28 PM

works great in 2.2.8.

umm. a bit late now, but is there a preferred hack to this one?

kippesp 11-01-2002 12:04 AM

What do you mean by "preferred hack." I'm not familure with that.

mkunichi 11-01-2002 03:48 PM

Given that it had been almost 6 months since the last post, I was just wondering if this hack had been superceded by another, better one.

kippesp 11-01-2002 09:21 PM

I've made no updates. The only enhancement I can think of would be to fix it to work with polls. Creating a new poll doesn't send out an email.

Smoothie 12-02-2002 05:41 AM

STEP 2
(newthread.php) Find the following code
PHP Code:

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

That is no longer how this code appears. It is now
PHP Code:

              eval("\$emailmsg = \"".gettemplate("email_moderator",1,0)."\";");
              eval(
"\$emailsubject = \"".gettemplate("emailsubject_moderator",1,0)."\";");
              
mail($val,$emailsubject,$emailmsg,"From: \"$bbtitle Mailer\" <$webmasteremail>");
            }
          }
          
$bbuserinfo['username'] = htmlspecialchars($bbuserinfo['username']);
        }
      } 

Will the current hack work with 2.2.9?

kippesp 12-02-2002 06:10 AM

Yes, it should work fine. I think the code in this area was first changed in 2.2.7. At least that's what my logs show without tracking down the real ZIP file.

So this line was added between 2.2.6 and 2.2.7:
$bbuserinfo['username'] = htmlspecialchars($bbuserinfo['username']);

The hack addition would still go after the 4th brace in that area--the 2nd brace after the above, quoted line.

Although I have yet to upgrade my forums--don't tell anyone--from your post, at least this area should be fine.

I'm very glad to see that this hack will no longer be necessary in vb3! I think vb3 has its own version anyway.

Paul

Smoothie 12-02-2002 06:24 AM

I've had this hack in my forums since 2.2.1 up to 2.2.7. For some reason I just noticed that extra line of code and wanted to check after I upgraded to 2.2.9

webhost 01-25-2003 10:38 PM

Works great except for one problem
see below how would someone get the thread to send out links instead of the vb code url and /url

take out the a's before url and that is what shows up in email, shows up with the url vb code tags, anyway to fix that


Quote:

Hello Sparky,

RWH Admin has just started the following thread, "Servers Back Online", in the forum "Important Notices / Outages / Virus Alerts" on RWH Forums.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Update: - Some reports are coming in that there is a major US DOS attack that seems to off orginated or has affected Microsoft SQL servers, and its affecting the rest of the net. We will keep you informed and hope to see this fixed as quickly as you do.
We are monitoring massive Distributed Denial of Service attacks all over the U.S. tonight starting at around 11:30 PM CST. As many as 5 of the 13 root name server have been down, up to 10 with massive packet loss (xx%):
All servers should be back up to full speed now.

- [aURL=http://abcnews.go.com/wire/Politics/ap20030125_423.html]ABC[/aURL]
- [aURL=http://europe.cnn.com/2003/TECH/internet/01/25/internet.attack/index.html]CNN[/aURL]
- [aURL=http://www.cbsnews.com/stories/2003/01/25/tech/main537959.shtml]CBS[/aURL]
- [aURL=http://news.bbc.co.uk/1/hi/technology/2693925.stm]BBC[/aURL]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This thread is located at:
http://forums.realwebhost.net/showth...8&goto=newpost

To unsubscribe from this forum, please visit this page:
http://forums.realwebhost.net/member...usub&forumid=3

Yours,
RWH Forums Team



kippesp 01-27-2003 03:17 AM

Personally, I like the markup since it doesn't change the meaning. But this should do the trick:

In newthread.php, find my hacked like:
Code:

$postcontents=unhtmlspecialchars($message);
and change it to:
Code:

$postcontents=strip_tags(bbcodeparse2(unhtmlspecialchars($message),1,1,0,1));
I've not tested this, but it may get you what you want. If you've changed it to send out HTML email, you'll want to not use the strip_tags function.

VBullDC 02-14-2003 01:51 PM

I have a question for the forum. I installed this Hack and love it -- it worked a few weeks ago when someone posted a very short message (like 300 characters). All who were subscribed to the specific forum received the email alert.

Today, however, someone posted a message (which was about 12,000 characters) and the message wasn't emailed out to folks subscribed to the forum.

The only difference in the messages that I can see is the length of the posting.

Does anyone have *any* insight into what might have happened this time around?

I haven't changed any of the vBulletin set-up in the time between the first post and the second. I installed the Hack on 1/17/2003 and am running vBulletin 2.2.8.

Thanks!

VBullDC 03-05-2003 07:34 PM

I posted #38 and didn't hear back from anyone....

I installed this hack and it worked several times. Nothing has changed on my board (it's just been running along, all fine), and I haven't installed any hacks or anything new.

But now the hack doesn't work. If someone posts to a forum I'm subscribed to, I don't get the email alert.

If anyone is out there and can help me I'd really appreciate it.

Thanks a lot.

mashby 03-11-2003 01:19 PM

Just installed on my board [link] and it works like a charm! Nice work, thank you very much.

Any chance of adding the Poll feature soon. If so, this would be a perfect hack! :)


All times are GMT. The time now is 04:46 PM.

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.01516 seconds
  • Memory Usage 1,851KB
  • 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
  • (2)bbcode_code_printable
  • (2)bbcode_php_printable
  • (8)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete