Previous Thread
Next Thread
Print Thread
Rating: 4
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Mod Name / Version: Digest or Instant Subscriptions 1.0

Description: This allows users to not only "subscribe" to forums via email, but they can choose the standard Digest Version from Threads, generated via cron of the subscriptions script, OR they can choose to receive the emails of new posts instantly.


Working Under: UBB.Threads 6.2

Mod Status: Beta

Any pre-requisites: You must run a subscriptions cron job as normally required for UBB.Threads to offer subscriptions. Help with cron jobs can be found http://www.ubbcentral.com/resources/cron.html


Author(s): JoshPet

Date: 04/30/03

Credits: CloudyNights.com for commissioning it. Also this is based on the Subscriber Emailer hack by Lunatic

Files Altered: editemail.php, changeemail.php, editemail.tmpl, addpost.php, and either /cron/php/subscriptions.php OR /cron/perl/subscriptions.pl

New Files: none

Database Altered: U_EmailDigest field added to the users table.

Info/Instructions: Follow the instructions posted here, then instruct users to adjust the "digest" setting in he Email Preferences page of "My Home".

Disclaimer: Please backup every file that you intend to modify.
If the modification modifies the database, it's a good idea to backup your database before doing so.

Note: If you modify your UBB.Threads code, you may be giving up your right for "official" support from Infopop.If you need official support, you'll need to restore unmodified files.


Attachments

Sponsored Links
Joined: Dec 2000
Posts: 1,471
Addict
Addict
Offline
Joined: Dec 2000
Posts: 1,471
Thx Josh! This is very handy for smaller boards.

Joined: Apr 2003
Posts: 5
Lurker
Lurker
Offline
Joined: Apr 2003
Posts: 5
Josh it seems I can not alter the data base from the web interface that my host gives me. I hate to ask but I will, could you make an altertable.php to make this so I can use it and it will be simple for others. This is just what I want for our union site... This may be asking too much but I figure it is worth a try...

Thanks either way... Great hack

Last edited by gkhan3; 05/08/2003 1:33 AM.
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
OK - download the attached text file - give it the extenions of .php instead of .txt and upload to your threads directory.

Run it in your browser - and you should be set. Then delete it from the server when you are done.

Josh
Attachments
79428-digestalter.txt (0 Bytes, 24 downloads)

Joined: Aug 2003
Posts: 7
Lurker
Lurker
Offline
Joined: Aug 2003
Posts: 7
Josh,

I tried your hack on UUBT 6.3.1 and I'm getting the following SQL error. Can you help?

URL is http://glade-crossing.com/ubbthreads/ubbthreads.php

SQL ERROR: Unable to do_query: UPDATE gcna_Users SET U_EReplies = 'On', U_Notify = 'On', U_AdminEmails = 'On', U_EmailFormat = 'plaintext' U_EmailDigest = 'no' WHERE U_Username = 'Mike_Tabat'
You have an error in your SQL syntax near 'U_EmailDigest = 'no' WHERE U_Username = 'Mike_Tabat' ' at line 7

[]JoshPet said:
Mod Name / Version: Digest or Instant Subscriptions 1.0

Description: This allows users to not only "subscribe" to forums via email, but they can choose the standard Digest Version from Threads, generated via cron of the subscriptions script, OR they can choose to receive the emails of new posts instantly.


Working Under: UBB.Threads 6.2

Mod Status: Beta

Any pre-requisites: You must run a subscriptions cron job as normally required for UBB.Threads to offer subscriptions. Help with cron jobs can be found http://www.ubbcentral.com/resources/cron.html


Author(s): JoshPet

Date: 04/30/03

Credits: CloudyNights.com for commissioning it. Also this is based on the Subscriber Emailer hack by Lunatic

Files Altered: editemail.php, changeemail.php, editemail.tmpl, addpost.php, and either /cron/php/subscriptions.php OR /cron/perl/subscriptions.pl

New Files: none

Database Altered: U_EmailDigest field added to the users table.

Info/Instructions: Follow the instructions posted here, then instruct users to adjust the "digest" setting in he Email Preferences page of "My Home".

Disclaimer: Please backup every file that you intend to modify.
If the modification modifies the database, it's a good idea to backup your database before doing so.

Note: If you modify your UBB.Threads code, you may be giving up your right for "official" support from Infopop.If you need official support, you'll need to restore unmodified files.


[/] [:"black"] [/]

Sponsored Links
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Look for this part in changeemail.php
Code
<br />		U_EmailFormat    = '$EmailFormat_q',<br />		U_EmailDigest    = '$EmailDigest_q'<br />		WHERE U_Username = '$Username_q'<br />


I suspect you ar missing the coma at the end of the email format line.

Joined: Aug 2003
Posts: 7
Lurker
Lurker
Offline
Joined: Aug 2003
Posts: 7
That was the problem. Hard to see. Good eye!!

Thanks for the hack and the assist!

Mike

Joined: Jun 2003
Posts: 131
Journeyman
Journeyman
Offline
Joined: Jun 2003
Posts: 131
[]JoshPet said:
Mod Name / Version: Digest or Instant Subscriptions 1.0

Description: This allows users to not only "subscribe" to forums via email, but they can choose the standard Digest Version from Threads, generated via cron of the subscriptions script, OR they can choose to receive the emails of new posts instantly.
[/]

Josh...this interests me greatly, and I had asked about this somewhere (probably on the infopop support board) and been told you couldn't get individual "instant" emails on a FORUM (as opposed to a thread). As I read your description, for those who subscribe to a forum, this ADDS the alternative of receiving instant emails of posts INSTEAD of the daily digest. Am I interpreting this correctly?

Thanks! Tony

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Yes, it allows them to subscribe to the forum.... either for a daily digest or instant notification. It doesn't work with the "Favorite Forums" bit, but rather the subscriptions.

Joined: Jun 2003
Posts: 131
Journeyman
Journeyman
Offline
Joined: Jun 2003
Posts: 131
great! Thanks - Tony

Sponsored Links
Joined: Jun 2003
Posts: 131
Journeyman
Journeyman
Offline
Joined: Jun 2003
Posts: 131
Josh...I think I want to try this on my test board this weekend.

So this requires adding that field to the database. I would have to do that, I guess, via the phpadmin tool that the website provides, and THERE the potentially relevant things appear to be:

1) the box for running queries, or

2) the place for creating a new table, where there are entry boxes for the table and the field(s) (all the latter in one box, I guess)

Is 2) where I would do something? e.g., naming an existing table and puttin gin the new field?

However, your code appears to be more in the form that I think I've seen recommended to people for running queries.

IS there a simple guide to where one does "easy" things like this, where the code is already provided to us?

Thanks - Tony

PS and I understand the bit about backing up the database first, except that I have no way of knowing whether the backups are usable...so many diverse things mentioned. I have been using the following:

- I select the tables to be backed up (in this case, I guess I select ALL, since we are altering the database)
- I check structure and data
-I check complete inserts
- I check send
and I hit "Go"

I would select one of the zipped options, except I've gotten 2 stories on which, AND I've found the only actually free zip program I could find didn't handle g or b zipped...guess I ought to spring for winzip, huh?

To take this a bit further, how can I check whether the backups are really valid? I do have a test board, so I guess I could use the backup from my main board, and maybe change all the tablename prefixes, and then go through the restore process on my testboard. Would that work??

Joined: Aug 2000
Posts: 1,609
Addict
Addict
Offline
Joined: Aug 2000
Posts: 1,609
You can enter SQL commands in your Admin section. Scroll to the DB Management table and click on SQL command. Enter the SQL commands that Josh gives in his inctrutions:

Code
 <br />ALTER TABLE w3t_Users <br />ADD U_EmailDigest VARCHAR( 3 ) DEFAULT 'no' NOT NULL <br />


...then click Submit.

Joined: Aug 2000
Posts: 1,609
Addict
Addict
Offline
Joined: Aug 2000
Posts: 1,609
I'd suggest you use the Save as File option when backing up in phpMyAdmin and it'll save it as a zip file. I believe this is a fairly new feature, though. Is your host running 2.5.2? If not, you can install your own version. And WinZip can be used for free.

http://winzip.com/ddchomea.htm

Joined: Jun 2003
Posts: 131
Journeyman
Journeyman
Offline
Joined: Jun 2003
Posts: 131
thanks for the info...my understanding is that the database management section in threads can't be used on a lot of sites, including infopop shared hosting...anyway, as noted above, there's an entry box for sql queries...is that where I would enter these commands? That's one of the things I was trying to clarify!

ok on winzip...somehow I thought that the evaluation version had a 30-day limit...

FInally...can I confirm that the scheme I outlined above can be used to check that the backup is valid...i.e., by backing up the tables from my MAIN board, changing the prefixes to the one for the TEST board, and then restoring that, and checking to see if the data was usable by the test board?

Thanks - Tony

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
also note -

It's OK to give this a try - but I have not tested or updated for 6.3..... and recently have LOADS of work on my plate.... so I won't have time to update this for a while unless a client needs it in the meantime.

So just in case it doesn't work - be sure you have your backup scripts so you can roll back.

Joined: Aug 2000
Posts: 1,609
Addict
Addict
Offline
Joined: Aug 2000
Posts: 1,609
Yes, there's a box in the admin section, just follow the path I laid out for you to get to it.

And nope, you can use WinZip for free for as long as you like.

You could test it by installing a back-up board, but that would be a lot of work. Really, all you have to do is check the date and size of the file(s) and give the sql file(s) a once over and look at them to see if they look right. Compare your database size to the file size. I believe they should be the same. Also, backups work for some shared servers. They work for mine. To check, after you backup in Threads, check the restore section for the date/size information. If it displays that day's date and the right file sizes (>0) then it should be okay.

Joined: Jul 2003
Posts: 26
User
User
Joined: Jul 2003
Posts: 26
Josh:

"but I have not tested or updated for 6.3"

I've had it running on our site for a couple months now and it seems to be working fine. This is a great MOD!

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Thanks.

Patrick actually wrote to me and said that on larger forums, this can slow down. I didn't write the original workings to this, as it's based on Lunatik's Subscriber Emailer Hack. I simply used it and added a "switch" to allow people do get either digest or subscription.

The original hack uses a query which Patrick's host told him was pretty inefficient.

$query = "
SELECT U_Email,
U_Language
FROM {$config['tbprefix']}Users
LEFT JOIN {$config['tbprefix']}Subscribe ON S_UID = U_Number
WHERE S_UID = U_Number
AND S_Board = '$Board_q'
AND U_EmailDigest = 'no'
";


Can anyone see a way that the query might be done so that it's faster to complete the post on larger boards?

I'm really not familiar with the use of LEFT JOIN so I'm not sure if that's good or not. LOL

Thanks.


Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
Try this:

SELECT U_Email, U_Language FROM {$config['tbprefix']}Subscribe
LEFT JOIN {$config['tbprefix']}Users ON U_Number = S_Uid
WHERE S_Board = '$Board_q' AND U_EmailDigest = 'no'

Last edited by Dave_L; 10/04/2003 12:38 PM.
Joined: Jul 2003
Posts: 26
User
User
Joined: Jul 2003
Posts: 26
Dave/Josh:

Looks like a SLIGHT improvement...

Now - Generated in 19.656 seconds in which 0.149 seconds were spent on a total of 19 queries

Before - Generated in 176.773 seconds in which 159.889 seconds were spent on a total of 16 queries.

THANKS!!!

Joined: Jun 2003
Posts: 1,025
Junior Member
Junior Member
Offline
Joined: Jun 2003
Posts: 1,025
Yeah, I would say that counts as an improvement.

Joined: Mar 2004
Posts: 5
Lurker
Lurker
Offline
Joined: Mar 2004
Posts: 5
The Digest or Instant Subscriptions 1.0 Hack is exactly what I need. Thanks for posting it, Josh.

I tried it with my board running 6.4.1.

However, when I tried to reply to a message to see if it worked, I got the following error:

Fatal error: Call to undefined function: headers() in e:\inetpub\wwwroot\ubbthreads\addpost.php on line 1024

This error happens in the new code I added from the hack. The bit of code is:

$to = $Mailto;
$mailer = new mailer;
$header = $mailer -> headers();
$subject = "New Post To $Title from $postername";

I wonder what went wrong there. Does anyone know if this hack will work on a 6.4.1 board?

Thanks,

Geoff

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
It would need to be rewritten a bit - as the mail function was rewritten in 6.4 so the headers() function no longer exists. It's all been moved into a send_mail function.

Joined: Mar 2004
Posts: 5
Lurker
Lurker
Offline
Joined: Mar 2004
Posts: 5
Oh, I see.

(Now I'm down on both knees begging):

Any chance you could update the hack?

My users are going nuts asking for this functionality.

You would be my hero!

Thanks,

Geoff

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
I'll add it to my list - shouldn't be too tough to update. Got some other projects to finish first though.

Joined: Mar 2004
Posts: 5
Lurker
Lurker
Offline
Joined: Mar 2004
Posts: 5
Thanks so much. I really, really appreciate it.

You don't know me, but your posts here and on the ubbcentral boards have been key for helping me get my board up and running and fully tweaked out.

Your helpful posts are everywhere. I swear they're must be five of you!

Thanks again,

Geoff

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
LOL

Sometimes I wish there were 5 of me - then I could really get something done.

Thanks,
Josh

Joined: Mar 2004
Posts: 5
Lurker
Lurker
Offline
Joined: Mar 2004
Posts: 5
Hey Josh.

I was able to make a small modification to your instructions and I got this mod to work with 6.4.2.

All I did was remove the following line from the modified code for addpost.php:

$header = $mailer -> headers();

Then I replaced the old call for sending mail:

mail("$to","$subject",$msg,$header);

with the new call:

$mailer -> send_mail($emailformat,"",$to,$subject,$msg);

and lo and behold everything worked! So now my users (who want it) are getting instant email notification on all posts in the Forums they are interested in.

Thanks a ton for posting this original mod. I'm loving 6.4.2 and now my users are too.

Take care,

Geoff

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Yup - you got it -

Great!


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Posts: 70
Joined: January 2007
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)