Skip to:
Content
Pages
Categories
Search
Top
Bottom

Trying to stop spam email


  • jfcarter
    Participant

    @jfcarter

    I’m trying to figure out ways to stop spam email. I just had a spammer setup an account on my BP network, leave it dormant for a day and then sent a bunch of emails to all of our members except the admin.

    This problem will be solved when people can only send messages to friends, but until then, does anyone have any plugins or solutions I could use to “stop the spammers.”

    Grrrrrrrrrr. Very frustrating.

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

  • r-a-y
    Keymaster

    @r-a-y

    Is this a bot or a manual signup who manually sends messages to the users?

    Anyway, the way I see it, there are two ways to combat this problem in the interim:

    1) do a check to see if the logged-in user is a friend of that user, if so run the bp_send_message_button() function

    2) code own function based on bp_send_message_button() and do the check within this function

    Either option will require modifying the Buddypress member theme template in three places:

    * /bp-themes/bpmember/activity/just-me.php

    * /bp-themes/bpmember/wire/latest.php

    * /bp-themes/bpmember/profile/index.php

    (I’m using the default BP member theme as an example)

    This is only for the “Send message” button though… how did the person spam your users?


    r-a-y
    Keymaster

    @r-a-y

    I liked this idea, so I implemented it on my BP install.

    I decided to do step #2.

    Here’s what I added to my /wp-content/plugins/bp-custom.php:

    function bp_send_message_to_friend_button() {
    global $bp;

    if ( bp_is_home() || !is_user_logged_in() || !friends_check_friendship($bp->loggedin_user->id,$bp->displayed_user->id) )
    return false;

    $ud = get_userdata( $bp->displayed_user->id );
    ?>
    <div class="generic-button">
    <a class="send-message" title="<?php _e( 'Send Message', 'buddypress' ) ?>" href="<?php echo $bp->loggedin_user->domain . $bp->messages->slug ?>/compose/?r=<?php echo $ud->user_login ?>"><?php _e( 'Send Message', 'buddypress' ) ?></a>
    </div>
    <?php
    }

    Then I edited the template files mentioned above with the new function call – bp_send_message_to_friend_button().

    Now, the “Send Message” button only shows up if you are a friend of said user.

    I’ve added a trac ticket about this issue as an enhancement, so maybe the above change will be built into the bp_send_message_button() function in the next BP release instead of having to add your own function.

    There’s still the autocomplete feature in the “My Messages > Compose” area, as well as the wire and group wire to worry about though… one step at a time!


    jfcarter
    Participant

    @jfcarter

    @r-a-y,

    Thanks for this information. It was a manual signup.

    I like what you’ve suggested and plan to use the code in my bp-custom file.

    But what did you mean by this: “Then I edited the template files mentioned above with the new function call – bp_send_message_to_friend_button().”?

    What exactly did you add to the templates, and which templates were you referring to?

    Much, much appreciated.

    Thx


    r-a-y
    Keymaster

    @r-a-y

    Hey Jfcarter,

    Sorry for not being clear there.

    If you’re using the default BP member theme, I replaced instances of bp_send_message_button with the newly, created bp_send_message_to_friend_button in these files:

    * /bp-themes/bpmember/activity/just-me.php

    * /bp-themes/bpmember/wire/latest.php

    * /bp-themes/bpmember/profile/index.php

    Keep in mind that if you’re using a different BP member theme, that those template links might be different.

    Hope that was clear enough!


    jfcarter
    Participant

    @jfcarter

    Totally clear. Thank you so much!


    jfcarter
    Participant

    @jfcarter

    r-a-y,

    I’ve used the code and changed the files, per your instructions. Is there some sort of ‘add action’ that should be at the end of the function? Right now i can’t get it to work.

    Any help would be appreciated.

    thanks,

    jfcarter


    r-a-y
    Keymaster

    @r-a-y

    Hey Jfcarter,

    There is no add_action for this function as the changes require manually replacing the existing message button function in the BP member template.

    Were you able to get this working before? Or is this the first time you’re trying this?

    Anyway, follow these steps:

    (1) Make sure you put the bp_send_message_to_friend_button() function in your /wp-content/plugins/bp-custom.php

    (2) Replace the bp_send_message_button() function with the newly, created bp_send_message_to_friend_button() in your BP member template.

    If you’re using the default BP member template, you have to replace the function in these places:

    * /bp-themes/bpmember/activity/just-me.php

    * /bp-themes/bpmember/wire/latest.php

    * /bp-themes/bpmember/profile/index.php

    If you’re using a modified version of the BP member template, you’ll need to manually find each instance of the bp_send_message_button() function and replace it.

    Just FYI, I’m no longer using this function as we did indeed wanted users to message non-friends.


    jfcarter
    Participant

    @jfcarter

    Hi r-a-y,

    Thanks. I was hoping not to have to use this function, because alot of our users are getting to know each other and are sending messages.

    The problem is that someone keeps creating accounts and spamming all of our members (well over 100) and I have to keep going in and deleting all of the messages. And I have to watch the user signups like a hawk.

    So, anyway, this was my first time using it. I changed the functions, but still can’t get it working. I think it may be how I’m adding it to my bp-custom.php. Here’s what I’ve added:

    function bp_send_message_to_friend_button() {
    global $bp;
    if ( bp_is_home() || !is_user_logged_in() || !friends_check_friendship($bp->loggedin_user->id,$bp->displayed_user->id) )
    return false;
    $ud = get_userdata( $bp->displayed_user->id );
    ?>
    <div class="generic-button">
    <a class="send-message" title="<?php _e( 'Send Message', 'buddypress' ) ?>" href="<?php echo $bp->loggedin_user->domain . $bp->messages->slug ?>/compose/?r=<?php echo $ud->user_login ?>"><?php _e( 'Send Message', 'buddypress' ) ?></a>
    </div>
    <?php
    }

    But I’m a bit confused. Shouldn’t it start with <?php and end with ?>

    Thanks for your help,

    jfcarter


    r-a-y
    Keymaster

    @r-a-y

    Hey JF,

    Yes, your bp-custom.php file should start with <?php and end with ?>.

    I assumed that you did that already! But if you didn’t, put that in your bp-custom.php file.

    Give that a shot and let me know if that works!

    If you’re having problems with spam signups, I recommend using this .htaccess snippet by WPMUTutorials.com (by way of Darcy Norman):

    http://wpmututorials.com/how-to/spam-blogs-and-buddypress/


    Seobrien
    Participant

    @seobrien

    This is strange, must have been hacked right? I wake up to find this sting at the top of our site with the template not working:


    https://buddypress.org/forums/topic/trying-to-stop-spam-email

    Warning: Cannot modify header information – headers already sent by (output started at /home/borumaco/public_html/wp-content/plugins/bp-custom.php:17) in /home/borumaco/public_html/wp-content/plugins/buddypress/bp-xprofile/deprecated/bp-xprofile-deprecated.php on line 436

    Warning: Cannot modify header information – headers already sent by (output started at /home/borumaco/public_html/wp-content/plugins/bp-custom.php:17) in /home/borumaco/public_html/wp-content/plugins/what-would-seth-godin-do/what_would_seth_godin_do.php on line 124


    Add that it includes a link to this very forum?? What’s going on?

    I’ve got our developers looking at this thread but any other insight you can shed is most appreciated.


    r-a-y
    Keymaster

    @r-a-y

    Check those lines in the error message for all files and debug.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Trying to stop spam email’ is closed to new replies.
Skip to toolbar