Email Digests

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in here. No new MODs will be accepted into the MOD Database for phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.

Rating:

Excellent!
48
59%
Very Good
17
21%
Good
9
11%
Fair
2
2%
Poor
6
7%
 
Total votes: 82

User avatar
MarkDHamill
Registered User
Posts: 4017
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: Email Digests

Post by MarkDHamill »

Here is the code that is failing:

Code: Select all

	// Get the union of the valid/moderator/admin_forums array (whichever applies) and the elected_formus array. The  
	// resulting elements are the forums that could be queried. This is necessary because MySQL 3.x doesn't support SQL Unions.
	switch ($row['user_level'])
	{
		case USER:
			$queried_forums = array_merge($valid_forums, $elected_forums);
			break;
		case MOD:
			$queried_forums = array_merge($moderator_forums, $elected_forums);
			break;
		case ADMIN:
			$queried_forums = $admin_forums; // Administrators see all forums
			break;
		default:
			message_die(GENERAL_ERROR, 'Attempt to run mail_digests.php for an invalid user level. User level is ' . $row['user_level'] . ' and username is ' . $row['username'], '', __LINE__, __FILE__, $sql);
	}
	$queried_forums = array_unique($queried_forums);
Defined user levels are in /includes/constants.php and are:

Code: Select all

// User Levels <- Do not change the values of USER or ADMIN
define('DELETED', -1);
define('ANONYMOUS', -1);

define('USER', 0);
define('ADMIN', 1);
define('MOD', 2);
So in this case for some reason username Mrs. Malmo in the phpbb_users table has a user_level of 3, which is not defined.

Do you have a special mod installed which defines new user levels? This is likely the problem (the mod was written to work on a generic board) or your database is corrupt. If this is an ordinary user, the value would be 0. You can use a tool like phpMyAdmin to fix the value to be 0, 1 or 2 as appropriate.
Get the latest versions of my Digests and Smartfeed extensions.
Need phpBB services or a phpBB consultant? I offer most phpBB services.

ogimaa
Registered User
Posts: 16
Joined: Sat Mar 10, 2007 10:30 am

Re: Email Digests

Post by ogimaa »

Yes, I have special user levels. I have Tri Force installed - Username Color, User Class, and ModCp.

In Constants I have:

Code: Select all

// User Levels <- Do not change the values of USER or ADMIN
define('DELETED', -1);
define('ANONYMOUS', -1);

define('USER', 0);
define('ADMIN', 1);
define('MOD', 2);
define('MAIN_MOD', 3);
define('SUPPORT', 4);
define('VIP', 5);
define('BOT', 99);
So I am guessing that I need to add case statements in mail_digests.php and digests.php? What else do I need to change?

Also, users are not receiving an option to check forums that they have access to, but are set as Private.

User avatar
MarkDHamill
Registered User
Posts: 4017
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: Email Digests

Post by MarkDHamill »

The purpose of the block of code I showed you is to create a select statement that retrieves all the forums the person can read. Moderators can also see moderator only forums, administrators see everything. If you have created other user types you will have to make the judgment as to which forums they should see. I am guessing the mod you installed has some special logic in this area.

This logic is the most secure and will ensure that no one falls through the cracks:

Code: Select all

   switch ($row['user_level'])
   {
      case USER:
         $queried_forums = array_merge($valid_forums, $elected_forums);
         break;
      case MOD:
         $queried_forums = array_merge($moderator_forums, $elected_forums);
         break;
      case ADMIN:
         $queried_forums = $admin_forums; // Administrators see all forums
         break;
      default:
         $queried_forums = array_merge($valid_forums, $elected_forums);
         break;
   }
   $queried_forums = array_unique($queried_forums);
Your issue though does suggest I need a better way of handling this. Since I should have a new release in about a week, I will look at improving the logic in this spot.
Get the latest versions of my Digests and Smartfeed extensions.
Need phpBB services or a phpBB consultant? I offer most phpBB services.

User avatar
MarkDHamill
Registered User
Posts: 4017
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

phpBB Digests 1.0.17 Released

Post by MarkDHamill »

phpBB Digests Version 1.0.17 is now ready for download.

Download here

I would like to thank those who helped test this release, but in particular Sylvain Bourdon, who did an incredible amount of detailed testing, as well as created a new French language translation.

I am a little nervous about the installation software, mainly because I cannot test it outside of a MySQL environment given the limited number of beta testers. In addition I am not entirely sure that some statements in digests_admin_add.php are cross platform, although they should be.

Please note that some files have been removed or renamed.

Because of the complexity of installation, there is now a Digests Installation web page. There is a link to the instructions in the digests.mod file.

Installation page

What's new? Details are on the download link but major new functionality includes many sought after features.
  • New Administrator Control Panel Interface
    • Make all new users receive digests by default.
    • One button press allows you to create digest subscriptions for all unsubscribed users (except administrators)
    • Selectively make groups of unsubscribed users receive digests
    • Add a single user to receive digests
    • Global Settings Interface
    • Digest Default Settings Interface
    • Sophisticated user interface allows ad-hoc groups on a page to be selected for global updates or deletes
    • Change individual digest subscription settings (except for forums subscribed)
    • Delete individual digest subscriptions
  • New and unread private messages received since a user's last board visit can show in the digest. User can control in their digest settings whether they want to see private messages in the digest.
  • New /install/digest_upgrade_db.php script makes intelligent changes to database if you are upgrading based on your previous version
  • Ability to automatically enroll new users to receive digests
If I installed the Digest Mod for you before and you would like me to upgrade it, let me know. My charge is $10.

Please note that this is likely to be the last version for phpBB 2.x, unless a bug patch is needed. I will begin the arduous work of a phpBB 3.x version soon.

This has been a huge amount of work for me, so please use it so I can feel all that effort was not in vain.

Of course if you are having issues, post them here.

Enjoy!
Get the latest versions of my Digests and Smartfeed extensions.
Need phpBB services or a phpBB consultant? I offer most phpBB services.

eteeple
Registered User
Posts: 5
Joined: Fri Aug 20, 2004 8:01 pm

SQL problem installing 1.0.17 upgrade

Post by eteeple »

I've been wrestling with email digests for a few weeks now--sometimes successfully, sometimes not. I thought I'd try the upgrade rather than yet another clean install of phpbb 2.0.22 (I end up doing the other two mods I have--attachments, and u2uinvitation--by hand).

I'm following the directions on web site, and had not yet ftp'd any files over, just moved (in ascii mode) the digest_upgrade_db.php file to /install, and ran it from my browser. I then got the following General Error:

Code: Select all

General Error

Error altering phpbb_mod_subscriptions table

DEBUG MODE

SQL Error : 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '('HTML', 'PHTM', 'TEXT') DEFAULT 'HTML'' at line 1

ALTER TABLE phpbb_mod_subscriptions CHANGE format ENUM('HTML', 'PHTM', 'TEXT') DEFAULT 'HTML'

Line : 60
File : digest_upgrade_db.php
 
Although my host has a pretty good array of helpers (cron job helper, for instance), I have no skills in MySQL. Should I just reinstall phpbb 2.0.22 and install a clean version of the new Email Digests? It's a new non-public board and it's no problem to lose everything.

User avatar
MarkDHamill
Registered User
Posts: 4017
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: Email Digests

Post by MarkDHamill »

What version did you use last? This program attempts to determine your old version and tries to upgrade you accordingly.

There could be a bug in my upgrade program. Are these fields currently CHAR(3) vs. ENUM? I'm gathering you may not know since you don't have access to phpMyAdmin. What version of the Digest software are you currently running?

You can try a fresh reinstall if you want but in doing so you will drop associated tables and lose existing digest subscriptions.
Get the latest versions of my Digests and Smartfeed extensions.
Need phpBB services or a phpBB consultant? I offer most phpBB services.

eteeple
Registered User
Posts: 5
Joined: Fri Aug 20, 2004 8:01 pm

Re: Email Digests

Post by eteeple »

MarkDHamill wrote: What version did you use last? This program attempts to determine your old version and tries to upgrade you accordingly.

There could be a bug in my upgrade program. Are these fields currently CHAR(3) vs. ENUM? I'm gathering you may not know since you don't have access to phpMyAdmin. What version of the Digest software are you currently running?

You can try a fresh reinstall if you want but in doing so you will drop associated tables and lose existing digest subscriptions.


I was using 1.1.16 of the digest software. If it helps, my host is using:
MySQL version 4.1.21-standard
and
Php version 4.4.4


Ah! I do have access to phpMyAdmin. What should I check/look for?

User avatar
MarkDHamill
Registered User
Posts: 4017
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: Email Digests

Post by MarkDHamill »

Look at the column types for the phpbb_mod_subscriptions table. Is the format column CHAR(3) or ENUM?

I think I see what may be the problem. Please change line 37 to this and let me know if it works:

Code: Select all

if (DIGEST_VERSION == '')
Get the latest versions of my Digests and Smartfeed extensions.
Need phpBB services or a phpBB consultant? I offer most phpBB services.

eteeple
Registered User
Posts: 5
Joined: Fri Aug 20, 2004 8:01 pm

Re: Email Digests

Post by eteeple »

MarkDHamill wrote: Look at the column types for the phpbb_mod_subscriptions table. Is the format column CHAR(3) or ENUM?


I think I'm looking in the right place. I looked in phpbb_mod_subscriptions, and the format column is char(4).
I think I see what may be the problem. Please change line 37 to this and let me know if it works:

Code: Select all

if (DIGEST_VERSION == '')


I changed line 37 of digest_upgrade_db.php, and BINGO, it worked! I got this on the next screen:

Code: Select all

If you see this message, then your database should be upgraded to support the latest digest features.

Please note that if you want users who have thus far not chosen to receive a digest to now automatically receive one, you should run the program http://peacebuildingandtrauma.netforum//install/digest_subscribe_all.php now.
.

If you are all done, please delete this file and remove the install directory, since your forum will not be accessible until it is removed.
Thanks so much.

User avatar
MarkDHamill
Registered User
Posts: 4017
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: Email Digests

Post by MarkDHamill »

My bad for leaving the bug in the code. I will correct it and republish.
Get the latest versions of my Digests and Smartfeed extensions.
Need phpBB services or a phpBB consultant? I offer most phpBB services.

ogimaa
Registered User
Posts: 16
Joined: Sat Mar 10, 2007 10:30 am

Re: Email Digests

Post by ogimaa »

Have you had a chance to look at how to handle Special User Classes ie Main Moderator, VIP, Bots?

User avatar
MarkDHamill
Registered User
Posts: 4017
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: Email Digests

Post by MarkDHamill »

Yes, if you look at mail_digests.php you will see that if the user class is unrecognized it defaults to the most paranoid response, which is the privileges of a regular user.

Code: Select all

	// Get the union of the valid/moderator/admin_forums array (whichever applies) and the elected_formus array. The  
	// resulting elements are the forums that could be queried. This is necessary because MySQL 3.x doesn't support SQL Unions.
	switch ($row['user_level'])
	{
		case MOD:
			$queried_forums = array_merge($moderator_forums, $elected_forums);
			break;
		case ADMIN:
			$queried_forums = $admin_forums; // Administrators see all forums
			break;
		default:
			$queried_forums = array_merge($valid_forums, $elected_forums);
			break;
	}
It is perhaps not ideal because your mod may assign special forum permissions to these types above that of regular user, but at least it won't cause mail_digests.php to terminate abnormally.
Get the latest versions of my Digests and Smartfeed extensions.
Need phpBB services or a phpBB consultant? I offer most phpBB services.

eteeple
Registered User
Posts: 5
Joined: Fri Aug 20, 2004 8:01 pm

Re: Email Digests

Post by eteeple »

This may be a small thing, but you might want to note it, as I'm pretty sure you said somewhere to make sure to follow the .mod instructions in the download, rather than on your website (http://phpbb.potomactavern.org/digests/installation.htm).

Regarding the installation/file transfers, on the Digests Installation web site, it says:

Code: Select all

copy templates/subSilver/digests_body.tpl to templates/subSilver/digests_body.tpl
While the instructions in digests.mod say

Code: Select all

copy templates/subSilver/digests.tpl to templates/subSilver/digests.tpl
I didn't see a digests.tpl anywhere in my downloaded files, so I'm assuming that in this case the website is correct and the .mod instructions just need to be changed, correct?

Hmmm. In digests.mod it also says

Code: Select all

copy templates/subSilver/digests_post.tpl to templates/subSilver/digests_post.tpl
and I don't see any file by that name in the /root/subSilver directory of the install package. The digests_post.tpl isn't mentioned on the website, either.

I'm guessing that you had things one way, and then changed your mind...

User avatar
MarkDHamill
Registered User
Posts: 4017
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: Email Digests

Post by MarkDHamill »

Yeah, you caught a couple errors.

I need to update digests.mod. This is correct:

Code: Select all

copy templates/subSilver/digests_body.tpl to templates/subSilver/digests_body.tpl
This should be:

Code: Select all

copy templates/subSilver/admin/digests_post.tpl to templates/subSilver/admin/digests_post.tpl
I will correct the .mod file.

This is also incorrect and should not be in the .mod file:

Code: Select all

copy templates/subSilver/digests_post.tpl to templates/subSilver/digests_post.tpl 
Archive has been updated.
Get the latest versions of my Digests and Smartfeed extensions.
Need phpBB services or a phpBB consultant? I offer most phpBB services.

User avatar
MarkDHamill
Registered User
Posts: 4017
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Bug found in 1.0.17

Post by MarkDHamill »

Reported by Sylvain Bourdon:

Line 84 of digest_functions.php should be:

Code: Select all

		if ($send_hour === 'R') // pick a random hour
Otherwise when you add users selectively a random hour will be picked.

I will fix the archive when I have a chance.
Get the latest versions of my Digests and Smartfeed extensions.
Need phpBB services or a phpBB consultant? I offer most phpBB services.

Post Reply

Return to “[2.0.x] MOD Database Releases”