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.
movedtoomuch
Registered User
Posts: 11
Joined: Sun Jul 29, 2007 4:55 pm

Re: Board watch

Post by movedtoomuch »

Okay, I just installed this mod. I see it when following part of the "Self Instructions", but a bit lost with some other parts. When I look at #2 from the instructions, I am lost. Maybe it is obvious, but EXACTLY where should I be going and making changes, and changes to what?

2. Go into the forum permissions part of the ACP and grant the applicable boardwatch permissions to users or groups as you think appropriate.
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: Board watch

Post by asinshesq »

movedtoomuch wrote:Okay, I just installed this mod. I see it when following part of the "Self Instructions", but a bit lost with some other parts. When I look at #2 from the instructions, I am lost. Maybe it is obvious, but EXACTLY where should I be going and making changes, and changes to what?

2. Go into the forum permissions part of the ACP and grant the applicable boardwatch permissions to users or groups as you think appropriate.
You need to grant permissions for this mod in the same way you grant permissions for all other phpbb3 features. So:

- Go to the ACP (to do that, click the Administrative Contol Panel link that appears at the bottom of each forum page for anyone who has administrative privileges)

- Click the Permissions tab that appears towards the top of the ACP

- Click Users' permissions (if you want to assign boardwatch permissions to individually selected users) or Groups' permissions (if you want to assign boardwatch permissions to groups) or User roles (if you want to assign boardwatch permissions to a role like standard features)...my guess is you will want to grant boardwatch permissions either to specific groups or, if you use them, to a User role)

- Click the user or group or role you want to assign boardwatch permissions to

- Click Advanced Permissions

- Click the Board Watch Options tab

- Make your selections and then click Apply Permissions
movedtoomuch
Registered User
Posts: 11
Joined: Sun Jul 29, 2007 4:55 pm

Re: Board watch

Post by movedtoomuch »

Might be time for a change in the instructions.

I just found it. The instructions say to go to ACP, and then FORUM permissions. I could not see anything with BOARDWATCH there. Instead, I went to GLOBAL PERMISSIONS and found it.
User avatar
DragonMaster1
Registered User
Posts: 994
Joined: Tue Aug 17, 2004 11:04 am
Name: Terry
Contact:

Re: Board watch

Post by DragonMaster1 »

Will this mod send the contents of the posts or just the link?
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: Board watch

Post by asinshesq »

DragonMaster1 wrote:Will this mod send the contents of the posts or just the link?
No, the notices look pretty much like regular phpbb3 notices. It wouldn't be hard to add the text to the notice if you know a bit of coding, and you could adapt some code from another mod of mine that allows posters to send notices of posts to groups (since that mod gives the poster the option to include the text of the post in the notice). See http://www.phpbb.com/community/viewtopi ... 5#p8952115
awair
Registered User
Posts: 13
Joined: Wed Apr 08, 2009 9:01 am

Re: Board watch

Post by awair »

I may have found a possible bug, is this the place to report?

I have disabled the UCP option to set the "user_boardwatchb" field, set the default to '2' & verified all values for all users as the default.

I then noticed that for some users, the value was returning to '0'.

After contacting the most recent member affected, he stated that he had changed the UCP option for the "user_boardwatchf" to '2', which appears to have reset the "user_boardwatchb field" to '0' [the option for this is not visible on the UCP].

I have been monitoring this field on a daily basis to check what was happening, and have now disabled all the options.

Any chance that there is something adrift with the code, or is this a coincidence?

Many thanks,
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:...I have disabled the UCP option to set the "user_boardwatchb" field, set the default to '2' & verified all values for all users as the default.

I then noticed that for some users, the value was returning to '0'.

After contacting the most recent member affected, he stated that he had changed the UCP option for the "user_boardwatchf" to '2', which appears to have reset the "user_boardwatchb field" to '0' [the option for this is not visible on the UCP]...
Thanks for pointing this out. The problem is that when you hide one of the options and someone makes a selection, the code will always reset the hidden option to a default value (in this case 0). The following should fix it (let me know how it goes):

Code: Select all

OPEN
includes/ucp/ucp_boardwatch.php

FIND
		// is the user submitting his or her selections?
		if (isset($_POST['submit']))
		{
			// get the selections
			$boardwatchb_selection	= request_var('boardwatch', 0);
			$boardwatchf_selection	= request_var('forumwatch', 0);
			$boardwatcht_selection	= request_var('topicwatch', 0);

			$sql_ary = array(
				'user_boardwatchb'		=> $boardwatchb_selection,
				'user_boardwatchf'		=> $boardwatchf_selection,
				'user_boardwatcht'		=> $boardwatcht_selection,
				'user_notify_status'	=> 0
			);

			$sql = 'UPDATE ' . USERS_TABLE . '
				SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
				WHERE user_id = ' . $user->data['user_id'];
			$db->sql_query($sql);

			meta_refresh(3, $this->u_action);
			$message = $user->lang['PREFERENCES_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
			trigger_error($message);
		}

		// get the current selections from the database to show as the default
		$sql = 'SELECT user_boardwatchb, user_boardwatchf, user_boardwatcht
			FROM ' . USERS_TABLE . '
			WHERE user_id = ' . $user->data['user_id'];
		$result = $db->sql_query($sql);
		$row = $db->sql_fetchrow($result);
		$db->sql_freeresult($result);

REPLACE WITH
		// get the current selections from the database to show as the default
		$sql = 'SELECT user_boardwatchb, user_boardwatchf, user_boardwatcht
			FROM ' . USERS_TABLE . '
			WHERE user_id = ' . $user->data['user_id'];
		$result = $db->sql_query($sql);
		$row = $db->sql_fetchrow($result);
		$db->sql_freeresult($result);

		// is the user submitting his or her selections?
		if (isset($_POST['submit']))
		{
			// get the selections
			$boardwatchb_selection	= request_var('boardwatch', $row['user_boardwatchb']);
			$boardwatchf_selection	= request_var('forumwatch', $row['user_boardwatchb']);
			$boardwatcht_selection	= request_var('topicwatch', $row['user_boardwatchb']);

			$sql_ary = array(
				'user_boardwatchb'		=> $boardwatchb_selection,
				'user_boardwatchf'		=> $boardwatchf_selection,
				'user_boardwatcht'		=> $boardwatcht_selection,
				'user_notify_status'	=> 0
			);

			$sql = 'UPDATE ' . USERS_TABLE . '
				SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
				WHERE user_id = ' . $user->data['user_id'];
			$db->sql_query($sql);

			meta_refresh(3, $this->u_action);
			$message = $user->lang['PREFERENCES_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
			trigger_error($message);
		}
I just updated the third post in this thread (which is my first post in the thread), located here: http://www.phpbb.com/community/viewtopi ... 5#p9075535)
to reflect this change, and I added a new download link in that post for version 1.0.1d that reflects all changes made so far.
awair
Registered User
Posts: 13
Joined: Wed Apr 08, 2009 9:01 am

Re: Board watch

Post by awair »

Alan, many thanks you're an absolute star!

I think I will leave the users with no options, just the default until the forum is a bit older, but will incorporate the changed code anyway.

This Mod is absolutely indispensable for us. I'm just trying to tweak the functionality a little without breaking it - so if you could confirm that what I've done is safe...

I've not changed any code.
I've changed the text in the following files in the /public_html/_turbine/language/en/email directory:
boardwatch_forum_notify.txt
boardwatch_forum_notify_but.txt
boardwatch_newtopic_notify.txt
boardwatch_newtopic_notify_but.txt
forum_notify.txt

The changes include abbreviating the subject & including the posting title [which works]. Adding the file name so I can track down which notification is being called [I couldn't follow why the forum_notify.txt was being used instead of the boardwatch equivalent].

I'm sure there is a more elegant solution for this but it seems to work.

I read your posting about integrating the postnotices_to_groups mod, to include the post message [& the sender & signature if possible] but I don't want to include the functionality of that whole mod [& I don't want to break what I already have], what's the minimum I would need to include to get the correct variables defined? I'm happy editing the files, but only by blind obedience rather than understanding.

Ideally what recipients would see is:
Subject: [myforum] This is the post title

The full text goes here.
But no links.
Sender
Senders signature from profile [if that isn't included in the body]

filename - this is an automatic notification from myforum
Many thanks again,
Andrew
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:could confirm that what I've done is safe...

I've not changed any code.
I've changed the text in the following files in the /public_html/_turbine/language/en/email directory:
boardwatch_forum_notify.txt
boardwatch_forum_notify_but.txt
boardwatch_newtopic_notify.txt
boardwatch_newtopic_notify_but.txt
forum_notify.txt

The changes include abbreviating the subject & including the posting title [which works]. Adding the file name so I can track down which notification is being called [I couldn't follow why the forum_notify.txt was being used instead of the boardwatch equivalent].
Nothing wrong with any of that.
I couldn't follow why the forum_notify.txt was being used instead of the boardwatch equivalent
So, when does it happen ;)
I don't think it will ever get used - does it ever get used on your board?

Having said that, you do bring up a point that hadn't occurred to me: if the admin does not grant a user permission to change ANY boardwatch options the sentence in the notification email that gives the user a link to the UCP place where the user can change his notification options should really be left out (since the user will get a message that the module does not exist if he follows it in that case). I didn't code for that because I didn't really envision an admin disallowing all boardwatch options, but perhaps in a future release I will make that change.
I read your posting about integrating the postnotices_to_groups mod, to include the post message [& the sender & signature if possible] but I don't want to include the functionality of that whole mod [& I don't want to break what I already have], what's the minimum I would need to include to get the correct variables defined? I'm happy editing the files, but only by blind obedience rather than understanding.
I just meant you can look at the other mod to see how it gets the text into the email and use the same code here. For example, the functions fetch_text() and bbcode_process_to_plain_text() that appear in includes/functions_postnotices.php would be useful. You wold call those and the output would be the text you would assign to the email. Since I don't want this capability I won't be coding it myself but if you have questions feel free to ask.
Ideally what recipients would see is:
Subject: [myforum] This is the post title

The full text goes here.
But no links.
Sender
Senders signature from profile [if that isn't included in the body]

filename - this is an automatic notification from myforum
What you are suggesting is an arrangement that will give people a reason never to come onto the forum (and if they want to reply to a post that arrangement will make it actively difficult for them to do so since there are no links to take them to the post to reply to). In my experience, that's not a good idea...on most forums you want people on the site itself to attract participation. But that's up to you of course.
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: Board watch

Post by asinshesq »

asinshesq wrote:
I read your posting about integrating the postnotices_to_groups mod, to include the post message [& the sender & signature if possible] but I don't want to include the functionality of that whole mod [& I don't want to break what I already have], what's the minimum I would need to include to get the correct variables defined? I'm happy editing the files, but only by blind obedience rather than understanding.
I just meant you can look at the other mod to see how it gets the text into the email and use the same code here. For example, the functions fetch_text() and bbcode_process_to_plain_text() that appear in includes/functions_postnotices.php would be useful. You wold call those and the output would be the text you would assign to the email. Since I don't want this capability I won't be coding it myself but if you have questions feel free to ask.
Ok, so call me a sucker ;) but here is some code that may or may not work for what you are trying to do:

To add text to the email, you can try this:

Code: Select all

OPEN
includes/functions_posting.php

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

BEFORE, ADD
				include_once($phpbb_root_path . 'language/' . $addr['lang'] . '/mods/info_ucp_boardwatch.' . $phpEx);
				$posttext_array = fetch_posttext($post_id);
				$posttext = htmlspecialchars_decode(bbcode_process_to_plain_text($posttext_array['post_text'], $posttext_array['bbcode_uid'], $lang));
				$postername = $user->data['username'];
				$postersig = ($user->data['user_sig']) ? htmlspecialchars_decode(bbcode_process_to_plain_text($user->data['user_sig'], $user->data['user_sig_bbcode_uid'], $lang)) : $user->data['username'];

FIND
					'U_FIRST_UNREAD'		=> generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&t=$topic_id&view=unread#unread",

AFTER, ADD
					'POSTTEXT'				=> $posttext,
					'POSTERNAME'			=> $postername,
					'POSTERSIG'				=> $postersig,

OPEN
includes/functions_boardwatch

FIND
?>

BEFORE, ADD
/**
*	This function does the following:
*	-	turns any quote or code bbcode tag into a simple plain text lead-in to or
*		exit from the quote or code block (if the post has a quote tag that specifies
*		a particular person that is being quoted, the code adds at the beginning the plain text
*		words "written by John Brown" or whoever the quote is from),
*
*	-	turns the [*] bbocode (marking a list item) into a simple plain text asterisk,
*
*	-	turns a url or img with an alias into a simple plain text url or img with brackets around it and
*
*	-	strips out all other bbcode.
*
*	Thanks to Merlin Sythove for helping me (asinshesq) come up with this code
*/
function bbcode_process_to_plain_text($text, $bbcode_uid = '', $lang)
{
	// First, add a colon before bbcode_uid since all bbcode_uid identifiers are always preceded by a colon
	$bbcode_uid = ':' . $bbcode_uid;

	// Next, remove slashes
	$text = html_entity_decode(trim(stripslashes($text)));

	// Before we start with bbcode removal, convert html links or email addresses to plain text
	$text = preg_replace('/<!-- w --><a class="postlink" href="http:\/\/(.*?)">(.*?)<\/a><!-- w -->/', '\\1', $text);
	$text = preg_replace('/<!-- m --><a class="postlink" href="http:\/\/(.*?)">(.*?)<\/a><!-- m -->/', '\\1', $text);
	$text = preg_replace('/<!-- e --><a href="mailto:(.*?)">(.*?)<\/a><!-- e -->/', '\\1', $text);
	$text = preg_replace('/<!-- s(.*?) --><img src="(.*?)" alt="(.*?)" title="(.*?)" \/><!-- s(.*?) -->/', '[\\4]', $text);

	// Now, we define the plain text markers used for [ quote ] and [ code ] blocks, list items, and [ img ] open and close tags
	$newline = "\r\n";
	$q1 = $newline . '>>>>>>>>>>>>>>>>>>>>>>' . $newline; // quote or code opening marker
	$q2 = $newline . '<<<<<<<<<<<<<<<<<<<<<<' . $newline; $newline; // quote or code closing marker
	$l1 = $newline . '   (*) '; // list item marker
	$img1 = '[' . $lang['IMAGE_AT'] . ': '; // img opening marker
	$img2 = ' ]'; // img closing marker

	// Next, replace open and close quote tags with plain text versions
    $text = preg_replace('/\[quote=\"(.*?)\"' . $bbcode_uid . '\]/', $newline . '\\1 '. $lang['WROTE'].':'.$q1, $text);
	$text = preg_replace('/\[quote' . $bbcode_uid . '\]/', $newline . $lang['QUOTE'].':'.$q1, $text);
	$text = preg_replace('/\[\/quote' . $bbcode_uid . '\]/', $q2, $text);

	// And now, replace code tags with plain text versions
	$text = preg_replace('/\[code' . $bbcode_uid . '\]/', $newline . $lang['CODE'].':'.$q1, $text);
	$text = preg_replace('/\[\/code' . $bbcode_uid . '\]/', $q2, $text);

	// Now, replace any open or close brackets that have been converted by phpbb into [ or ] (e.g if nested inside of code tags)
	$text = preg_replace('/&#91;/', '[', $text);
	$text = preg_replace('/&#93;/', ']', $text);

	// Next, change list item bbcode ([*]) into simple asterisks (note: does not process list numbers or letters)
	$text = preg_replace('/\[\*' . $bbcode_uid . '\]/', $l1, $text);

	// Now, process image and url bbcode (get rid of aliases and insert the actual image or url address; put images inside of square prackets).
	$text = preg_replace('/\[img' . $bbcode_uid . '\](.*?)\[\/img' . $bbcode_uid . '\]/', $img1 .'\\1' . $img2, $text);
	$text = preg_replace('/\[url=(.*?)' . $bbcode_uid . '\](.*?)\[\/url' . $bbcode_uid . '\]/', '\\1', $text);
	$text = preg_replace('/\[url' . $bbcode_uid . '\](.*?)\[\/url' . $bbcode_uid . '\]/', '\\1', $text);

	// Now, remove all bracketed expressions with bbcode_uid identifier in them
	$text = preg_replace('/\[([^[]*?)' . $bbcode_uid . '([^]]*?)\]/', '', $text);

	// And finally, change multiple blank lines into one blank line
	$text = preg_replace('/(\\r\\n){3,}/s', $newline.$newline, $text);

	return $text;
}


/**
* look up the post_text and bbcode_uid
*/
function fetch_posttext($post_id)
{
	global $db;

	// user is including post text in notice, so fetch bbcode_uid for the post and run text through
	// bbcode_process_to_plain_text() to clean up any bbcode in it
	$sql = 'SELECT post_text, bbcode_uid
		FROM ' . POSTS_TABLE . '
		WHERE post_id = ' . $post_id;
	$result = $db->sql_query($sql);
	$row = $db->sql_fetchrow($result);

	return array('post_text' => $row['post_text'], 'bbcode_uid' => $row['bbcode_uid']);
}

OPEN
language/en/mods/info_ucp_boardwatch

FIND
	'TOPICWATCH_YES_BUT'		=> 'Yes, but only once between visits to the topic',

AFTER, ADD
	// language definitions used when converting a bbcode encoded message to plain text
	'CODE'										=> 'Code',
	'IMAGE_AT'									=> 'Image at',
	'QUOTE'										=> 'Quote',
	'WROTE'										=> 'wrote',
If I did all of that correctly, you can include {POSTTEXT}, {POSTERNAME} and/or {POSTERSIG} whereever you want it in any of the email templates this mod adds and the text and poster's username and/or signature should show up in those places.

If you want to limit the text that appears in the email to a specified number of characters, make the following additional change to code referred to above:

Code: Select all

OPEN
includes/functions_posting.php

FIND
	return $text;

BEFORE, ADD (change xyz to the number of characters you want included)
	$text = substr($text, 0, xyz);
[edit: I changed the last line in the first BEFORE, ADD above to refer to $lang rather than $addr['lang']]

[2nd edit: changed the changes in includes/functions_posting.php to (hopefully) properly deal with bbcode in signatures]

[3rd edit: added code in the function converting bbcode to plain text that will convert html links and email addresses to plain text]

[4th edit: added sentence describing how to limit the number of characters from the post that get included in the email]

[5th edit: added code in the function converting bbcode to plain text that will convert smilies to plain text versions and added postername and postersignature rather than just postersignature]
Last edited by asinshesq on Mon Feb 08, 2010 10:47 pm, edited 10 times in total.
evina
Registered User
Posts: 110
Joined: Mon Nov 10, 2008 2:06 am

Re: Board watch

Post by evina »

I know this may be obvious to you but how do you watch a forum or the board after you install 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 »

evina wrote:I know this may be obvious to you but how do you watch a forum or the board after you install the mod?
With your eyes :mrgreen:
(Sorry.

Seriously, boardwatch is just like forumwatch or topic watch - it allows users to sign up to get email notifications when someone posts a post on the site.
awair
Registered User
Posts: 13
Joined: Wed Apr 08, 2009 9:01 am

Re: Board watch

Post by awair »

Depending on your board style, [mine is prosilver], you will have a [ticked] checkbox named 'Subscribe forum' towards the bottom left of the page when viewing a forum, or 'Subscribe topic' when viewing a thread.

These appear in the light blue 'footer' band of the page, next to 'Board Index'.

Once you have selected 'subscribe', the checkbox changes to a cross titled 'Unsubscribe forum'.

You can manage your subscriptions in the UCP.

[It took me a while to find, and I'm not convinced my members know where to find it...]

Sorry, that only answers half your question...

To watch the entire board, there is a new tab option in the UCP, 'Edit post notification options'.
asinshesq
Registered User
Posts: 6266
Joined: Sun Feb 22, 2004 9:34 pm
Location: NYC
Name: Alan

Re: Board watch

Post by asinshesq »

Ah, I apoligize. I totally misunderstood your question. but I see awair has already answered it. Subscribing to a topic or forum happens exactly like it does with regular phpbb3 (when you post in a topic you can elect to subscribe to it, and any user can subscribe to a topic or forum by clickng the link that appears towards the bottom of the topic or forum in viewtopic or viewforum). And in the UCP any user who is given permission to change his boardwatch options has a new area under board preferences called 'edit post notification options' which allows him to turn on or off boardwatch (i.e. subscribe to the entire board or turn that subscription off) as well as to specify exactly how he wants boardwatch, forumwatch and topic watch to work (there are some self-explanatory alternatives the user can select from).

Note also that each email notice that goes out includes a link that takes the user to the 'edit post notification options' part of the UCP so it's pretty easy for people to find.
evina
Registered User
Posts: 110
Joined: Mon Nov 10, 2008 2:06 am

Re: Board watch

Post by evina »

I can't find that notifications tab under board preferences. Maybe I installed it wrong?

I've been having a lot of problems with mods lately.
Locked

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