You need to grant permissions for this mod in the same way you grant permissions for all other phpbb3 features. So: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.
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#p8952115DragonMaster1 wrote:Will this mod send the contents of the posts or just the link?
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):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]...
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);
}
Many thanks again,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
Nothing wrong with any of that.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].
So, when does it happenI couldn't follow why the forum_notify.txt was being used instead of the boardwatch equivalent
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.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.
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.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
Ok, so call me a sucker but here is some code that may or may not work for what you are trying to do:asinshesq wrote: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.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.
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('/[/', '[', $text);
$text = preg_replace('/]/', ']', $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',
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);
With your eyesevina wrote:I know this may be obvious to you but how do you watch a forum or the board after you install the mod?