XF 2.0 Run some code (via widget) after user login - Needs improve

Scandal

Well-known member
Hello all! :)

I have the following question on XF2.
Well, I need to run a part of php code which applies on the page some html (XF2 template system needed), with one criteria: the code should run only if this page loaded after a user login.

Currently for this result I have use a a widget class and inside render() I have my code which makes:
PHP:
return $this->renderer('myhtml', $viewParams);

How I make it running only after login? --> I have extend Pub Login.php actionLogin() function which adds a parameter on the redirect url. Let's say it &val=1


So inside the widget I'm running:
PHP:
    public function render()
    {
        $trigger = $this->app()->request()->filter('val', 'int');
     
        if ($trigger == 1)
        { 
             //$viewParams = blah blah;
            return $this->renderer('myhtml', $viewParams);                
        }
        return;                
    }

Is there any more normalize way to run the code via the widget, after a login by not using a parameter on the redirect url?

I spent lot of time to think a way but with no result. I didn't achieve to recognize inside the widget render() when this page load was a redirect from login.
 
Top Bottom