Skip to:
Content

BuddyPress.org

Opened 7 years ago

Closed 3 years ago

#4990 closed enhancement (fixed)

Error message after log out

Reported by: henrywright Owned by: r-a-y
Milestone: 2.7 Priority: normal
Severity: normal Version: 2.0
Component: Core Keywords: has-patch commit
Cc: jfarthing84, info@…

Description

Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'wp_shake_js' not found or invalid function name in /htdocs/wp-includes/plugin.php on line 406

The following series of steps results in the error message above:

  1. Whilst logged-in, navigate to the general settings page

example.com/members/username/settings

  1. Click the log out button (you should get redirected to the login page with a "you are now logged out" message displayed.
  1. Hit the back button in your browser (you should be taken back to the settings page as it was just before you logged out
  1. Hit F5 to refresh the page.

You should be redirected to the login page and will see the above error message appear at the top of the page.

Notes:

I am using Theme My Login. I am not sure if the error message appears when the plugin isn't used.

http://wordpress.org/extend/plugins/theme-my-login/

Attachments (1)

4990.01.patch (2.0 KB) - added by r-a-y 4 years ago.

Download all attachments as: .zip

Change History (19)

#1 @r-a-y
7 years ago

  • Keywords reporter-feedback added; warning message removed

Can you try disabling the Theme My Login plugin to see if the warning pops up?

#2 @henrywright
7 years ago

Just tried the steps after deactivating Theme My Login. The error mgs doesn't appear as wp-login.php is used instead of the themed login page provided by the plugin. Perhaps the error is related to the use of the themed login page. I'll raise this as an issue on the plugin's support forum.

Thanks r-a-y

#3 @jfarthing84
7 years ago

Does BuddyPress apply the wp_shake_js function anywhere?

#4 @jfarthing84
7 years ago

  • Cc jfarthing84 added

#5 @jfarthing84
7 years ago

Line 528 of bp-core/bp-core-catchuri.php adds the wp_shake_js function to the login_head action. The problem is, this function is defined in wp-login.php and TML does not define it.

#6 @henrywright
7 years ago

Thanks Jeff - so is this a BuddyPress, WordPress or TML issue? I'd like to make sure i'm raising the issue in the right place.

#7 @DJPaul
6 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

This is a bug in the custom theme, yes. Thanks for investigating, jfarthing84!

#8 @maxgx
4 years ago

  • Cc info@… added

can anyone tell if this bug has been fixed?

it's still happening in WP installs using Theme My Login in conjunction with BuddyPress - why is it being flagged as "invalid" and "closed"?
for me, it happens when trying to access a BuddyPress page when not logged in: when you register, you get a confirmation email which, like all BP emails, has a "cancel" link in the footer. if you click that, you go to the Login page with the warning about wp_shake_js.

Jeff Farthing has shown you the problem lies in bp-core/bp-core-catchuri.php - which doesn't seem to be a custom theme thing, DJPaul...

or at least, could you tell us which custom theme that is? just to check if i'm using it too.
or can you be so kind as to direct us where to look for a fix in whatever theme we may be using?

thanks

#9 @r-a-y
4 years ago

It's a Theme My Login problem because they are overriding the entire login process and not adding support for wp_shake_js().

Add one of the following to your theme's functions.php or wp-content/plugins/bp-custom.php to fix this issue:

remove_action( 'login_form_bpnoaccess', 'bp_core_no_access_wp_login_error' );

or:

add_action( 'login_head', function() {
    remove_action( 'login_head', 'wp_shake_js', 12 );
}, 0 );
Last edited 4 years ago by r-a-y (previous) (diff)

#10 @maxgx
4 years ago

thanks r-a-y for the clarification, but as you can see, the confusing bit is that it's been dismissed as a "theme bug" and TML plugin author has been thanked for the investigation - i guess J. Farthing has now dismissed it too as such.

anyway, i tried out your script in my bp-custom.php and it works fine, thank you!

i see you mentioned putting it either in the theme's functions.php or in bp-custom.php, and i have a question related to that: i think this is not the right place to ask for it, so i'm sending you a mail apart.

#11 @jfarthing84
4 years ago

Why, exactly, does BuddyPress need to add the wp_shake_js function to the login_head hook? This is already done in wp-login.php where it applies...

Last edited 4 years ago by jfarthing84 (previous) (diff)

#12 @r-a-y
4 years ago

Why, exactly, does BuddyPress need to add the wp_shake_js function to the login_head hook? This is already done in wp-login.php where it applies...

Good question. It's because the 'shake_error_codes' filter runs too early in wp-login.php. It runs before our custom error is even added:
https://core.trac.wordpress.org/browser/tags/4.5.2/src/wp-login.php?marks=42-43,47-54,56-57,171-175#L42

I haven't taken a look at your plugin, but BuddyPress is using the hooks made available on the WP login page.

How do you handle wp_shake_js() for regular login errors like empty_password or empty_email?

@r-a-y
4 years ago

#13 @r-a-y
4 years ago

  • Keywords has-patch added; reporter-feedback removed
  • Milestone set to Under Consideration
  • Type changed from defect (bug) to enhancement
  • Version changed from 1.7 to 2.0

Update: Looks like WordPress added a new way to add custom error messages as of v3.6.0.

Attached patch implements this idea.

@maxgx, @jfarthing84 - Can you test the patch and see if that fixes things when TML is used?

#14 @jfarthing84
3 years ago

That should do it!

#15 @maxgx
3 years ago

yep, it seems to be working on my install too (without using the remove_action snippet above, of course).

while at it, i noticed yet another instance where Theme My Login hijacks BP's admin bar for logged in/non-editor-or-admin level users... and i already have /plugins/theme-my-login-custom.php with the add_filter( 'show_admin_bar', 'return_true' ); line in it...

oh well, yet another googling session on the subject, i suppose...

what a sad life is having to make two very useful plugins work together... ;)

if i had any power in WP matters, i'd enforce a rule whereby successful plugins over a certain amount of installations are FORCED to work together :D

#16 @r-a-y
3 years ago

  • Milestone changed from Under Consideration to 2.7
  • Resolution invalid deleted
  • Status changed from closed to reopened

Cool! Not sure if we can add this fix in for v2.6 since it's late in the dev cycle.

For now, I'm going to move this to the v2.7 milestone.

#17 @DJPaul
3 years ago

  • Keywords commit added

If I'm reading this right, we'll get shakey on WP 3.6 but on older WP, no shake. I think this is OK.

#18 @r-a-y
3 years ago

  • Owner set to r-a-y
  • Resolution set to fixed
  • Status changed from reopened to closed

In 10982:

Core: Adjust how our error message is registered on the WP login page.

WordPress 3.6 introduced the 'wp_login_errors' filter, which allows us to
properly register our no access error message on the WordPress login page
in a better manner.

This also addresses an issue with the Theme My Login plugin where a PHP
warning was being displayed.

Fixes #4990.

Note: See TracTickets for help on using tickets.