AndyB
Well-known member
I would like to extend Forum, but I'm not having any success passing my variable to the forum_view template.
The following PHP code does not work:
	
	
	
		
and also tried using the subView code I learned how to do in this thread:
https://xenforo.com/community/threads/i-would-like-to-extend-findnew.83748/
but that doesn't work either.
Thank you.
				
			The following PHP code does not work:
		PHP:
	
	<?php
class Andy_ShowModeration_ControllerPublic_Forum extends XFCP_Andy_ShowModeration_ControllerPublic_Forum
{
    public function actionIndex()
    {
        // get parent       
        $parent = parent::actionIndex();
        // return parent action if this is a redirect or other non View response
        if (!$parent instanceOf XenForo_ControllerResponse_View)
        {
            return $parent;
        }
               
        // get cookie
        $showModeration = XenForo_Helper_Cookie::getCookie('show_moderation');
       
        // prepare viewParams
        if ($parent instanceOf XenForo_ControllerResponse_View)
        {
            $viewParams = array(
                'showModeration' => $showModeration
            );
           
            // add viewParams to parent params
            $parent->params += $viewParams;
        }   
       
        // return parent
        return $parent;
    }
}
	and also tried using the subView code I learned how to do in this thread:
https://xenforo.com/community/threads/i-would-like-to-extend-findnew.83748/
but that doesn't work either.
Thank you.