Reply To: Letting non-admin users create announcements


Home Forums Front End PM PRO Letting non-admin users create announcements Reply To: Letting non-admin users create announcements

#17625
shamim
Keymaster

Add following code in your theme’s (child theme’s if any) functions.php

add_filter( 'fep_current_user_can', function( $can, $cap, $id ){
	if ( 'add_announcement' !== $cap ) {
		return $can;
	}
	if ( array_intersect( wp_get_current_user()->roles, [ 'administrator', 'editor' ] ) ) {
		return true;
	}
	return false;
}, 10, 3);

Change roles as you like. You can add more roles separated by comma.