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

  • Part 1 of “Integrating nicely into Community Framework” primarily focused on minor user experience improvements. Part 2 will explain how to integrate into some of the completely new features of Community Framework 2.1.


    com.woltlab.wcf.page object type


    If you read the Notices spotlight, you may have seen that the administrator is able to select the pages the notice should appear on. As not every page may be suited for such purposes you have to define pages that are available to select. You accomplish this task by adding a new object type for every page:



    This feature is not forward compatible: The installation will fail in Community Framework 2.0, due to the missing object type definition!


    Condition object types


    This partly goes in tandem with the previous improvement: Several new features (automated user group assignments, ads, notices) support “conditions”, such as the current page viewed or the amount of points the user has. We recommend adding sensible new conditions to these, in order integrate more nicely with the overall workflow. An example could be a condition for the notice system that allows the administrator to filter by the amount of files uploaded into the filebase. This allows him to show a short explanation only to those users that don’t have any files yet.


    As the condition system is very powerful one could fill an entire post with an explanation. We recommend taking a look at the Commit that introduced the automated user group assignments system. You can use the Plugin development forum in case any questions arise, we provided you a brand new WCF 2.1.x label! It goes without saying that this is not limited to questions related to conditions, feel free to ask anything you have on your mind :-) Building the example given above should be rather easy, though. Most work is done automatically, all you need to do is to add an object type (and some language items):



    This feature is not forward compatible: The installation will fail in Community Framework 2.0, due to the missing object type definition!


    Statistics


    We recommend reading the end user spotlight for this feature first. Integrating into the statistics only requires a small effort, but provides the administrator a much more complete overview on his community. You only need an object type, some language items and a PHP class:


    XML: objectType.xml
    <type>
    <name>com.woltlab.wcf.user</name>
    <definitionname>com.woltlab.wcf.statDailyHandler</definitionname>
    <!-- the name of the class reading the daily items -->
    <classname><![CDATA[wcf\system\stat\UserStatDailyHandler]]></classname>
    <categoryname>com.woltlab.wcf.general</categoryname>
    </type>



    The most common case is counting the related items, we provided the getCounter() and getTotal() functions for this case. But the statistics system is not limited to this use case! You can create statistics for everything that can be expressed with numbers.


    This feature is not forward compatible: The installation will fail in Community Framework 2.0, due to the missing object type definition!