BuddyDev

Search

[Resolved] BP Ajax Registration – Overriding modal styles from theme

  • 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 #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

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #22085

    Hi Diana,
    Thank you for the reply.
    yes, you are right about it.

    We need to maintain the same hierarchy as in the plugin.

    PS:- Thank you for the email.

    Best regards
    Brajesh

  • 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 #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.

  • Keymaster
    (BuddyDev Team)
    Posts: 24593
    Brajesh Singh on #22130

    Hi Diana,
    It looks good.

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: resolved