Simple Machines Community Forum

SMF Support => SMF 1.1.x Support => Topic started by: gerrymore on January 26, 2005, 12:46:24 PM

Title: Turn off Printable View
Post by: gerrymore on January 26, 2005, 12:46:24 PM
Is there a way to turn off the prinatble view of the forum? I Admin my son's school forum and some teachers and parents are noticing a lot of "Guests" printing off pages, and would like it stopped if possible.
Title: Re: Turn off Printable View
Post by: ryanbsoftware on January 26, 2005, 01:08:47 PM
Quote from: gerrymore on January 26, 2005, 12:46:24 PM
Is there a way to turn off the prinatble view of the forum? I Admin my son's school forum and some teachers and parents are noticing a lot of "Guests" printing off pages, and would like it stopped if possible.

well i don't think you can disable that without some sort of modification, plus they could just print the normal version, you can make it to where guests have to login tho in the admin panel.

Admin -> Edit Features And Options -> Unselct "Allow guests to browse the forum"
Title: Re: Turn off Printable View
Post by: Oldiesmann on January 26, 2005, 05:03:38 PM
That will work, but it's a bit drastic...

This will stop them...

First step - hide the "print" button ;)

Themes/*/Display.template.php (should be the same in most themes)

Find
$buttonArray[] = '<a href="' . $scripturl . '?action=printpage;topic=' . $context['current_topic'] . '.0" target="_blank">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/print.gif" alt="' . $txt[465] . '" border="0" />' : $txt[465]) . '</a>';

Replace
if(!$context['user']['is_guest'])
$buttonArray[] = '<a href="' . $scripturl . '?action=printpage;topic=' . $context['current_topic'] . '.0" target="_blank">' . ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/print.gif" alt="' . $txt[465] . '" border="0" />' : $txt[465]) . '</a>';


Second step - force them to login if they try to do it anyway...

index.php

Find
// If guest access is off, a guest can only do one of the very few following actions.
elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('login', 'login2', 'register', 'register2', 'reminder', 'activate', 'help', '.xml'))))
{
require_once($sourcedir . '/Subs-Auth.php');
return 'KickGuest';
}


Add after that
// Guests can't print topics...
elseif ($user_info['is_guest'] && $_REQUEST['action'] == 'printpage')
{
require_once($sourcedir . '/Subs-Auth.php');
return 'KickGuest';
}
Title: Re: Turn off Printable View
Post by: ryanbsoftware on January 26, 2005, 06:54:50 PM
Quote from: Oldiesmann on January 26, 2005, 05:03:38 PM
That will work, but it's a bit drastic...

true but it's a school forum, i'd bet anyone who needs legit access to it has an account.  so it wouldn't be a big deal but would be easier to do.
Title: Re: Turn off Printable View
Post by: Enigma on January 27, 2005, 07:13:23 AM
I have noticed that when Searchbots are on the forum, it may show up as they are printing a certain topic.