COMMUNITY FORUM
How do I disable the url's of those who comment?
- Tessa Priddy
-
Topic Author
- Offline
- New Member
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
- Posts: 8743
<?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; ?>
<?php echo $comment->userName; ?>
Please Log in or Create an account to join the conversation.
- Tessa Priddy
-
Topic Author
- Offline
- New Member
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
Otherwise you will lose your edits when you update K2.
Please Log in or Create an account to join the conversation.
- Tessa Priddy
-
Topic Author
- Offline
- New Member
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
Please Log in or Create an account to join the conversation.
- Tessa Priddy
-
Topic Author
- Offline
- New Member
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
-
- Offline
- Platinum Member
- Posts: 15920
The check whether uses is a guest or not is:
<?php if($user->guest): ?>
// altered code
<? php else: ?>
// Original code
<?php endif; ?>
Please Log in or Create an account to join the conversation.
- Tessa Priddy
-
Topic Author
- Offline
- New Member
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
-
- Offline
- Platinum Member
- Posts: 15920
Can you check if you duplicated my error?
Please Log in or Create an account to join the conversation.
- Tessa Priddy
-
Topic Author
- Offline
- New Member
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.
- Lefteris
-
- Offline
- Platinum Member
- Posts: 8743
<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>
Please Log in or Create an account to join the conversation.
- Tessa Priddy
-
Topic Author
- Offline
- New Member
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
<?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.
Please Log in or Create an account to join the conversation.
- Tessa Priddy
-
Topic Author
- Offline
- New Member
Please Log in or Create an account to join the conversation.
- Robert_ITMan
-
- Offline
- New Member
- Posts: 10
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
-
- Offline
- Platinum Member
- Posts: 15920
More info can be found here getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates
Please Log in or Create an account to join the conversation.