Ticket #8100: 8100.patch
| File 8100.patch, 7.7 KB (added by , 5 years ago) |
|---|
-
src/bp-core/bp-core-blocks.php
diff --git src/bp-core/bp-core-blocks.php src/bp-core/bp-core-blocks.php index 7e5f8d2bd..cc5d93c12 100644
add_filter( 'widget_block_dynamic_classname', 'bp_widget_block_dynamic_classname 221 221 * @return string HTML output. 222 222 */ 223 223 function bp_blocks_get_login_widget_registration_link( $content = '', $args = array() ) { 224 if ( isset( $args['form_id'] ) && 'bp-login-widget-form' === $args['form_id'] && bp_get_signup_allowed() ) { 225 $content .= sprintf( 226 '<p class="bp-login-widget-register-link"><a href="%1$s">%2$s</a></p>', 227 esc_url( bp_get_signup_page() ), 228 esc_html__( 'Register', 'buddypress' ) 229 ); 224 if ( isset( $args['form_id'] ) && 'bp-login-widget-form' === $args['form_id'] ) { 225 if ( bp_get_signup_allowed() ) { 226 $content .= sprintf( 227 '<p class="bp-login-widget-register-link"><a href="%1$s">%2$s</a></p>', 228 esc_url( bp_get_signup_page() ), 229 esc_html__( 'Register', 'buddypress' ) 230 ); 231 } 232 233 if ( isset( $args['include_pwd_link'] ) && true === $args['include_pwd_link'] ) { 234 $content .= sprintf( 235 '<p class="bp-login-widget-pwd-link"><a href="%1$s">%2$s</a></p>', 236 esc_url( wp_lostpassword_url( bp_get_root_domain() ) ), 237 esc_html__( 'Lost your password?', 'buddypress' ) 238 ); 239 } 230 240 } 231 241 232 242 $action_output = ''; … … function bp_block_render_login_form_block( $attributes = array() ) { 260 270 $block_args = bp_parse_args( 261 271 $attributes, 262 272 array( 263 'title' => '', 273 'title' => '', 274 'forgotPwdLink' => false, 264 275 ) 265 276 ); 266 277 … … function bp_block_render_login_form_block( $attributes = array() ) { 338 349 } 339 350 } else { 340 351 $action_output = ''; 352 $pwd_link = (bool) $block_args['forgotPwdLink']; 353 341 354 if ( has_action( 'bp_before_login_widget_loggedout' ) ) { 342 355 ob_start(); 343 356 /** … … function bp_block_render_login_form_block( $attributes = array() ) { 357 370 358 371 $widget_content .= wp_login_form( 359 372 array( 360 'echo' => false, 361 'form_id' => 'bp-login-widget-form', 362 'id_username' => 'bp-login-widget-user-login', 363 'label_username' => __( 'Username', 'buddypress' ), 364 'id_password' => 'bp-login-widget-user-pass', 365 'label_password' => __( 'Password', 'buddypress' ), 366 'id_remember' => 'bp-login-widget-rememberme', 367 'id_submit' => 'bp-login-widget-submit', 373 'echo' => false, 374 'form_id' => 'bp-login-widget-form', 375 'id_username' => 'bp-login-widget-user-login', 376 'label_username' => __( 'Username', 'buddypress' ), 377 'id_password' => 'bp-login-widget-user-pass', 378 'label_password' => __( 'Password', 'buddypress' ), 379 'id_remember' => 'bp-login-widget-rememberme', 380 'id_submit' => 'bp-login-widget-submit', 381 'include_pwd_link' => $pwd_link, 368 382 ) 369 383 ); 370 384 -
src/bp-core/classes/class-bp-core.php
diff --git src/bp-core/classes/class-bp-core.php src/bp-core/classes/class-bp-core.php index 2a8e56faf..e2ee0bcde 100644
class BP_Core extends BP_Component { 397 397 'style' => 'bp-login-form-block', 398 398 'style_url' => plugins_url( 'css/blocks/login-form.css', dirname( __FILE__ ) ), 399 399 'attributes' => array( 400 'title' => array(400 'title' => array( 401 401 'type' => 'string', 402 402 'default' => '', 403 403 ), 404 'forgotPwdLink' => array( 405 'type' => 'boolean', 406 'default' => false, 407 ), 404 408 ), 405 409 'render_callback' => 'bp_block_render_login_form_block', 406 410 ), -
src/bp-core/css/blocks/login-form-rtl.css
diff --git src/bp-core/css/blocks/login-form-rtl.css src/bp-core/css/blocks/login-form-rtl.css index f25ff8d9b..9c7a95e7d 100644
34 34 margin-right: 1em; 35 35 vertical-align: super; 36 36 } 37 38 #bp-login-widget-form .bp-login-widget-pwd-link { 39 font-size: 80%; 40 } -
src/bp-core/css/blocks/login-form.css
diff --git src/bp-core/css/blocks/login-form.css src/bp-core/css/blocks/login-form.css index a86ac020f..b2ffafdc4 100644
34 34 margin-left: 1em; 35 35 vertical-align: super; 36 36 } 37 38 #bp-login-widget-form .bp-login-widget-pwd-link { 39 font-size: 80%; 40 } -
src/bp-core/js/blocks/login-form.js
diff --git src/bp-core/js/blocks/login-form.js src/bp-core/js/blocks/login-form.js index 303925005..5f9eb3d0a 100644
var _wp = wp, 134 134 Disabled = _wp$components.Disabled, 135 135 PanelBody = _wp$components.PanelBody, 136 136 TextControl = _wp$components.TextControl, 137 ToggleControl = _wp$components.ToggleControl, 137 138 _wp$element = _wp.element, 138 139 Fragment = _wp$element.Fragment, 139 140 createElement = _wp$element.createElement, … … var _bp = bp, 148 149 var editLoginForm = function editLoginForm(_ref) { 149 150 var attributes = _ref.attributes, 150 151 setAttributes = _ref.setAttributes; 151 var title = attributes.title; 152 var title = attributes.title, 153 forgotPwdLink = attributes.forgotPwdLink; 152 154 return createElement(Fragment, null, createElement(InspectorControls, null, createElement(PanelBody, { 153 155 title: __('Settings', 'buddypress'), 154 156 initialOpen: true … … var editLoginForm = function editLoginForm(_ref) { 160 162 title: text 161 163 }); 162 164 } 165 }), createElement(ToggleControl, { 166 label: __('Include the link to reset the user password', 'buddypress'), 167 checked: !!forgotPwdLink, 168 onChange: function onChange() { 169 setAttributes({ 170 forgotPwdLink: !forgotPwdLink 171 }); 172 } 163 173 }))), createElement(Disabled, null, createElement(ServerSideRender, { 164 174 block: "bp/login-form", 165 175 attributes: attributes … … registerBlockType('bp/login-form', { 243 253 title: { 244 254 type: 'string', 245 255 default: '' 256 }, 257 forgotPwdLink: { 258 type: 'boolean', 259 default: false 246 260 } 247 261 }, 248 262 edit: _edit.default, -
src/bp-core/sass/blocks/login-form.scss
diff --git src/bp-core/sass/blocks/login-form.scss src/bp-core/sass/blocks/login-form.scss index f92840150..b69bff291 100644
40 40 margin-left: 1em; 41 41 vertical-align: super; 42 42 } 43 44 .bp-login-widget-pwd-link { 45 font-size: 80%; 46 } 43 47 } -
src/js/bp-core/js/blocks/login-form.js
diff --git src/js/bp-core/js/blocks/login-form.js src/js/bp-core/js/blocks/login-form.js index 61092ff62..7091fa366 100644
registerBlockType( 'bp/login-form', { 30 30 type: 'string', 31 31 default: '', 32 32 }, 33 forgotPwdLink: { 34 type: 'boolean', 35 default: false, 36 }, 33 37 }, 34 38 edit: editLoginForm, 35 39 transforms: transforms, -
src/js/bp-core/js/blocks/login-form/edit.js
diff --git src/js/bp-core/js/blocks/login-form/edit.js src/js/bp-core/js/blocks/login-form/edit.js index 9c124885f..7734dc7d8 100644
const { 9 9 Disabled, 10 10 PanelBody, 11 11 TextControl, 12 ToggleControl, 12 13 }, 13 14 element: { 14 15 Fragment, … … const { 29 30 } = bp; 30 31 31 32 const editLoginForm = ( { attributes, setAttributes } ) => { 32 const { title } = attributes;33 const { title,forgotPwdLink } = attributes; 33 34 34 35 return ( 35 36 <Fragment> … … const editLoginForm = ( { attributes, setAttributes } ) => { 42 43 setAttributes( { title: text } ); 43 44 } } 44 45 /> 46 <ToggleControl 47 label={ __( 'Include the link to reset the user password', 'buddypress' ) } 48 checked={ !! forgotPwdLink } 49 onChange={ () => { 50 setAttributes( { forgotPwdLink: ! forgotPwdLink } ); 51 } } 52 /> 45 53 </PanelBody> 46 54 </InspectorControls> 47 55 <Disabled>