4

I want to restrict the guest users to show full article. Once the user is logged in, then only he will be able to read the full article else introduction article will be shown. I achieved this by referring the following documentation:

https://docs.joomla.org/Restricting_access_to_%22read_more%22

But here, when user clicks on read more button, he is taken to a login page but I want to show the login form in the popup in that page itself. Also, user must be redirected to the same article whose read more he clicked. Is there any way by which this can be achieved?

6

You need to create a template override for the article view - default.php template file.

So there you can create a "modal button" for the register link, to open the registration view inside a modal window.

This blog post explains how to create modals in Joomla 3. It covers the boostrap way for Joomla 3 with many examples, but also has a reference to an older article with examples using the mootools way - which still works on Joomla 3 by the way.

Regarding the loading of the registration screen, I would suggest to add the tmpl=component in the link, so it will only load the component output and not the whole template.

So the link to the registration page will become like:

<?php $link = new JUri(JRoute::_('index.php?option=com_users&view=login&Itemid=' . $itemId .'&tmpl=component', false)); ?>

You will also might want to deal with the an auto-closing of the modal window after successful login and refresh of the current window.

This could be achieved with some javascript, but I haven't tried that with the bootstrap way so I dont' have the answer on this ready and it's late here to go and look for it. But if you manage to reach up to this point, then the remaining steps will come as well.

An alternative way to achieve that is to try and load a popup ajax login module instead of linking to the registration page.

Check this module: SC Login.

See this answer here that describes how to load a module from inside a component: Displaying more articles in the article view

  • Again I haven't tried this solution with the popup login module, but there is big chance it will work.
  • thanks a lot , it worked. I edited the override of the article and it was perfect :) and SC Login extension is great. I needed it for login popup. – Liz. Jul 26 '16 at 11:50
  • is there any I can change the button text using php code? I rendered the module using the code as in article override, now it's showing login button . I want to change the text to register to read more. – Liz. Jul 27 '16 at 11:00

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.