Ozzy47
Well-known member
I have an addon that will allow those with permission to view censored words, https://xenforo.com/community/resources/ozzmodz-censor-permissions.9660/
It uses the Formatter.php file to adjust it. It works as it should. However, I'd like to add it for a single node only. I have an option set up for my addon using PHP callback with
In my formatter file, how would I make it so it only applies in the selected node?
	
	
	
		
				
			It uses the Formatter.php file to adjust it. It works as it should. However, I'd like to add it for a single node only. I have an option set up for my addon using PHP callback with
\XF\Option\Forum::renderSelect which allows you to select one forum, the option is called ozzmodz_words_monitor_nodeIn my formatter file, how would I make it so it only applies in the selected node?
		PHP:
	
	<?php
namespace OzzModz\CensorPerms\XF\Str;
use XF\Template\Templater;
class Formatter extends XFCP_Formatter
{
    public function censorText($string, $censorChar = null)
    {
        // Get Parent       
        $parent = parent::censorText($string, $censorChar = null);
        
        // Get Visitor
        $visitor = \XF::visitor();
        if ($visitor->hasPermission('ozzmodzCensorPerms', 'view'))
        {
            // Show Censored Words
            return $string;
        }
        else
        {
           // Return To Parent
            return $parent;
        }
    }
} 
 
		 
 
		
 
 
		 
 
		 
 
		 
 
		