1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Get Node-Permissions in Template Hook

Discussion in 'XenForo Development Discussions' started by r1pe, Jun 28, 2013.

  1. r1pe

    r1pe Member

    Hello,

    I have created some additional node permissions in the "Permission Definitions" section of the Admin Control Panel. Therefore I created a new Interface Group called "Forum BBCode Permissions" and added some permissions with the Permission Group "Forum Permissions" and the Interface Group "Forum BBCode Permission".

    I want do this because I want to enable/disable additional BBCodes for different forums.

    Afterwards I created a "Template Hook" event listener, here the code:

    PHP:
    class AddOns_AdditionalBbCodes_Listener_TemplateHook
    {
        public static function 
    listener($hookName, &$contents, array $hookParamsXenForo_Template_Abstract $template)
        {
            switch (
    $hookName)
            {
                case 
    'editor':
                
    // --> modify the editor settings
                
    break;
            }
      }
    }
    I want to check the BBCode permissions and change the content according to this. How I can get my forum permissions there? The $hookParams and $template->getParams(); variables don't help me. Does anyone have a good idea how I can get my forum permissions in this template hook? Or is this the wrong location for a permission check? After the permission check I want to pass an array with the enabled BBCodes to the template and enable the allowed BBCodes with JS.
     

Share This Page