Go Back   Pligg CMS Forum > Pligg Development > Modification Tutorials

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-20-2007, 07:02 AM
Constant Pligger
Pligg Version: 9.7
Pligg Template: Yget
 
Join Date: Nov 2006
Posts: 160
Thanks: 26
Thanked 1 Time in 1 Post
How To: Enable HTML in the comments

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 09:35 AM..
Reply With Quote
  #2 (permalink)  
Old 11-24-2007, 06:59 AM
AnAlienHolakres3's Avatar
Pligg Donor
 
Join Date: Jul 2007
Location: Prague
Posts: 117
Thanks: 7
Thanked 112 Times in 40 Posts
Send a message via ICQ to AnAlienHolakres3
Enabling HTML in the comments

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.
__________________
=Everything that has a beginnig has an end=
=Nevere stop fighting=

Site: http://www.vselink.org
Reply With Quote
  #3 (permalink)  
Old 11-25-2007, 08:49 AM
computerbar's Avatar
Pligg Donor
Pligg Version: 9.9.5
Pligg Template: yget,lemontwi
 
Join Date: Nov 2007
Location: UK
Posts: 79
Thanks: 32
Thanked 9 Times in 8 Posts
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, 04:39 AM
AnAlienHolakres3's Avatar
Pligg Donor
 
Join Date: Jul 2007
Location: Prague
Posts: 117
Thanks: 7
Thanked 112 Times in 40 Posts
Send a message via ICQ to AnAlienHolakres3
Enabling ALL HTML tags in comments for Admin and Gods

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...
__________________
=Everything that has a beginnig has an end=
=Nevere stop fighting=

Site: http://www.vselink.org
Reply With Quote
The Following 2 Users Say Thank You to AnAlienHolakres3 For This Useful Post:
  #5 (permalink)  
Old 12-26-2007, 01: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: 42
Thanks: 2
Thanked 1 Time in 1 Post
Is there a way to allow users to post just images? Maybe something like bb code?

Last edited by rwallen; 12-26-2007 at 05:02 PM..
Reply With Quote
Reply

Thread Tools
Display Modes
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML Disabled problem gavinpov General Help 11 09-30-2008 05:12 PM
Enable HTML GrinGEO General Help 0 11-03-2007 08:12 AM
[0.9.8] HTML available when showing comments on LIVE sixlaneve Bug Report 0 09-13-2007 10:14 AM
Line breaks in HTML enabled comments jobert General Help 0 09-11-2007 06:43 AM
how to enable comments html? coolbean2018 General Help 5 08-09-2006 03:10 PM


Search Engine Friendly URLs by vBSEO 3.2.0