BuddyDev

Search

Replies

  • Participant
    Level: Enlightened
    Posts: 29
    rabb on #27319

    Hi Barjesh,

    no worries, the site is still under development.
    I haven’t found any further bugs so far.
    But it would be nice if you could add a variable [first_name] in the e-mails.

    I mean for the class-bl-actions-handler.php:

    if ( ! bl_is_valid_key( $_GET['key'], $_GET['login'] ) ) {
    			$info_message['error'] = __( 'Either key is invalid or login name is invalid.', 'bl-branded-login' );
    		} else {
    			$user     = get_user_by( 'login', $_GET['login'] );
    			$password = wp_generate_password();
    			$first_name = $user->first_name;

    and

    $message = str_replace(
    				array(
    					'[user_login]',
    					'[password]',
    					'[login_url]',
    					'[first_name]',
    				),
    				array(
    					$user->user_login,
    					$password,
    					$link,
    					$first_name,
    				),
    				$message
    			);

    and for the bl-functions.php:

    // Redefining user_login ensures we return the right case in the email.
    	$user_login = $user_data->user_login;
    	$user_email = $user_data->user_email;
    	$key        = get_password_reset_key( $user_data );
    	$first_name = $user_data->first_name;

    and

    $message = str_replace(
    		array(
    			'[user_login]',
    			'[site_url]',
    			'[reset_url]',
    			'[first_name]',
    		),
    		array(
    			$user_login,
    			network_home_url( '/' ),
    			trailingslashit( wp_lostpassword_url() ) . "?action=verify&key=$key&login=" . rawurlencode( $user_login ),
    			$first_name,

    Best regards

    Ralf

  • Participant
    Level: Enlightened
    Posts: 29
    rabb on #27298

    Hi Barjesh,

    do you have some news concerning the discussed issue and the bugfix?

    Best regards

    Ralf

  • Participant
    Level: Enlightened
    Posts: 29
    rabb on #27140

    Hi Barjesh,

    that’s right, the message of the mail is translatable now.

    But I’m referring to the text messages of the notice field that are stored in the file ‘bp-branded-login-en_US.po’. Not all of them are translated when I generate a new po-file in another language.

    For example:
    1. Open the reset password url
    2. Insert a mail that does not exist.
    3. The notice ‘Invalid email!’ appears although this string is translated in the new po-file.

    I think the reason for that can be found for example in the file bl-functions.php, line 274:

    'invalid_email' => __( 'Invalid email!', 'bl_branded_login' ),

    This line refers to ‘bl_branded_login’ that does not exist. There are also many other positions, see my post #26857.

    In my opinion every occurrence of the string ‘bl-branded-login’ or ‘bl_branded_login’ should be replaced with ‘bl-branded-login’.

    What do you think?

    Regards

    Ralf

  • Participant
    Level: Enlightened
    Posts: 29
    rabb on #26933

    Hi Barjesh,

    thank you very much for your support!

    Regards

    Ralf

  • Participant
    Level: Enlightened
    Posts: 29
    rabb on #26932

    Hi Barjesh,

    okay, I’ll wait for the upcoming release for the new mail functionality.

    As mentioned in my post #26857 the current version is still not translating everything. Can you have a look at my post and tell me the right way to translate everything? Or is there still a bug?

    Regards

    Ralf

  • Participant
    Level: Enlightened
    Posts: 29
    rabb on #26859

    Hey Barjesh,

    thank you very much. It’s working fine.

    I would like to make another suggestion. Can you also add another action right after line 172? Something like:

    
    $info_message['error'] = __( 'Either key is invalid or login name is invalid.', 'bl-branded-login' );
    do_action( 'bl_password_reset_invalid' );
    

    This would also allow to redirect to another page if the password reset url is not valid. At the moment the normal reset page is shown. This can eventually confuse the user.

    All the best

    Ralf

  • Participant
    Level: Enlightened
    Posts: 29
    rabb on #26858

    I forgot one thing. You mentioned in post #26701 that you would provide a setting in the backend to adjust the subject and complete message of the mails. Can you include that feature also? Then I would not have to hack the source code.

    Regards

    Ralf

  • Participant
    Level: Enlightened
    Posts: 29
    rabb on #26857

    Hi Brajesh,

    thanks for the update. I’ve translated the language file
    /wp-content/plugins/bp-branded-login/languages/bp-branded-login-en_US.po
    and saved it as
    /wp-content/languages/bp-branded-login-xx_XX.po and
    /wp-content/languages/bp-branded-login-xx_XX.mo
    where xx = country abbreviation.

    Unfortunately it is still not working. So I searched in the complete plugin folder for the strings mentioned in post #26803 (bl-branded-login, bp-branded-login and bl_branded_login).
    All strings are still used. That would explain why it is not working completely.

    Is that correct?

    Regards

    Ralf

    p.s. Here’s the result of the search for the strings :

    \wp-content\plugins\bp-branded-login\core\bl-components-helper.php (1 hit)
    Line 23: add_action( 'bp_setup_components', 'bl_register_components', 8 );
    
    \wp-content\plugins\bp-branded-login\core\bl-functions.php (15 hits)
    Line 154: 		$errors->add( 'empty_username', __( '<strong>ERROR</strong>: Enter a username or email address.', 'bp-branded-login' ) );
    Line 158: 			$errors->add( 'invalid_email', __( '<strong>ERROR</strong>: There is no user registered with that email address.', 'bp-branded-login' ) );
    Line 174: 		$errors->add( 'invalidcombo', __( '<strong>ERROR</strong>: Invalid username or email.', 'bp-branded-login' ) );
    Line 234: 	$title = sprintf( __( '[%s] Password Reset', 'bp-branded-login' ), $blogname );
    Line 256: 		wp_die( __( 'The email could not be sent.', 'bp-branded-login' ) . '<br />' . __( 'Possible reason: your host may have disabled the mail() function.', 'bp-branded-login' ) );
    Line 256: 		wp_die( __( 'The email could not be sent.', 'bp-branded-login' ) . '<br />' . __( 'Possible reason: your host may have disabled the mail() function.', 'bp-branded-login' ) );
    Line 272: 		'empty_password'     => __( 'Your Password is empty. Please enter correct password.', 'bl_branded_login' ),
    Line 273: 		'empty_email'        => __( 'Your Email is empty. Please enter your Email.', 'bl_branded_login' ),
    Line 274: 		'invalid_email'      => __( 'Invalid email!', 'bl_branded_login' ),
    Line 275: 		'invalidcombo'       => __( 'Invalid username or email.', 'bl_branded_login' ),
    Line 276: 		'empty_username'     => __( 'Your Username is empty. Please enter your Username.', 'bl_branded_login' ),
    Line 277: 		'invalid_username'   => __( 'The username is Invalid!', 'bl_branded_login' ),
    Line 278: 		'incorrect_password' => __( 'Password is Invalid!', 'bl_branded_login' ),
    Line 284: 		return __( 'Invalid Request', 'bl_branded_login' );
    Line 321: 		'username_blacklisted' => __( 'Too many failed login attempts.', 'bl_branded_login' ),
    
    \wp-content\plugins\bp-branded-login\core\bl-hooks.php (6 hits)
    Line 43: add_filter( 'login_url', 'bl_filter_login_url' );
    Line 63: add_filter( 'lostpassword_url', 'bl_filter_reset_url' );
    Line 96: add_filter( 'logout_url', 'bl_filter_logout_url' );
    Line 133: add_action( 'bp_screens', 'bl_screens_handler', 1 );
    Line 166: add_action( 'init', 'bl_redirect_wp_login_page' );
    Line 194: add_filter( 'site_url', 'bl_modify_login_post_url', 10, 4 );
    
    \wp-content\plugins\bp-branded-login\core\classes\class-bl-actions-handler.php (6 hits)
    Line 129: 			$message = __( 'You have logged in successfully.', 'bl-branded-login' );
    Line 172: 			$info_message['error'] = __( 'Either key is invalid or login name is invalid.', 'bl-branded-login' );
    Line 191: 			$subject = sprintf( __( '[%s] New generated password', 'bl-branded-login' ), $blogname );
    Line 226: 				$info_message['success'] = __( 'New password has been sent to your registered email address.', 'bl-branded-login' );
    Line 251: 				$message = __( 'Password reset link has been sent on your registered email address.', 'bp-branded-login' );
    Line 273: 		bp_core_add_message( __( 'You have successfully logged out!', 'bl-branded-login' ) );
    
    \wp-content\plugins\bp-branded-login\core\classes\class-bl-login-component.php (1 hit)
    Line 23: 			__( 'Login', 'bl-branded-login' ),
    
    \wp-content\plugins\bp-branded-login\core\classes\class-bl-logout-component.php (1 hit)
    Line 23: 			__( 'Logout', 'bl-branded-login' ),
    
    \wp-content\plugins\bp-branded-login\core\classes\class-bl-pass-reset-component.php (1 hit)
    Line 23: 			__( 'Password Reset', 'bl-branded-login' ),
    
    \wp-content\plugins\bp-branded-login\core\classes\class-bl-theme-compat.php (3 hits)
    Line 78: 			$title = __( 'Login', 'bl-branded-login' );
    Line 80: 			$title = __( 'Reset Password', 'bl-branded-login' );
    Line 82: 			$title = __( 'Thank You', 'bl-branded-login' );
    
    \wp-content\plugins\bp-branded-login\templates\blogin\login.php (3 hits)
    Line 37: 				<?php _e( 'Username', 'bl' ) ?><br/>
    Line 43: 		<label for="bp-login-widget-user-pass"><?php _e( 'Password', 'bp-branded-login' ); ?></label>
    Line 70: 			<?php $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( bp_get_signup_page() ), __( 'Register', 'bp-branded-login' ) );
    
    \wp-content\plugins\bp-branded-login\templates\blogin\resetpass.php (2 hits)
    Line 36: 			<label for="user_login" ><?php _e( 'Username or Email', 'bl-branded-login' ) ?><br />
    Line 44: 			<input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e('Get New Password', 'bl-branded-login' ); ?>" />
  • Participant
    Level: Enlightened
    Posts: 29
    rabb on #26803

    Hi Brajesh,

    I’ve just translated the language file ‘bp-branded-login-en_US’ with Poedit but as a result not all strings were translated in the browser. I’ve noticed in the source code that the strings refer to different translation files: ‘bl-branded-login’, ‘bp-branded-login’ and ‘bl_branded_login’.

    Examples:

    File: class-bl-actions-handler.php:

    $info_message['success'] = __( 'New password has been sent to your registered email address.', 'bl-branded-login' );

    File: class-bl-actions-handler.php:

    $message = __( 'Password reset link has been sent on your register email address. Please check.', 'bp-branded-login' );

    File: bl-functions.php:

    'empty_password' => __( 'Your Password is empty. Please enter correct password.', 'bl_branded_login' ),

    It works when I add another po and mo file with the prefix ‘bl_branded_login-‘ or ‘bl-branded-login-‘ in the filename. But I can’t imagine that this is the best way.

    So the question is if this is done intentionally or if this is a bug?

    Regards

    Ralf

  • Participant
    Level: Enlightened
    Posts: 29
    rabb on #26714

    Hey Brajseh,

    I figured it out. To redirect to a static page after having pressed the button I insterted two lines right after the successful error check of the file class-bl-actions-handler.php:

    
    if ( ! is_wp_error( $errors ) ) {
    	$message = __( 'Password reset link has been sent on your register email address. Please check.', 'bp-branded-login' );
    	bp_core_add_message( $message, 'success' );
    	wp_redirect(site_url('/pagename/'));
    	exit;
    } else {
    	$message = bl_get_error_message( key( $errors->errors ) );
    	bp_core_add_message( $message, 'error' );
    }
    

    The code I’ve posted in post #26694 is faultiy. Unfortunately I cannot edit this post anymore. This is the corrected code:

    do_action(bp_nouveau_template_notices());

    Regards

    Ralf