Call to undefined function error on Q&A

Hello,

I am trying to set up Q&A Plugin and as I go to /questions/ask or if I try to answer to any question, I receive this error:

Fatal error: Call to undefined function ot_get_media_post_ID() in /home/mydomain/public_html/wp/wp-content/themes/sevenmag/admin/ot-loader.php on line 613

I have attempted removing it as I read in another post, but I did get another error, plus the theme works properly everywhere else so I am not really sure I should remove pieces of code.

  • Tyler Postle
    • CGO

    Hey Michele,

    Hope you are well today!

    That error means that the theme is calling a function that doesn't exist. Can you link to the page so we can see it first hand?

    Not sure if this is the thread you saw but it might be worth removing the code this member removed: https://premium.wpmudev.org/forums/topic/fatal-error-call-to-undefined-function-3 - different theme but same file. Just make sure you save a back up first.

    Look forward to your reply!

    Cheers,
    Tyler

  • Michele
    • Flash Drive

    Hello,

    thank you for your answer.

    Yes, that's the thread I read, but since the theme works fine anywhere else, and I still receive a different error when removing the piece lined there, I don't think that's a proper solution.

    Can check juststormit.com/questions/ask to actually see the issue.

    Thank you!

    • Tyler Postle
      • CGO

      Hey Michele,

      I'm not seeing any errors but perhaps that's because I'm not logged in. Would you mind granting support access via your wp admin - WPMU DEV > Support > Support Access > Grant Support.

      Then I'll be able to see the page as a logged in user :slight_smile:

      Look forward to your reply!

      Cheers,
      Tyler

  • Michele
    • Flash Drive

    Done!

    Now I experience a different issue, depending on the browser:
    After registering as a normal user with IE11, it just redirects me away to the home page (I believe I have granted access to the area to users)
    whereas with Chrome I can't post questions or answers.

    Thank you for your help

    • Tyler Postle
      • CGO

      Hey Michele,

      Thanks for granting access :slight_smile:

      When you change to a different theme is the problem resolved? I'm wondering if maybe this is a plugin conflict.

      Can you check for plugin conflicts by deactivating your other plugins? Especially any caching plugins or security plugins those are known to cause conflicts.

      Let us know what you find there then we'll dig deeper if needed :slight_smile: it's good to start with theme/plugin conflicts because those are often the cause and if not then it crosses off a lot of possibilities.

      Look forward to your reply and by the way - welcome to the WPMU DEV community!

      Cheers,
      Tyler

      PS. I am just heading to bed now, but I will be back online tomorrow to follow up on this :slight_smile: Have a good night/day Michele.

  • Michele
    • Flash Drive

    Hello,

    it appears to be working with other themes, so I would say it is not a plugin issue.
    I tried commenting out that part of code, and it now appears to be working.

    What I would like to know though, is what changes, even though I see no apparent difference.

    I mean, will it have any repercussions elsewhere? my thinking is that it has some purpose, otherwise they wouldn't have added the code in the first place.

    But if this is the solution and there's no downside, then I am thankful for your help.

    Also thank you for welcoming me, and have a good night.

    • Tyler Postle
      • CGO

      Hey Michele,

      Hope you're doing well today and thanks for your patience, apologies for not getting back to this thread yesterday!

      I see you've narrowed it down to a theme related issue. ot-loader.php usually refers to the option tree plugin: https://wordpress.org/plugins/option-tree/ I'm guessing your theme may have it built into it or you've added it separately.

      I've seen on threads for different plugins(non-WPMU DEV ones) where they simply go in and comment out that specific function which I believe should be on line 612 for you. You can try that :slight_smile: you can comment out the line by adding "//" in front of it.

      Note: when making any changes, even small ones, to template files it's always a good idea to save a backup.

      Hopefully that will work! Keep us posted on this, we'll do what we can to get this resolved for you.

      All the best,
      Tyler

  • Michele
    • Flash Drive

    Hello!

    Apologize for the late reply.

    Thank you for your help so far.
    You did mean to comment out line 612 of ot-loader.php, right? Which is..
    if ( ! is_object( $post ) )

    and it does not seem to enable me to write answers or questions. I can see asked questions though, but I have no form to reply or to create new answers now, and the page ends abruptly. There's also no error anymore.

    I can enable admin and you can create an user or something to test it out, if you'd like. or I can also post a screenshot.

    Thank you

  • aristath
    • Recruit

    Hello again @Michele,

    I'm not sure I completely understand what you mean...
    I just created an account, logged-in and then visited that URL to test this.
    I could see the form just fine....
    What do you mean it's "truncated"? A screenshot and some more explanations would really help...

    Can you please elaborate?

    Cheers,
    Ari.

  • aristath
    • Recruit

    Maybe it has to do with access type. I have given subscribers every power in the QA settings. Does it still work?

    Hmmm... That must be it.
    Now that you've given me access for everything, I can replicate your issue and I can also see a js conflict of some sort from your theme (see attached screenshot).
    Can you please switch to the default twentyfourteen theme just for a couple of minutes and test if it works there? If it does, then this is definitely a theme issue.
    If it still doesn't work there, we'll have to start de-activating your other plugins one by one to see which one it is that causes these.

    Please advise,
    Ari.

  • Michele
    • Flash Drive

    I have not switched yet (there's some custom css that gets lost whenever I switch), but I have tried enabling the option "Disable WP Editor" which says:
    "If you are having issues with Buddypress or if you don't want submissions to be formatted, check this checkbox. Then, textarea will be used for question and answer forms instead of the WP editor."

    I do in fact have buddypress and it does in fact work right now.

    Also, on a whim, I disabled it again and went to remove the "upload files" permission.

    It works and with the WP form rather than a text area.

    So as it stands right now:

    - Everything enabled: works by disabling WP form (which isn't optimal, can't even really upload without it)
    - Everything enabled BUT uploads: works even with WP form.

    At this point I suppose I could disable uploads on it altogether and just have it work this way, if there's no easy fix available. It's still most likely alright, although I guess I can't even link images this way.

  • Tyler Postle
    • CGO

    Hey Michele,

    Thanks for getting back to us with that information. So if I'm understanding correctly, it will work fine when checking "Disable WP Editor" OR when taking away the upload files capability?

    There must be something else conflicting because on my installation I'm not having any issues and I also have BuddyPress enabled.

    Have you tried disabling all other plugins to see if it works then? You may also have to make a backup of that CSS and temporarily switch to the default theme. Then paste the css back in.

    Just so we can narrow down the issue even further here :slight_smile:

    Look forward to your reply Michele!

    Cheers,
    Tyler

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.