• Resolved Philipp Stracker

    (@strackerphil-1)


    The 3.0 update created many conflicts by adding tons of unexpected features.

    In this thread I want to report an annoying problem with the admin bar:

    A custom plugin on our website disables the admin-bar for certain pages or users, based on URL-parameters. We use show_admin_bar(false) to do this.
    Since the update, the admin-bar is always visible since this plugin blindly overwrites our choice with the global checkbox from the admin page via the filter add_filter('show_admin_bar', [$this, 'admin_bar_control'], 9999999999999999999999999999999999999999); in file AdminBarDashboardAccess.php

    Please fix this – we have many Popups that display an iframe that suddenly contains the admin bar!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Collins Agbonghama

    (@collizo4sky)

    ProfilePress includes an admin bar control feature.

    In your custom plugin, increase the priority to maybe PHP_INT_MAX or a value grater than “9999999999999999999999999999999999999999”.

    That should fix the issue.

    Thread Starter Philipp Stracker

    (@strackerphil-1)

    We’re not using the filter in our custom plugin. We use the WP core function show_admin_bar(false) to set the visibility of the admin bar. You should use that function too, instead of overwriting all other plugins/code with the ProfilePress setting value.

    Also, the PHP_INT_MAX value is “9223372036854775807”
    While your plugin uses the value “9999999999999999999999999999999999999999” (40 digit number that is interpreted as the float value 1.0E+40)

    Plugin Author Collins Agbonghama

    (@collizo4sky)

    We find the use of the filter better than calling the function.

    You could remove our implementation by calling the function below in your code.

    remove_filter('show_admin_bar', 'admin_bar_control')

    Thread Starter Philipp Stracker

    (@strackerphil-1)

    Interesting approach… However, I disagree with that. In my opinion, the function is clearly better than a filter.

    For example, your plugin also overrides the admin bar settings of the Divi theme, and of Restrict Content Pro. Possibly also many other plugins conflict with your decision here…

    I’ll switch to a different plugin, as I do not want to start coding around those limitations, and it’s uncertain which other conflicts you are unwilling to address.

    Heads-up: The correct code snippet to remove the filter requires the correct priority and the correct callback function; it’s more likely

    
    $obj = ProfilePress\Core\AdminBarDashboardAccess\Init:: get_instance();
    remove_filter('show_admin_bar', [$obj, 'admin_bar_control'], 9999999999999999999999999999999999999999);
    

    (I have not tested that code; I’m not sure if that priority is actually un-hookable)

    Plugin Author Collins Agbonghama

    (@collizo4sky)

    Adding the priority is an optional argument.

    It is easier for you to switch to using the filter which is more fool-proof instead of the functions than for us to change our code.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Overwrites `show_admin_bar()`’ is closed to new replies.