Customizing wp-activate.php

You are right, this is very hacky.

What I ending up doing was creating two new page templates Register and Activate and creating two new WordPress pages using those templates and then using a filter in my functions.php file to modify the behaviour one wpmu_signup_user_notification.

Users will register on this new Register page and they will be sent an email linking to the new Activation page.

Register Template

In the Register template, I copied the code from wp-signup.php and removed the following lines from the beginning:

require( dirname(__FILE__) . '/wp-load.php' );    
require( './wp-blog-header.php' );

I also changed <div id="content" class="widecolumn> to <div id="main"> so as to fit in with the template.

I also changed the form action value from action="<?php echo network_site_url('wp-activate.php'); ?>" to action=""

Activate Template

In the Activate template, I copied the code from wp-activate.php and removed the following lines from the beginning:

define( 'WP_INSTALLING', true );  
/** Sets up the WordPress Environment. */  
require( dirname(__FILE__) . '/wp-load.php' );  
require( './wp-blog-header.php' );

I changed <div id="content" class="widecolumn> to <div id="main"> so as to fit in with the template.

Again, I changed all the form actions to action=""

Functions.php

I copied the wpmu_signup_user_notification function from wp-includes/ms-functions.php into my functions.php file.

Renamed it so something unique: af_wpmu_signup_user_notification

Removed the following:

if ( !apply_filters('wpmu_signup_user_notification', $user, $user_email, $key, $meta) )
        return false;

I changed the line site_url( "wp-activate.php/?key=$key" ) to site_url( "activate/?key=$key" ) since activate is the page slug of my Activate page.

Then I applied it as a filter with the following code:

add_filter('wpmu_signup_user_notification', 'af_wpmu_signup_user_notification', 10, 4);

This seems to be working okay – I can modify these pages at will without affecting the core. Although this too feels a little too hacky.

Leave a Comment