- Posts: 2
COMMUNITY FORUM
Weiterlesen nur für angemeldete User
- werner
- Topic Author
- Offline
- New Member
Less
More
4 years 8 months ago - 4 years 8 months ago #175095
by werner
Weiterlesen nur für angemeldete User was created by werner
Liebes Team,
gibt es eine Möglichkeit so wie bei Joomla-Artikeln auch in K2 den weiterlesen-Link nur für z.B. angemeldete User frei zu geben...?
Vielen Dank!
Werner
gibt es eine Möglichkeit so wie bei Joomla-Artikeln auch in K2 den weiterlesen-Link nur für z.B. angemeldete User frei zu geben...?
Vielen Dank!
Werner
Last edit: 4 years 8 months ago by werner.
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
Less
More
- Posts: 6218
4 years 8 months ago - 4 years 8 months ago #175118
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on topic Weiterlesen nur für angemeldete User
This is actually very simple to accomplish with K2.
It requires that you override K2's item.php file (more info on overriding here: getk2.org/documentation/tutorials/templating-with-k2-and-the-concepts-of-sub-templates) to insert some additional code to handle what users who are NOT registered see.
A simplified example would be to add this at the top of the item.php file (but right after "defined('_JEXEC') or die;"):
It requires that you override K2's item.php file (more info on overriding here: getk2.org/documentation/tutorials/templating-with-k2-and-the-concepts-of-sub-templates) to insert some additional code to handle what users who are NOT registered see.
A simplified example would be to add this at the top of the item.php file (but right after "defined('_JEXEC') or die;"):
// Get the user info
$user = JFactory::getUser();
// If the user is not registered (aka a guest), show some message, otherwise show the item's content
if ($user->guest) {
echo '<p>You need to be registered to view this content.</p><p>You can <a href="#">sign up here</a>.</p>';
} else {
?>
<!-- the actual code for item.php continues -->
<?php
} // Here we close the if/else statement which controls what the user sees (this will be at the bottom of the item.php file)
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Last edit: 4 years 8 months ago by JoomlaWorks. Reason: Fixed code typo
Please Log in or Create an account to join the conversation.
- werner
- Topic Author
- Offline
- New Member
Less
More
- Posts: 2
4 years 7 months ago #175239
by werner
Replied by werner on topic Weiterlesen nur für angemeldete User
Thank you Fotis,
but I dont know which item.php you mean...
greetings werner
but I dont know which item.php you mean...
greetings werner
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
Less
More
- Posts: 6218
4 years 7 months ago #175244
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on topic Weiterlesen nur für angemeldete User
"item.php" is the template override for the item (article) view. That file is in /components/com_k2/templates/default/ and you can copy it INSIDE your Joomla template's html/com_k2/default/ folder (create it if it doesn't exist) and then modify it.
Read the link I posted. More info is present there.
Read the link I posted. More info is present there.
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.