WCF 2.1 — Integrating nicely into Community Framework 2.1 (Part 1)

  • The Product Spotlights primarily addresses end users, but of course there were several changes under the hood of Burning Board as well. Now it’s developer’s time: This first developer spotlight will show you how your plugin will integrate nicely into some of the new features introduced with Burning Board 4.1 and Community Framework 2.1. We recommend using all of these improvements, where applicable, to provide the best experience for end users.


    <usersonly> for user group option PIP


    There will always be plugins, such as the conversation system, that do not support guests at all or at least in certain parts. The respective option still could be checked for the “guests” group, leading to confusion for the end user. Community Framework 2.1 supports the new <usersonly> tag in the user group option PIP. By setting the value to 1 the option will be hidden for the guests group and the permission will always return false for guests.


    XML: userGroupOption.xml
    <option name="user.conversation.canUseConversation">
    <categoryname>user.conversation</categoryname>
    <optiontype>boolean</optiontype>
    <defaultvalue>1</defaultvalue>
    <usersonly>1</usersonly>
    </option>


    This feature is forward compatible: If your plugin is installed into Community Framework 2.1 or updated after the community upgraded to Community Framework 2.1 it will work. If it is installed into Community Framework 2.0 or the community upgrades to Community Framework 2.1 after installing your plugin it will be silently ignored.


    <moddefaultvalue> for user group option PIP


    Don’t close your userGroupOption.xml yet! We have some further improvements for you: Previously you had to define the default values for moderators by using the script PIP. This changes with Community Framework 2.1. You are able to set the default value for groups with the mod.general.canUseModeration permission by setting the <moddefaultvalue> tag to the proper value. It works exactly like <admindefaultvalue>, <userdefaultvalue> and <defaultvalue>.


    Renaming users in old contents
    Previous versions of Community Framework and Burning Board did not update the username in contents that already exists. Starting at Community Framework 2.1 the username will automatically be updated once a user is renamed. It requires some work by you to be fully consistent, though:


    Add an event listener to rename@\wcf\data\user\UserAction for both, the admin and the user environment. You can retrieve the userID and new username like this:


    PHP: UserActionRenameListener.class.php
    $objects = $eventObj->getObjects();
    $userID = $objects[0]->userID;
    $parameters = $eventObj->getParameters();
    $username = $parameters['data']['username'];


    Now simply update all references of the old username by the new one.


    This feature is forward compatible: If the community is running Community Framework 2.1 it will work, if it is running Community Framework 2.0 it will be silently ignored.