Allow sending even if not a member of the receiving group?


Home Forums Front End PM PRO Allow sending even if not a member of the receiving group?

This topic is: Not Resolved
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #43243
    wayne.schulz
    Participant

    How do I allow a certain user or member of a group to send to any other group (even if they are not part of the receiving group)?

    We are using your plugin on our staff site and wish to allow certain users or groups to send to other groups even if the sender is not a member of the receiving group (ex: a member of manager group sending to all members of department group). I tried making them an FEP admin and that seemed to do nothing (even website admin had no access unless a member of the receiving group).

    #43246
    Shamim Hasan
    Keymaster

    You can follow https://www.shamimsplugins.com/support/topic/allow-only-admin-to-message-groups/#post-36544
    Or if you want to allow multiple user role users to send group message you can follow https://www.shamimsplugins.com/support/topic/question-about-groups-messages/#post-28661 (change roles as you want)

    #43249
    wayne.schulz
    Participant

    Thank you for your reply, however, members of the manager and/or administration group still can only send to groups they are members of? I require managers and administration to be able to send to any group (or a select set of groups) even if not a member of.

    When setting up groups in Front End PM, I used the {role-unparsed}-rolename for each group that our site has (if that has an impact on anything). Which BTW is very nice as I don’t have to manually add/remove users from the Front End PM groups.

    #43251
    Shamim Hasan
    Keymaster

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

    add_filter( 'fep_get_option', function( $value, $option ){
        if( 'can-send-to-group' == $option ){
            if( array_intersect( [ 'administrator', 'rolename' ], wp_get_current_user()->roles ) ){
                $value = true;
            } else {
                $value = false;
            }
        }
        return $value;
    }, 10, 2 );
    

    after that user with administrator and rolename (you can change to your actual role name) role can send message without being a member.

    #43253
    wayne.schulz
    Participant

    Yes, I have done that using code from post #28661 (replaced ‘teacher’ with ‘manager’ and added ‘administration’).

    This is what one of the users in the ‘administration’ role sees:

    [✓] Send Message to group
    [All Drivers ˅ ]
    [All Employees]
    [Administrative]

    This user is also in the ‘drivers’ role and of course the ’employee’ role, however, this user being in the ‘administration’ role should also see all the other groups and is not. (see attached)

    I require managers and administration to be able to send to any group (or a select set of groups) even if not a member of. I do not wish to make a ‘manager’ or an ‘administration’ user a member of all the other groups.

    Attachments:
    You must be logged in to view attached files.
    #43256
    Shamim Hasan
    Keymaster

    Sorry for the confusion. Please remove those code and follow https://www.shamimsplugins.com/support/topic/latest-update-breaks-groups/#post-26896 (return conditionally if user in your desire role)

    #43258
    wayne.schulz
    Participant
    This reply has been marked as private.
    #43262
    Shamim Hasan
    Keymaster

    Please change to following

    // Allow administrator and manager group to send to other groups
    add_filter( 'fep_filter_groups_to_send_message', function( $groups ){
        if( array_intersect( [ 'administrator', 'administration', 'manager' ], wp_get_current_user()->roles ) ){
            return Fep_Group_Message::init()->get_all_groups();
        }
        return $groups;
    });
    

    Also with your last added code except these 3 roles nobody will be allowed to send a group message.

    #43266
    wayne.schulz
    Participant

    I see the code above was an attempt to combine the two functions I had, however, it did not work. No one was able to send to any groups.

    #43271
    Shamim Hasan
    Keymaster

    Can you please send me all code added for this plugin?

    #43274
    wayne.schulz
    Participant

    All code added for your plugin was posted in reply #43258,

    I replaced all below ‘// Allow administrator and manager group to send to other groups’ with your code above (reply #43262).

    When that did not work, I reverted back to what was posted in reply #43258 (which is working).

    #43282
    Shamim Hasan
    Keymaster

    What code you have now will allow all users to send message to any group. and except that 3 roles nobody will allowed to send to any group.
    If that is ok then you can continue.
    Or you can use #43262 code again (i changed a bit there) and remove your last filter.
    Let me know

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