Restrict which rolls show up on front end for announcement.


Home Forums Front End PM PRO Restrict which rolls show up on front end for announcement.

This topic is: Resolved
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #25032
    ronnie kanka
    Participant

    For example, user of role 1 can only send announcements to users of role 1, 2 or 4. Users of role 2 can only send announcements to users of role 2, 5, 8.

    If too complicated, how about just restricting certain roles from showing up on the announcement list (for example, Role 1 is not listed on list of role to announce to)

    #25048
    Shamim Hasan
    Keymaster

    You can add following code in your theme’s (child theme’s if you are using) functions.php

    add_filter( 'fep_filter_to_roles_to_create_announcement', function( $roles ){
        unset( $roles['administrator'] ); //set here which role you do not want to show
        return $roles;
    });
    
    #25058
    ronnie kanka
    Participant

    sorry I’m a php rookie.
    How would I unset multiple roles? can you show me an example? I tried

    “add_filter( ‘fep_filter_to_roles_to_create_announcement’, function( $roles ){
    unset( $roles[‘administrator’, ‘student’, ‘faculty’] ); //set here which role you do not want to show
    return $roles;
    });”

    but no luck

    thanks so much

    #25063
    Shamim Hasan
    Keymaster

    Use like unset( $roles['administrator'], $roles['student'], $roles['faculty'] );

Viewing 4 posts - 1 through 4 (of 4 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.