change copy in error message
-
I am using a function to restrict the ability to create new topics in specific forums:
`function buddydev_is_restricted_forum( $forum_id ) {
$restricted_forum_ids = array( 1347, 93, 91, 89, 95, 1348, 1394, 1349 );
if ( in_array( $forum_id, $restricted_forum_ids ) ) {
return true;
}
return false;
}
function buddydev_bbp_restrict_topic_creation( $can ) {
if ( ! bbp_is_user_keymaster() && bbp_is_single_forum() && buddydev_is_restricted_forum( bbp_get_forum_id() ) ) {
$can = false;
}
return $can;
}
add_filter( ‘bbp_current_user_can_publish_topics’, ‘buddydev_bbp_restrict_topic_creation’ );function buddydev_restrict_from_posting_topic( $forum_id ) {
if ( ! bbp_is_user_keymaster() && buddydev_is_restricted_forum( $forum_id ) ) {
//set error on bbpress and it will not allow creating topic
bbp_add_error( 403, __( ‘Not allowed’ ) );
}
}
add_action( ‘bbp_new_topic_pre_extras’, ‘buddydev_restrict_from_posting_topic’ );’The function works and on those specific forum pages I get an error message that says “You cannot create new topics.” I want to change that copy to say something different but I can’t seem to find where it is coming from. I looked for a 403 error but found nothing and I tried to change the ‘Not allowed’ portion of the ( 403, __( ‘Not allowed’ ) ); but that changed nothing as well.
- You must be logged in to reply to this topic.