BuddyDev

Search

Replies

  • Participant
    Level: Guru
    Posts: 900
    Tosin on in reply to: Hide some stuff from buddypress activity stream #17382
  • Participant
    Level: Guru
    Posts: 900

    Hello Brajesh,

    The updated plugin and the filter worked successfully, thank you so very much.

    Tosin

  • Participant
    Level: Guru
    Posts: 900

    Hello Brajesh,

    I have not received any feed back yet with regards to the update.

    Thank you

  • Participant
    Level: Guru
    Posts: 900

    Hello Brajesh,

    I am using two methods to achieve (1) through the ithemes security plugin (2) through custom code in my functions.php file

    1. Using the ithemes security plugin by navigating to settings the wordpress tweaks

    2. Below is the custom code applied to my functions.php file

     /* ------------------------------------------------------------------------- *
     * Remove WordPress default authentication function
    /* ------------------------------------------------------------------------- */
    remove_filter('authenticate', 'wp_authenticate_username_password', 20);
    
    /* ------------------------------------------------------------------------- *
     * Add custom authentication function
    /* ------------------------------------------------------------------------- */
    add_filter('authenticate', function($user, $email, $password){
    
        //Check for empty fields
        if(empty($email) || empty ($password)){        
            //create new error object and add errors to it.
            $error = new WP_Error();
    
            if(empty($email)){ //No email
                $error->add('empty_username', __('<strong>ERROR</strong>: Email field is empty.'));
            }
            else if(!filter_var($email, FILTER_VALIDATE_EMAIL)){ //Invalid Email
                $error->add('invalid_username', __('<strong>ERROR</strong>: Email is invalid.'));
            }
    
            if(empty($password)){ //No password
                $error->add('empty_password', __('<strong>ERROR</strong>: Password field is empty.'));
            }
    
            return $error;
        }
    
        //Check if user exists in WordPress database
        $user = get_user_by('email', $email);
    
        //bad email
        if(!$user){
            $error = new WP_Error();
            $error->add('invalid', __('<strong>ERROR</strong>: Either the email or password you entered is invalid.'));
            return $error;
        }
        else{ //check password
            if(!wp_check_password($password, $user->user_pass, $user->ID)){ //bad password
                $error = new WP_Error();
                $error->add('invalid', __('<strong>ERROR</strong>: Either the email or password you entered is invalid.'));
                return $error;
            }else{
                return $user; //passed
            }
        }
    }, 20, 3); 

    Thank you

  • Participant
    Level: Guru
    Posts: 900

    Hello Brajesh,

    I’m using a plugin to prevent usernames and accept only on email address on login, is there a way to work around this because I don’t want my users to be able to login using their username but only their email address.

    1. For security reasons logins with email address is better as I want to use usernames for communication purpose only in the community.

    2. Users cannot easily identity another user’s email address unlike usernames that are publicly visible during communication in buddypress.

    Thanks

  • Participant
    Level: Guru
    Posts: 900

    Hello Brajesh,

    I just updated the plugin now and it works perfectly. Just to let you know, I am using this plugin with the buddyboss wall plugin but I only enabled the stream on the site wide activity page and not the profile page, I don’t think there is any form of conflict. If possible I can send you a copy of the buddyboss wall plugin to check it out for compatibility issues.

    Thank you so much
    Tosin

  • Participant
    Level: Guru
    Posts: 900

    Hello Brajesh,

    Thank you so much for explaining, I was also wondering if it will be possible to also change the all members label for only logged in users.

    1. Logged in users will see the label (My wall) while logged out users will see (all members) label.

    2. When a user is logged out does the site wide activity page revert back to the default all members activities.

    Thanks
    Tosin

  • Participant
    Level: Guru
    Posts: 900

    Hello Brajesh,

    Thank you so very much i’m very grateful. You even took the plugin a step further.

  • Participant
    Level: Guru
    Posts: 900
    Tosin on in reply to: BuddyPress Clear Notifications support for Klein theme #14824
    This reply has been marked as private.
  • Participant
    Level: Guru
    Posts: 900

    The code worked successfully thank you very much Brajesh, God bless.