• When doing frontend upload using plugin wp photo album plus, one get this fatal error when Blackhole pro is activated:

    [Tue Sep 13 03:05:54.542326 2022] [fcgid:warn] [pid 23668:tid 139805776135936] [host https://www.marcustibesar.com] [client 77.165.100.4:52772] PHP Fatal error: Uncaught TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, function “blackhole_register_settings” not found or invalid function name in /var/www/html/ma/marcustibesar.com/wp-includes/class-wp-hook.php:307, referer: https://www.marcustibesar.com/photo-albums/

Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Author Jeff Starr

    (@specialk)

    Hey Jacob, I am glad to help but the forums here at www.ads-software.com forbid any discussion on pro plugins (it’s for free versions only). No problem though I am glad to help if you send your report via our contact form. Thank you.

    Thread Starter Jacob N. Breetvelt

    (@opajaap)

    @specialk The same error occurs in the free version:

    Fatal error: Uncaught Error: call_user_func_array(): Argument #1 ($callback) must be a valid callback, function “blackhole_register_settings” not found or invalid function name
    in /mnt/web208/b3/15/51893315/htdocs/opajaap/betatest/wp-includes/class-wp-hook.php on line 307

    @opajaap Thank you for identifying my issue on [link removed by moderator]

    @specialk Advance thank you Jeff for helping us to resolve the issue.

    Plugin Author Jeff Starr

    (@specialk)

    I’m not seeing this on default WordPress running on PHP 8.0.23. If anyone can provide steps on default WordPress how to replicate, I will try to resolve asap. Thanks.

    Thread Starter Jacob N. Breetvelt

    (@opajaap)

    Default wp plus plugin wp-photo-album-plus with ajax method set to Normal (is default after install), i.e. the frontend ajax method conform the plugin hanbook.

    You can see it happening in a minute on my dev site: https://betatest.opajaap.nl/ where i enabled upload for loggedout users. Click the Upload link in the topmost gray box, the rest is self explanatory.

    To do it yourself, install https://www.ads-software.com/plugins/wp-photo-album-plus/
    Create an album, display an upload box by means of shortcode [wppa type=”upload”] on a page.

    Upload a photo to the album, everything runs ok until the green progressionbar if full (the moment the proc called by ajax starts processing the upload), it fails with a fatal error.

    If you want to see a bit more of the wppa plugin, have a look here:
    https://wppa.nl/ or more specific here: https://wppa.nl/docs-by-subject/user-upload/

    Plugin Author Jeff Starr

    (@specialk)

    Thanks but not sure if I understand. Can you just let me know the steps to replicate on default WordPress. You know something like:

    1) Install and activate whatever plugin
    2) Visit the this or that page
    3) Do this action or something
    4) Etc. until the error occurs

    That will help me to follow along and try to help asap. Thank you.

    Thread Starter Jacob N. Breetvelt

    (@opajaap)

    1) Be loggedin as administrator on a normal wp site
    2) Install and activate plugin https://www.ads-software.com/plugins/wp-photo-album-plus/
    3) On the dashboard open Photo Albums -> Settings page
    4) Tick the box in Item 6: Enable User uploads on the default tab.
    5) open Photo Albums -> Album Admin and click the Add New button
    6) Create a wp page with content [wppa]
    7) Visit the page. You will see one album cover with title New Album and a link named Upload Photo
    8) Click the link, a dialog opens, Click the Browse button, select a .jpg file on your pc and click the Upload Photo button

    If you do this without the blackhole-bad-bots plugin active: succes
    If you do this with the blackhole-bad-bots plugin active: fatal error.

    If you have plugin https://www.ads-software.com/plugins/query-monitor/ active, you will see an error box like this:

    Fatal error: Uncaught Error: call_user_func_array(): Argument #1 ($callback) must be a valid callback, function "blackhole_register_settings" not found or invalid function name
    in /mnt/web208/b3/15/51893315/htdocs/opajaap/betatest/wp-includes/class-wp-hook.php on line 307
    
    Call stack:
    
        WP_Hook::apply_filters()
        wp-includes/class-wp-hook.php:331
        WP_Hook::do_action()
        wp-includes/plugin.php:476
        do_action()
        wp-admin/admin-ajax.php:45
        include_once()
        wp-content/plugins/wp-photo-album-plus/wppa-ajax.php:16
        wppa_ajax_include()
        wp-includes/class-wp-hook.php:307
        WP_Hook::apply_filters()
        wp-includes/class-wp-hook.php:331
        WP_Hook::do_action()
        wp-includes/plugin.php:476
        do_action()
        wp-includes/template-loader.php:13
        require_once()
        wp-blog-header.php:19
        require()
        index.php:17

    To save you a lot of work, here is the fix:

    File blackhole.php, line 124:

    		private function includes() {
    			
    			require_once BBB_DIR .'inc/blackhole-core.php';
    			require_once BBB_DIR .'inc/blackhole-helpers.php';
    			require_once BBB_DIR .'inc/blackhole-ip.php';
    			require_once BBB_DIR .'inc/blackhole-response.php';
    			
    //			if (is_admin()) {
    				
    				require_once BBB_DIR .'inc/contextual-help.php';
    				require_once BBB_DIR .'inc/resources-enqueue.php';
    				require_once BBB_DIR .'inc/settings-register.php';
    				require_once BBB_DIR .'inc/settings-display.php';
    				require_once BBB_DIR .'inc/settings-reset.php';
    				require_once BBB_DIR .'inc/badbots-register.php';
    				
    //			}
    			
    

    Remove if (is_admin()) so the functions are always available when the hooks are activated.

    FYI: is_admin() is an unreliable switch. e.g.: It returns false in a widget when using it in the widget block editor. So: admin-init and is_admin() not always have a cosistent relation.

    Plugin Author Jeff Starr

    (@specialk)

    That is great, thank you @opajaap. I will take a look and try to resolve this asap. Note however that just loading everything regardless of admin or front end is gonna mean a performance hit for all users. Hopefully I can narrow that down to just one or two files that need included. Otherwise it may not be worth it just to support one other plugin.

    Also, do you know if there a suitable (consistent) replacement for is_admin()?

    Thread Starter Jacob N. Breetvelt

    (@opajaap)

    I tried some code to make our own is_admin, that would return true when either is_admin() returns true or admin_init has been run, but without success.

    It turns out that only 3 out of 6 files are needed, you only need to place the following outside the is_admin() enclosure:

    
    require_once BBB_DIR .'inc/settings-register.php';
    require_once BBB_DIR .'inc/badbots-register.php';
    require_once BBB_DIR .'inc/settings-reset.php';
    
    

    To my opinion, you should not worry about 22 kb php code being loaded extra

    It would be a pity if i have to add this plugin to the blacklist for wppa

    @specialk @opajaap I have run both wppa and black hole for years, and if my vote counts, I want to continue running BOTH of these wonderful plugins forever.

    I have almost 15,000 photos available on one site and will have over 30,000 photos on my personal site. These plugins are important to my years of work.

    Thank you both for your wonderful work and contributions to the WP community.

    Plugin Author Jeff Starr

    (@specialk)

    @opajaap Thanks that looks like a reasonable solution. Will push out an update soon. Thanks again for your help and feedback.

    @mtibesar No worries, will get this fixed up asap. Thanks to you as well for your feedback, it is appreciated.

    Plugin Author Jeff Starr

    (@specialk)

    Just to follow up with this, the suggested fix is implemented in the latest version of the plugin (v3.3.4), now available. Pro update coming soon.

    @specialk @opajaap Thank you both very much! A small donation is on its way.

    Plugin Author Jeff Starr

    (@specialk)

    Received, thank you @mtibesar!

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Fatal error’ is closed to new replies.