BP-Confirm/confirm.js – query
-
I have a wordpress theme that is built on bootstrap and is also styled for use with Buddypress (although I’m not quite sure if Buddypress is actually using bootstrap)
I’ve successfully enqueued a script called bootbox.min.js in the theme’s functions.php file so when a js alert or confirm function is made it uses the bootstrap modal instead of the generic browser popup.
I do this by changing alert() or confirm() to bootbox.alert() or bootbox.confirm() and it does its thing.
This works fine across other areas of the site but not in Buddypress. I’m specifically trying to get the “Are you Sure?” confirm function to use bootbox. So I have made a slight change to both confirm.js and confirm.min.js
eg.
jQuery( document ).ready( function() { jQuery( 'a.confirm').click( function() { if ( bootbox.confirm( BP_Confirm.are_you_sure ) ) { return true; } else { return false; } }); });I’ve also tried enqueuing the bootbox script in bp-core-cssjs.php
$scripts = apply_filters( 'bp_core_register_common_scripts', array( // Legacy 'bootbox' => array( 'file' => "{$url}bootbox.min.js", 'dependencies' => array( 'jquery' ) ), 'bp-confirm' => array( 'file' => "{$url}confirm{$min}.js", 'dependencies' => array( 'jquery' ) ), 'bp-widget-members' => array( 'file' => "{$url}widget-members{$min}.js", 'dependencies' => array( 'jquery' ) ), 'bp-jquery-query' => array( 'file' => "{$url}jquery-query{$min}.js", 'dependencies' => array( 'jquery' ) ), 'bp-jquery-cookie' => array( 'file' => "{$url}jquery-cookie{$min}.js", 'dependencies' => array( 'jquery' ) ),AND
function bp_core_confirmation_js() { if ( is_multisite() && ! bp_is_root_blog() ) { return false; } wp_enqueue_script( 'bp-confirm' ); wp_enqueue_script( 'bootbox' ); wp_localize_script( 'bp-confirm', 'BP_Confirm', array( 'are_you_sure' => __( 'Are you sure?', 'buddypress' ), ) ); }I have copied the bootbox.min.js into the Buddypress js directory
But there is no joy. For example, when deleting an activity, the activity deletes ok but now even the generic confirm doesn’t pop up.Just wondering if I’m totally off track or if it’s even possible? New this so apologies for the long winded explanation. Any help would be appreciated to lead me in the right direction
- The topic ‘BP-Confirm/confirm.js – query’ is closed to new replies.