PHP updates and fixing BuddyPress Follow
- By : Matthew Brown
- Category : Bugs, PHP, WordPress Development
- Tags: BuddyPress, bug fix, follow, plugin
BuddyPress Follow is a plugin we use to enable you to follow rather than “friend” each other. Sadly, it is not PHP 8 ready. This was holding us back both in terms of security and speed.
Today, I fixed that.
It was a four-line fix, which I shared here.
Find line 133 in buddypress-followers/_inc/bp-follow-widgets.php
add_action( 'widgets_init', create_function( '', 'return register_widget("BP_Follow_Following_Widget");' ) );
Then write this instead:
function BP_Follow_Following_Widget_init_func(){
register_widget("BP_Follow_Following_Widget");
}
add_action( 'widgets_init', 'BP_Follow_Following_Widget_init_func' );
The reason this works is that the function create_function()
was removed in PHP 8 and was deprecated in 7.4 or thereabout.
Also, this post is the first to use the new Open Mention Tag Patterns. These are dead simple one-line paragraphs with hyperlink templates which can be used to tag your content in OpenMentions, which will ping via WebMention. Your post will then (eventually) be listed on OpenMentions.com.
By default, the writing patterns are enabled for all, but you can add dreamlogging templates if you admin a blog here and want to. You can find the code here. While, yes, you can just grab a link and use it, I think the Patterns are one step easier. Edit as you wish.
The next line was the Pattern:
This is a WordPress Development post.
No Comments