Allowing only $content with urls to be posted(Error)
-
Hi I ran into an error and it would be nice if someone could help me. The error has something to do with the args that are passed. It’s an ‘Uncaught ArgumentCountError: Too few arguments to function bp_require_link_in_activity(), 1 passed’ Error.
The Code goes like this:function bp_require_link_in_activity( $content, $user_id , $type = null, $item_id = null , $secondary_item_id = null, $component = null , $action = null, $recorded_time = null, $hide_sitewide = null ) {
if ( ! preg_match( ‘/https?:\/\/\S+/i’, wp_strip_all_tags( $content ) ) ) {
bp_core_add_message( ‘Gültigen Link eintragen.’, ‘error’ );
return false;
}return $content;
}
add_filter( ‘bp_activity_before_save’, ‘bp_require_link_in_activity’, 10, 9 );Thanks in advance
- You must be logged in to reply to this topic.