BuddyDev

Search

[Resolved] BuddyBlog with BadgeOs

  • Participant
    Level: Initiated
    Posts: 3
    Adrian Tudor on #32992

    Hi,

    I’m using BuddyBlog with BP Simple Front End Post, but I get an error when a user try to create/edit a new post: https://screencast-o-matic.com/watch/cYQfXLHtQG

    It seems it is a conflict with BadgeOs plugin.

    The error is:
    Fatal error: Uncaught Error: Call to undefined function get_current_screen() in wp-content/plugins/badgeos/includes/open_badge/functions.php:274
    Stack trace:
    #0 wp-includes/class-wp-hook.php(289): badgeos_ob_png_only_note(‘<p class=”hide-…’)
    #1 wp-includes/plugin.php(206): WP_Hook->apply_filters(‘<p class=”hide-…’, Array)
    #2 wp-admin/includes/post.php(1580): apply_filters(‘admin_post_thum…’, ‘<p class=”hide-…’, 1190, ”)
    #3 wp-content/plugins/bp-simple-front-end-post/form.php(60): _wp_post_thumbnail_html(”, Object(WP_Post))
    #4 wp-content/plugins/bp-simple-front-end-post/core/classes/class-edit-form.php(303): include(‘/home/live4life…’)
    #5 wp-content/plugins/bp-simple-front-end-post/core/classes/class-edit-form.php(261): BPSimpleBlogPostEditForm->load_post_form()
    #6 wp-content/plugins/buddybl in /home/live4life/public_html/wp-content/plugins/badgeos/includes/open_badge/functions.php on line 274

    Please, maybe you can help me with this.

    Best regards,
    Adrian

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #32993

    Hi Adrian,
    I am sorry for the issue.

    the problem is we are using this function

    
    _wp_post_thumbnail_html
    

    for generating the post thumbnail meta box and badge os seems to be hooking to it. Not their fault entirely though as this function is considered private and only available in the admin.

    The solution can be implemented in badgeOS by checking if the get_current_screen exists.

    Another temporary solution is to disable the post thumbnail option in BuddyBlog settings.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 3
    Adrian Tudor on #32997

    Hi Brajesh,

    Thank you for your quick answer.

    You have right. Disabling the post thumbnail option in BuddyBlog settings solved the issue, but I’m not very happy with this.

    I would like to try your first proposal, but I’m not sure that I understand well what I should do. Can you please be more precisely with “checking if the get_current_screen exists”

    There is no “function get_current_screen() {…” in BadgeOs.

    The only get_current_screen functions can be found in:
    – wp-admin/includes/screen.php: function get_current_screen() {…
    – wp-content/plugins/facebook-for-woocommerce/vendor/skyverge/wc-plugin-framework/woocommerce/class-sv-wc-helper.php: public static function get_current_screen() { …

    The error from BadgeOs is comming from this line:
    $pt = get_current_screen()->post_type;

    Can you give me more instructions?

    Best regards,
    Adrian

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on #32999

    Hello Adrian,

    Please try the following code and let me know if it works or not.

    
    add_action( 'bsfep_before_thumbnail', function () {
    
    	if ( has_filter( 'admin_post_thumbnail_html', 'badgeos_ob_png_only_note' ) ) {
    		remove_filter( 'admin_post_thumbnail_html', 'badgeos_ob_png_only_note' );
    	}
    
    } );
    
    add_action( 'bsfep_before_taxonomy_terms', function () {
    
    	if ( ! has_filter( 'admin_post_thumbnail_html', 'badgeos_ob_png_only_note' ) ) {
    		add_filter( 'admin_post_thumbnail_html', 'badgeos_ob_png_only_note' );
    	}
    
    } );
    
    

    Regards
    Ravi

  • Participant
    Level: Initiated
    Posts: 3
    Adrian Tudor on #33002

    You are the best. As always:)

    Thank you very much!!!!!!

    BR,
    Adrian

The topic ‘ [Resolved] BuddyBlog with BadgeOs’ is closed to new replies.

This topic is: resolved