phpBB Digest Installation
If you want to encourage me to maintain this Digests mod, please consider sending me a small donation.
Contents
- Warning about Mod Conflicts
- Preparing to Install
- Download the Mod
- If upgrading, upgrade the database first
- Move the files to your web server
- Create the database tables you need
- Delete the /install directory
- Make the file changes to phpBB
- Configure the board's settings
- Send yourself a test digest manually
- Enable the cron job
- Tweaking phpBB Digests
- Troubleshooting and Questions
- History and Acknowledgements
These instructions are for phpBB Digest Version 1.0.18 and 1.0.19. For installation instructions for versions before version 1.0.17 please check the install.txt file in the archive.
Warning: While this mod is EasyMod compatible, much more is required for installation than using EasyMod. Follow the steps below carefully.
Installing the phpBB Digest mod is one of the most challenging of all phpBB mods to install. It is not for the faint of heart. It generally takes at least sixty minutes to install, and that's for someone who comfortable doing server side "stuff" like using FTP, setting up crons and the like.
What makes it really different than installing any other mod is you typically have to get outside of phpBB and get your hands dirty at the server level by programming a "cron job" or its equivalent. Often this can be done through a control panel interface provided by your web host. In some cases you will need to work with SSH (a secure telnet protocol) and program the "cron job" from a command line interface. In other cases when nothing else seems to work you have to find a site monitoring service and teach it to call your server hourly. Why all this work? It is because phpBB has no way to wake itself up, and the way the Digest mod is written, the program mail_digests.php must be called once an hour in order to ensure digest subscribers receive their digest at the time of day they chose.
Please be aware that since this mod is complex to install I may be willing to install it for you. My typical fee is $30. For more information see my services page.
Warning about Mod Conflicts
As with all official phpBB Mods, this was was developed to work from a "pure" phpBB installation using the latest phpBB source code (2.0.22 in this case) using the default subSilver style. There are thousands of mods out there. If your board is heavily modded, it is possible that changes in this mod will affect your other mods, and visa versa. In general the larger the mod you have installed and the more mods you have installed, the greater the likelihood of a mod conflict. In particular major mods like eXtreme Styles or portals which integrate phpBB with portals like PHP Nuke probably will not work with the Digest mod. In general if you have a mod which changes the format of the phpBB by altering or removing column names the probability of successful installation of this mod decreases rapidly.
If you are up to the challenge, here are the instructions for installing this mod.
1. Preparing to Install
The preparation steps are:
- Check to make sure your server environment supports a feature to run a job automatically once an hour.
- Make sure you have the phpBB Administrator ID and password to your forum.
- Make sure you have a way to FTP the files in the Digest Mod archive to your web site.
- Make sure your phpBB 2 board is current. (Download change files here.) Upgrade your board to the latest version of phpBB 2 if necessary. You can find your version of phpBB from the Administrator Control Panel for your board. You may find that upgrading from older versions of phpBB will not work. Upgrade at your own risk.
How to determine if your server supports a feature to run a job automatically once an hour
In the typical case, you are renting your web space from a web host and your web host is running on Linux or some Unix variation. In this case, browse the control panel provided by your web host. (You should have received this when you set first step up your web site with your web host.) Look for a link like "Cron jobs" in your control panel . (It may not be on your top level control panel page. Consult your web host's online help or web host provided knowledge base if you don't see it. You may find it under the FTP area.) This example shows the link on a cPanel Control Panel.
Some hosting packages do not allow you to program cron jobs or is a feature if you upgrade your hosting package. Others don't offer an interface to it, but will allow you to program a cron job through SSH (secure shell). Needless to say, using SSH is the most difficult way to program a cron job and should be avoided if possible. Others provide an interface, but won't let you run the same job more than once a day.
If you don't see a Cron, Crontab or Cron Jobs link in your control panel, you are not necessarily out of luck since there is still the option of using a Site Monitoring Service. This is covered in the final part of installation.
If you have a Windows server, there are ways to do the same thing as a cron job.
2. Download the Mod
Of course you won't get very far if you don't have the latest version of this modification. You can download it here. After you download it, unzip it into a temporary folder on your computer using a program like PKZIP.
3. If upgrading, upgrade the database first
If you are upgrading from a previous version, copy this file in ASCII to an install directory under your phpBB root directory and run it.
copy install/digest_upgrade_db.php to install/digest_upgrade_db.php
To run, you need to substitute the bolded part below with your own site URL. Example:
http://www.mysite.com/phpBB2/install/digest_upgrade_db.php
If your board is heavily trafficked, you may wish to remove this file and the install folder now, particularly if you plan to wait before moving on to step 4.
Upgrading from 1.0.18
Note: there are NO new edits that need to be made. Here are the files that were changed, so copy over these files only:
- admin/admin_digests_config.php
- includes/digest_functions.php
- includes/digest_emailer.php
- install/digest_tables.php (You won't need this)
- install/digest_upgrade_db.php (Run this)
Upgrading from 1.0.17
Note: there are NO new edits that need to be made. Here are the files that were changed, so copy over these files only:
- mail_digests.php
- install/digest_tables.php (You won't need this)
- install/digest_upgrade_db.php (Run this)
- language/lang_english/lang_digests.php
Upgrading from earlier versions
Now remove your previous version of phpBB Digests and reinstall. If you don't know how to remove your previous version, look at the install.txt file for your current version and follow the instructions in reverse. You can find previous versions on the Digests page. Do not drop the associated tables. These were just upgraded.
4. Move the files to your web server
I will assume you can figure out how to do this. If you don't have a FTP program and run Windows, SmartFTP is a decent program you can install.
The key is to put copy all the files into the correct folders from your phpBB Root Directory. All files should be transmitted as ASCII except for the one image file icon_mini_digest.gif, which must be transferred as BINARY.
If you have EasyMod installed, you can use it at this point to both copy the files and make the changes to phpBB required in Step 7. If you use EasyMod, you will have to FTP the files to a different location (a mods folder) per the instructions that come with EasyMod. Beware that although EasyMod is widely used to ease installations, it is not considered a stable mod, so its use incurs some risk.
If you use styles other than subSilver, copy all the files in the templates/subSilver folder to all of your styles folders that are selectable.
Beware that when you copy the install folder no one can access your forum until you run the appropriate programs in this folder and delete the folder on your server. You may wish to go in to the Administrator Control Panel and disable your board before starting.
copy digests.php to digests.php copy mail_digests.php to mail_digests.php copy admin/admin_digests_add.php to admin/admin_digests_add.php copy admin/admin_digests_config.php to admin/admin_digests_config.php copy admin/admin_digests_modify.php to admin/admin_digests_modify.php copy includes/digest_functions.php to includes/digest_functions.php copy includes/digest_emailer.php to includes/digest_emailer.php copy install/digest_tables.php to install/digest_tables.php
copy language/lang_english/lang_digests.php to language/lang_english/lang_digests.php copy language/lang_english/email/mail_digests_html.tpl to language/lang_english/email/mail_digests_html.tpl copy language/lang_english/email/mail_digests_text.tpl to language/lang_english/email/mail_digests_text.tpl copy templates/subSilver/digests_body.tpl to templates/subSilver/digests_body.tpl copy templates/subSilver/admin/digests_add_body.tpl to templates/subSilver/admin/digests_add_body.tpl copy templates/subSilver/admin/digests_config_body.tpl to templates/subSilver/admin/digests_config_body.tpl copy templates/subSilver/admin/digests_modify_body.tpl to templates/subSilver/admin/digests_modify_body.tpl copy templates/subSilver/images/icon_mini_digest.gif to templates/subSilver/images/icon_mini_digest.gif
Installing languages other than English
Language translations are in a translations folder in the archive. At this time the only translation provided is French. Look for a digests.mod file in the appropriate language folder, and copy and modify the appropriate files per the guidance in this file.
5. Create the database tables you will need
If you are upgrading, skip this step.
Substitute http://www.mysite.com/phpBB2/ in the example below with the URL to your phpBB root directory:
http://www.mysite.com/phpBB2/install/digest_tables.php
This script will create the three tables needed: phpbb_mod_subscriptions, phpbb_mod_subscribed_forums and phpbb_mod_digest_settings. It was tested with MySQL, and should also work with Postgres and MS SQL Server. You should get a short message if it worked correctly. If something went wrong, you should get a prominent error.
If it failed ask for help on the phpBB Digests topic.
6. Delete the /install directory
Delete the files in the /install directory and the directory itself. You can do this with your FTP tool. Your users will not be able to access your board until these steps are completed. You may wish to reenable your board at this point if you disabled it earlier. If your board is heavily trafficked, some users may notice quirks as you make the changes in the next step.
7. Make the file changes to phpBB
If you installed with EasyMod, this step should already be done.
As with all phpBB modifications, you should backup the files first just in case the installation does not work correctly.
Always apply changes carefully. Particularly if you are on a live board, changes may cause critical parts of the board might stop working because you made the change incorrectly.
If you permit use of styles other than subSilver, you will have to modify the overall_header.tpl code to match each template. Consequently the instructions below for modifying overall_header.tpl may NOT work and you will have to puzzle through the template file and make adjustments until it does work.
After installation, in the subSilver style the digests icon and text that is applied to the header should appear for registered users and disappear for unregistered users and guests. Some styles though don't show icons, and in this case you will want to remove the HTML that displays the icon.
If you have a busy board, you may want to defer the changes to overall_header.tpl until the very end. Otherwise your users may be confused by the new links that may not work.
Please make the changes from the digests.mod file in the archive, not from below. This will preserve the identing needed in the code. The changes are listed below for your reference.
Here are the changes that are required using the phpBB modification syntax:
#
#-----[ OPEN ]------------------------------------------
#
profile.php
#
#-----[ FIND ]------------------------------------------
#
else if ( $mode == 'activate' )
{
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Begin Digest Mod
include($phpbb_root_path . 'includes/digest_functions.' . $phpEx);
// End Digest Mod
# #-----[ OPEN ]------------------------------------------ # admin/admin_users.php
# #-----[ FIND ]------------------------------------------ # require($phpbb_root_path . 'includes/functions_validate.'.$phpEx);
# #-----[ AFTER, ADD ]------------------------------------------ # // Begin Digest Mod include($phpbb_root_path . 'includes/digest_functions.' . $phpEx); // End Digest Mod
#
#-----[ FIND ]------------------------------------------
#
if ( !$db->sql_query($delete_text_sql) )
{
message_die(GENERAL_ERROR, 'Could not delete private message text', '', __LINE__, __FILE__, $delete_text_sql);
}
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Begin Digest Mod
// Delete digests subscriptions, if any.
// First remove all individual forum subscriptions
$sql = 'DELETE FROM ' . DIGEST_SUBSCRIBED_FORUMS_TABLE . ' WHERE user_id = ' . $user_id;
if ( !($result = $db->sql_query($sql)))
{
message_die(GENERAL_ERROR, 'Could not delete from ' . DIGEST_SUBSCRIBED_FORUMS_TABLE . ' table', '', __LINE__, __FILE__, $sql);
}
// remove subscription itself
$sql = 'DELETE FROM ' . DIGEST_SUBSCRIPTIONS_TABLE . ' WHERE user_id = ' . $user_id;
if ( !($result = $db->sql_query($sql)))
{
message_die(GENERAL_ERROR, 'Could not delete from ' . DIGEST_SUBSCRIPTIONS_TABLE . ' table', '', __LINE__, __FILE__, $sql);
}
// End Digest Mod
#
#-----[ FIND ]------------------------------------------
#
else
{
message_die(GENERAL_ERROR, 'Admin_user_fail', '', __LINE__, __FILE__, $sql);
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Begin Digest Mod
if ($user_status)
{
// Subscribe to a digest, if board is so enabled
autosubscribe_digest($user_id);
}
else
{
// If the user is becoming inactive, remove their digest subscription
save_digest_settings ($user_id, 'DEL');
}
// End Digest Mod
# #-----[ OPEN ]------------------------------------------ # includes/page_header.php
#
#-----[ FIND ]------------------------------------------
#
define('HEADER_INC', TRUE);
# #-----[ AFTER, ADD ]------------------------------------------ # // Begin Digest Mod include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_digests.' . $phpEx); // End Digest Mod
# #-----[ FIND ]------------------------------------------ # $l_login_logout = $lang['Logout'] . ' [ ' . $userdata['username'] . ' ]';
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Begin Digest Mod
$template->assign_block_vars('switch_show_digests', array());
// End Digest Mod
# #-----[ FIND ]------------------------------------------ # 'L_MEMBERLIST' => $lang['Memberlist'],
# #-----[ AFTER, ADD ]------------------------------------------ # // Begin Digest Mod 'L_DIGESTS' => $lang['digest_page_title_short'], // End Digest Mod
#
#-----[ FIND ]------------------------------------------
#
'U_MEMBERLIST' => append_sid('memberlist.'.$phpEx),
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Begin Digest Mod
'U_DIGESTS' => append_sid('digests.'.$phpEx),
// End Digest Mod
# #-----[ OPEN ]------------------------------------------ # includes/usercp_activate.php
#
#-----[ FIND ]------------------------------------------
#
$sql = "UPDATE " . USERS_TABLE . "
SET user_active = 1, user_actkey = ''" . $sql_update_pass . "
WHERE user_id = " . $row['user_id'];
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not update users table', '', __LINE__, __FILE__, $sql_update);
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Begin Digest Mod
autosubscribe_digest($row['user_id']);
// End Digest Mod
# #-----[ OPEN ]------------------------------------------ # includes/usercp_register.php
#
#-----[ FIND ]------------------------------------------
#
{
$message = $lang['Account_added'];
$email_template = 'user_welcome';
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Begin Digest Mod
include($phpbb_root_path . 'includes/digest_functions.' . $phpEx);
autosubscribe_digest($user_id);
// End Digest Mod
# #-----[ OPEN ]------------------------------------------ # language/lang_english/lang_admin.php
# #-----[ FIND ]------------------------------------------ # $lang['Restore_DB'] = 'Restore Database';
# #-----[ AFTER, ADD ]------------------------------------------ # // Begin Digest Mod $lang['Digests'] ='Digests Admin'; $lang['Digests_Modify_Subscribers']='Modify Subscribers'; $lang['Digests_Add_Subscribers']='Add Subscribers'; $lang['Digests_Configuration']='Configuration'; // End Digest Mod
# #-----[ OPEN ]------------------------------------------ # language/lang_english/lang_faq.php
# #-----[ FIND ]------------------------------------------ # // // This ends the FAQ entries //
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// Begin Digest Mod
$faq[] = array("--","Digests");
$faq[] = array("What are Digests?", "Digests are email messages sent to you periodically with summary of postings made here. Weekly or daily digests are available.");
$faq[] = array("Why would I want a digest?", "It makes your life easier. You don't have to explicitly visit this site to see what conversations are going on around here. Just read your digest and if there is some topic that seems of interest, click on it in your email program and start participating! Unsubscribe at any time.");
$faq[] = array("How often are digests sent?", "They can be sent daily or weekly. Weekly digests are sent on the day set by the board's administrator.");
$faq[] = array("When are digests sent?", "You determine the hour you want to receive the digest. Whatever time you choose, you will always get the latest news so pick a time that suits your lifestyle.");
$faq[] = array("What time period is covered by the digest?", "Either 24 hours or 7 days, depending on whether you selected a daily or weekly digest. Messages older than this will not be sent. In addition if you want you can elect not to see messages since you last logged in, if you visited recently. You can even filter out your own messages.");
$faq[] = array("Suppose I don't want summaries of every message here. Can I be selective?", "Yes. You can pick the forum or forums that interest you. By default you will get messages for all forums that you are allowed to access.");
$faq[] = array("What email message formats are available?", "We can send you HTML or text. Unless your email program can't handle HTML (very unusual these days) we suggest HTML. Frankly, text digests look pretty plain and are harder to use. That's the nature of plain text. There are two variations of HTML formatted email. The Enhanced HTML embeds images and board smilies. The Plain HTML provides a simpler HTML format.");
$faq[] = array("Do I get the whole message text in the digest?", "You can choose how much post text comes in your digest. The default is set by the board administrator. You can choose to see the entire message or the first 50, 100, 150, 300 or 600 characters of each post. Anything beyond the limit you set will be truncated. If the board is a busy board, we recommend using a lower message length because otherwise your digests may get so big as to be unusable. We have also heard that very large digests may be rejected by your ISP or put you over your server storage quota. An excerpt reduces bandwidth and is usually all that is needed. Why? Because each message has a convenient link that will take you to the topic or message of interest.");
$faq[] = array("How do I get started?", "Just click on the Digests link near the top right part of any page. Or if you prefer <a href=\"./digests.php\">click here</a>.");
$faq[] = array("Can I unsubscribe?", "Of course! Just go to the same page and select \"None\" for \"Type of Digest Wanted\". Then submit the form. Your subscription will end immediately.");
$faq[] = array("Are digests commercial free?", "There is no advertising embedded in the digest. It is possible that someone will post a message on this board that is the equivalent of spam.");
$faq[] = array("Is my privacy protected?", "Yes, your digest is sent to you and no one else at the email address you gave us in your profile. Think of the digest as a special edition newspaper customized just for you. Someone else is likely getting a completely different digest.");
$faq[] = array("Why are there private messages in my digest?", "As for version 1.0.17 of the phpBB Digest Mod, private message can appear in the digest. If you edit your digest settings using the link at the bottom of the digest, you can turn off the private messaging feature.");
$faq[] = array("I am getting a digest and I did not subscribe. Why?", "The board administrator either set a policy requiring all new users to receive digests by default, or he enrolled you to receive a digest using an interface in the Administrator Control Panel. You can use the link at the bottom of the digest to unsubscribe. If you are upset about being subscribed against your will, complain to the board administrator. The author of this modification to phpBB cannot rectify your problem.");
// End Digest Mod
# #-----[ OPEN ]------------------------------------------ # templates/subSilver/overall_header.tpl
#
#-----[ FIND ]------------------------------------------
#
<!-- BEGIN switch_user_logged_out -->
#
#-----[ BEFORE, ADD ]------------------------------------------
#
<!-- BEGIN switch_show_digests -->
<a href="{U_DIGESTS}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_digest.gif" width="12" height="13" border="0" alt="{L_DIGESTS}" hspace="3" />{L_DIGESTS}</a>
<!-- END switch_show_digests -->
# #-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ # # EoM
8. Configure the board's digest settings
- Log onto your board as an Administrator. You should see a Digests icon and link in the phpBB header.
- Go into the Administrator Control Panel. You will notice in the left frame there is a Digest Admin area. Select Configuration under Digest Admin.
- On the Digest Configuration screen, correct the field with "Your forum's site URL" so it reflects the public URL to your forum. Make sure you leave the / on at the end - this is crucial!
- You can make other changes if you want, but it is recommended you save others for later. Press the Change Global Settings button.
- If you want, you can also save the default Digest settings (lower on the same screen) for your users at this time.
9. Send yourself a test digest manually
First, configure your digest settings
- While each user decides the time of day they want to receive their digest, the mod assumes that the user has gone into their phpBB profile and applied the correct time zone. Make sure the timezone in your phpBB profile accurately reflects your local time. Be careful if in daylight savings time, since you want one hour earlier. For example, EST is -5:00 GMT, so for daylight savings time your profile needs to be set to -4:00 GMT.
- Check the email address in your profile. The digest will be sent to this email address. Correct if necessary.
- Make sure some messages were posted in the last 24 hours in the forums you selected. Post a test message if necessary.
- Choose the link that is in the phpBB header called "Digests". It should bring up a page that looks similar to this:
- Select a daily digest (default)
- Make sure "Show new messages only" is set to NO. This is crucial, otherwise you will only get a digest for messages since you last visited your board, which means there is likely to be nothing in the digest! Instead, you should see all posts that occurred over the last 24 hours.
- Make sure "Send a digest if no new messages were posted" is set to YES (default). This means you will get a digest even if no messages were posted for the forums you selected.
- Set "Time of day to send digests" to the current hour in your timezone.
Second, run mail_digests.php manually
At this point we have not programmed a "cron job" or its equivalent to send digests to subscribers hourly. We just want to see if any digest can be sent and will appear. The mail_digests.php program actually sends emails containing the digests.
Via URL invoke the mail_digests.php program in your phpBB root folder. (Mail will be sent to you at the address in your phpBB profile.) Example URL to invoke:
http://www.mysite.com/phpBB2/mail_digests.php
If it worked correctly, you should get a response page in your browser similar to this:
Digest Summary
A digest containing 1 posts was sent to MarkDHamill@yahoo.com
A total of 1 digests were emailed.
Server Date: 03/17/2007
Server Hour: 07
Server Time Zone: -6 or MDT
The summary should report that 1 digest went out to your email address. If not, probably your timezone is incorrect in your phpBB profile. Fix it and try again.
Now to check your email to see if the digest arrived. It may take some minutes (or in some cases, some hours) before the mail arrives.
Here is an example of how a digest will look in an email client. In this case the DesertStorm style was used, and the style appears in the email:
Troubleshooting Digest Problems
mail_digests.php says no digests were sent
- Check your phpBB profile and make sure your timezone is correct and the timezone is corrected for daylight savings time, if applicable
- Did you make sure "Show new messages only" is set to NO in the digest interface?
- Did you post a test message, if your board is lightly trafficked?
- Did you configure your digest settings to include posts that you wrote in the digest?
- Check the hour you asked digests to be sent to you again by running digests.php. In the interim the server clock may have moved into the next hour. In this case advance your digest time of day setting to the current hour.
- Fix and rerun mail_digests.php
mail_digests.php returns an error message
- The error message can hopefully suggest what is wrong. It could be that not all files were installed correctly during installation.
- It may be that your phpBB board was set to use SMTP for sending email instead of sendmail, or visa versa. Check your settings in the Administrator Control Panel under General Settings. Sendmail is the typical way mail is sent for Linux and Unix server operating systems. SMTP is usually needed for Windows servers. If you need to use SMTP, you may need to inquire with your web host on the proper configuration for SMTP.
mail_digests.php says it sent me a digest, but I never received it
- Are you looking in the wrong email box? The digest is sent to the email address in your phpBB profile.
- Your internet service provider may be marking the digest as spam. Check your ISP spam folder, your whitelist spam folder, or your email spam folder as applicable.
- It may take some hours to receive the digest, if the internet is congested or the intervening mail servers are backlogged.
- Your ISP's mail server may be overloaded, and it may take some time for it to catch up. You might want to check their support page to see if this is a general problem
- Check the Administrator email address in the phpBB Administrator Control Panel, General Setting. Does the administrator's email domain match the board's email domain? Sometimes if there is a mismatch your web host will say, "How can this domain be sending email by someone from another domain?" If your server is configured this way, such email addresses may be flagged as "spam" and the email may not go through. If you suspect this is the problem, contact your web host.
- Your web host may be scanning outgoing mail for spam and it is thinking the digest is spam. Web hosts don't want to get blacklisted. If you suspect this is the problem, file a support request with your web host.
- If the board is behind a firewall, it may not be able to send email outside the internal network.
I get no feedback when I run mail_digests.php manually
- The digest was probably sent, but no feedback was given. Check the Administrator Control Panel, Digest Admin, Configuration. Make sure the Show summary checkbox is checked. Make sure the Summary Format is HTML since it will give better feedback when you run mail_digests.php from the browser. Now rerun mail_digests.php
The links in the email don't work or point to somewhere else
- Typically this means you skipped Step 8 where you configure your forum's site URL, or did it incorrectly. Verify this step was done correctly. This includes putting a / at the end of the site URL.
I cannot see my style applied to the text in the email digest
- Styles will not appear if you selected a text digest
- Some email clients, particularly web based email clients (like Yahoo! Mail), will ignore stylesheet commands. Others, like Mozilla Thunderbird, may see a security problem displaying images. In this case you may need to grant explicit permission.
- By default your style should be /templates/<style_name>/<style_name>.css. This file may not exist. If your stylesheet has a different name you can override the default setting in Digest Configuration in the Administrator Control Panel. If you have overridden the default setting, it is possible you misspelled the .css file.
- Many email programs will not apply stylesheets to emails automatically. GMail and Thunderbird are two of many email programs with this feature. In this case, enable permissions in your email program to show images and stylesheets for your forum.
- If your forum is protected by an additional layer of security like a .htaccess file or aMember software, it may result in not allowing any email program to "see" your stylesheet. You can try to change your security permissions to allow the stylesheets to be seen without some sort of authentication. If you cannot do this you may have to live with digests where the styles are not applied.
I don't like the default greeting and footer text
- These can be changed if you carefully edit /language/lang_english/lang_digests.php.
10. Enable the Cron Job
Now that you have verified that digests can be sent manually, it is time to automate the process. Most typically this is done by accessing your server's cron tool. Cron is a Unix/Linux operating system program that can cause jobs to begin automatically at specified times. Windows servers have a similar functionality.
Regardless of the method used, you need a way to automatically call mail_digests.php once an hour, every hour, every day of the week.
This is typically the toughest part of the digest installation. If you get too confused, you are advised to find a friend or consultant who is perhaps more tech savvy with "server stuff" and have him/her help you. If you get to the point where you are totally frustrated or your web host simply doesn't offer cron, or a cron like feature, there is an alternative: use an external web monitoring service.
Linux/Unix Hosting
Setting up the cron using a Cron Tool in your web host control panel
This is the typical way to call mail_digests.php automatically. Invoke the cron tool in your web host control panel that you discovered in Step 1.
I recommend creating a cron job that uses curl. curl is a Unix utility that can call a URL, hence its name. It does lots of other things too but our need is simple. It is also almost always supplied with Unix servers. The syntax is simple:
curl <url_to_call>
So an example might be:
curl http://www.mysite.com/phpBB/mail_digests.php
You can try programming your cron job to run this command. Often it work fine, so give it a try. However, you may find it won't work. In that case you need to know the absolute path on your system to curl. You can ask your web host by filing a support ticket. If you have access to SSH, you might be able to find it with this command:
whereis curl
or
which curl
If you don't have SSH, you can write a short PHP program that can probably tell you this information. This short script, perhaps saved as test.php, saved to and run from your phpBB root directory might tell you. This should work if PHP was compiled to allow shell scripts to be executed, which is the typical case:
<?php
$output = shell_exec('whereis curl');
echo 'The curl program is in one or more of these directories: ' . $output;
?>
The curl program is typically some place like /usr/bin or /usr/lib/bin. So the full command to program into your cron tool might be something like:
/usr/bin/curl http://www.mysite.com/phpBB/mail_digests.php
This example shows how it might be programmed using the cPanel cron tool (Advanced settings). Your cron tool may may look different. Note that the command is longer than what fits in the text box, so the full command is not shown:
One problem that may occur is that cron will want to report to you on the success and/or failure of running the cron job by shooting you an email. This is interesting at first, but an email once an hour gets old after a while. Some cron interfaces allow you to suppress emails generated by the cron. If yours does not and this happens to you, revising the command to something like this might "shut up" curl and your cron tool:
/usr/bin/curl -s -o /dev/null http://www.mysite.com/phpBB/mail_digests.php
The -s option should put curl in silent mode, and using -o redirects output if there is any. If sent to /dev/null output should go into the bit bucket.
Note the asterisks (*) above. The asterisk is a wild card and means repeat for every unit. So the * under hour means run it every hour. You should program a cron job like this. You should use * in all the columns except the first (minute). You can enter 0 to kick of mail_digests.php at the top of the hour, or you can enter any number between 0 and 59 to kick it off on a different minute.
Now change your digest settings to the next hour. Once you save your changes sit back and wait to see if you get your digest in your email box shortly after the time you programmed the cron.
If it works once then it should work as long as you do not change the cron tool. You have completed installation. Keep reading though to learn about changing the behavior of cron.
Note: if curl is not available or not accessible, see if wget is available on your server. The syntax will be different but the principle is the same.
Instead of curl or wget, you can also invoke PHP from a cron job directly, if you know the path to PHP. The following program might tell you the location of PHP on your system.
<?php
$output = shell_exec('whereis php');
echo 'PHP is in one or more of these directories: ' . $output;
?>
Here is an example of how the cron might be programmed:
/usr/bin/php /www/htdocs/mydomainname/phpBB/mail_digests.php
The following program, if stored in your phpBB root folder as test.php and run should give you the absolute path needed for the second argument. It may not work if safe mode is enabled for your installation of PHP. You can use the second argument for constructing your cron job, as in the example above.
<?php
$output = shell_exec('pwd');
echo 'The current directory is : ' . $output;
?>
If this approach still does not work then you may have change line 36 of mail_digests.php to show the absolute path to your phpBB root directory.
$phpbb_root_path = './';
The result might look something like this, but will depend on what your absolute path actually is:
$phpbb_root_path = '/home/username/public_html/phpBB2/';
Setting up a cron job manually using SSH or Telnet
Real men (and women) program from the command line! If you have the right stuff or, more importantly, you have no cron tool in your control panel, but you do have SSH (secure shell) or telnet access to your server, you can program cron the old fashioned way from the Unix prompt. Here are some instructions that may work.
- If your web host allows straight telnet access, great. Log in. Skip the next step.
- Most web hosts they require that if you want a telnet access you have to use a secure telnet program, such as Secure Shell (SSH). (Putty is a free SSH tool you can install on your computer.) Find out from your web host what you need to do to use SSH. This may not be a trivial process. Elapsed time may take a day or two if you haven't done it before. Often your web host's control panel will contain instructions on how to use SSH. Not all web hosts allow SSH.
- You will need a passing ability to use the Unix "vi" text editor to program your crontab job. Here is how
I did it (do not send the quotes as part of the commands). Note that you need to first figure out the path
to the curl. See the instructions above.
- From the command prompt, I entered the command "crontab -e" then Enter, which took me into a "vi" environment
- Typing "i" put me in the vi insert mode
- Very carefully I typed the following:
0 * * * * /usr/bin/curl -s -o /dev/null http://www.mysite.com/phpBB/mail_digests.php
- I pressed the Escape key to get out of vi insert mode
- Typed ":wq" then Enter to get out of vi.
- To verify the job was scheduled I entered the command "crontab -l" then Enter.
- Logged out
- Now change your digest settings to the next hour. Wait to see if you get your digest in your email box shortly after the time you programmed the cron. You have completed installation. Keep reading though to learn about changing the behavior of cron.
Windows Hosting
I have not installed phpBB Digests on a Windows box, but other users have. I will pass on what I have learned. Essentially you need two things:
- Familiarity with Windows Scheduled Tasks
- wget for Windows or some similar program written for Windows that can call a URL for you. (If you are comfortable programming in the .NET environment, there are a number of various ways to write programs that call URLs.)
Create a batch file (with a .bat extension) in Notepad or a similar text editor and call it from Windows Scheduled Tasks. The batch file should look something like this:
wget -q -O - http://full.url.to/mail_digests.php exit
As with Unix cron jobs, you need to program Windows Scheduled Tasks to call this batch file once an hour, every hour, every day of the week. I am not sure if Windows will retain this job if you log out or reboot your server.
After setting up Windows Scheduled Tasks, keep trying and tweaking things until it works. Wait to see if you get your digest in your email box shortly after the time you programmed the cron. Did you succeed? If so, you have completed installation. Keep reading though to learn about changing the behavior of cron.
Using an External Web Monitoring Service
If you are tearing your hair out at this point and ready to spit nails because all this is too hard to figure out and too geeky, there is another solution. Use a site monitoring service.
A site monitoring service is an internet company that periodically polls your server to see if it is "up". It notifies you via email if the site is down, so you can complain to your web host. To check if a site is up, you have to provide a URL to check. Instead of having it check your top level page, you can have it run mail_digests.php instead. As part of checking it, it will also run the script and send out digests. So if you can get it to call your mail_digests.php program once an hour, you are home free. You will need to program the URL you used in Step 9 when prompted by the site monitoring service.
This sounds like a simple, hassle free way to go. Why am I not recommending it by default?
- There is no guarantee one of these services will be around in a day or a year.
- The service may try just once and then give up. Given the congestion on the internet your server may be up but the request may never arrive. Most services will try again if they first do not succeed, but there is no way they can guarantee that they will be able to call your server once an hour, every hour, every day.
- Many offer a free service for limited use. However, remember that the service is only as good as it remains financially viable. You might want to pay them some money to keep the service around.
This Google Search should give you some site monitoring services worth checking out:
http://www.google.com/search?q=uptime+monitors+free&btnG=Search
I experimented with SiteUpTime and it seems to work well for me. I am not recommending it, but you might want to give it a try.
Regardless of the service you will have to register on the service, create an account, probably create an ID and password and then work your way through the interface. If it can't check at least hourly, don't use this service.
Now change your digest settings to the next hour. Hopefully the site monitoring service will call your program at the top of the hour. Wait to see if you get your digest in your email box shortly after the time you programmed the site monitoring service. Did it succeed? If so, you have completed installation. Keep reading though to learn about changing the behavior of cron.
Troubleshooting Cron Problems
I can get mail_digests.php to run manually, but it fails from a cron
- You may need to use the absolute path to call curl, wget or php. See the advice above.
- Are you using the correct URL to mail_digests.php if using curl or wget? Generally people install phpBB in a folder under their domain like phpBB2.
- Are the permissions set correctly for mail_digests.php? Particularly if using curl or wget, make sure public read permissions to the file are set.
- Maybe there are no digests to send this hour. Have you changed your Digest settings for the next hour? Try it and wait to see what happens in the next hour.
- mail_digests.php might have to be set to use an absolute path to point to your phpBB root directory. This will require editing line 36 of mail_digests.php. Use the guidance above to figure out the absolute path to your phpBB root directory. Try the cron again and see if it works.
- If you get frustrated and are tearing your hair out, relax. Give up and use an External Monitoring Service.
I am getting email every hour with lots of cryptic stuff in it. Make it stop!
- Some cron tools allow you to suppress emails. If yours does, this is the easiest thing to do.
- Program your cron tool, if it allows it, to send email to a fake email address. Try no_email@example.com. The domain example.com is a special Internet domain so anything sent to it should go into the bit bucket.
- Try to send any output from mail_digests.php to the bit bucket using the suggestions above. A curl example is shown.
- Set up your spam filter to ignore them
- Ask your web host if there is a way to redirect this email by default to a digital trash can
I want to keep a log to troubleshoot problems. How do I do it?
- First, enable the log feature of mail_digests.php. In the Administrator Control Panel, Digests Admin, Configuration select the Show Summary checkbox. Then select Text for the Summary Type.
- Next redirect output from the mail_digests.php program to a file. Make sure it is in a writeable area and you provide the absolute path. Warning: this file will get very big over time. Example for curl:
/usr/bin/curl -s -o /dev/null http://www.mysite.com/phpBB/mail_digests.php >> /www/htdocs/potomactavern/phpBB/mail_digests.log
- To view the log from the command line use the tail command. To see the last lines in the file the command would be:
tail /www/htdocs/potomactavern/phpBB/mail_digests.log
I can't seem to use "vi" to edit the crontab
- It may be that by default your web host configured you to use another editor.
- You can create the file on your PC and upload it, then if you can get to the command like you can program the cron using file redirection like this:
crontab < uploaded_file.txt
I don't see the answer to my question. What now?
- Post the question on the phpBB Digest Topic.
11. Tweaking phpBB Digests
Congratulations on completing installation. You might also want to post an announcement on your board and encourage users to sign up!
phpBB Digests now includes an Administrator Control Panel Interface. Here are some of the highlights:
- You can enroll all or selected users to receive digests under the "Add Subscribers" option. Beware that while you can do this, it may not be a good idea because most people prefer to "opt in" to an email list. Such an action may be considered pushy and may drive users away from your board.
- You can modify digest settings for individual users and well as delete them from the "Modify Subscribers" option. The only thing you cannot do is change the precise forums for which users can receive digests. This is because the permissions logic is too complex. This logic may be added in a future version. Post a message in the phpBB Digest Topic if you want this feature.
- You can enroll all new users to receive digests by default. In the Configuration screen, click on the checkbox "Enable automatic digest subscription?"
- You can set the default digest settings for your board in the Configuration screen. Users can override these when they subscribe.
- Don't like using the default stylesheet in your digests? You can "roll your own" then link to it in the Configuration screen. You will have to learn CSS. Here is a good CSS reference.
- Change the date and time presentation options for digests in the Configuration screen
- For extra security, you may wish to require a key parameter to be used with mail_digests.php. This can also be done from the Configuration screen. If you enable this you will have to go back and edit your cron job.
Spam filtering is becoming more and more aggressive these days. This often results in complaints from users that they are not receiving digests. Here are some tips you might want to post:
- Are you looking in the wrong email box? The digest is sent to the email address in your phpBB profile.
- Your internet service provider may be marking the digest as spam. Check your ISP spam folder, your whitelist spam folder, or your email spam folder as applicable.
- It may take some hours to receive the digest, if the internet is congested or the intervening mail servers are backlogged.
- Your ISP's mail server may be overloaded, and it may take some time for it to catch up. You might want to check their support page to see if this is a general problem
At the bottom of the Configuration screen a message appears if there is a new digest version. Check it periodically. You may want to upgrade.
Troubleshooting and Questions
If you still find yourself at a loss, try posting a question on my support forum.
History & Acknowledgements
This mod was first released in 2003 by Mark D. Hamill. It has undergone numerous upgrades to improve functionality. Without a doubt though it would not be so popular without the extensive beta testing done by many users and the suggestions and feedback provided on the phpBB forums.
I hope you find this mod useful. Allowing similar users to come together online is what phpBB is all about. With the digest mod content can be pushed back to the community.
Pay Pal donations are always gratefully appreciated, but not expected. Donations can be sent to mhamill@computer.org.
