Keyword

Weiterlesen nur für angemeldete User

  • werner
  • werner's Avatar Topic Author
  • Offline
  • New Member
More
7 months 1 week ago - 7 months 1 week ago #175095 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
Last edit: 7 months 1 week ago by werner.

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

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
7 months 1 week ago - 7 months 1 week ago #175118 by Fotis
Replied by Fotis 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;"):
// 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)

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member
Last edit: 7 months 1 week ago by Fotis. Reason: Fixed code typo

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

  • werner
  • werner's Avatar Topic Author
  • Offline
  • New Member
More
6 months 3 weeks 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

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

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
6 months 3 weeks ago #175244 by Fotis
Replied by Fotis 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.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

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


Powered by Kunena Forum