jDownloadsownloads.com


Author Topic: How to remove links from myhistory page?  (Read 200 times)

0 Members and 1 Guest are viewing this topic.

Offline tillhunter

  • Newbie
  • *
  • Posts: 6
How to remove links from myhistory page?
« on: 16.06.2018 13:40:22 »
Hi.

I've tried to make changes at My Download History but can't do that.



I want to remove a link that shows after file title and make a download title linkable that will redirect user to this file page.
I have tried to change {log_file_title} to {file_title} but this tag not rendering here in this file.



Here are the questions:
1. How can I remove link from download name?
2. How to add link back to download page?

Best regards

Offline Arno

  • Administrator
  • ***
  • Posts: 12.321
    • jDownloads.com
Re: How to remove links from myhistory page?
« Reply #1 on: 16.06.2018 17:14:27 »
Hi,
Quote
1. How can I remove link from download name?
When I use this menu type I get not listed any link. Can it be that you have already modify it.

The original line 128 should be:
Code: [Select]
$html_file = str_replace('{log_file_title}', '<b>'.$files[$i]->log_title.'</b> ('.basename($files[$i]->log_file_name).')', $html_file);
Quote
2. How to add link back to download page?
See example pic for a simple link.
Added in line 136:
Code: [Select]
    $document = JFactory::getDocument();
    $db       = JFactory::getDBO();
    $user     = JFactory::getUser();
    $access_levels   = implode(',', $user->getAuthorisedViewLevels());
    $active_language = $document->language;
   
    $sql = 'SELECT id FROM #__menu WHERE (link LIKE ' . $db->Quote('index.php?option=com_jdownloads&Itemid='). ' OR link LIKE ' . $db->Quote('index.php?option=com_jdownloads&view=categories'). '  ) AND published = 1 AND client_id = 0 AND access IN ('.$access_levels.')' ;
    $db->setQuery($sql);
    $result = $db->loadResult();
    $html .= '<div><a href="'.JRoute::_('index.php?option=com_jdownloads&view=categories&Itemid='.(int)$result).'">Back to Download Area</a></div>';

You could also copy only the link given from the frontend. Then you need only the last line like:
Code: [Select]
$html .= '<div><a href="link_from_frontend">Back to Download Area</a></div>';
« Last Edit: 16.06.2018 17:17:29 by Arno »
Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!

Offline tillhunter

  • Newbie
  • *
  • Posts: 6
Re: How to remove links from myhistory page?
« Reply #2 on: 17.06.2018 10:34:51 »
Hi.
Thanks for your reply.
But it didn't solve the problem.

1. I didn't make any changes in files I just started. The code is exactly same in that file.
Quote
$html_file = str_replace('{log_file_title}', '<b>'.$files[$i]->log_title.'</b> ('.basename($files[$i]->log_file_name).')', $html_file);
I noticed that by default user can see file name. As I'm using external links to my download instead of file name it is showing link. Need to remove that link and display only title. How can I do that?

2. This code appearing at the end of download list (I add it to line 135 in myhistory/default.php) and returning me back to the category. How to make it return every download to its page?
Quote
$document = JFactory::getDocument();
    $db       = JFactory::getDBO();
    $user     = JFactory::getUser();
    $access_levels   = implode(',', $user->getAuthorisedViewLevels());
    $active_language = $document->language;
   
    $sql = 'SELECT id FROM #__menu WHERE (link LIKE ' . $db->Quote('index.php?option=com_jdownloads&Itemid='). ' OR link LIKE ' . $db->Quote('index.php?option=com_jdownloads&view=categories'). '  ) AND published = 1 AND client_id = 0 AND access IN ('.$access_levels.')' ;
    $db->setQuery($sql);
    $result = $db->loadResult();
    $html .= '<div><a href="'.JRoute::_('index.php?option=com_jdownloads&view=categories&Itemid='.(int)$result).'">Back to Download Area</a></div>';


I have tried to add this code after file details and it is not appearing on the frontend


Also what should add instead of link_from_frontend in this code?
Quote
$html .= '<div><a href="link_from_frontend">Back to Download Area</a></div>';

Sorry if I ask stupid questions.
I'm the newbie.

Thank you for your help
Best regards

Offline ColinM

  • Moderator
  • *
  • Posts: 3.713
Re: How to remove links from myhistory page?
« Reply #3 on: 17.06.2018 11:13:09 »
Hi
Further to Arno's suggestions if you just want to remove the file name as indicated in pic history01.png

then go to Line 128 or thereabouts where you should find
 
Code: [Select]
   $html_file = str_replace('{log_file_title}', '<b>'.$files[$i]->log_title.'</b> ('.basename($files[$i]->log_file_name).')', $html_file);
Modify so that the code looks like below
   
Code: [Select]
//        $html_file = str_replace('{log_file_title}', '<b>'.$files[$i]->log_title.'</b> ('.basename($files[$i]->log_file_name).')', $html_file);
      $html_file = str_replace('{log_file_title}', '<b>'.$files[$i]->log_title.'</b>', $html_file);
     
This gives the result as shown in  pic history02.png
If you now want to insert a  link to the actual Download then this is much more complex. And will include database searches as Arno indicates
I am not sure exactly what you want from such a link.  It may help if you could clarify the end result.  Is it to show the download again in say a Download Details View, is it to just make it a link that could download like from the Content plugin; is it to show which category the Download is in, or what?
Colin