skip to Main Content

I’m working on a multisite where we have to customize the activation template for new users. I thought there might be a filter for this text, but then I stumbled upon this: https://wordpress.stackexchange.com/questions/41329/customizing-wp-activate-php

This hacky solution requires me to make a page on every single subsite, but the multisite has 250 subsites. Is there another possible solution? Or is there a way to quickly create these using e.g. wp cli?

2

Answers


  1. I think below solution will help to create quickly for all subsite

    Solution:

    step1 : Create one custom plugin and write a code to create page automatically.

    step2: install and activate plugin as network active so it will automatically create on all subsites

    step3: done

    Login or Signup to reply.
  2. I found that

    1. Multisite activated as subdomains eg. xxx.mysite.com uses header-wp-activate.php & footer-wp-activate.php from the activated theme of that site.

    2. Multisite activated as subfolders eg. mysite.com/xxx uses header-wp-activate.php & footer-wp-activate.php from the main site theme.

    If you have same theme across all sites then just add these files on the corresponding theme only.

    If you have many unique themes, then write a script loop through the directories and copy both the files there.

    header-wp-activate.php

    <?php defined( 'ABSPATH' ) or die( 'No script kiddies please!' ); 
     
    global $post; 
     
    ?><!doctype html>
    <html lang="en">
      <head>
        <!-- Required meta tags -->
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <meta http-equiv="Cache-control" content="public">
        <?php wp_head(); ?>
        <title><?php echo $post ? $post->post_title . ' | ' : ''; ?><?php echo get_option('blogname'); ?></title>
    <style type="text/css">
            html {
                background: #f1f1f1;
            }
            body {
                background: #fff;
                border: 1px solid #ccd0d4;
                color: #444;
                font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
                margin: 2em auto;
                padding: 1em 2em;
                max-width: 700px;
                -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
                box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
            }
            h1 {
                border-bottom: 1px solid #dadada;
                clear: both;
                color: #666;
                font-size: 24px;
                margin: 30px 0 0 0;
                padding: 0;
                padding-bottom: 7px;
            }
            #error-page {
                margin-top: 50px;
            }
            #error-page p,
            #error-page .wp-die-message {
                font-size: 14px;
                line-height: 1.5;
                margin: 25px 0 20px;
            }
            #error-page code {
                font-family: Consolas, Monaco, monospace;
            }
            ul li {
                margin-bottom: 10px;
                font-size: 14px ;
            }
            a {
                color: #0073aa;
            }
            a:hover,
            a:active {
                color: #006799;
            }
            a:focus {
                color: #124964;
                -webkit-box-shadow:
                    0 0 0 1px #5b9dd9,
                    0 0 2px 1px rgba(30, 140, 190, 0.8);
                box-shadow:
                    0 0 0 1px #5b9dd9,
                    0 0 2px 1px rgba(30, 140, 190, 0.8);
                outline: none;
            }
            #submit {
                background: #f3f5f6;
                border: 1px solid #016087;
                color: #016087;
                display: inline-block;
                text-decoration: none;
                font-size: 13px;
                line-height: 2;
                height: 28px;
                margin: 0;
                padding: 0 10px 1px;
                cursor: pointer;
                -webkit-border-radius: 3px;
                -webkit-appearance: none;
                border-radius: 3px;
                white-space: nowrap;
                -webkit-box-sizing: border-box;
                -moz-box-sizing:    border-box;
                box-sizing:         border-box;
                width:auto;
                vertical-align: top;
            }
    
            #submit {
                line-height: 2.30769231;
                min-height: 32px;
                padding: 0 12px;
            }
    
            #submit:hover,
            #submit:focus {
                background: #f1f1f1;
            }
    
            #submit:focus {
                background: #f3f5f6;
                border-color: #007cba;
                -webkit-box-shadow: 0 0 0 1px #007cba;
                box-shadow: 0 0 0 1px #007cba;
                color: #016087;
                outline: 2px solid transparent;
                outline-offset: 0;
            }
    
            #submit:active {
                background: #f3f5f6;
                border-color: #7e8993;
                -webkit-box-shadow: none;
                box-shadow: none;
            }
            #key {
              width: 99%;
              font-size: 24px;
            }           
            
    
                </style>    
      </head>
      <body id="error-page">  
          

    footer-wp-activate.php

    <?php defined( 'ABSPATH' ) or die( 'No script kiddies please!' ); ?>    
    </body>
    </html>

    Output of my multisite wp-activate.php

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search