BuddyDev

Search

Replies

  • Participant
    Level: Enlightened
    Posts: 32
    Diana on #22126

    After 2 days of flogging, this worked (in child theme functions.php):

    
    // Stop user accounts logging in that have not been activated (user_status = 2)
    function my_bp_login_auth ( $auth_obj, $username ) {
    	global $bp, $wpdb;
    
    	if ( !$user_id = bp_core_get_userid( $username ) )
    		return $auth_obj;
    
    	$user_status = (int) $wpdb->get_var( $wpdb->prepare( "SELECT user_status FROM $wpdb->users WHERE ID = %d", $user_id ) );
    
    	if ( 2 == $user_status )
    		return new WP_Error( 'bp_account_not_activated', __( '<strong>ERROR</strong>: Your account has not yet been activated. Buzz off!', 'buddypress' ) );
    	else
    		return $auth_obj;
    }
    add_filter( 'authenticate', 'my_bp_login_auth', 30, 2 );
    

    It’s a BuddyPress message, not one from WordPress.

  • Participant
    Level: Enlightened
    Posts: 32
    Diana on #22125

    One more question — which may or may not be related to your plugin.

    I’ve set that account activation by admin is required. After registration but not activation, the login properly displays

    “ERROR: Your account has not been activated.
    Check your email for the activation link.

    If you have not received an email yet, click here to resend it.”

    I’d like to change that message but am befuddled as to how to do that.

    It seems as though WP has a filter for that, but I’m not sure how to test for the condition as to whether the account has not been activated in order to trigger the error message change. Or maybe I’m totally on the wrong track.

    I tried the following code in mu-plugins (from StackExchange) but it does not work:

    
    <?
    
    function wpse_161709( $errors, $redirect_to )
    {
       if( isset( $errors->errors['registered'] ) )
       {
         // Use the magic __get method to retrieve the errors array:
         $tmp = $errors->errors;
    
         // What text to modify:
         $old = __('Your account has not been activated.');
         $new = 'Buzz off!';
    
         // Loop through the errors messages and modify the corresponding message:
         foreach( $tmp['registered'] as $index => $msg )
         {
           if( $msg === $old )
               $tmp['registered'][$index] = $new;
         }
         // Use the magic __set method to override the errors property:
         $errors->errors = $tmp;
    
         // Cleanup:
         unset( $tmp );
       }
       return $errors;
    

    A point in the right direction would be appreciated. I haven’t found similar error message strings in your plugin but might have missed something. I also haven’t been able to find a list of messages for wp_login_errors.

    Thank you very much.

  • Participant
    Level: Enlightened
    Posts: 32
    Diana on #22079

    Apparently panel-registration.php wants to be in

    M:\Ampps\www\wp\wp-content\themes\customizr-child\bpajaxr\default

    not in M:\Ampps\www\wp\wp-content\themes\customizr-child\bpajaxr\default\assets

  • Participant
    Level: Enlightened
    Posts: 32
    Diana on #22078

    If I want to override panel-registration.php, where do I put that? Doesn’t seem to work when placed in …….\themes\customizr-child\bpajaxr\default\assets\

    Thank you, will keep plugging away. So to speak.

  • Participant
    Level: Enlightened
    Posts: 32
    Diana on #22077

    Registration works with default styling; I was hiding one field I don’t want users to see but registration might gag without that. Possibly I can figure a way to appease the registration system without letting users see the BuddyPress “Name” field; I want it to be the same as the WordPress Username.

  • Participant
    Level: Enlightened
    Posts: 32
    Diana on #22076

    Login now working, I need to debug the registration form now. It may be a day or two before I have time to track that down.

  • Participant
    Level: Enlightened
    Posts: 32
    Diana on #22060

    Hi Brajesh,

    I added a bunch more css and only had to use !important on some of them. I just got unlucky on the first few, I guess.

    File is in

    M:\Ampps\www\wp\wp-content\themes\customizr-child\bpajaxr\default

    on my local drive. I have all the css done — I think — but the submit button isn’t working so far as I can determine. I tried just the login form and the wheely icon just spins & spins. I am going to set everything back to defaults and if it still doesn’t work, will upload to the host server to debug further.

    Should I disable the enque, or leave it in?

    wp_enqueue_style( 'bp-register-style', get_stylesheet_directory_uri() . '/bpajaxr/default/bpajaxr-style.css' );

    Before this plugin was updated you had me use the following function in my functions.php:

    
    function buddydev_login_load_ajaxr_styles() {
    	wp_enqueue_style( 'bp-custom-ajaxr-1', get_stylesheet_directory_uri() . '/bp-ajax-register.css' );
    }
    add_action( 'login_enqueue_scripts', 'buddydev_login_load_ajaxr_styles' ,11);
    

    I thought perhaps that wasn’t needed with the plugin update and took it out. Perhaps that was a mistake.

    Thank you for hanging in there with me. I must say, I was in complete despair before I found your BuddyPress registration plugin. The extra options and admin interface on the plugin are a lovely upgrade.

    When I get things working, I’ll email you the css file. It’s 2-column and looks pretty sharp.

    Diana

    • This reply was modified 5 years, 8 months ago by Diana.
  • Participant
    Level: Enlightened
    Posts: 32
    Diana on #22034

    It’s working although it would be nice if I didn’t have to put !important for every single css attribute in order to overrride. I am still enqueing — perhaps that is not necessary?

  • Participant
    Level: Enlightened
    Posts: 32
    Diana on #21689

    Thank you, Brajesh.

    I’ll upload the style when I’m done, in case anyone else wants to use it or something similar.

  • Participant
    Level: Enlightened
    Posts: 32
    Diana on #14400

    Hi Brajesh,

    Please send me a private message with an email address to which I can send a link that will activate temporary admin access for you.

    Also, thank you for the explanation about ‘login_enqueue_scripts’. My lack of knowledge about various WordPress hooks is a big stumbling block.

    Take care,
    Diana