Keyword

How do I disable the url's of those who comment?

  • Tessa Priddy
  • Tessa Priddy's Avatar Topic Author
  • Offline
  • New Member
More
10 years 2 months ago #130400 by Tessa Priddy
I've looked through the backend of my website and I can't find a way to disable the url's of those who comment on my website. They may enter a url when they make comments and I really don't want those links to work. I read that it has to be done using code, but the article didn't make sense to me and I need specific instructions if it does require code. I don't want it to mess up when I update K2 or Joomla in the future. How do I disable the urls included with comments of guests and/or signed in users? The url's aren't part of the comments by the way. They are part of the information given when a guest or signed in user leaves a comment.

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

More
10 years 2 months ago #130401 by Lefteris
This requires some basic code. Actually you just need to remove a part of code, not write code. First read getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates to see how you can override the default output of K2. Then just edit the layout file item.php so the part :
			    <?php if(!empty($comment->userLink)): ?>
			    <a href="<?php echo JFilterOutput::cleanText($comment->userLink); ?>" title="<?php echo JFilterOutput::cleanText($comment->userName); ?>" target="_blank" rel="nofollow">
			    	<?php echo $comment->userName; ?>
			    </a>
			    <?php else: ?>
			    <?php echo $comment->userName; ?>
			    <?php endif; ?>
looks like:
<?php echo $comment->userName; ?>

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

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

  • Tessa Priddy
  • Tessa Priddy's Avatar Topic Author
  • Offline
  • New Member
More
10 years 2 months ago #130402 by Tessa Priddy
Replied by Tessa Priddy on topic Re: How do I disable the url's of those who comment?
I read the article you referenced, Lefteris. I saved a copy of the protostar-default template and named it "godlywriterproto-default" when I first began working on my new website. This copy is the template that I've been using as my default. Is it still necessary to do what is suggested in the article, since I saved this copy with a new name? I haven't done the second part of your suggestion yet, because I'm not sure if I should alter it without knowing the answer to this question regarding the K2 sub-templating. I'm having some difficulty understanding the concept. Since I created the copy template through the backend, is it still necessary to do the copy and paste process described in the article? Thanks for your suggestions and help!

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
10 years 2 months ago #130403 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: How do I disable the url's of those who comment?
Yes, you definitely have to override K2 (follow the post's instructions).
Otherwise you will lose your edits when you update K2.

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

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

  • Tessa Priddy
  • Tessa Priddy's Avatar Topic Author
  • Offline
  • New Member
More
10 years 2 months ago #130404 by Tessa Priddy
Replied by Tessa Priddy on topic Re: How do I disable the url's of those who comment?
Alright, the article said, "COPY THE CONTENTS of the folder /components/com_k2/templates/ and PASTE it into /templates/YOURJOOMLATEMPLATE/html/com_k2/" I went to do that, but my joomla template html file does not contain com_k2. I'm assuming that I need to create a file called com_k2, but my file manager requires that I save it with an extension. What should the com-k2 file extension be? There are a good many possibilities from CSS, text, html, scripts, and the extensions under those. Does it matter which one I save it as?

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
10 years 2 months ago #130405 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: How do I disable the url's of those who comment?
You need to create a folder not a file.

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

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

  • Tessa Priddy
  • Tessa Priddy's Avatar Topic Author
  • Offline
  • New Member
More
10 years 2 months ago - 10 years 2 months ago #130406 by Tessa Priddy
Replied by Tessa Priddy on topic Re: How do I disable the url's of those who comment?
I created the folder, completed the steps mentioned in the article, and have a k2 sub-template :woohoo: I followed Lefteris instructions for changing the code, then went to the backend of Joomla, and chose my sub-template that I created. It was right there on the drop-down list, which was great. However, the changes to the code (removing some) and leaving that one line did not have the desired affect.

The member's url's all link to their own page within my website, which is good. I want it to do that, but when the guest's give a url I don't want their name to link to their off site link. The reason is that I don't want my site to link to inappropriate or offensive websites. I don't want to have to check each one either. I don't want guest names to link to an outside website, but want to keep member names link to their onsite page. Thanks for the help so far, is there anything else you can tell me to resolve this?

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
10 years 2 months ago #130407 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: How do I disable the url's of those who comment?
Yes you can perform a simple check, if the user is registered display the original code else display the modified code.

The check whether uses is a guest or not is:
<?php if($user->guest): ?>
// altered code
<? php else: ?>
// Original code
<?php endif; ?>

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

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

  • Tessa Priddy
  • Tessa Priddy's Avatar Topic Author
  • Offline
  • New Member
More
10 years 2 months ago #130408 by Tessa Priddy
Replied by Tessa Priddy on topic Re: How do I disable the url's of those who comment?
Krikor, I did what you said and now when I go to the Bible study page this error shows up:

Parse error: syntax error, unexpected T_ELSE in study/templates/MYTEMPLATE/html/com_k2/biblestudy/item.php on line 622

Do you have any idea what I did wrong?

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
10 years 2 months ago #130409 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: How do I disable the url's of those who comment?
I accidentally pasted <? php else: ?> instead of <?php else: ?>

Can you check if you duplicated my error?

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