Login  |  Register
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome, Guest. Please login or register.
Did you miss your activation email?

December 08, 2021, 07:03:41 AM

Login with username, password and session length
Members
  • Total Members: 3831
  • Latest: pulgoki
Stats
  • Total Posts: 192617
  • Total Topics: 21020
  • Online Today: 152
  • Online Ever: 1035
  • (November 26, 2020, 04:45:12 AM)
Users Online
Users: 0
Guests: 93
Total: 93

Author Topic: Print link on articles  (Read 1511 times)

0 Members and 1 Guest are viewing this topic.

Offline jernatety

  • Sr. Member
  • ****
  • Posts: 349
Print link on articles
« on: September 13, 2021, 07:15:57 AM »
Hi, I'm using the latest version TP on 2.17. I noticed in the latest version I had to turn on the edit and print options in the TP settings, which I did. However, when I view articles as a guest the print link doesn't appear. I looked through the SMF guest perms and don't see anything for TP guest options. Is there any way I can have this visible for guests?

Thank you in advance! :)

Offline @rjen

  • Support Team
  • *
  • Posts: 2973
    • FJR-club Nederland
Re: Print link on articles
« Reply #1 on: September 13, 2021, 03:23:25 PM »
That is correct. The article print link is by default not visible to guests. That's coded in the software and it's been like taht for a long time..

If you want to change it you have to edit TPsubs.template.php

Find
Code: [Select]
function article_print($render = true)
{
global $scripturl, $txt, $context;

    $data = '';

if($context['TPortal']['print_articles']==1) {
if(isset($context['TPortal']['article']['boardnews']) && !$context['user']['is_guest']) {
$data .= '
<div class="article_rating"><a href="' . $scripturl . '?action=printpage;topic=' . $context['TPortal']['article']['id'] . '">' . $txt['print_page'] . '</a></div>';
        }
elseif (!$context['user']['is_guest']) {
$data .= '
<div class="article_rating"><a href="' . $scripturl . '?page=' . $context['TPortal']['article']['id'] . ';print">' . $txt['tp-print'] . '</a></div>';
        }
}

    if($render) {
        echo $data;
    }
    else {
        return $data;
    }
}
And change it to

Code: [Select]
function article_print($render = true)
{
global $scripturl, $txt, $context;

    $data = '';

if($context['TPortal']['print_articles']==1) {
if(isset($context['TPortal']['article']['boardnews']) {
$data .= '
<div class="article_rating"><a href="' . $scripturl . '?action=printpage;topic=' . $context['TPortal']['article']['id'] . '">' . $txt['print_page'] . '</a></div>';
        }
else {
$data .= '
<div class="article_rating"><a href="' . $scripturl . '?page=' . $context['TPortal']['article']['id'] . ';print">' . $txt['tp-print'] . '</a></div>';
        }
}

    if($render) {
        echo $data;
    }
    else {
        return $data;
    }
}
Running TP2.1.0 on SMF2.0 at: www.fjr-club.nl

Testing TP on SMF2.0
Testing TP on SMF2.1 (latest Github)
Want to check what php version I am testing on? See: PHP Info

Offline jernatety

  • Sr. Member
  • ****
  • Posts: 349
Re: Print link on articles
« Reply #2 on: September 13, 2021, 03:27:03 PM »
Hi rjen, I don't even recall seeing a print option in any other version until the latest so that's something I must've always missed. When I make this change will I have to do the same thing in all future versions as well? As always appreciate the help.

Offline njtweb

  • Jr. Member
  • **
  • Posts: 11
Re: Print link on articles
« Reply #3 on: September 13, 2021, 03:54:48 PM »
Making the change, (did it 4 times to make sure I didn't miss anything. This is the result after saving and then refreshing.
Code: [Select]
Unable to load the 'tp_above' template.

EDIT
I had no idea I had 2 separate accounts here. I had to login on this laptop because I can't access cpanel on my work laptop.

Offline @rjen

  • Support Team
  • *
  • Posts: 2973
    • FJR-club Nederland
Re: Print link on articles
« Reply #4 on: September 14, 2021, 12:26:29 AM »
That's what you get giving an answer on the fly..

in my corrected code there was one { missing.
Change to this, that works..

Code: [Select]
function article_print($render = true)
{
global $scripturl, $txt, $context;

    $data = '';

if($context['TPortal']['print_articles']==1) {
if(isset($context['TPortal']['article']['boardnews'])) {
$data .= '
<div class="article_rating"><a href="' . $scripturl . '?action=printpage;topic=' . $context['TPortal']['article']['id'] . '">' . $txt['print_page'] . '</a></div>';
        }
else {
$data .= '
<div class="article_rating"><a href="' . $scripturl . '?page=' . $context['TPortal']['article']['id'] . ';print">' . $txt['tp-print'] . '</a></div>';
        }
}

    if($render) {
        echo $data;
    }
    else {
        return $data;
    }
}
Running TP2.1.0 on SMF2.0 at: www.fjr-club.nl

Testing TP on SMF2.0
Testing TP on SMF2.1 (latest Github)
Want to check what php version I am testing on? See: PHP Info

Offline @rjen

  • Support Team
  • *
  • Posts: 2973
    • FJR-club Nederland
Re: Print link on articles
« Reply #5 on: September 14, 2021, 12:30:28 AM »
Hi rjen, I don't even recall seeing a print option in any other version until the latest so that's something I must've always missed. When I make this change will I have to do the same thing in all future versions as well? As always appreciate the help.

There is a 'general' option in the "Article settings" in Tinyportal admin to switch the print function on or off in general, but as I stated: it's always deactivated for guests (unless you make the change, and yes, you will have to do that again when you upgrade)

tbh, I personally find this print function is a bit redundant: I for one NEVER used it anywhere. There are plenty ways to copy content from a webpage...
Running TP2.1.0 on SMF2.0 at: www.fjr-club.nl

Testing TP on SMF2.0
Testing TP on SMF2.1 (latest Github)
Want to check what php version I am testing on? See: PHP Info

Offline jernatety

  • Sr. Member
  • ****
  • Posts: 349
Re: Print link on articles
« Reply #6 on: September 14, 2021, 05:21:12 AM »
Thank you very much as usual. Here's my case. My oldest went to college this school year and is playing hockey for the university. The local paper rarely writes any stories so I'm taking that on and opening it up for students who might also be interested in writing articles for the team to be posted at my site. Basically they'd submit their article to me and I'd post it in an article page. Then the players can print out the articles for their scrapbooks. I always appreciate your's and the TP team's expert knowledge.

Offline @rjen

  • Support Team
  • *
  • Posts: 2973
    • FJR-club Nederland
Re: Print link on articles
« Reply #7 on: September 14, 2021, 06:14:49 AM »
I can see the use case but since this is the first request ever I am not sure that this is a reason to change core functionality…
Running TP2.1.0 on SMF2.0 at: www.fjr-club.nl

Testing TP on SMF2.0
Testing TP on SMF2.1 (latest Github)
Want to check what php version I am testing on? See: PHP Info