Board watch

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

NOTICE: This forum is only for the announcement of new releases and/or updates of MODs. Any MOD support should be obtained through the Customisations Database in the support area designated for each MOD.

A direct link to support for each MOD is in the first post of the respective topic.
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: Board watch

Post by asinshesq »

shott wrote:I am still getting the following error when I post replies (phpBB 3.0.4 on Linux with a Postgresql database ....):
General Error
SQL ERROR [ postgres ]

ERROR: invalid input syntax for integer: " . BOARDWATCH_YES . " []

SQL

SELECT u.user_id, u.username, u.user_email, u.user_lang, u.user_notify_type, u.user_jabber, u.user_boardwatchf FROM phpbb_forums_watch fw, phpbb_users u WHERE fw.forum_id = 5 AND fw.user_id NOT IN (1, 2, 62, 66, 54, 57, 58, 64, 55, 63, 60, 56, 65, 61, 53, 54, 57, 58, 64, 55, 63, 60, 56, 65, 61, 53) AND (fw.notify_status = 0 OR u.user_boardwatchf = ' . BOARDWATCH_YES . ') AND u.user_type IN (0, 3) AND u.user_id = fw.user_id...
I think I may have found it. Give this a try and let me know what happens:

Code: Select all

OPEN
includes/functions_posting.phpo

FIND
				AND (fw.notify_status = 0 OR u.user_boardwatchf = ' . BOARDWATCH_YES . ')

REPLACE WITH
				AND (fw.notify_status = 0 OR u.user_boardwatchf = " . BOARDWATCH_YES . ")
edit...I just saw that you said this:
Although I have not yet tested it, I believe that the second $sql query would work properly (that is, will interpret the BOARDWATCH_YES constant properly) if the single quotes that precede and follow BOARDWATCH_YES are each changed to double quotes. In this way, the $forum_id and $sql_ignore_users variables will be interpreted properly and the BOARDWATCH_YES (which will no longer be quoted) will be interpreted as a constant.
As you can see, great minds think alike ;)
That should do the trick.
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: Board watch

Post by asinshesq »

I've been thinking about why that error wouldn't have jumped out at me on my test board. The reason is that my test board uses mysql and mysql is more forgiving than postgres (too forgiving in my view) in allowing you to interpret a literal string (letters) as though they mean 0 in a select for a field that is supposed to be an integer. So on a mysql board, the part of your query that was giving you problems resolves as:

Code: Select all

AND (fw.notify_status = 0 OR u.user_boardwatchf = 0)
rather than

Code: Select all

AND (fw.notify_status = 0 OR u.user_boardwatchf = ' . BOARDWATCH_YES . ')
And completely coincidentally, the constant BOARDWATCH_YES really is 0, so on a mysql board everything works right even though you are correct that the single quotes in that place are absolutely wrong.

Thanks for pointing this out!
shott
Registered User
Posts: 8
Joined: Mon Apr 06, 2009 2:00 pm

Re: Board watch

Post by shott »

Alan:

Thanks for your responses and for the explanation of why MySql would be different than Postgresql in this regard. When I found the single- vs double-quote difference, I was sitting here nervously asking myself "Why do I appear to be the first person to have noticed this? I would have thought that everyone would have seen this". But, I can easily believe that as a recently released mod, I may well be the first Postgresql person.

In any event, replacing the singe quotes with the double quotes, as you suggested, did eliminate the SQL error.

I did, however, still get an error message further downstream:
General Error
Could not find email template file [ ./language/en_us/email/boardwatch_reply_but_but.txt ]
Note: I had copied everything in ./language/en/email/boardwatch*.txt into the directory ./language/en-us/email so, in general, the boardwatch_*.txt files are there. (Of course, that may not have been a legal thing to do, but I thought that would be the logical thing to do for folks who had defined en_us as their default language.) However, there is clearly no file named boardwatch_reply_but_but.txt.

I've got a suspicion that something in my database may be in an inconsistent state because of the previous SQL error that apparently completed part, but not all, of the update_notification() function.

Do you have a suggestion as to where I might look to see if something is in an inconsistent state or where an extra '_but' might get added to a file name that already ended with a '_but' .... but apparently didn't realize it.

Thanks for you help,

John
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: Board watch

Post by asinshesq »

shott wrote:I did, however, still get an error message further downstream:
General Error
Could not find email template file [ ./language/en_us/email/boardwatch_reply_but_but.txt ]
Note: I had copied everything in ./language/en/email/boardwatch*.txt into the directory ./language/en-us/email so, in general, the boardwatch_*.txt files are there. (Of course, that may not have been a legal thing to do, but I thought that would be the logical thing to do for folks who had defined en_us as their default language.) However, there is clearly no file named boardwatch_reply_but_but.txt.

I've got a suspicion that something in my database may be in an inconsistent state because of the previous SQL error that apparently completed part, but not all, of the update_notification() function.
Doesn't sound like a problem with the db. Sounds more like a problem where the code is executing the line that adds '_but' to the template name more than once - as though the defined term $email_template (I think that's what it's called though I don't have access to my files here) didn't get reset in the loop that includes the line adding '_but' to the filename reference when the user in question specified 'yes but'. Probably my error. Unfortunately, I can't look at the code till tomorrow at the earliest so I won't be right back to you, but I will take a look as soon as I can and let you know what the problem is. Sorry this is causing you such problems!
shott
Registered User
Posts: 8
Joined: Mon Apr 06, 2009 2:00 pm

Re: Board watch

Post by shott »

Alan:
Doesn't sound like a problem with the db. Sounds more like a problem where the code is executing the line that adds '_but' to the template name more than once - as though the defined term $email_template (I think that's what it's called though I don't have access to my files here) didn't get reset in the loop that includes the line adding '_but' to the filename reference when the user in question specified 'yes but'.
One other thought .... Is there any chance that this problem was created because I failed to clear the cache after I made the change to get the SQL statement to work? Or would that not have resulted in an opportunity to add another '_but' to something that already had '_but' appended.
Unfortunately, I can't look at the code till tomorrow at the earliest so I won't be right back to you, but I will take a look as soon as I can and let you know what the problem is. Sorry this is causing you such problems!
No need to apologize! You've been impressively quick in your responses thus far and I expect that the broadly tunable capabilities that this module adds is going to be very popular. While I'm running a forum with only a very limited number of subscribers, I know that I've got folks that never want email notification and others that never want to miss a posting. I can only assume that this is true of many folks. While I don't know much about MySql, I've had enough dealings with Postgresql and Oracle to know that anything that works with multiple databases is really tricky because SQL is such a non-standardized standard.

Have a good evening,

John
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: Board watch

Post by asinshesq »

Shott, let's give this a try (it looks like it should work but I haven't tried it):

Code: Select all

OPEN
includes/functions_posting.php

FIND
				// start mod boardwatch (and end mod too)...added the next line
				$email_template = ($addr['yes_but']) ? $email_template . '_but' : $email_template;

				$messenger->template($email_template, $addr['lang']);

REPLACE WITH
				// start mod boardwatch (and end mod too)...added the next line and in the one after, changed
				// $email_template to $boardwatch_template
				$boardwatch_template = ($addr['yes_but']) ? $email_template . '_but' : $email_template;

				$messenger->template($boardwatch_template, $addr['lang']);
Please let me know if that does the trick.
shott
Registered User
Posts: 8
Joined: Mon Apr 06, 2009 2:00 pm

Re: Board watch

Post by shott »

Alan:

I believe that this latest fix did the trick! I no longer see the error message about looking for a email template named something_but_but.txt. While I haven't been able to verify that each subscribed member got the notification that they should have, I have at least been able to confirm that a number of emails were sent out to subscribed members. Since most of my subscribers have not yet altered the default BOARDWATCH_YES setting, this seems correct as well.

So, I thank you again for your timely response in resolving this issue and thanks for you efforts in creating and supporting this useful enhancement to phpBB3.

Have a good day,

John
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: Board watch

Post by asinshesq »

And thank you for acting like the test guineau pig. I'm not used to my mods not working (maybe some subtle occassional erros from time to time but not fundamental problems like this), so I apologize for putting you through the hassle.

Maybe the difference is that my forums are still on phpbb2 (I hope to move to phpbb3 in the next month or so) so my phpbb3 mods don't get the same real world testing. Anyway, glad it's all working fine now.

It does occur to me that maybe the better default for a user is to set boardwatch to now and forum watch and topic watch to yes but)? At a minimum I should at least add an author's note telling people how to change that, but what do you think the default should be if the person installing the mod does not change it?
shott
Registered User
Posts: 8
Joined: Mon Apr 06, 2009 2:00 pm

Re: Board watch

Post by shott »

It does occur to me that maybe the better default for a user is to set boardwatch to now and forum watch and topic watch to yes but)? At a minimum I should at least add an author's note telling people how to change that, but what do you think the default should be if the person installing the mod does not change it?
Alan:

I think that in many cases ... particularly for high-traffic forums ... a default setting of boardwatch to no and forumwatch and topicwatch to yes_but is probably correct so that folks aren't suddenly flooded with email. The only downside, as I see it, to that more gentle introduction to boardwatch is that if they aren't currently subscribed to any forums or topics, they may never realize that boardwatch is an option. I believe that you could make an argument that setting all three (boardwatch, forumwatch, and topicwatch) to yes_but might be a good compromise because that way, even if they weren't subscribed to any forums or topics, they would quickly get something alerting them to boardwatch's existence and a link to the page where they can set up and fine tune their own options.

Of course, you'd best take my thoughts with a grain of salt as I'm a new phpBB3 administrator and also run a comparatively low-volume set of forums .... both in terms of number of registered members and in terms of message volume.

In terms of documentation, here is a slightly cleaned up posting that I sent to my registered users describing how they could alter their own boardwatch settings. This, of course, is not the same as describing how a board administrator would alter the default behavior, but I thought that it may be of use to others keeping an eye on boardwatch.
We have recently added a new module named boardwatch to this system that allows you great control over how often you are notified via email of new postings to various forums on this board.

In particular, some of you will want to be notified of about everything .... whereas others of you may want to receive no email notifications and only see what is new when you actually visit the forum. Boardwatch allows that degree of flexibility. In fact, as the default notification behavior turns boardwatch on, you will likely receive an email message notifying you that I have posted this topic and it will include a link that allows you to control future notifications.

When you click that link, you will be taken to the BOARDWATCH_EDIT_OPTIONS section of the Board Preferences tab of the User Control Panel.

That panel gives you three rows of options: Boardwatch options, Forumwatch options, and Topicwatch options.

In phpBB parlance, the board is the collection of all of the forums on this web site. A forum is any one of those individual forums. A topic is one discussion thread on one of those forums.

So, lets look at the highest level the boardwatch options. Interestingly, you have 3 choices: YES, NO, and interestingly named option of BOARDWATCH_YES_BUT.

Here is what each means on the Boardwatch options row:

YES means that you will receive email notifications from all postings to the entire board. This will make you aware of each and every posting to the board. Of course, many of you will not want to be flooded with that much email.

BOARDWATCH_YES_BUT means that you will receive an email notification when there has been a new posting since your last visit (so that you know that there is something new) but will not send you notifications of subsequent postings.

NO means that you will receive no board-wide email notifications. Of course, if you subscribe to either individual forums or topics, you will receive notifications about those specific forums or topics depending on your choice of the Forumwatch or Topicwatch options.

If you are not interested in receiving notification from all forums, you can still subscribe to receive email notifications from individual forums by clicking the "Subscribe forum" link on the bottom of each forum page. How you will be notified depends on your settings on the Forumwatch settings described below:

YES means that you will receive email notifications from all postings to each subscribed forum. This will make you aware of each and every posting to the subscribed forums.

FORUMWATCH_YES_BUT means that you receive an email notification when there has been a new posting to the subscribed forum since your last visit, but will not continue to send you notifications of subsequent postings to that forum.

If you are only interested in receiving notifications from individual topics, you can subscribe to just those topics that are of interest to you by clicking the "Subscribe topic" link at the bottom of each topic page. How you will be notified depends on your setting on the Topicwatch settings described below:

YES means that you will receive email notifications from all postings to each subscribed topc. This will make you aware of each and every posting to the subscribed topc.

TOPICWATCH_YES_BUT means that you receive an email notification when there has been a new posting to the subscribed topic since your last visit, but will not continue to send you notifications of subsequent postings to that topic.

By default, boardwatch is set up to notify you of all postings to all forums. For many (and even most) of you, that will be way too many email notifications. By following the link to the BOARDWATCH_EDIT_OPTIONS section of the Board Preferences tab of the User Control Panel you can quickly alter those setting so that you will be never notified by email, only notified when you have subscribed to individual topics, or only notified when you have subscribed to individual subscriptions. Also, as described above, you can choose between either notification of all posts or only to be notified of the first post since you last visit at the board, forum, or topic level, respectively.

Hopefully you will tune this in a manner that makes these discussion forums most useful to you without filling your already overloaded inboxes with unwanted email notifications.

Thanks again for all of your efforts,

John
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: Board watch

Post by asinshesq »

shott wrote:In terms of documentation, here is a slightly cleaned up posting that I sent to my registered users describing how they could alter their own boardwatch settings. This, of course, is not the same as describing how a board administrator would alter the default behavior, but I thought that it may be of use to others keeping an eye on boardwatch...
Good idea to have a posting like that and I like the text, but it reveals that you've got another problem on your board.
When you click that link, you will be taken to the BOARDWATCH_EDIT_OPTIONS section of the Board Preferences tab of the User Control Panel...So, lets look at the highest level the boardwatch options. Interestingly, you have 3 choices: YES, NO, and interestingly named option of BOARDWATCH_YES_BUT...
Something is going on there because:

- that area of board preferences should not say BOARDWATCH_EDIT_OPTIONS but instead should say "Edit post notification options"

- the first actual option should say "Send me notice of all posts, even where I am not subscribed to the forum or topic:" and the alternatives are "Yes" or "Yes, but only once between visits to the site" or "No"

- the second actual option should say "When I subscribe to a forum, send me notice of all posts in the forum:" and the alternatives are "Yes" or "Yes, but only once between visits to the forum"

- the third actual option should say "When I subscribe to a topic, send me notice of all posts in the topic:" and the alternatives are "Yes" or "Yes, but only once between visits to the topic"

For some reason the ucp is not reading your langague file called language/en/mods/info_ucp_boardwatch.php. Is that file in the right place and with the right name on your board?
shott
Registered User
Posts: 8
Joined: Mon Apr 06, 2009 2:00 pm

Re: Board watch

Post by shott »

Alan:

Yes, you've spotted another problem .... this one was entirely my fault.

I've got the en_us language module installed. I had remembered to move the language/en/email/boardwatch*.txt files into language/en_us/email directory, but had failed to do the similar thing for language/en/mods/info_ucp_boardwatch.php and language/en/acp/permissions_boardwatch.php.

Things look much better now. Thanks for pointing that out to me ...

John
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: Board watch

Post by asinshesq »

shott wrote:Things look much better now. Thanks for pointing that out to me ...
Great. If you decide to update your informational posting to reflect the correct terms, please edit your original post to pick up your revised version (of course, don't waste your time if you aren't otherwise going to update that informational posting).
awair
Registered User
Posts: 13
Joined: Wed Apr 08, 2009 9:01 am

Re: Board watch

Post by awair »

Sorry to 'but' in...

Can you confirm that the code listed above is designed to fix the '_but_but' problem and not something else (as well)?

I thought I was being really clever [as a complete newb] and copied the '_but' file and made an identical '_but_but' file. This of course cleared the original error message...

... and generated the '_but_but_but' error.

I really like the mod [we are moving from a Yahoo Groups mailing list to a phpbb3 forum] and without this mod would be missing considerable functionality.

On the question of default notifications, I believe that the whole board should be set to 'No', and others set to 'once'.

- my host limits mail to 150 messages per hour. With a small board of 400 members and 150 posts at the moment, a single new post floods the host. Increasing to the host's maximum 750, will only provide temporary relief. [Needless to say, I am changing host.]

- my board has has several discrete and diverse sub-forums [tried to keep each private/hidden using groups] but most members will only want to subscribe to say 1 of 10 different sections, everyone wanting a different 1! [The reason we left Yahoo was too much 'Off Topic' traffic, of course everyone had a different idea of what was 'off topic'.]

Hope this feedback is useful. Once again, thanks for the mod.
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: Board watch

Post by asinshesq »

awair wrote:Sorry to 'but' in...

Can you confirm that the code listed above is designed to fix the '_but_but' problem and not something else (as well)?

I thought I was being really clever [as a complete newb] and copied the '_but' file and made an identical '_but_but' file. This of course cleared the original error message...

... and generated the '_but_but_but' error.
Lol! And by the way, adding a but_but file will cause problems beyond getting those error messages. You should delete the but_but files and use the solution I posted above.
my host limits mail to 150 messages per hour. With a small board of 400 members and 150 posts at the moment, a single new post floods the host. Increasing to the host's maximum 750, will only provide temporary relief. [Needless to say, I am changing host.]
Sounds like finding a new host is a really good idea ;)
awair
Registered User
Posts: 13
Joined: Wed Apr 08, 2009 9:01 am

Re: Board watch

Post by awair »

Many thanks for the quick reply, I have deleted the '_but_but' file and amended the code in 'functions_posting'.

I have changed user permissions to prevent changes to 'user_boardwatchb'.

I am using phpMyAdmin, and changed the default to '2' for new users using the 'change icon' on the structure tab of the users table.

However, I was a little stuck on the SQL syntax to update existing users to '2'. I was selecting the SQL tab and entering the code below [my users table is 'users' not 'phpbb_users'], but getting a syntax error...

Code: Select all

UPDATE TABLE users
SET user_boardwatchb = 2
WHERE 1 = 1;
#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 'TABLE users
SET user_boardwatchb = 2
WHERE 1 = 1' at line 1

Eventually, I found another tutorial suggesting:

Code: Select all

USE mydatabase;

UPDATE users
SET user_boardwatchb = 2
WHERE 1 = 1;
And this worked! [Correction - the SQL update worked, will wait to see if this fixes the email errors that I've been having.]

Just in the process of tweaking the email formats...

Thanks again

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