How To: Enable HTML in the comments

Register an Account
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 11-20-2007, 08:02 AM
Constant Pligger
Pligg Version: 9.7
Pligg Template: Yget
 
Join Date: Nov 2006
Posts: 154
Ok, its not rocket science, but thanks to one user on my site, I've managed to enable HTML on the comments on my site and thought i'd share it with you all.
All you need to do is change the following in line 120 of comments.php
Code:
$smarty->assign('comment_content', save_text_to_html($this->content));
TO

Code:
$smarty->assign('comment_content', ($this->content));
What this does is, it will disable line breaks. To enable line breaks, use the nl2br function this way (credit again to the same user)
Code:
$smarty->assign('comment_content', nl2br($this->content));
Enable HTML on the comments at your own risk!
A request to the pligg developers: I am told that one would need to write a new function to allow/restrict certain tags. Now, if only one of the pligg developers could share that *huge grin*

Last edited by nothingman; 10-22-2008 at 10:35 AM.
Reply With Quote
  #2 (permalink)  
Old 11-24-2007, 07:59 AM
AnAlienHolakres3's Avatar
Pligg Donor/Coder
 
Join Date: Jul 2007
Location: Prague
Posts: 116
Send a message via ICQ to AnAlienHolakres3
This could be extremely dangerous to allow HTML in comments for all users. It is possible to steal password if user clicks on specific link. Pligg is not exactly best security site on the world. If you really want to allow HTML in comments,do it in this way:
PHP Code:
    $smarty->assign('comment_content'nl2br(strip_tags(($this->content),"<p><b><i><u><ul><li>"))); 
Allow only some tags.
Reply With Quote
  #3 (permalink)  
Old 11-25-2007, 09:49 AM
computerbar's Avatar
Pligg Donor
Pligg Version: 9.9.5
Pligg Template: yget,lemontwi
 
Join Date: Nov 2007
Location: UK
Posts: 67
How to allow only some users html tags (links and img) in comments?
e.g I have user "rssbot" set on my site for RSS importing.
How can I specify this "rssbot" and "admin" to use HTML tags i.e. links and img in comments.

thanks
Reply With Quote
  #4 (permalink)  
Old 11-26-2007, 05:39 AM
AnAlienHolakres3's Avatar
Pligg Donor/Coder
 
Join Date: Jul 2007
Location: Prague
Posts: 116
Send a message via ICQ to AnAlienHolakres3
Quote:
Originally Posted by computerbar View Post
How to allow only some users html tags (links and img) in comments?
e.g I have user "rssbot" set on my site for RSS importing.
How can I specify this "rssbot" and "admin" to use HTML tags i.e. links and img in comments.

thanks
Ok it is possible. This mod allow to add all HTML tags to Admin and Gods.
Do following:
1) In function fill_smarty (in comment.php) change original smarty assign code to:
PHP Code:
        $smarty->assign('comment_content'nl2br($this->content)); 
2) Find function store() and replace comment_content with:
PHP Code:
        //ALL HTML elements for GOD and Admin users MOD
        
$canIhaveAccess 0;
        
$canIhaveAccess $canIhaveAccess checklevel('god');
        
$canIhaveAccess $canIhaveAccess checklevel('admin');
        
        if(
$canIhaveAccess == 1){ 
        
$comment_content $db->escape($this->content);        
        }else{
            
//other users can use only this elements
        
$comment_content $db->escape(strip_tags(($this->content),"<p><b><i><u><ul><li>"));        
        }        
        
//mode end 
If you wish to add specific user, you can always add into condition userid...
Reply With Quote
  #5 (permalink)  
Old 12-26-2007, 02:18 PM
Casual Pligger
Pligg Version: 9.8.2
Pligg Template: It was Shredit but I've torn it apart
 
Join Date: Nov 2007
Posts: 35
Is there a way to allow users to post just images? Maybe something like bb code?

Last edited by rwallen; 12-26-2007 at 06:02 PM.
Reply With Quote
  #6 (permalink)  
Old 11-07-2010, 06:00 PM
New Pligger
 
Join Date: Sep 2010
Posts: 10
I've tried all these methods and I can't seem to get any of them to work....can somebody go in depth on how to do this....
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Admin Panel for 1.0 and above mismeflight Wiki Articles 0 03-04-2009 11:04 AM
Enable HTML GrinGEO Questions and Comments 0 11-03-2007 09:12 AM
[0.9.8] HTML available when showing comments on LIVE sixlaneve Questions and Comments 0 09-13-2007 11:14 AM
Line breaks in HTML enabled comments jobert Questions and Comments 0 09-11-2007 07:43 AM
how to enable comments html? coolbean2018 Questions and Comments 5 08-09-2006 04:10 PM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development