diff --git a/e107_plugins/forum/e_emailprint.php b/e107_plugins/forum/e_emailprint.php index eb2667cd8..98d02e384 100755 --- a/e107_plugins/forum/e_emailprint.php +++ b/e107_plugins/forum/e_emailprint.php @@ -3,33 +3,10 @@ if (!defined('e107_INIT')) { exit; } function print_item($thread_id) { - global $tp; - $gen = new convert; - include_once(e_PLUGIN.'forum/forum_class.php'); - $forum = new e107forum; - - $thread_info = $forum->threadGet($thread_id,0,999); - $thread_name = $tp->toHTML($thread_info[0]['thread_name'], TRUE); - $text = "".$thread_name."
- ".$thread_info[0]['user_name'].", ".$gen->convert_date($thread_info[0]['thread_datestamp'], "forum")."

- ".$tp->toHTML($thread_info[0]['thread_thread'], TRUE); - - - $count = 1; - - unset($thread_info[0], $thread_info['head']); - foreach($thread_info as $reply) - { - $text .= "

Re: ".$thread_name."
- ".$reply['user_name'].", ".$gen->convert_date($reply['thread_datestamp'], "forum")."

- ".$tp->toHTML($reply['thread_thread'], TRUE); - } - - -// return "
".print_r($thread_info,TRUE)."
"; - return $text; + // moved to e_print.php } + function email_item($thread_id) { global $tp; @@ -53,5 +30,4 @@ function email_item($thread_id) ".$tp->toHTML($reply['thread_thread'], TRUE); } return $text; -} - +} \ No newline at end of file diff --git a/e107_plugins/forum/e_print.php b/e107_plugins/forum/e_print.php index 06d6c2031..d60df5829 100644 --- a/e107_plugins/forum/e_print.php +++ b/e107_plugins/forum/e_print.php @@ -1,15 +1,52 @@ threadGet($thread_id); + //print_a($thread_info); - -} + // Check if user is allowed to view this forum topic + if(!$forum->checkPerm($thread_info['thread_forum_id'], 'view')) + { + return LAN_FORUM_0008; + } + + // Get all posts in this topic + $post_list = $forum->postGet($thread_id, 0, 9999); + //print_a($post_list); + + // Set topic name + $topic_name = e107::getParser()->toHTML($thread_info['thread_name'], true); + + // Display topic name + $text .= "".$topic_name."
"; + + // Display initial (first) post in topic + $text .= " + ".$post_list[0]['user_name'].", ".e107::getDate()->convert_date($post_list[0]['post_datestamp'], "forum")." +

+ ".$tp->toHTML($post_list[0]['post_entry'], true); + + // Remove original post from $post_list array, so only replies are left + unset($post_list['0']); + + // Loop through each reply + foreach($post_list as $reply) + { + $text .= "

Re: ".$topic_name."
+ ".$reply['user_name'].", ".e107::getDate()->convert_date($reply['post_datestamp'], "forum")."

+ ".$tp->toHTML($reply['post_entry'], TRUE); + } + + return $text; + } +} \ No newline at end of file diff --git a/e107_plugins/forum/forum_setup.php b/e107_plugins/forum/forum_setup.php index dcffb6d4d..60469d9a1 100644 --- a/e107_plugins/forum/forum_setup.php +++ b/e107_plugins/forum/forum_setup.php @@ -71,6 +71,12 @@ class forum_setup // } + // Check if e_print addon is loaded + if(!e107::getAddon('forum','e_print')) + { + return true; + } + return false; } @@ -128,5 +134,11 @@ class forum_setup $mes->addSuccess("Migration is required. Please click 'Continue'.
Continue"); } + + if(!e107::getAddon('forum','e_print')) + { + e107::getPlug()->clearCache()->buildAddonPrefLists(); + } + } }