Skip to content

Instantly share code, notes, and snippets.

@toluaddy
Forked from imath/wp-idea-stream-custom.php
Created February 3, 2020 17:11
Show Gist options
  • Save toluaddy/8946e3452ca139422c4bddbcc89e42f2 to your computer and use it in GitHub Desktop.
Save toluaddy/8946e3452ca139422c4bddbcc89e42f2 to your computer and use it in GitHub Desktop.
Add a confirmation prompt to remove link in BuddyPress groups.
<?php
// Exit if accessed directly
defined( 'ABSPATH' ) || exit;
function georgio_idea_footer_actions( $footer = '' ) {
if ( ! bp_is_group() ) {
return $footer;
}
preg_match( '/class=\"remove-(.*)\"/', $footer, $classes );
if ( ! empty( $classes[1] ) && 0 === strpos( $classes[1], 'idea' ) ) {
$new_classes = str_replace( 'idea', 'idea confirm', $classes[0] );
$footer = str_replace( $classes[0], $new_classes, $footer );
}
return $footer;
}
add_filter( 'wp_idea_stream_ideas_get_idea_footer', 'georgio_idea_footer_actions', 12, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment