Members get a “This activation link is expired” error when verifying.
-
Hi, @missveronicat
I am still with this issue going on, also because i do not know what a ‘child theme’ is. (The other thread was closed, so I could not post there).
In the article:
Add the source.php file from this posting?https://github.com/MissVeronica/um-landing-page-for-email-links/blob/main/source.php?to your child-theme functions.php file.
I have to add the content of source.php to the functions.php file?
In which directory exactly will I find this specific functions.php file??
Thanks so much.
Best
-
You can create a child-theme to avoid code snippet removal when updating the Theme.
Make the child-theme your active Theme where you add the code snippets to the
functions.php
file.The Child Theme is located at
.../wp-content/themes/{main-theme-name}-child/
Create the child-theme with the “Child Theme Configurator” plugin
https://www.ads-software.com/plugins/child-theme-configurator/
I’ll have to investigate in order to understand. Thanks.
hi, @missveronicatv
Thank you!Make the child-theme your active Theme where you add the code snippets to the?
functions.php
?file.
I shall add the content source.php into the functions.php file, i presume.
Before ou after this?
// BEGIN ENQUEUE PARENT ACTION
// AUTO GENERATED – Do not modify or remove comment markers above or below:You add code snippets at the end of the
functions.php
file.Completed.
Thank you!!Best!!
I am pasting the content of source.php at the end of functions.php file of the Divi Child 02 folder. But it is giving a parse error.
<?php add_action( 'wp_enqueue_scripts', 'my_enqueue_assets' ); function my_enqueue_assets() { wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' ); } <?php // https://github.com/MissVeronica/um-landing-page-for-email-links // // Ultimate Member Landing Page for Email Links - Version 3 // Supporting both UM upto 2.4.2 and UM 2.5.0 and afterwards // Date: 2022-08-16 add_filter( 'wp_mail', 'my_wp_mail_filter', 10, 1 ); add_shortcode( 'um-landing-page', 'um_landing_page' ); function my_wp_mail_filter( $compact ) { if( strpos( $compact['message'], '?act=reset_password' ) > 0 ) { $reset_page = str_replace( get_bloginfo( 'url' ), '', get_permalink( UM()->config()->permalinks['password-reset'] )); $compact['message'] = str_replace( $reset_page . '?act=reset_password', '/um-landing-page/?myact=landing_for_password', $compact['message'] ); } if( strpos( $compact['message'], '?act=activate_via_email' ) > 0 ) { $compact['message'] = str_replace( '?act=activate_via_email', '/um-landing-page?myact=landing_for_activate', $compact['message'] ); preg_match( '/\&user_id=\s*(\d+)/', $compact['message'], $matches ); um_fetch_user( intval( $matches[1] )); $compact['message'] = preg_replace("/\&user_id=.*?\"/", '&login=' . esc_html( um_user( 'user_login' )) . '"', $compact['message'] ); } return $compact; } function um_landing_page() { global $wpdb; if( isset( $_REQUEST['myact'] )) { if( $_REQUEST['myact'] == 'landing_for_activate' ) { $query = $wpdb->get_results( "SELECT user_id FROM {$wpdb->prefix}usermeta WHERE meta_key='account_secret_hash' AND meta_value LIKE '" . sanitize_text_field( $_REQUEST['hash'] ) . "' LIMIT 0,1", ARRAY_A ); if( is_array( $query ) && isset( $query[0]['user_id'] )) { $user_id = $query[0]['user_id']; um_fetch_user( $user_id ); if( um_user( 'user_login') != sanitize_text_field( $_REQUEST['login'] )) $user_id = ''; elseif( is_user_logged_in() && absint( $user_id ) !== get_current_user_id()) $user_id = ''; // NEW 2022-01-14 } else $user_id = ''; if( empty( $user_id )) { echo '<h4>Sorry, your activation link is invalid or outdated.</h4>'; } else { ?> <h4>Please click this button to activate your account.</h4> <div> <form id="account-activation-form" action="" method="post"> <input type="hidden" id="act" name="act" value="activate_via_email"> <input type="hidden" name="hash" value="<?php echo esc_html( $_REQUEST['hash'] );?>"> <input type="hidden" id="user_id" name="user_id" value="<?php echo esc_html( $user_id );?>" /> <p><button data-action='submit'><?php echo 'Activate now'; ?></button></p> </form> </div> <?php } ?> <div>Need help?<p><a href="<?php echo esc_url( 'mailto:' . get_bloginfo( 'admin_email' ), array( 'mailto' ));?>">Contact us</a> today.</p></div> <div> <div>Thank you!</div> <div>The <a href="<?php echo esc_url( get_bloginfo( 'url' ));?>"><?php echo esc_html( get_bloginfo( 'name' ));?></a> Team</div> </div> <?php } if( $_REQUEST['myact'] == 'landing_for_password' ) { $reset_page = esc_url( str_replace( get_bloginfo( 'url' ), '', get_permalink( UM()->config()->permalinks['password-reset'] ))); if( isset( $_REQUEST['login'] )) { // UM 2.5.0 and afterwards $value = $_REQUEST['login']; $id = 'login'; } if( isset( $_REQUEST['user_id'] )) { // UM until 2.4.2 $value = $_REQUEST['user_id']; $id = 'user_id'; } ?> <h4>Please click this button to reset your password.</h4> <div> <form id="account-password-form" action="<?php echo $reset_page;?>" method="get"> <input type="hidden" id="act" name="act" value="reset_password"> <input type="hidden" name="hash" value="<?php echo esc_html( $_REQUEST['hash'] );?>"> <input type="hidden" id="<?php echo $id;?>" name="<?php echo $id;?>" value="<?php echo esc_html( $value ); ?>" /> <p><button data-action='submit'><?php echo 'Reset password now'; ?></button></p> </form> </div> <div>Need help?<p><a href="<?php echo esc_url( 'mailto:' . get_bloginfo( 'admin_email' ), array( 'mailto' ));?>">Contact us</a> today.</p></div> <div> <div>Thank you!</div> <div>The <a href="<?php echo esc_url( get_bloginfo( 'url' ));?>"><?php echo esc_html( get_bloginfo( 'name' ));?></a> Team</div> </div> <?php } } }
You must remove the first line in the code snippet where you have
<?php
I have updated the code snippet to a plugin now.
Remove the code snippet fromfunctions.php
.
Download the plugin ZIP file.
Install the plugin ZIP file as a new WP plugin.https://github.com/MissVeronica/um-landing-page-for-email-links
Thaaaaaaanks!
Done. Left the theme-child02 with its original functions.php file. Installed the plugin ‘say what?’.
But I also installed the plugin Breeze as an alternative to resolve cache issues. I don’t need it anymore, do i?You can use the “Breeze” plugin for other pages, which are not created by UM.
https://docs.ultimatemember.com/article/1595-caching-problems#problems
I don’t see the need yet, so I am choosing to exclude the plugin for now.
Thank you once again!Cheers!
Hi… I can delete the Child-Theme folder I created in the process, right?
Child-theme is used for safe storage of custom UM Templates and custom UM Notification Emails.
Keep the child-theme and activate the child-theme for your customizations.
https://docs.ultimatemember.com/article/1335-email-templates
If you have your translated Notication emails in your Theme folder move them to the child-theme.
How do I know If I have my translated Notication emails in my Theme folder? Divi? UM? … pardon me…
- The topic ‘Members get a “This activation link is expired” error when verifying.’ is closed to new replies.