How to suppress "Back to Pinboard" in Public View?

Currently there is a link “Back to Board” in public task view.

Me and also others are not happy with that, which offers access to complete project via public link for 1 single task.

Is there a simple possibility to suppress that “Back …” link in public view?

CU

Rainer

Simple? No. This needs a change in KB code base, and you’ll have to apply this after every upgrade. Or you write a plugin…

Quick&dirty™:

  1. Create a copy of file /app/Template/task/details.php, name it e.g., details_pub.php.
  2. Remove the link section from your details_pub.php.
                         </small>
                     </li>
                     <?php endif ?>
-                    <?php if ($project['is_public'] && !$editable): ?>
-                    <li>
-                        <small>
-                            <?= $this->url->icon('th', t('Back to the board'), 'BoardViewController', 'readonly', array('token' => $project['token'])) ?>
-                        </small>
-                    </li>
-                    <?php endif ?>
 
                     <?= $this->hook->render('template:task:details:first-column', array('task' => $task)) ?>
                 </ul>
  1. Edit the file /app/Template/task/public.php as follows.
 <section id="main" class="public-task">
-    <?= $this->render('task/details', array(
+    <?= $this->render('task/details_pub', array(
         'task' => $task,
         'tags' => $tags,
         'project' => $project,

Maybe it’s a good idea to backing up the files before modifying them.
No Warranty, it’s fully up to you. Good luck!

2 Likes

Hi Alfred, that’s the direction I was thinking about.

I have a test installation and will try to comment out lines in details_pub.php and modify line in public.php. We will see …

And of course, I will share my results here.

CU

Rainer

According to my experience, commenting out in templates will often fail. Be prepared.

1 Like

In a Test project I did the modifications as per your suggestions. I deleted lines, did not comment out.

Seems to do nothing, as you should see in Task1 and Task2

Task2 I created after modifications due to your suggestions.
Before I created Task 2

  1. ./.
  2. ./.
  3. Relaunched Browser

Then
4. Opened Browser → Created Task2 → Opened Task → Clicked “Public Link”.
» “Back to Pinboard” shown

Before I created Task1
11. renamed details.php to details_.php
12. renamed details_pub.php to details_pub_.php
13. Relaunched Browser

Then
14. Opened Browser → Created Task1 → Opened Task → Clicked “Public Link”.
» “Back to Pinboard” shown

My Question: Are the modifications something that should have influence for creation of new tasks, but existing tasks will beshown (in public view) as before the modifications? Or should modifications have impect on public view on existing tasks?

I don’t fully understand your question. The template details.php is also used for the “normal” task display. If the modification doesn’t work on your side, then either you modified the wrong files or there is some PHP caching in effect. Here it was working on the 1st run.

1 Like

I did a code change in "…/app/Template/task/details.php
Commented out with the html-comment-command (php “//” did not work)

<!--                     <li>
                        <small>
                            <?= $this->url->icon('th', t('Back to the board'), 'BoardViewController', 'readonly', array('token' => $project['token'])) ?>
                        </small>
-->                     </li>

Some first test are promising. And also removes that link from German UI

CU

Rainer

Hi Alfred, I additionally tested your suggestion again, and it also works fine. Now some php versions, database changes and KANBOARD versions later. I haven’t a clue what might have gone wrong in my tests in May …

But most plausible reason for the mishap during my test in May: The man on the office chair …

It’s wrong. You have to move the ‘–>’ behind the ‘’. And the icon still appears to be active.
As I said earlier, commenting out blocks of code in templates often doesn’t work as expected.

1 Like