• Hello,
    I get Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'td_tts_userAjax' not found or invalid function name in [...]/wp-includes/plugin.php on line 429 and because of this the plugin isn’t working properly.

    The whole thing is rather strange:

    • All plugin files are present and complete, with correct permissions. Including function td_tts_userAjax.
    • If I move code of td_tts_userAjax to another file, I immediately get Parse error: syntax error, unexpected end of file in [...]/wp-content/plugins/td-ticket-system/td-ticketsystem.php.
    • I expect there might be some problem with the heredoc syntax, which makes the code quite hard to parse for me… so I can’t be sure.

    Help, please? Tell me if you need more information.

    Thanks in advance.

    P.S.: I believe correct way to include javascript is by using wp_enqueue_script. But am not sure if it would solve this issue.

    https://www.ads-software.com/plugins/td-ticket-system/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author transcendev

    (@transcendev)

    Sorry you’re having trouble. Just a few questions.
    When are you seeing that error? From within the admin panel or on the user end?

    What other plugins do you have installed?

    Does your WordPress theme have the wp_footer() function in it?

    The wp_enqueue_script function is useful for including commonly used javascript or jQuery modules that might end up as part of other plugins, but not particularly necessary for custom functions such as the ones in question. I can’t imagine anyone would likely name any javascript functions with that exact name.

    Thread Starter Jan ?tětina

    (@zaantar)

    I see the error on bottom of every page on the front-end. Even if no other plugins are active. I use the Montezuma theme and I am quite sure that this error happens when wp_footer action is called.

    Concerning the wp_enqueue_script, you are right, I think it’s just a “best practice”.

    Plugin Author transcendev

    (@transcendev)

    Can you verify that the Montezuma theme has wp_footer() in the footer template? I’m wondering if it’s missing, as that is the hook that the particular function is added into. If that’s missing, then that function would go missing. I can’t imagine why else what would occur.

    You might try changing line 52 in the plugin so that it hooks on the wp_head function instead and see if that fixes the issue.

    so change:
    add_action('wp_footer', 'td_tts_userAjax');

    to:
    add_action('wp_head', 'td_tts_userAjax');

    Thread Starter Jan ?tětina

    (@zaantar)

    Well, I tried to change wp_footer into wp_head and the warning still appears (but at the top of the page this time). I think that if wp_footer action hadn’t been called, WordPress wouldn’t even try to call td_tts_userAjax. Montezuma is a big theme, lot of code. I will examine it tomorrow if it is needed.

    But there is something really strange happening. Why does php die with a syntax error “unexpected end of file” when I move source code of td_tts_userAjax function to another file?? That usually happens if some brackets aren’t closed… but in that case the syntax error should happen every time, even without the modification, right?

    Plugin Author transcendev

    (@transcendev)

    Is that a free theme? I’ll see if I can find and install it on my test blog and maybe I can duplicate the issue.
    I’ve got to imagine it’s something within the theme causing the issue since it seems to work fine otherwise. Do you have debugging turned on on your WP install?

    The unexpected end of file error would suggest you might have left a bracket when you removed the function. Did you cut from line 520 to line 585?

    Plugin Author transcendev

    (@transcendev)

    Found a free theme called Montezuma, hopefully the same one. Doesn’t seem to be any issue:
    https://65.60.2.210/~mikestes/ticket-system/

    Do you have a link to your site that I could check out? Wondering if viewing the source would shine any light on the issue.

    Thread Starter Jan ?tětina

    (@zaantar)

    Yes, that’s the correct theme. Thank you very much for doing this!

    I found the following:

    • WP_DEBUG unfortunately doesn’t reveal anything related to your plugin.
    • I took extra care when experimenting with your code, function was cut from function td_tts_userAjax() { to it’s last }.
    • Montezuma does call wp_footer() as it should.

    The affected site is https://oporavnouzi.cz/. I could arrange for you an read-only access to it’s source code if you think that would help.

    Maybe it is also worth saying that the site runs under lighttpd web server, not apache. I am suspecting the heredoc syntax might be somehow involved in this error…

    Plugin Author transcendev

    (@transcendev)

    The lighttpd server might have a lot to do with it.
    Any way you can give me FTP access to just the ticket system plugins folder? I would welcome the opportunity to try and fix the issue. Understandable if you can’t. I run Linux machines in my office so I could probably install lighttpd locally and see if I can duplicate the issue that way.

    Do you know what version of PHP the server is running? That might have more to do with it than the server software.

    The heredoc syntax is used similarly on the admin side to implement javascript. Do you see issues with that as well or is it only on the user end?

    Thread Starter Jan ?tětina

    (@zaantar)

    I created an FTP account for you, please tell me your e-mail address (or write to [email protected]) so I can send you login information.

    PHP version is 5.5.10.

    The only issue so far is this one… nothing on the admin side or elsewhere, as far as I know.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Error: function 'td_tts_userAjax' not found or invalid function name’ is closed to new replies.