BP template notice and redirect
-
Hi,
I use the below custom function to force users to publish a post before they can send messages.
It used to work fine: redirect to a front-end posting component AND show a template notice.
I am now using BP 2.4.3 and the template notice does no longer show.
It shows fine if I comment the redirect, but this redirect is obviously need to force publishing a post.Any idea what goes wrong?
function force_publishing() { global $bp; $post_count = count_user_posts( bp_loggedin_user_id() , get_post_types() ); //All post types if( bp_is_my_profile() && bp_is_current_component('messages') && ( $post_count == 0 ) ) { bp_core_add_message( __( 'Publish a post first! You must publish a post to view and send messages.' ), 'error' ); bp_core_redirect( bp_loggedin_user_domain() . buddypress()->front-end-post->slug ); } } add_action( 'bp_template_redirect', 'force_publishing', 10 );
- You must be logged in to reply to this topic.