HookPress Plugin on v4


#1

We are trying to use a plugin called HookPress on a basic Wordpress site running on ee v4. I have tested it on a Wordpress site still running on ee v3 without issues but when it attempts to pull a list of fields it doesn’t populate the dropdown and I get the below error. Both sites are running the latest version of WordPress but only the site on the ee v4 server is having the issues. Any ideas what might be causing this or what I can do to resolve it?

I get this error from the console in Chrome.

Failed to load resource: the server responded with a status of 500 () /wp-admin/admin-ajax.php:1

I checked the logs and this is the error being reported by Nginx.

==> /opt/easyengine/sites/dev.cfimortgage.com/logs/nginx/access.log <==
65.***.***.*** - - [26/Feb/2019:16:22:20 +0000] "POST /wp-admin/admin-ajax.php HTTP/1.1" 500 5 "https://dev.cfimortgage.com/wp-admin/options-general.php?page=webhooks" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"

Below is the message from the wp-debug log.

[26-Feb-2019 15:52:03 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function ereg() in /var/www/htdocs/wp-content/plugins/hookpress/services.php:13
Stack trace:
#0 /var/www/htdocs/wp-includes/class-wp-hook.php(286): hookpress_ajax_get_fields('')
#1 /var/www/htdocs/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters('', Array)
#2 /var/www/htdocs/wp-includes/plugin.php(465): WP_Hook->do_action(Array)
#3 /var/www/htdocs/wp-admin/admin-ajax.php(167): do_action('wp_ajax_hookpre...')
#4 {main}
  thrown in /var/www/htdocs/wp-content/plugins/hookpress/services.php on line 13

This is the code snippet from the services.php file the error references.

	$fields = array();
	if (is_array($args)) {
		foreach ($args as $arg) {
			if (ereg('[A-Z]+',$arg)) <---------
				$fields = array_merge($fields,hookpress_get_fields($arg));
			else
				$fields[] = $arg;
		}
	}

#2

HookPress hasn’t been updated in four years - you really shouldn’t be using it. Because it’s so outdated it isn’t compatible with PHP 7, which is what EE4 uses (7.2), hence the ereg() error.

I really would try to find an alternative.


#3

I did notice that it hasn’t been updated in years but it was my only real options and it was working on ee v3 so I was hoping it would work. Guess it is time to look into other options. Any suggestions?


#4

Just found this on GitHub, a version of HookPress compatible with PHP 7 (updated two years ago). Might be worth a try.


#5

I was literally coming back on here to say that I found that same one on GitHub so I didn’t trouble you but it looks like you are a little faster than me. lol Thank you again for the assistance!


closed #6

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.