Skip to:
Content
Pages
Categories
Search
Top
Bottom

Can I stop private messages being sent to one particular user?


  • Artisantopia
    Participant

    @artisantopia

    HI! I manage a site with 400+ members who are students of a course. The site owner/teacher would like to be able to block anyone from sending her private messages. We want all the students to be able to PM between themselves, but just not to the teacher.

    I’ve looked at this plugin http://etivite.com/wordpress-plugins/buddypress-restrict-messages/ but that would require her to unfriend all the members, or to ignore any future friend requests – which she doesn’t want to do as that sends a negative message.

    Is there a way to achieve this? I’d appreciate any suggestions or ideas. Thanks!

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

  • shanebp
    Moderator

    @shanebp

    Do you know how to use filters?

    Take a look at function send() in
    \buddypress\bp-messages\bp-messages-classes.php

    It has lots of filters.
    I’d use the do_action_ref_array


    Artisantopia
    Participant

    @artisantopia

    thank you @shanebp.

    I only know enough about filters to get myself into trouble! I’ve just had a look at that one. Are you suggesting that I remove the teacher from the array so they don’t show in the list of members to send to? Is that how that works?

    How would that work from the member/student perspective?

    I really appreciate any guidance you can give me.

    Thank you.


    shanebp
    Moderator

    @shanebp

    You’ll need to know the user_id for the teacher.

    Then check the array for that id. If it’s found, remove it.

    And tell the student why, something like:

    bp_core_add_message( __( 'You cannot send a private message to the teacher.', 'buddypress' ), 'error' );

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Can I stop private messages being sent to one particular user?’ is closed to new replies.
Skip to toolbar