Jump to content

Developer Documentation

Extending IPS Connect

If you are using IPS Community Suite as a master application and wish to extend or change its functionality, you can easily do so without having to edit any PHP files, ensuring your customizations are retained through future upgrades.  The master IPS Connect gateway with the IPS Community Suite is found at /applications/core/interface/ipsconnect/ipsconnect.php.  You can create a new file in this same location called "custom.php" with a class inside this file called ipsConnect_custom, extending ipsConnect.  This file will be automatically loaded if it exists, and the ipsConnect_custom class will be instantiated instead of ipsConnect.  From there, you can override any methods you need to.

As an extension to this, the following methods can be defined which will be called automatically:

  • _postCrossLogin(): Because cross login requests result in redirection instead of returning a response to output in JSON format, this method is supported which allows you to perform any custom actions you require before the redirection occurs.
  • _postCrossLogout(): Because logout requests result in redirection instead of returning a response to output in JSON format, this method is supported which allows you to perform any custom actions you require before the redirection occurs.

Example:

<?php
// My custom.php file
class ipsConnect_custom extends ipsConnect
{
    public function register()
    {
        $result = parent::register();
        
        // A user just registered, do something custom now
        
        return $result;
    }
    
    protected function _postCrossLogin()
    {
        // Do something before the request is redirected to a different site
    }
    
    protected function _postCrossLogout()
    {
        // Do something before the request is redirected to a different site
    }
}

 


  Report Document


×
×
  • Create New...