Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • @tjackson9
    Hi,

    You could try moving the call to do the install as below

    1. comment/remove these lines (420-421).
      	$activatestr = str_replace(WP_PLUGIN_DIR . "/", "activate_", __FILE__);
      	add_action($activatestr, 'loginLockdown_install');
    2. Add after those lines
      register_activation_hook( __FILE__, 'loginLockdown_install' );

    Haven’t tried it, but should work. make sure to deactivate & activate the plugin after.

    Sam

    Hi @mvandemar,

    The issue is with line 420, when you are trying to create a activate hook name from the file path, being windows it contains a \ as the separator, but also being wordpress it also contains / for some of the separators, here’s my fix for it (forgive the nested str_replace).

    $activatestr = 
            str_replace(
                DIRECTORY_SEPARATOR, "/", 
                str_replace(
                    str_replace("/", DIRECTORY_SEPARATOR, 
                    WP_PLUGIN_DIR
                ) 
            . DIRECTORY_SEPARATOR, "activate_", __FILE__)
            );
    

    Would this be better done with register_activation_hook ?

    Sam

Viewing 2 replies - 1 through 2 (of 2 total)