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 #130410 by Tessa Priddy
Replied by Tessa Priddy on topic Re: How do I disable the url's of those who comment?
I did duplicate your error, but I changed it and got a new error message.
The error message: Parse error: syntax error, unexpected T_ELSE in ... /templates/MYTEMPLATE/html/com_k2/biblestudy/item.php on line 626

Here is the code that I added, because I already had made the previous changes mentioned in this thread. I copied and pasted the code provided in this thread. Here is the code I used (including the code you gave me plus some code preceding it to ensure I put it in the right place)

<span class="commentAuthorName">
<?php echo JText::_('K2_POSTED_BY'); ?>
<?php if(!empty($comment->userLink)): ?>
<?php if($user->guest): ?>
<?php echo $comment->userName; ?>

<?php else: ?>
<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; ?>
</span>

Thanks!

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

More
10 years 2 months ago #130411 by Lefteris
This is probably the exact code you need:
<span class="commentAuthorName">
<?php echo JText::_('K2_POSTED_BY'); ?>
<?php if(!empty($comment->userLink)): ?>
<?php if($user->guest): ?>
<?php echo $comment->userName; ?>
<?php else: ?>
<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 endif; ?>
</span> 

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 #130412 by Tessa Priddy
Replied by Tessa Priddy on topic Re: How do I disable the url's of those who comment?
I tried the copied and pasted the code. The result was a similar error message to the previous ones. I played around with it throughout the day and couldn't get it to work right :( Would it be easier to alter the form some how so that if a user is a guest, then the website url field in the form won't be available to enter a web address? OR do you have some other suggestion?

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 #130413 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: How do I disable the url's of those who comment?
<?php echo JText::_('K2_POSTED_BY'); ?>
<?php if(!empty($comment->userLink)): ?>
<?php if($user->guest): ?>
<?php echo $comment->userName; ?>
<?php else: ?>
<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 endif; ?>
<?php endif; ?>

A trailing <?php endif; ?> was missing.

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 1 month ago #130414 by Tessa Priddy
Replied by Tessa Priddy on topic Re: How do I disable the url's of those who comment?
Good news, I added the trailing code and I didn't get the previous error messages anymore. Bad news, it still doesn't keep the user name of the guests from linking to their website. It doesn't seem to do anything different than the original code on the frontend either. Thanks for trying to help me with it! I can't seem to find anybody who knows a code on the internet to alter the code that will allow the user name for members to continue to link and at the same time keep guests user names from linking to an outside url.

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

More
9 years 9 months ago #135735 by Robert_ITMan
Replied by Robert_ITMan on topic How do I disable the url's of those who comment?
My solution to this issue was simple and the answer to mine will likely answer the problems above too. I wanted to disable the URL from the comment form - I like the user URL - and I have it so only registered users can comment - so I have no need for the comment form to ask for the 'Website URL'.. I just needed to know what file to edit in my template and this is what worked for me:

I edited this file:
templates/(my template)/html/com_k2/default/item_comments_form.php
=> as copied from components/com_k2/templates/default/item_comments_form.php
<?php /* hidden - don't want external links for comments
	<label class="formUrl" for="commentURL"><?php echo JText::_('K2_WEBSITE_URL'); ?></label>
	<input class="inputbox" type="text" name="commentURL" id="commentURL" value="<?php echo JText::_('K2_ENTER_YOUR_SITE_URL'); ?>"  onblur="if(this.value=='') this.value='<?php echo JText::_('K2_ENTER_YOUR_SITE_URL'); ?>';" onfocus="if(this.value=='<?php echo JText::_('K2_ENTER_YOUR_SITE_URL'); ?>') this.value='';" />
end hide - following added to have the URL field hidden in the form */ ?>
	<!-- hide the URL -->
    <input type="hidden" name="commentURL" id="commentURL" value="<?php echo JText::_('K2_ENTER_YOUR_SITE_URL'); ?>"  onblur="if(this.value=='') this.value='<?php echo JText::_('K2_ENTER_YOUR_SITE_URL'); ?>';" onfocus="if(this.value=='<?php echo JText::_('K2_ENTER_YOUR_SITE_URL'); ?>') this.value='';" />

www.ourfingertips.ca - websites developed and managed @ ourfingertips

Let me help you make the most of the technology at our fingertips

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 8 months ago #135759 by Krikor Boghossian
Replied by Krikor Boghossian on topic How do I disable the url's of those who comment?
Yes, this is the correct procedure for overriding K2's templates.

More info 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.


Powered by Kunena Forum