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

options ... individual ..

Discussion in 'XenForo Development Discussions' started by DroidHost, Jun 4, 2011.

  1. DroidHost

    DroidHost Well-Known Member

    I know how to create an option for an add-on ... that will be in AdminCP

    but what if I want each user can made up his own value of an option ?
    or an option will be for each user-group ?
    how can that achieved

    thanks ...
     
  2. DroidHost

    DroidHost Well-Known Member

    PHP:
    ....

            
    $Permission _getpermissiondModel();
            
    $Permission->getPermissionsByAddOn('demo');

    ......

        protected function 
    _getpermissiondModel()
        {
            return 
    $this->getModelFromCache('XenForo_Model_Permission');
        }

    if I add a permissiongroup .... etc ...
    how can this work ?
     
  3. ragtek

    ragtek Guest

    XenForo_Visitor::getInstance()->hasPermission('group', 'name');

    for example

    XenForo_Visitor::getInstance()->hasPermission('general', 'viewRagtekArticleSystem')
     
  4. DroidHost

    DroidHost Well-Known Member

    Amazing
    but what if the permission is an integer ? not true of false
     
  5. ragtek

    ragtek Guest

    have you checked what hasPermission returns? ;)

    start reading the code;)!
    PHP:
          /**
         * Gets the value (true, false, or int) of the specified permission if it exists.
         * Used for global permissions which have a group and an individual permission.
         *
         * @param array $permissions Grouped permissions ([group][permission] => value)
         * @param string $group Permission group
         * @param string $permission Permission ID
         *
         * @return true|false|int False if the permission isn't found; the value of the permission otherwise
         */
        
    public static function hasPermission(array $permissions$group$permission)
        {
     
    DroidHost likes this.
  6. DroidHost

    DroidHost Well-Known Member

    you are amazing ..... 'actually I did read it but .... I did a small mistake I did not capitalize the first latter so my code did not work'
    I know now how to do group options, what about users ?

    thanks again
     

Share This Page