Ultimate Member keep me signed in option not possible to disable

Blog, Ultimate Member

If you use Ultimate Member, you might have come across the issue that it’s not possible to disable the “keep me signed in” checkbox, when on the login page.

This is caused by the validation javascript in Ultimate Member, located in um-conditional.js. From each um-field class element, the data attribute “key” is retrieved. But this checkbox does not have the data attribute “key”, causing the script to fail.

I’ve noticed this bug has been reported to Ultimate Member, so it will probably be fixed in the next release, but for now, you can simply fix it by adding one line to the script.

In wp-content/plugins/ultimate-member/assets/js you can find um-conditional.js.

Look up the function

um_apply_conditions()

Then, after the line

var key = $dom.parents(‘.um-field[data-key]’).data(‘key’);
Insert:
if (!key) return;

That should fix your problem.

* Edit *

In response to questions, I’ve checked this again, and it appears Ultimate Member has NOT fixed this in their latest updates. I’ll send them a note about this.

The above fix will work, but as the non minified script files will only load when debugging is enabled, you should also minify this script, for example here, then replace the .min version of the file: um-conditional.min.js in the same directory.

This has the disadvantage that it will get overwritten when you update Ultimate Member, so you should move the file to a different folder, then add some php to your functions.php:

add_action( 'wp_enqueue_scripts',  'ioh_enqueue_scripts', 999);
function ioh_enqueue_scripts()
{
    wp_deregister_script('um_conditional');
    wp_register_script('um_conditional', get_template_directory() . 'js/um-conditional.min.js', array('jquery', 'jquery-masonry'), 1, true);
}

This will deregister the default Ultimate Member script, then registers your own, customized one.

This works for me, so it should work for you 😉

 

7 thoughts on “Ultimate Member keep me signed in option not possible to disable

  1. I too need the facility to not have keep me signed on enabled. This is a security issue and should be a switch to turn on or turn off in the back end. Is there a work around? I want it to always be off by default

  2. Please let me know that I want to remove login button from registration page can you please help me for this that how can i hide/remove login button in registration page.

  3. This issue seems to be still not fixed in the current version of the plugin. Since I didn’t like that the solutions posted above require either manipulating the plugin files (causing the fix to break on the next update) or to copy plugin scripts (causing updates to only work partially), I developed the following solution, which should be completely independent of updating Ultimate Member, work for both minimized and non-minimized code and make as least as possible changes:

    – In your functions.php, add the following code:
    wp_enqueue_script(‘um_apply_conditions_fix’, get_template_directory_uri() . ‘/js/um_apply_conditions_fix.js’, array(‘jquery’, ‘jquery-masonry’, ‘um_conditional’), false, true);

    – Add a new script file (in my case to the “js” subdirectory of my custom theme, but you can use any location of you update the path above accordingly):
    if (typeof _um_apply_coditions_fix_applied === ‘undefined’) {
    _old_um_apply_conditions = um_apply_conditions;
    eval(“function um_apply_conditions(d,i){if(!d.parents(‘.um-field[data-key]’).data(‘key’)){return;}_old_um_apply_conditions(d,i);}”);
    }
    _um_apply_coditions_fix_applied = 1;

    What this does is redefine the um_apply_coditions() function with a version that first checks for the inappropriate parameter and calls the “real” function if parameters are OK. Of course you can also directly add the code to your site, but I like the wp_enqueue_script() approach better, because it only adds the code on pages where UM is actually loaded (due to the dependencies specified).

    Hope this helps somebody in the same situation than me.

Leave a Reply

Your email address will not be published. Required fields are marked *

×