News:

Support for jDownloads 3 has been ended
Since 17 August 2023 Joomla.org has discontinued support for Joomla 3.x. Therefore, we will no longer offer official support for our Joomla 3 jDownloads version 3.9.x from January 2024.
Please update your website to the latest Joomla version (Joomla 4 or Joomla 5) as soon as possible. Afterwards, please update jDownloads to the latest published version. The longer you delay, the more difficult the upgrade process for your website is likely to be.

Main Menu
Support-Forum

Need help redirecting to login page for user notloggedin to download file.

Started by walkout, 07.08.2015 07:19:33

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

walkout

Hi ,
I am using jdownload , on my portal Everything seems to be working fine. I have enabled direct download for only logged in users to download File.

I am trying to find a way , so i can link the text "Only registered and logged in users can download this file" to login / register page , when guest tries to download the file.

Can someone point me in the right direction as to how i could accomplish this?


Ritesh
  •  

ColinM

Ritesh
That sounds like a nice idea but it is not straight forward to achieve.  Part of the problem is that the text "Only registered and logged in users can download this file" is part of the site language file. Specifically it is the TEXT Identifier COM_JDOWNLOADS_FRONTEND_FILE_ACCESS_REGGED which in the English file is "Only registered and logged in users can download this file."  If you are familiar with HTML and have a suitable link then you could edit the text to read something like
COM_JDOWNLOADS_FRONTEND_FILE_ACCESS_REGGED="Only registered and logged in users can download this file. <a href=your link info >Click here to logon</a>"

However that would possibly change on an update, and would need doing for every language.  One could of course modify the source code but again that could be an update problem.

To implement fully it would mean having a configuration parameter that requested the target link.
Perhaps you should put in suggestions

Colin
Colin M
  •  

walkout

Hi Colin,
Thanks for your prompt responce. This is a required on one of my website http://1specialplace.com/drift-away-sail-boat.html

I was looking into extension code , and modifying it , Didnt realise there is a simpler way ;D

Thanks I will put in the suggestions section.
  •  

walkout

A Simple fix for my problem.

I am using Modules Anywhere , Instead of Displaying text message and hyperlink to register page I was able to insert a custom module.

Reference page could be seen at http://1specialplace.com/drift-away-sail-boat.html

Also , PS: This is a code hack and if upgraded you will loose the modifications.

You can modify the files JText::_('COM_JDOWNLOADS_FRONTEND_FILE_ACCESS_REGGED')

to JHTML::_('content.prepare', '{module modulename}'))

Files To be modified -
(1) Plugin / content / jdownloads.php file line -1147
Replace
$first_reg_msg = '<div class="jdpf_not_logged_in">'.JText::_('COM_JDOWNLOADS_FRONTEND_FILE_ACCESS_REGGED').'</div>';
with
$first_reg_msg = '<div class="jdpf_not_logged_in">'.JHTML::_('content.prepare', '{module custom login}')).'</div>';

(2) components/com_jdownloads/views/download/tmpl/default.php
Line - 673
Replace
$regg = JText::_('COM_JDOWNLOADS_FRONTEND_FILE_ACCESS_REGGED');
with
$regg =JHTML::_('content.prepare', '{module custom login}'));


(3) components/com_jdownloads/views/downloads/tmpl/default.php

Line - 1138
Replace
$regg = str_replace('
', '', JText::_('COM_JDOWNLOADS_FRONTEND_FILE_ACCESS_REGGED'));

With

$regg = str_replace('
', '', JHTML::_('content.prepare', '{module custom login}'));

Hope it helps

Thanks
Ritesh
  •  

ColinM

Hi
Yes that is a neat solution - and it is minimally invasive of the core code.  Does your custom module know if the user is logged in already?

With a bit more effort in you custom module you could get a regular looking button like attached

Colin

[gelöscht durch Administrator]
Colin M
  •