[2.0.7] Printer-friendly topic mod

The cleanup is complete. This forum is now read only.

Rating:

Excellent!
48
45%
Very Good
26
25%
Good
11
10%
Fair
9
8%
Poor
12
11%
 
Total votes: 106

HB
Registered User
Posts: 139
Joined: Mon May 16, 2005 9:30 pm
Contact:

Post by HB » Wed Oct 18, 2006 1:14 pm

kdtcat wrote: Hi folks,

is there an easy hack to restrict print function for logged in Users only?

Klaus

Try this:

Code: Select all

#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]------------------------------------------
#
$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
#
#-----[ AFTER, ADD ]------------------------------------------
if (isset($HTTP_GET_VARS['printertopic']) && !$userdata['session_logged_in'] ) {
	message_die(GENERAL_MESSAGE, 'Please login before printing a topic.');
}
#

Code: Select all

#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/viewtopic_body.tpl
#
#-----[ FIND ]------------------------------------------
#
	<td align="left" valign="bottom" nowrap="nowrap"><span class="nav"><a href="{U_POST_NEW_TOPIC}"><img src="{POST_IMG}" border="0" alt="{L_POST_NEW_TOPIC}" align="middle" /></a>&nbsp;&nbsp;&nbsp;<a href="{U_POST_REPLY_TOPIC}"><img src="{REPLY_IMG}" border="0" alt="{L_POST_REPLY_TOPIC}" align="middle" /></a></span></td>
#
#-----[ IN-LINE FIND ]------------------------------------------
#
{L_POST_REPLY_TOPIC}" align="middle" /></a>
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
<!-- BEGIN switch_user_logged_in --> 	
&nbsp;&nbsp;&nbsp;<a target="_blank" href="{U_PRINTER_TOPIC}"><img src="{PRINTER_IMG}" border="0" alt="{L_PRINTER_TOPIC}" align="middle" /></a>
<!-- END switch_user_logged_in -->
Dan Kehn

kdtcat
Registered User
Posts: 8
Joined: Tue Nov 22, 2005 1:32 pm
Location: Wiesbaden, Germany

Post by kdtcat » Wed Oct 18, 2006 3:42 pm

Wow that was fast. Many thanks HB.

The hack is working perfectly. :D

In templates/subSilver/viewtopic_body.tpl I also changed the second occurence at bottom of topic.

Klaus
have a nice day

User avatar
Dogs and things
Registered User
Posts: 2114
Joined: Fri Sep 01, 2006 9:04 am
Location: Spain
Contact:

Post by Dogs and things » Thu Oct 19, 2006 10:55 am

Hello HB,

I´m trying to install the only_for_logged_in add-on but I get errors.

In viewtopic.tpl I allready find

Code: Select all

if(isset($HTTP_GET_VARS['printertopic']))
{
where you say that after

Code: Select all

$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
I should add

Code: Select all

if (isset($HTTP_GET_VARS['printertopic']) && !$userdata['session_logged_in'] ) {
   message_die(GENERAL_MESSAGE, 'Please login before printing a topic.');
}
Should I replace what is allready there or should I add your piece before what is allready there?

And in subSilver/viewtopic_body.tpl I find

Code: Select all

{L_POST_REPLY_TOPIC}" align="middle" /></a>
twice and after that piece there is allready

Code: Select all

&nbsp;&nbsp;&nbsp;<a target="_blank" href="{U_PRINTER_TOPIC}"><img src="{PRINTER_IMG}" border="0" alt="{L_PRINTER_TOPIC}" align="middle" /></a>
Here the same question as before, should I leave what´s allready there or replace it with

Code: Select all

<!-- BEGIN switch_user_logged_in -->    
&nbsp;&nbsp;&nbsp;<a target="_blank" href="{U_PRINTER_TOPIC}"><img src="{PRINTER_IMG}" border="0" alt="{L_PRINTER_TOPIC}" align="middle" /></a>
<!-- END switch_user_logged_in -->
?
For phpBB2 support visit phpBB2refugees.

kdtcat
Registered User
Posts: 8
Joined: Tue Nov 22, 2005 1:32 pm
Location: Wiesbaden, Germany

Post by kdtcat » Thu Oct 19, 2006 11:35 am

I am not HB but I asked for the hack.

I did not install the hack for viewtopic.php because I do not see the value. If the user is not logged in he will not see the printer choice and cannot select it.

Here is my changed piece of code in templates/subSilver/viewtopic_body.tpl :

Code: Select all

<table width="100%" cellspacing="2" cellpadding="2" border="0">
  <tr> 
	<td align="left" valign="bottom" nowrap="nowrap"><span class="nav"><a href="{U_POST_NEW_TOPIC}"><img src="{POST_IMG}" border="0" alt="{L_POST_NEW_TOPIC}" align="middle" /></a>&nbsp;&nbsp;&nbsp;<a href="{U_POST_REPLY_TOPIC}"><img src="{REPLY_IMG}" border="0" alt="{L_POST_REPLY_TOPIC}" align="middle" /></a>
	<!-- BEGIN switch_user_logged_in -->	
	&nbsp;&nbsp;&nbsp;<a target="_blank" href="{U_PRINTER_TOPIC}"><img src="{PRINTER_IMG}" border="0" alt="{L_PRINTER_TOPIC}" align="middle" /></a>
	<!-- END switch_user_logged_in -->	
	</span></td>
	<td align="left" valign="middle" width="100%"><span class="nav">&nbsp;&nbsp;&nbsp;<a href="{U_INDEX}" class="nav">{L_INDEX}</a> 
	  -> <a href="{U_VIEW_FORUM}" class="nav"></a><a href="{U_VIEW_FORUM}" class="nav">{FORUM_ICON_IMG}{FORUM_NAME}</a></span></td>
  </tr>
</table>
have a nice day

User avatar
Dogs and things
Registered User
Posts: 2114
Joined: Fri Sep 01, 2006 9:04 am
Location: Spain
Contact:

Post by Dogs and things » Thu Oct 19, 2006 11:55 am

Thank you kdtcat,

I applied your change but nothing changes, not logged in can still use the printer. The only diference I appreciate is that when logged in I see a printer button at the top and at the bottom of the topic and when not logged in I only see a button at the bottom. :?
For phpBB2 support visit phpBB2refugees.

User avatar
Dogs and things
Registered User
Posts: 2114
Joined: Fri Sep 01, 2006 9:04 am
Location: Spain
Contact:

Post by Dogs and things » Thu Oct 19, 2006 12:32 pm

If I add this in viewtopic.php

Code: Select all

if (isset($HTTP_GET_VARS['printertopic']) && !$userdata['session_logged_in'] ) {
   message_die(GENERAL_MESSAGE, 'Please login before printing a topic.');
}
after

Code: Select all

$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
I get the error that even logged in is told that he has to be logged in to be able to print. Allthough not logged in gets that message also. So it seems to be working to good. If I don´t change nothing in viewtopic.php happens what described in earlier post.
For phpBB2 support visit phpBB2refugees.

kdtcat
Registered User
Posts: 8
Joined: Tue Nov 22, 2005 1:32 pm
Location: Wiesbaden, Germany

Post by kdtcat » Thu Oct 19, 2006 12:34 pm

I applied your change but nothing changes, not logged in can still use the printer


How can a not logged on user print, if he does not see a print button?


and when not logged in I only see a button at the bottom. Confused


You need to apply the hack in templates/subSilver/viewtopic_body.tpl at 2 different places! First occurence is in about line 14 and second occurence at about line 76.

klaus
have a nice day

User avatar
Dogs and things
Registered User
Posts: 2114
Joined: Fri Sep 01, 2006 9:04 am
Location: Spain
Contact:

Post by Dogs and things » Thu Oct 19, 2006 12:39 pm

Thank you Klaus,

Now it´s all perfect. :P

Have a nice day!
For phpBB2 support visit phpBB2refugees.

User avatar
stevemagruder
Registered User
Posts: 210
Joined: Wed Jul 02, 2003 2:05 pm
Location: Louisville, KY
Contact:

Post by stevemagruder » Mon Oct 30, 2006 3:38 am

Dogs and things wrote: If I add this in viewtopic.php

Code: Select all

if (isset($HTTP_GET_VARS['printertopic']) && !$userdata['session_logged_in'] ) {
   message_die(GENERAL_MESSAGE, 'Please login before printing a topic.');
}
after

Code: Select all

$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
I get the error that even logged in is told that he has to be logged in to be able to print. Allthough not logged in gets that message also. So it seems to be working to good. If I don´t change nothing in viewtopic.php happens what described in earlier post.


The if clause can work only if it is placed after session management code runs. Put the if clause after:

Code: Select all

//
// End session management
//
That should work.
Steve Magruder - WebCommons :: Media
Administrator for the Louisville History & Issues discussion board

masi
Registered User
Posts: 12
Joined: Thu Nov 09, 2006 12:39 pm

Post by masi » Sun Nov 12, 2006 11:38 am

i got a problem with this mod.
frist it worked great, but after changeing some settings and adding some mods for test reasons (dont ask me wich, i forgot allready - i just could give you the easymod history, but not all mods listed there are still installed), it now stopped wotking.

getting the same error with all styles (even subsilver):

Template->loadfile(): No file specified for handle qrbody


the mod was installed useing easymod, but after it didnt work i installed it manually after it. still the same errors

aznole
Registered User
Posts: 9
Joined: Sun Nov 19, 2006 5:37 am

Post by aznole » Sun Nov 19, 2006 5:45 am

masi wrote: getting the same error with all styles (even subsilver):

Template->loadfile(): No file specified for handle qrbody

the mod was installed useing easymod, but after it didnt work i installed it manually after it. still the same errors


I have the same issue ... installed a few mods via EM and am now getting the

Template->loadfile(): No file specified for handle qrbody error as well

Anyone got a clue??

TIA

Cyberlink420
Registered User
Posts: 30
Joined: Fri Oct 27, 2006 5:54 pm

Post by Cyberlink420 » Sun Nov 19, 2006 10:07 pm

Gettin same error as u two..

aznole
Registered User
Posts: 9
Joined: Sun Nov 19, 2006 5:37 am

Post by aznole » Sun Nov 19, 2006 11:15 pm

Cyberlink420 wrote: Gettin same error as u two..


For whatever reason after I shut down firefox last night and restarted today ... the problem has dissappeared ... maybe make sure your cache is cleared ...

Cyberlink420
Registered User
Posts: 30
Joined: Fri Oct 27, 2006 5:54 pm

Post by Cyberlink420 » Mon Nov 20, 2006 5:08 am

that worked for me too. but only works one time, then the problem is back.

There must be a way around this problem..??

AFIEE
Registered User
Posts: 76
Joined: Thu Mar 24, 2005 9:06 pm

Post by AFIEE » Sat Jan 13, 2007 6:04 pm

I getting that too. I cleared my cache and still having the problem.

Post Reply

Return to “[2.0.x] MOD Database Cleanup”

Who is online

Users browsing this forum: No registered users and 7 guests