ipboards a good forum for developers

David Jones
@david3jones
avatar-davidejones

In the past year or so i’ve been developing addons for a forum called invisionpower, not specifically for the company but for a gaming community that uses their systems. Previous to this the most i have ever worked with is phpbb as this is free and i’ve yet to meet a client that has been willing to pay for a forum. However if there was ever a reason to pay for a forum this would be the forum to fork the cash out for and i’d recommend it to a client easily. I started off quite skeptical at being able to have any freedom in developing changes to the forums but i found it to be quite refreshing and infact has made me think about the way i am currently developing my bespoke projects. IPboards uses a number of methods for extending the functionality and design without breaking the system or creating something so different from the original product that its near impossible for others to assist when problems occour. It uses a combination of xml files and php classes to create new applications and hooks which allow you to create full blown systems like the prebuilt calendar and gallery or to add new features to the templates. Having used it for roughly over a year now i feel i am still only touching the tip of the iceberg of what can be done. I would like to share with you a simple how to on creating a hook for the forums and installing it. Alot of the development is actually done through the boards, so if you can log in to the admin area and click on hooks and click create hook. This will take you through the basics first up is the basic information of who created it etc. hookfile So you will need to select the following to do the mod tool bar addon File hook type: template hooks The skin group this hook is in: skin_global The skin function this hook is in: globalTemplate Type of template hook: if statement The hook ‘ID’: issupermod Position of template hook: (pre.startif) before the start of the if statement Once thats done save the hook and you should now see it in the hooks list. Click the little triangle on the right and export the hook this will take you to a new page where you can specify extra settings but you don’t have too. Just click the export button and it will let you download the xml file. Once you have the file you will now want to add in the php code to do the work, heres my final hook code which does just that.

<?xml version="1.0" encoding="utf-8"?>
<hookexport>
      <hookdata>
        <config>
          <hook_name>My Example Hook</hook_name>
          <hook_desc>Adds a new link in the mod tools bar</hook_desc>
          <hook_author>Invisible Man</hook_author>
          <hook_email>david@davidejones.com</hook_email>
          <hook_website>http://www.davidejones.com</hook_website>
          <hook_update_check/>
          <hook_requirements><![CDATA[a:4:{s:20:"hook_ipb_version_min";i:0;s:20:"hook_ipb_version_max";i:0;s:20:"hook_php_version_min";s:1:"5";s:20:"hook_php_version_max";s:0:"";}]]></hook_requirements>
          <hook_version_human>1.0.0</hook_version_human>
          <hook_version_long>1000</hook_version_long>
          <hook_extra_data><![CDATA[a:1:{s:7:"display";N;}]]></hook_extra_data>
          <hook_key>modtoollink</hook_key>
        </config>
      </hookdata>
      <hookfiles>
        <file>
          <hook_file_real>modToolsAddon.php</hook_file_real>
          <hook_type>templateHooks</hook_type>
          <hook_classname>modToolsAddon</hook_classname>
          <hook_data><![CDATA[a:6:{s:15:"classToOverload";s:0:"";s:9:"skinGroup";s:11:"skin_global";s:12:"skinFunction";s:14:"globalTemplate";s:4:"type";s:2:"if";s:2:"id";s:10:"issupermod";s:8:"position";s:11:"pre.startif";}]]></hook_data>
          <hooks_source><![CDATA[<?php
class modToolsAddon
{
    	protected $registry;
    	protected $settings;
    	protected $cache;
    	public function __construct()
    	{
    		/* Make registry objects */
    		$this->registry = ipsRegistry::instance();
    		$this->settings =& $this->registry->fetchSettings();
    		$this->request  =& $this->registry->fetchRequest();
    		$this->lang     = $this->registry->getClass('class_localization');
    		$this->member   = $this->registry->member();
    		$this->memberData =& $this->registry->member()->fetchMemberData();
    		$this->cache    = $this->registry->cache();
    		$this->caches   =& $this->registry->cache()->fetchCaches();
    	}
    	public function getOutput()
    	{
    		//you may have some check here, e.g if admin then show link
    		//heres an example with a static list of allowed user group ids
    		if(!in_array($this->memberData['member_group_id'], array(4,11,10,9)))
    		{
    			return;
    		}
    		return '<li><a href="http://www.davidejones.com/" title="Test Link" target="_blank">Test Link</a></li>';
    	}
}]]></hooks_source>
        </file>
      </hookfiles>
      <hookextras_settings/>
      <hookextras_language/>
      <hookextras_modules/>
      <hookextras_help/>
      <hookextras_templates/>
      <hookextras_tasks/>
      <hookextras_database_create/>
      <hookextras_database_alter/>
      <hookextras_database_update/>
      <hookextras_database_insert/>
</hookexport>

Once you have this you can install the hook by uploading the xml file. Once its installed you should see it listed in the hooks like before. test link

Comments

    Comments are currently closed