BuddyBoss, s2Member and WordPress wp-login.php

If I use either s2Member or BuddyBoss by themselves I have no issue with the wp-login screen. But with both s2Member and BuddyBoss trying to alter the login screen the labels Username or email and Password disappear.

If I inspect the html code in the browser they are missing in the final display code. I’ve tracked it down to the area where it’s disappearing and have included it below. If I keep refreshing the screen and pause it in debug mode at just the right time the both labels are there. It’s when it reaches the section of code below that is vanishes. The login screen works not problem, but we all know if there is not labels there I’ll be flooded with emails saying they can’t figure out how to log in.

You can see it first hand at: https://www.p9nw.com/wp-login.php

I’ve tracked it to this section of code:

function wp_attempt_focus(){

wp_attempt_focus/<@https://www.p9nw.com/wp-login.php:263:0
wp_attempt_focus/<@https://www.p9nw.com/wp-login.php:265:0
wp_attempt_focus/<@https://www.p9nw.com/wp-login.php:268:0

}, 200);

This is the line of code where the text disappears just after it finishes processing:
(global)@https://www.p9nw.com/wp-content/plugins/s2member/s2member-o.php?ws_plugin__s2member_js_w_globals=1&qcABC=1&ver=170722-170722-4203087189:9:0

Anyone have any idea why the code is vanishing. It’s not a CSS issue the labels are just missing in the final html code.

Thank you

This sort of conflict is pretty much inevitable if you use two plugins that both want to amend the same form.

The HTML is indeed getting removed by that piece of javascript, which looks horrible to me. It actually says:

<script type="text/javascript">
function wp_attempt_focus(){
    setTimeout( function(){
        try{
            d = document.getElementById('user_login');
            d.focus();
            d.select();
        }
        catch(e){}
    }, 200);
}

wp_attempt_focus();
if(typeof wpOnload=='function')wpOnload();
</script>
```
That `200` figure means that the code doesn't run for 200ms. After that time, it runs and causes your problem. I have no idea why it's using a try and catch there. It seems very odd when all it's apparently trying to do is set focus. You could probably replace all that with just one short line (using jQuery instead of vanilla javascript):

$(’#user_login’).focus();