about bp_core_add_message
-
Hi,I have this function, which use bp_core_add_message.
The problem is that the message is displayed only when the page is reloaded.
How can I display it immediatly ? Is there a core function for this ?
Thanks
function classifieds_screen_single() {
global $bp;
if ( $bp->is_single_item ) {
if ( isset($_GET['new']) ) {
// Delete classified request notifications for the user
}
$watch_action = $bp->action_variables[0];
//WATCH | UNWATCH
if ( ( $watch_action == 'watch' ) || ( $watch_action == 'unwatch' ) ) {
if (!is_user_logged_in()) {
bp_core_add_message( __('Only registered users can use this function', 'classifieds'), 'error' );
}else {
if ( $watch_action == 'watch' ) {
if (bp_classifieds_classified_watch_action()) {
bp_core_add_message( __('This classified has been added to your Watched List', 'classifieds') );
}else {
bp_core_add_message( __('There was a problem adding this classified to your Watched List', 'classifieds'),'error' );
}
}elseif ( $watch_action == 'unwatch' ) {
if (bp_classifieds_classified_watch_action(false)) {
bp_core_add_message( __('This classified has been removed from your Watched List', 'classifieds') );
}else {
bp_core_add_message( __('There was a problem removing this classified from your Watched List', 'classifieds'),'error' );
}
}
}
do_action( 'classifieds_screen_single' );
bp_core_load_template( apply_filters( 'classifieds_template_single', 'classifieds2/classified-single' ) );
}
do_action( 'classifieds_screen_single' );
bp_core_load_template( apply_filters( 'classifieds_template_single', 'classifieds2/classified-single' ) );
}
}
Viewing 1 replies (of 1 total)
-
Nothing built in. You’d have to use an AJAX function to achieve this; look at bp_core_render_notice() as a starting point.
Viewing 1 replies (of 1 total)
- The topic ‘about bp_core_add_message’ is closed to new replies.