Issues Developing Simple Plugin [Resolved]

Post Reply
bjazmoore
Jr. Bludit
Posts: 5
Joined: Sun Feb 09, 2020 7:20 am

Sun Feb 09, 2020 7:39 am

I have basically leveraged the about plugin. I am trying to create a sidebar plugin that will display a link to the admin page (which defaults to the logon form when not logged in) or the text "You are logged in" when the user is logged in.

By trial and error I have identified the snippet of code that tests to see if the user is logged in as the offending code. I am pretty sure I am doing this correctly, but the failures seem to suggest I am not.

I have searched for some diagnostic logs (it looks like DEBUG is enabled in the file init.php on the boot folder of blkernel), but cannot find them.

This is the specific code that is failing:

Code: Select all

$ltext = $this->getValue('loggedintext');
        if($login->isLogged()){
            $ltext = $this->getValue('linktext');
        }
If I comment out the IF statement then the plugin will run and the site will load. If I leave that code active the page will stop loading immediately after the header is loaded.

I am attaching the entire plugin for examination. Most of it works fine. The plugin can be activated, and the options can be set and changed and written to the database.

Any help would be fantastic. Thanks
Attachments
login.zip
(1.61 KiB) Downloaded 4 times
Last edited by bjazmoore on Tue Feb 11, 2020 8:32 pm, edited 1 time in total.
bjazmoore
Jr. Bludit
Posts: 5
Joined: Sun Feb 09, 2020 7:20 am

Sun Feb 09, 2020 8:30 pm

I got it working. I was being stupid. It was necessary for me to instantiate an object for the login class to access its members.

I ended up doing this:

Code: Select all

        $logged = new Login;
        if($logged->isLogged()){
            $ltext = 'Logged in as ' . $logged->username();
        }
Things are working great.
Post Reply