Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[100] rework signups #187

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions inc/namespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,15 @@ function bootstrap() {

// Force limit comments per page to 50 max.
add_filter( 'pre_update_option_comments_per_page', __NAMESPACE__ . '\\set_comments_per_page' );

// Remove WP-Sign-Ups admin menu.
add_action( 'admin_menu', __NAMESPACE__ . '\\remove_wp_signups_admin_menu' );

// Move the Sign Ups menu into the Users menu.
add_action( 'custom_menu_order', __NAMESPACE__ . '\\move_wp_signups_submenu' );

// Change the admin title to Invitations.
add_filter( 'admin_title', __NAMESPACE__ . '\\filter_wp_signups_title' );
}

/**
Expand Down Expand Up @@ -190,6 +199,38 @@ function remove_site_healthcheck_admin_menu() {
remove_submenu_page( 'tools.php', 'site-health.php' );
}

/**
* Remove the signups menu.
*/
function remove_wp_signups_admin_menu() {
remove_menu_page( 'signups' );
}

/**
* Move the Sign Ups list page into the Users menu and rename it to Invitations.
*/
function move_wp_signups_submenu() {
global $submenu;

$submenu['signups'][0] = [
__( 'Invitations', 'altis' ),
'manage_signups',
'signups',
__( 'Invitations', 'altis' ),
];

$submenu['users.php'][] = $submenu['signups'][0];
}

/**
* Rename Sign ups to Invitations
*
* @param string $title The original admin title.
*/
function wp_signups_title( $title ) {
return str_replace( 'sign ups', __( 'Invitations', 'altis' ), strtolower( $title ) );
}

/**
* Disable access to the site health check admin page.
*
Expand Down