Forums

Theme My Login
[resolved] call_user_func_array Error (17 posts)

  1. ctruelson
    Member
    Posted 4 months ago #

    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

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

  2. Jeff Farthing
    Member
    Posted 4 months ago #

    Where? On the registration form or themed profile? Or both?

  3. ctruelson
    Member
    Posted 4 months ago #

    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

  4. Jeff Farthing
    Member
    Posted 4 months ago #

    Wait - are you using Theme My Login or Theme My Profile?

  5. ctruelson
    Member
    Posted 3 months ago #

    I'm sorry, I am using Theme My Login with the "Themed Profile" module.

    C

  6. ctruelson
    Member
    Posted 3 months ago #

    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.

  7. Jeff Farthing
    Member
    Posted 3 months ago #

    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?

  8. ctruelson
    Member
    Posted 3 months ago #

    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,
    Charles

  9. Jeff Farthing
    Member
    Posted 3 months ago #

    So, 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?

  10. ctruelson
    Member
    Posted 3 months ago #

    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.
    Charles

  11. ctruelson
    Member
    Posted 3 months ago #

    Sorry 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.

  12. Jeff Farthing
    Member
    Posted 3 months ago #

    Something, somewhere is improperly passing an array instead of a function to one of the action hooks.

  13. codex73
    Member
    Posted 3 months ago #

    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.... :(

  14. codex73
    Member
    Posted 3 months ago #

    Found this good article. Writing a WordPress Plugin Using Classes

    Haven't tried the code, but it looks good.

  15. ctruelson
    Member
    Posted 3 months ago #

    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?

  16. codex73
    Member
    Posted 3 months ago #

    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?

  17. ctruelson
    Member
    Posted 3 months ago #

    The culprit plugin was ProjectManager. I deactivated it and all errors went away.

    Thanks for your help.

    C

Reply

You must log in to post.

About this Plugin

About this Topic