[Plugin: Theme My Login] call_user_func_array Error
-
Hello! I am getting this error right below the password fields:
call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, ‘Array’ was given in /html/wp-includes/plugin.php on line 405
Does anyone have any idea what this means or how to fix it?
Everything looks fine on the admin side when I disable the profile module.Thanks in advance!
Charles
-
Where? On the registration form or themed profile? Or both?
Hey Jeff, thanks for getting back so quickly.
The error is occurring on the themed profile, underneath the “change password” fields. I’m not using Theme My Profile for user registration; I’m using the Gravity Forms User Registration Plugin.
C
Wait – are you using Theme My Login or Theme My Profile?
I’m sorry, I am using Theme My Login with the “Themed Profile” module.
C
I just tried using Theme My Profile, with the “Themed Profiles” module disabled on Theme My Login. I am getting the same error.
What I also realized is that after clicking the “Update Profile” button, I am getting a warning page with several warnings, which read:
Warning: Cannot modify header information – headers already sent by (output started at /home/content/80/8787380/html/wp-includes/plugin.php:405) in /home/content/80/8787380/html/wp-includes/pluggable.php on line 686
Thanks for your help.
Please, don’t use Theme My Profile – it is no longer supported.
Have you created any of your own functions, using theme-my-login-custom.php or your theme’s functions.php?
I have added functions to my theme.
I am hiding the “Admin Bar” for logged in users with this function:
add_filter( ‘show_admin_bar’, ‘__return_false’ );
I am also showing several additional fields with user meta, with the following:
add_action( ‘show_user_profile’, ‘my_show_extra_profile_fields’ );
add_action( ‘edit_user_profile’, ‘my_show_extra_profile_fields’ );
function my_show_extra_profile_fields( $user ) { ?>For each additional field being displayed on the profile, I am using the following:
<?php echo esc_attr( get_the_author_meta( ‘cell_phone’, $user->ID ) ); ?>
I’ve also added a few custom navigation menus.
I haven’t added anything to the theme-my-login-custom.php file.
Another plugin that affects the profile is “Simple Local Avatar” which adds the ability for users to upload an avatar. I deactivated it to see if that was the problem, but nothing happened.
One thing I noticed is when I remove the following code:
<?php do_action( ‘show_user_profile’, $profileuser ); ?>
…the call_user_func_array error goes away.
However the Warning: Cannot modify header information error is still there after submitting.Thanks Jeff,
CharlesSo, it sounds like it has something to do with the functions you added. If you remove your actions:
add_action( 'show_user_profile', 'my_show_extra_profile_fields' ); add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );Does it go away?
It does! Thank you. What do you think I should do to keep those custom fields in there?
Also, the form submission error is still there. Here’s the submission error:
Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, ‘Array’ was given in /html/wp-includes/plugin.php on line 405
Warning: Cannot modify header information – headers already sent by (output started at /html/wp-includes/plugin.php:405) in /html/wp-includes/pluggable.php on line 866
I really appreciate your help, thanks Jeff.
CharlesSorry Jeff, I lied — I had
<?php do_action( 'show_user_profile', $profileuser ); ?>commented out. Removing those actions didn’t do anything besides remove the custom fields I had on the profile.Something, somewhere is improperly passing an array instead of a function to one of the action hooks.
Jeff, After searching for a solution, I stumbled on your comment “improperly passing an array”. Well, that was it!
I going through some old tutorial where it’s using a class and referencing the hook like this:
add_action('admin_menu', array(&$objectname,'pluginname_admin_actions'), 1);
I’ve broken the class into inline procedural functions and passed only a string and it works great.
How could I use a class instead?
Any particular way to reference the function?
I tried
$objectname->functionaname()but no good…. 🙁
Found this good article. Writing a WordPress Plugin Using Classes
Haven’t tried the code, but it looks good.
Any idea of what I can search for in my files to try and find the culprit? Or should I just try deactivating plugins with trial and error?
Hey Guys, sorry I wasn’t referring to Jeff’s plugin with my comment, but to my own plugin. I looked to the repo, but it has lots of files to go through. @ctruelson If you leave only this plugin enabled and disable the others, will it still break?
The topic ‘[Plugin: Theme My Login] call_user_func_array Error’ is closed to new replies.