Skip to content

Extending the PtcDebug component to add login functionality

ifsale edited this page Nov 14, 2013 · 1 revision

Extending the library components is a good practice to costumize the library for your needs.
This example demonstrates how we can add login functionality to the Debugger & Logger component.
If your application has a user private area you can check if the user is logged in before rendering the Ptcdebug panels.


class MY_Ptcdebug extends PtcDebug
{
            public static function load()
            {
                        /* Use your own custom function here to check if user is loggedin */
			if(is_super_admin()) // taken from the wordpress core
			{
				parent::load(); // loading the Ptcdebug class
			}
            }
}

You can view a working example from the wordpress plugin.