Keyword

[SOLVED] Premium Content Items Invisible IF Not Logged In

  • Lisa Jorgensen
  • Lisa Jorgensen's Avatar Topic Author
  • Offline
  • New Member
More
9 years 4 months ago #133778 by Lisa Jorgensen
Premium Content Items Invisible IF Not Logged In was created by Lisa Jorgensen
Before I converted to K2, the image and intro of articles that were premium could be seen by visitors who were not logged in. Instead of the phrase "Read more..." at the end of the intro, it said "Log in or subscribe to read more...". What I've noticed now is that if I'm not logged in, the premium articles are not seen at all. I liked the teaser effect before of letting visitors see what they were missing. Is it possible to to see the image and intro of premium content when I'm not logged in?

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 4 months ago #133779 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Premium Content Items Invisible IF Not Logged In
You need to use Joomla!'s user function in your K2 templates.
docs.joomla.org/Accessing_the_current_user_object

This is an example check;
        $user = JFactory::getUser();
 
        if ($user->guest) {
                echo "<p>You must login to see the content. I want your email address.</p>";
        } else {
          // do sth
}
 

More on K2 overrides can be found here:
getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Lisa Jorgensen
  • Lisa Jorgensen's Avatar Topic Author
  • Offline
  • New Member
More
9 years 4 months ago #133780 by Lisa Jorgensen
Replied by Lisa Jorgensen on topic Re: Premium Content Items Invisible IF Not Logged In
OK - thanks very much.

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 4 months ago #133781 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Premium Content Items Invisible IF Not Logged In
You 're welcome Lisa.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Lisa Jorgensen
  • Lisa Jorgensen's Avatar Topic Author
  • Offline
  • New Member
More
9 years 4 months ago #133782 by Lisa Jorgensen
Replied by Lisa Jorgensen on topic Re: Premium Content Items Invisible IF Not Logged In
I can't find where K2 is screening out premium content if the user is a guest. I've been looking in item.php, but I think K2 has decided whether to display the item (based on guest or not) before that, Where is that decision made?

Please Log in or Create an account to join the conversation.

  • Lisa Jorgensen
  • Lisa Jorgensen's Avatar Topic Author
  • Offline
  • New Member
More
9 years 4 months ago #133783 by Lisa Jorgensen
Replied by Lisa Jorgensen on topic Re: Premium Content Items Invisible IF Not Logged In
Looks like the decision is made in controllers/item.php. I see that line 22 retrieves the type of item (I assume that means whether it's premium or not), and then line 29 sets $cache = true if guest. But I don't see where the two are compared and a decision is made. Can you assist?

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 4 months ago #133838 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Premium Content Items Invisible IF Not Logged In
There are no premium items in K2.
You can use Joomla!'s API and user groups to hide certain aspects of your content, hence the link I sent you.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Lisa Jorgensen
  • Lisa Jorgensen's Avatar Topic Author
  • Offline
  • New Member
More
9 years 4 months ago #133874 by Lisa Jorgensen
Replied by Lisa Jorgensen on topic Premium Content Items Invisible IF Not Logged In
Sorry for dragging this out, but I don't think I'm making myself clear enough.

Without K2 installed, guests can still see the title and intro of premium articles (they can't read the full articles, of course). With K2 installed, the premium item in a K2 module does not show up at all, which means it must be blocking it somewhere. I'd like to just make it behave as Joomla standard does in regard to premium items.

So, the primary issue is how to prevent the premium item's title and intro from being blocked. The message to the guest would come after that - once I've got hold of the premium item.

Are you saying that premium items don't even get inside a K2 module if the user is a guest? Am I understanding this right?

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 4 months ago #133921 by Krikor Boghossian
Replied by Krikor Boghossian on topic Premium Content Items Invisible IF Not Logged In
K2 is a replacement to Joomla!'s default article system
In its modules you can only retrieve K2 items, not articles.

With the link I sent you, you can block several aspects of the module to non-registered users. Remember to change the feeds as well.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Lisa Jorgensen
  • Lisa Jorgensen's Avatar Topic Author
  • Offline
  • New Member
More
9 years 4 months ago #133929 by Lisa Jorgensen
Replied by Lisa Jorgensen on topic Premium Content Items Invisible IF Not Logged In
Yes, the contents I'm referring to are K2 items, not articles. I do see where to use the link you sent me.
You mentioned the feed. That's what I need to control. Where can I find that, please?

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum