• Resolved emiliengerbois

    (@emiliengerbois)


    Hi again,

    I tried to activate only on subsites but a problem remains: the auto-logout works with default values but not with the configured idle behaviors. I tested it with multiple user roles, both on main site and subsites. I only tested the logout and redirect option because this is the only one I would need.

    For now I didn’t investigate further regarding compatibility issues with other plugins but this matter made me think of something:

    is it possible to add a default redirect option as a default behavior in the general settings tab and set a redirect on default logout, even hardcoding it? I wouldn’t mind having every roles logged out after the same time and redirecting to the same page so I thought it could do the job this way.

    Can you help me with this? thank you so much in advance,

    Emilien

    https://www.ads-software.com/plugins/idle-user-logout/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Abiral Neupane

    (@abiralneupane)

    Hi Emilien,

    Sorry that the plugin isn’t working in your scenario.

    However, there is a solution, if you have access to the code. We have added a hook (filters) to change the action of the theme. it’s modify_iul_action. You can use that filter to modify the action of the plugin.

    As per now here is a code snippets which can be added to your custom plugin, or child theme.

    add_filter( 'iul_action', 'modify_iul_action' );
    function modify_iul_action($action){
    	$action['action_type'] = 2; /* 2: Logout and redirect to login page */
    	$action['timer'] = 40; /* add this line if you want to change timer's default value. Otherwise remove this line */
    	return $action;
    }

    Hope it helps.

    Regards

    Plugin Author Abiral Neupane

    (@abiralneupane)

    Hello again,

    Did this solve your issue, for now?

    We will be making this plugin multisite compatible, so that you don’t have to add this code anymore.

    If this gave you the solution, please mark this as resolved.

    Thanks

    Thread Starter emiliengerbois

    (@emiliengerbois)

    Hello Abiral,

    thank you for you messages and sorry that I respond so late.
    Regarding the code snippet, I’d need to redirect to a custom page instead of the login one, would it be feasible?

    Thank you again and have a nice day,
    Emilien

    Plugin Author Abiral Neupane

    (@abiralneupane)

    Hello,

    Yes that one is feasible too.

    But since you are in multisite, you need to enter url of the page manually.

    Look at the code below:

    add_filter( 'iul_action', 'modify_iul_action' );
    function modify_iul_action($action){
    	/*
    	 * Action Types:
    	 * 1: Bypass logout
    	 * 2: Logout and redirect to login page
    	 * 3: Logout user and redirect - requires action_value
    	 * 4: Do not logout but show page in popup - requires modal [ html that is meant to be displayed in popup ]
    	 * 5: Do not logout but redirect to page - requires action_value
    	 */
    
    	$action['action_type'] = 3;
    	$action['action_value'] = 'https://www.ads-software.com'; //URL of the page
    	// $action['timer'] = 40;
    	//$action['modal'] = 'html content';
    	return $action;
    }

    For reference, I have added a list of action_type that the plugin supports. You can make the changes as per your requirement.
    $action['action_type'] = 3 tells plugin to logout and redirect to the page
    `$action[‘action_value’] = ‘your-page-url’ tells where to redirect
    // $action['timer'] = 40; is optional one. You can change timer if you want.
    //$action['modal'] = 'html content'; is needed if your action_type was 4

    Hope this helps.

    Thanks

    Thread Starter emiliengerbois

    (@emiliengerbois)

    Thank your so much for such a quick and efficient support, I’ll have it tested and keep you posted ?? have a great day!

    Plugin Author Abiral Neupane

    (@abiralneupane)

    Hello emiliengerbois,

    Did it solve your issue?

    If so, please mark it as resolved ??

    Thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘idle behavior doesn't apply’ is closed to new replies.