Jump to content


Developer Documentation


What it is

GroupLimits extensions allow your application an opportunity to take a group setting and then determine what ultimate value a user who belongs to multiple groups should be given. For instance, if a user is in a group who is allowed to post content and in a group who is not allowed to post content, then the user should be permitted to post content (because the group setting merges take the best value possible). While this simple use case scenario is handled out of the box, other slightly more complex scenarios will require you to define how the user's permission should be set.

Generally speaking, if you create a GroupForm extension you will want to create a GroupLimits extension as well.

How it works

The extension requires you to define a single getLimits() method

     * Get group limits by priority
     * @return    array
    public function getLimits()

This method should return an array that specifies how to process your group settings. The valid array keys are as follows:

  • exclude: An array of group setting keys that should NOT be merged, no matter what. For instance, there is no better or worse group icon, so a user's group icon will always be the one representing their primary group, and group icons are excluded when merging member group permissions.
  • lessIsMore: An array of group setting keys where the LOWER the value, the better. For instance, if you have a timeout period, the lower the timeout the less restrictive, and thus the better the value.
  • neg1IsBest: An array of group setting keys where a -1 value is considered best, followed by the HIGHEST value. -1 is commonly used to indicate "unlimited" throughout the Invision Community software.
  • zeroIsBest: An array of group setting keys where a 0 value is considered best, followed by the HIGHEST value. If you have an on/off field, for instance, and off would be a less restrictive setting for the member, then you would want to define this in zeroIsBest.
  • callback: An array with group setting keys as the keys and the values being a callback function accepting 3 parameters: the first parameter is the first group we are checking, the second parameter is the second group we are checking, and the third parameter is the group setting key being checked. More complex group configuration options may require you to manually determine which value to use. For instance, signature configurations store complex values and the two groups must be manually checked against each other.

  Report Document

  • Create New...