This topic has 2 replies, 2 voices, and was last updated 10 years by hugblue.

  • Author
  • #9794
     hugblue
    Participant

    Hi ..

    I am trying to filter emails from buddypress members messages.

    I found this code :
    used in functions.php


    /*remove email addresses from private messages*/

    function wdw_remove_email_from_private_msg($message){

    $replacement = “[Warning: Contact removed]“;

    /*if you dont want any replacement text, replace the above line with

    $replacement = “”;

    */

    return preg_replace(“/[^@\s]*@[^@\s]*\.[^@\s]*/”, $replacement, $message);

    /*the code is short and works in most cases but not full proof. Check */

    }

    add_filter(‘messages_message_content_before_save’, ‘wdw_remove_email_from_private_msg’);

    add_filter(‘messages_message_subject_before_save’, ‘wdw_remove_email_from_private_msg’);

    But when i run it.
    I gives me a white blank screen.

    Someone who have a solution to filter emails away or can see what is wrong with this code.

    Thz.

    #9886
     Abe
    Keymaster

    This re-typing all the single and double quotes in the code since I don’t think they are the right ones

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #9890
     hugblue
    Participant

    Hmm

    Not sure i can see the errors.

    Maybe another person can.

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

The forum ‘Sweetdate – WordPress’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?