Does anyone know how I can customise wp-activate.php?
It wraps the content in <div id="content" class="widecolumn">
, however in my theme the main wrapper is <div id="main">
Presumably, I could just style div#content.widecolumn
to be identical to div#main
. But I am curious if anyone knows how to customise this file without editing it.
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: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'); ?>"
toaction=""
Activate Template
In the Activate template, I copied the code from
wp-activate.php
and removed the following lines from the beginning: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 myfunctions.php
file.Renamed it so something unique:
af_wpmu_signup_user_notification
Removed the following:
I changed the line
site_url( "wp-activate.php/?key=$key" )
tosite_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:
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.
Don’t forget to change return to false in your af_wpmu_signup_user_notification. Otherwise two mails will be sent to user. One with the old link and one with the new one.
The main problem here is:
wp-activate.php
includes yourheader.php
but not thefunctions.php
. You may get fatal errors if you use functions in you header which are defined in yourfunctions.php
.I use two new files in my themes:
header-activate.php
andfooter-activate.php
When
wp-activate.php
is called the constantWP_INSTALLING
is set toTRUE
(for no obvious reason). I use that in myheader.php
: I include thefunctions.php
and call my setup function.Start of my regular
header.php
So I prevent the execution of the regular header file and use a customized one.
My
header-activate.php
As you can see, I use no external stylesheet. Not necessary. But the custom background image is still active.
I do the same in my
footer.php
:Start of the regular
footer.php
Complete
footer-activate.php
Result
The whole process is way to hacky. Iâm sure there are better ways to handle this.
I made the activate page same as the rest of the site by adding this:
I just wanted to modify some of the text so I was able to filter gettext using this code put into mu-plugins/my-functions.php. It will NOT work putting this into a regular plugin, but you can put it into functions.php of your base theme.