Keyword

[SOLVED] Premium Content Items Invisible IF Not Logged In

More
7 years 3 months ago #160042 by Mars Cureg
Replied by Mars Cureg on topic Premium Content Items Invisible IF Not Logged In
Opps! Never mind. I got it, found the lines that needs to be edited in helper.php

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 3 months ago #160063 by Krikor Boghossian
Replied by Krikor Boghossian on topic Premium Content Items Invisible IF Not Logged In
Nice to hear that you sorted this out.

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

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

More
7 years 2 months ago - 7 years 2 months ago #160581 by Chris Hogan
Replied by Chris Hogan on topic Premium Content Items Invisible IF Not Logged In
Hi there - I've read this post a few times now but just need a bit of clarification on a few things.

1) Where does this code below need to be put in the components/com_k2/templates/default/item.php file.

<!-- Start K2 Item Layout --> Does it go Here?......or is there a line number!

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

2) I understand I have to: COPY THE CONTENTS of the folder /components/com_k2/templates/ and PASTE it into /templates/YOURJOOMLATEMPLATE/html/com_k2/. for the above code to work?

BUT as I don't seem to have the /com_k2 folder in my sites template folder do I just create a single directory myself and drop the CONTENTS of the folder /components/com_k2/templates in to it??
Last edit: 7 years 2 months ago by Chris Hogan.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 2 months ago #160599 by Krikor Boghossian
Replied by Krikor Boghossian on topic Premium Content Items Invisible IF Not Logged In
You need to create the following folder.
/templates/YOURJOOMLATEMPLATE/html/com_k2/default.

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

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

More
7 years 2 months ago - 7 years 2 months ago #160602 by Chris Hogan
Replied by Chris Hogan on topic Premium Content Items Invisible IF Not Logged In
Ok so I will create an empty folder 'DEFAULT' folder inside another folder 'com_k2' and copy in the Template folder files

As for the code below, where should this be pasted to in the /components/com_k2/templates/default/item.php file - for an unregistered user to be able to view the text before the read more button.

$user = JFactory::getUser();

if ($user->guest) {
echo "<p>You must login to see the content. I want your email address.</p>";
} else {
// do sth
}
Last edit: 7 years 2 months ago by Chris Hogan.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 2 months ago #160607 by Krikor Boghossian
Replied by Krikor Boghossian on topic Premium Content Items Invisible IF Not Logged In
The templates folder is not needed.
This post will give you a nice insight about overrides.
www.joomlaworks.net/blog/item/194-k2-inheritance-sub-templating

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

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

More
7 years 1 month ago - 7 years 1 month ago #160789 by Chris Hogan
Replied by Chris Hogan on topic Premium Content Items Invisible IF Not Logged In
Hi there - thanks for the link I believe I now have the folder and files all in the correct place now!

/public_html/new/templates/MYSITESTEMPLATE/html/com_k2

BUT I still don't know how to get my Registered Content to display before a read more button?

Please any advise is welcome as I'm at a complete dead-end with this!
Last edit: 7 years 1 month ago by Chris Hogan.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 1 month ago #160801 by Krikor Boghossian
Replied by Krikor Boghossian on topic Premium Content Items Invisible IF Not Logged In
What is the exact code you are using?

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

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

More
7 years 1 month ago - 7 years 1 month ago #160811 by Chris Hogan
Replied by Chris Hogan on topic Premium Content Items Invisible IF Not Logged In
Hi, Its the code below, mentioned in this topic taken from the Joomla 'user function' page.

It also says somewhere on this thread to put the code into /default/item.php file

But I cannot figure out exactly where I'm supposed to put it??

$user = JFactory::getUser();

if ($user->guest) {
echo "<p>You must login to see the content. I want your email address.</p>";
} else {
// do sth
}
Last edit: 7 years 1 month ago by Chris Hogan.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 1 month ago #160817 by Krikor Boghossian
Replied by Krikor Boghossian on topic Premium Content Items Invisible IF Not Logged In
I think you need to contact a developer about this.
This code is a starting point but you need a basic understanding of coding.

As to "where to put the code" you need to place it in the blocks you need to hide from public users.
Inside the else statement instead of the placeholder you should put the blocks you want hidden.

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

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


Powered by Kunena Forum