Converting core modification to a plugin
I needed to change two strings shown to the user on the site upon clicking the confirmation links in the email (not to modify the emails sent out). I made the following modifications and it worked.:
--- wp-activate.bak 2017-02-28 13:01:03.883175677 +0530
+++ wp-activate.php 2017-02-28 13:47:35.000000000 +0530
@@ -13,6 +13,10 @@ require( dirname(__FILE__) . '/wp-load.p
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
+// Changes the header
+
+require( dirname(__FILE__) . '/wp-custommsg.php' );
+
if ( !is_multisite() ) {
wp_redirect( wp_registration_url() );
die();
@@ -128,7 +132,7 @@ get_header( 'wp-activate' );
$url = isset( $result['blog_id'] ) ? get_home_url( (int) $result['blog_id'] ) : '';
$user = get_userdata( (int) $result['user_id'] );
?
- h2?php _e('Your account is now active!'); ?/h2
+ h2?php _e($active_page_title); ?/h2
div id="signup-welcome"
pspan class="h3"?php _e('Username:'); ?/span ?php echo $user-user_login ?/p
@@ -147,7 +151,7 @@ get_header( 'wp-activate' );
?php else: ?
p class="view"?php
/* translators: 1: login URL, 2: network home URL */
- printf( __( 'Your account is now activated. a href="%1$s"Log in/a or go back to the a href="%2$s"homepage/a.' ), network_site_url( 'wp-login.php', 'login' ), network_home_url() );
+ printf( __( $active_page_msg ), network_site_url( 'wp-login.php', 'login' ), network_home_url() );
?/p
?php endif;
}
And wp-custommsg.php contains:
?php
$active_page_title = 'My custom title';
$active_page_msg = 'My custom message';
?
I tried to read about hooks and actions but can't seem to wrap my head around them. How can I convert my changes into a plugin so that it survives a wordpress version update?
To clarify, these modifications reside in html code outside of the php content in wp-activate.php, and as far as I can see, do not have hooks.
Topic wp-signup plugin-development customization Wordpress
Category Web