Letting non-admin users create announcements

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

This topic is: Resolved
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #17613
    Steve Hammatt

    In another thread, Shamim, on this subject you said:

    If you need permission for any non admin users you can use fep_current_user_can filter hook to give permission.

    Trouble is, my WP dev knowledge is pretty low, sadly (though I need to make some time so I can learn more), and I don’t understand what you mean. I was hoping it was a capability that I could simply grant to my user role (Editor), but it looks like that isn’t the case.

    Am I going to need to code this?

    Shamim Hasan

    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.

    Steve Hammatt

    Thank you, Shamim, that’s extremely helpful. I have on my list of things to do to set up a child theme, and this now gives me a good reason to do that soon.

Viewing 3 posts - 1 through 3 (of 3 total)

You need to purchase ‘Front End PM PRO’ to create topic in this support forum.

If you already purchased ‘Front End PM PRO’ please LOGIN.