mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-16 13:13:33 +09:00
Merge pull request #1703 from ultimatemember/feature/button-hooks
Enhance button class filters
This commit is contained in:
@@ -362,6 +362,27 @@ function um_add_submit_button_to_login( $args ) {
|
||||
if ( ! isset( $primary_btn_word ) || $primary_btn_word == '' ){
|
||||
$primary_btn_word = UM()->options()->get( 'login_primary_btn_word' );
|
||||
}
|
||||
/**
|
||||
* Filters the classes applied to the primary button on the login form.
|
||||
*
|
||||
* @hook um_login_form_primary_btn_classes
|
||||
* @since 2.10.5
|
||||
*
|
||||
* @param {array} $classes An array of CSS classes applied to the primary button.
|
||||
* @param {array} $args An array of arguments or configurations used in the login form.
|
||||
*
|
||||
* @return {array} Button CSS classes.
|
||||
*
|
||||
* @example <caption>Extend the classes applied to the primary button on the login form.</caption>
|
||||
* function my_custom_classes( $classes, $args ) {
|
||||
* // Add a new class to the button
|
||||
* $classes[] = 'new-button-class';
|
||||
*
|
||||
* return $classes;
|
||||
* }
|
||||
* add_filter( 'um_login_form_primary_btn_classes', 'my_custom_classes', 10, 2 );
|
||||
*/
|
||||
$primary_btn_classes = apply_filters( 'um_login_form_primary_btn_classes', array( 'um-button' ), $args );
|
||||
|
||||
/**
|
||||
* UM hook
|
||||
@@ -426,7 +447,7 @@ function um_add_submit_button_to_login( $args ) {
|
||||
if ( ! empty( $args['secondary_btn'] ) ) { ?>
|
||||
|
||||
<div class="um-left um-half">
|
||||
<input type="submit" value="<?php esc_attr_e( wp_unslash( $primary_btn_word ), 'ultimate-member' ); ?>" class="um-button" id="um-submit-btn" />
|
||||
<input type="submit" value="<?php esc_attr_e( wp_unslash( $primary_btn_word ), 'ultimate-member' ); ?>" class="<?php echo esc_attr( implode( ' ', $primary_btn_classes ) ); ?>" id="um-submit-btn" />
|
||||
</div>
|
||||
<div class="um-right um-half">
|
||||
<a href="<?php echo esc_url( $secondary_btn_url ); ?>" class="um-button um-alt">
|
||||
@@ -437,7 +458,7 @@ function um_add_submit_button_to_login( $args ) {
|
||||
<?php } else { ?>
|
||||
|
||||
<div class="um-center">
|
||||
<input type="submit" value="<?php esc_attr_e( wp_unslash( $primary_btn_word ), 'ultimate-member' ); ?>" class="um-button" id="um-submit-btn" />
|
||||
<input type="submit" value="<?php esc_attr_e( wp_unslash( $primary_btn_word ), 'ultimate-member' ); ?>" class="<?php echo esc_attr( implode( ' ', $primary_btn_classes ) ); ?>" id="um-submit-btn" />
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
@@ -597,6 +597,28 @@ function um_add_submit_button_to_register( $args ) {
|
||||
$primary_btn_word = UM()->options()->get( 'register_primary_btn_word' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the classes applied to the primary button on the registration form.
|
||||
*
|
||||
* @hook um_register_form_primary_btn_classes
|
||||
* @since 2.10.5
|
||||
*
|
||||
* @param {array} $classes An array of CSS classes applied to the primary button.
|
||||
* @param {array} $args An array of arguments or configurations used in the registration form.
|
||||
*
|
||||
* @return {array} Button CSS classes.
|
||||
*
|
||||
* @example <caption>Extend the classes applied to the primary button on the registration form.</caption>
|
||||
* function my_custom_classes( $classes, $args ) {
|
||||
* // Add a new class to the button
|
||||
* $classes[] = 'new-button-class';
|
||||
*
|
||||
* return $classes;
|
||||
* }
|
||||
* add_filter( 'um_register_form_primary_btn_classes', 'my_custom_classes', 10, 2 );
|
||||
*/
|
||||
$primary_btn_classes = apply_filters( 'um_register_form_primary_btn_classes', array( 'um-button' ), $args );
|
||||
|
||||
$secondary_btn_word = $args['secondary_btn_word'];
|
||||
/**
|
||||
* UM hook
|
||||
@@ -656,7 +678,7 @@ function um_add_submit_button_to_register( $args ) {
|
||||
<?php if ( ! empty( $args['secondary_btn'] ) ) { ?>
|
||||
|
||||
<div class="um-left um-half">
|
||||
<input type="submit" value="<?php esc_attr_e( wp_unslash( $primary_btn_word ), 'ultimate-member' ) ?>" class="um-button" id="um-submit-btn" />
|
||||
<input type="submit" value="<?php esc_attr_e( wp_unslash( $primary_btn_word ), 'ultimate-member' ) ?>" class="<?php echo esc_attr( implode( ' ', $primary_btn_classes ) ); ?>" id="um-submit-btn" />
|
||||
</div>
|
||||
<div class="um-right um-half">
|
||||
<a href="<?php echo esc_url( $secondary_btn_url ); ?>" class="um-button um-alt">
|
||||
@@ -667,7 +689,7 @@ function um_add_submit_button_to_register( $args ) {
|
||||
<?php } else { ?>
|
||||
|
||||
<div class="um-center">
|
||||
<input type="submit" value="<?php esc_attr_e( wp_unslash( $primary_btn_word ), 'ultimate-member' ) ?>" class="um-button" id="um-submit-btn" />
|
||||
<input type="submit" value="<?php esc_attr_e( wp_unslash( $primary_btn_word ), 'ultimate-member' ) ?>" class="<?php echo esc_attr( implode( ' ', $primary_btn_classes ) ); ?>" id="um-submit-btn" />
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
@@ -6,17 +6,18 @@
|
||||
*
|
||||
* Call: function ultimatemember_password()
|
||||
*
|
||||
* @version 2.7.0
|
||||
* @version 2.10.5
|
||||
*
|
||||
* @var string $mode
|
||||
* @var int $form_id
|
||||
* @var array $args
|
||||
*
|
||||
* phpcs:disable WordPress.Security.NonceVerification
|
||||
*/
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="um <?php echo esc_attr( $this->get_class( $mode ) ); ?> um-<?php echo esc_attr( $form_id ); ?>">
|
||||
<div class="um-form">
|
||||
<form method="post" action="">
|
||||
@@ -62,19 +63,24 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
*/
|
||||
do_action( 'um_reset_password_page_hidden_fields', $args );
|
||||
|
||||
if ( ! empty( $_GET['updated'] ) ) { ?>
|
||||
if ( ! empty( $_GET['updated'] ) ) {
|
||||
?>
|
||||
<div class="um-field um-field-block um-field-type_block">
|
||||
<div class="um-field-block">
|
||||
<div style="text-align:center;">
|
||||
<?php if ( 'expiredkey' === sanitize_key( $_GET['updated'] ) ) {
|
||||
<?php
|
||||
if ( 'expiredkey' === sanitize_key( $_GET['updated'] ) ) {
|
||||
esc_html_e( 'Your password reset link has expired. Please request a new link below.', 'ultimate-member' );
|
||||
} elseif ( 'invalidkey' === sanitize_key( $_GET['updated'] ) ) {
|
||||
esc_html_e( 'Your password reset link appears to be invalid. Please request a new link below.', 'ultimate-member' );
|
||||
} ?>
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php } else { ?>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<div class="um-field um-field-block um-field-type_block">
|
||||
<div class="um-field-block">
|
||||
<div style="text-align:center;">
|
||||
@@ -82,7 +88,8 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php }
|
||||
<?php
|
||||
}
|
||||
|
||||
$fields = UM()->builtin()->get_specific_fields( 'username_b' );
|
||||
|
||||
@@ -111,18 +118,36 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
* }
|
||||
* ?>
|
||||
*/
|
||||
do_action( 'um_after_password_reset_fields', $args ); ?>
|
||||
do_action( 'um_after_password_reset_fields', $args );
|
||||
|
||||
/**
|
||||
* Filters the classes applied to the primary button on the password reset form.
|
||||
*
|
||||
* @hook um_password_reset_form_primary_btn_classes
|
||||
* @since 2.10.5
|
||||
*
|
||||
* @param {array} $classes An array of CSS classes applied to the primary button.
|
||||
* @param {array} $args An array of arguments or configurations used in the password reset form.
|
||||
*
|
||||
* @return {array} Button CSS classes.
|
||||
*
|
||||
* @example <caption>Extend the classes applied to the primary button on the password reset form.</caption>
|
||||
* function my_custom_classes( $classes, $args ) {
|
||||
* // Add a new class to the button
|
||||
* $classes[] = 'new-button-class';
|
||||
*
|
||||
* return $classes;
|
||||
* }
|
||||
* add_filter( 'um_password_reset_form_primary_btn_classes', 'my_custom_classes', 10, 2 );
|
||||
*/
|
||||
$primary_btn_classes = apply_filters( 'um_password_reset_form_primary_btn_classes', array( 'um-button' ), $args );
|
||||
?>
|
||||
<div class="um-col-alt um-col-alt-b">
|
||||
|
||||
<div class="um-center">
|
||||
<input type="submit" value="<?php esc_attr_e( 'Reset password', 'ultimate-member' ); ?>" class="um-button" id="um-submit-btn" />
|
||||
<input type="submit" value="<?php esc_attr_e( 'Reset password', 'ultimate-member' ); ?>" class="<?php echo esc_attr( implode( ' ', $primary_btn_classes ) ); ?>" id="um-submit-btn" />
|
||||
</div>
|
||||
|
||||
<div class="um-clear"></div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* UM hook
|
||||
|
||||
Reference in New Issue
Block a user