Keyword

[SOLVED] Premium Content Items Invisible IF Not Logged In

  • Lisa Jorgensen
  • Lisa Jorgensen's Avatar Topic Author
  • Offline
  • New Member
More
10 years 5 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
10 years 5 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
10 years 5 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
10 years 5 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
10 years 5 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
10 years 5 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
10 years 5 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
10 years 5 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
10 years 5 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
10 years 5 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.

  • Lisa Jorgensen
  • Lisa Jorgensen's Avatar Topic Author
  • Offline
  • New Member
More
10 years 5 months ago #133948 by Lisa Jorgensen
Replied by Lisa Jorgensen on topic Premium Content Items Invisible IF Not Logged In
I just want to to add that it's unfortunate that I can get only one reply every 24 hours. I realize you may be in a country whose timezone is opposite mine.

For those of us who have subscriber-based websites, this is an urgent issue. K2 is unusable as it is. I'm not a programmer, and I don't seem to be able to make headway on this issue. Actually, I consider it a bug. The functionality is reduced from standard Joomla. Guests have to be able to see the title and intro of premium items. If this can't be resolved within a few days, I'll have to uninstall K2. I would hate to do that because I love the masonry effect, and I love the future potential in what I can offer my subscribers.

Please solve this. Telling me that I need to check the feed is just not useful. I don't know how to do that, or even where to look.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
10 years 5 months ago #134008 by Krikor Boghossian
Replied by Krikor Boghossian on topic Premium Content Items Invisible IF Not Logged In
You get an answer every 24hours not only because of opposite timezones but due to the fact of that we do not work over weekends.

If you are looking for 24/7 support you should consider hiring a developer. Open source does not mean 24.7 support.

I have already posted my answer multiple times as well as links to documentation. I will post it for one final time.

You need to use the code snippet I sent you in your template overrides. The item.php in particular. Check the link to locate the file/ folder. Then you need to disable or change the feeds so users are not able to see the entire item from the RSS feeds.

It is that simple. I am really sorry If you are having issues implementing this solution.

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
10 years 5 months ago #134034 by Lisa Jorgensen
Replied by Lisa Jorgensen on topic Premium Content Items Invisible IF Not Logged In
Again, no idea how to affect the feeds, or even where they are, in order to implement what is already present in Joomla. I was not counting on hiring a programmer.

Unfortanately, I will be uninstalling K2 today.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
10 years 5 months ago #134043 by Krikor Boghossian
Replied by Krikor Boghossian on topic Premium Content Items Invisible IF Not Logged In
Sorry to hear that.
Feed are disabled from either K2' category option or from the menu item's settings.

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

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

  • Vlachos Evaggelos
  • Vlachos Evaggelos's Avatar
  • Offline
  • Junior Member
More
10 years 5 months ago #134099 by Vlachos Evaggelos
Replied by Vlachos Evaggelos on topic Premium Content Items Invisible IF Not Logged In
Hi Lisa, take a look here...

1.) if not use joomla 1.5 and
2.) need to view non login users all k2 items where have access level public and register (if need extra access levels just put level(s) id in "i.access IN(1,2, your_extra_level_id(s))" and if click the item then must login edit ./components/com_k2/models/itemlist.php


final code ./components/com_k2/models/itemlist.php:62-88

if ($user->guest)
        {

            $query .= "i.access IN(1,2)"." AND i.trash = 0"." AND c.published = 1"." AND c.access IN(".implode(',', $user->getAuthorisedViewLevels()).")"." AND c.trash = 0";

            $mainframe = JFactory::getApplication();
            $languageFilter = $mainframe->getLanguageFilter();
            if ($languageFilter)
            {
                $languageTag = JFactory::getLanguage()->getTag();
                $query .= " AND c.language IN (".$db->quote($languageTag).",".$db->quote('*').") 
						AND i.language IN (".$db->quote($languageTag).",".$db->quote('*').")";
            }
        }
        else
        {
            $query .= "i.access IN(".implode(',', $user->getAuthorisedViewLevels()).")"." AND i.trash = 0"." AND c.published = 1"." AND c.access IN(".implode(',', $user->getAuthorisedViewLevels()).")"." AND c.trash = 0";

            $mainframe = JFactory::getApplication();
            $languageFilter = $mainframe->getLanguageFilter();
            if ($languageFilter)
            {
                $languageTag = JFactory::getLanguage()->getTag();
                $query .= " AND c.language IN (".$db->quote($languageTag).",".$db->quote('*').") 
						AND i.language IN (".$db->quote($languageTag).",".$db->quote('*').")";
            }
        }

Please use k2 template for above changes... :)

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

More
10 years 5 months ago #134233 by George
Vlachos Evaggelos, your way of changing the file itemlist.php gives error 1054 when browsing categories. I have installed Joomla 3.2 and K2 2.6.8. I think that the best solution would be to add a button select the level of access available in standard content manager of Joomla. But how? Sorry for my English.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
10 years 5 months ago #134245 by Krikor Boghossian
Replied by Krikor Boghossian on topic Premium Content Items Invisible IF Not Logged In
I would suggest that instead of 'hacking' the core of K2 that you use Joomla!'s user function in your template overrides.
docs.joomla.org/Accessing_the_current_user_object

This way you will not lose your changes when you update.

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

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

More
10 years 4 months ago #134372 by George
Eventually, I just use the Akeeba Subscriptions extension. It is able to work with the component K2.

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

More
10 years 4 months ago #135195 by Lawrence Clayton
Replied by Lawrence Clayton on topic Premium Content Items Invisible IF Not Logged In
Hi George,

I have recently moved to K2, im about to uninstall it due to the same issue, I need customers to login to read content. I dont want to charge people... I want to capture their details so I can direct market to them... But they also need to be able to read the first 50 - 70 words, to incite them to login.. Native joomla can do this.

How did you configure Akeeba Subscriptions for the desired result?

Regards

Lawrence

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

More
8 years 3 months ago #160041 by Mars Cureg
Replied by Mars Cureg on topic Premium Content Items Invisible IF Not Logged In
This is so helpful, it works perfectly.

Now, I need the same logic to display in in K2 content module

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


Powered by Kunena Forum