 src/bp-core/admin/bp-core-admin-tools.php | 77 ++++++++++++++++++++++++++-----
 1 file changed, 65 insertions(+), 12 deletions(-)

diff --git a/src/bp-core/admin/bp-core-admin-tools.php b/src/bp-core/admin/bp-core-admin-tools.php
index 0ad810e0d..47eb04785 100644
--- a/src/bp-core/admin/bp-core-admin-tools.php
+++ b/src/bp-core/admin/bp-core-admin-tools.php
@@ -147,6 +147,14 @@ function bp_admin_repair_list() {
 		'bp_admin_reinstall_emails',
 	);
 
+	// Invitations
+	// - maybe create the database table
+	$repair_list[110] = array(
+		'bp-invitations-table',
+		__( 'Create the database table for Invitations.', 'buddypress' ),
+		'bp_admin_invitations_table',
+	);
+
 	ksort( $repair_list );
 
 	/**
@@ -159,6 +167,61 @@ function bp_admin_repair_list() {
 	return (array) apply_filters( 'bp_repair_list', $repair_list );
 }
 
+
+/**
+ * Create the invitations database table if it does not exist.
+ *
+ * @since 6.0.0
+ *
+ * @return array
+ */
+function bp_admin_invitations_table() {
+	global $wpdb;
+
+	$statement = __( 'Creating the Invitations database table if it does not exist&hellip; %s', 'buddypress' );
+	$result    = __( 'Failed!', 'buddypress' );
+
+	$charset_collate = $GLOBALS['wpdb']->get_charset_collate();
+	$bp_prefix       = bp_core_get_table_prefix();
+	$table_name      = $bp_prefix . 'bp_invitations';
+
+	$sql = "CREATE TABLE $table_name (
+		id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
+		user_id bigint(20) NOT NULL,
+		inviter_id bigint(20) NOT NULL,
+		invitee_email varchar(100) DEFAULT NULL,
+		class varchar(120) NOT NULL,
+		item_id bigint(20) NOT NULL,
+		secondary_item_id bigint(20) DEFAULT NULL,
+		type varchar(12) NOT NULL DEFAULT 'invite',
+		content longtext DEFAULT '',
+		date_modified datetime NOT NULL,
+		invite_sent tinyint(1) NOT NULL DEFAULT '0',
+		accepted tinyint(1) NOT NULL DEFAULT '0',
+		KEY user_id (user_id),
+		KEY inviter_id (inviter_id),
+		KEY invitee_email (invitee_email),
+		KEY class (class),
+		KEY item_id (item_id),
+		KEY secondary_item_id (secondary_item_id),
+		KEY type (type),
+		KEY invite_sent (invite_sent),
+		KEY accepted (accepted)
+		) {$charset_collate};";
+
+
+	require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
+
+	$db_result = maybe_create_table( $table_name, $sql );
+
+	if ( ! $db_result ) {
+		return array( 2, sprintf( $statement, $result ) );
+	} else {
+		return array( 0, sprintf( $statement, __( 'Finished!', 'buddypress' ) ) );
+	}
+
+}
+
 /**
  * Recalculate friend counts for each user.
  *
@@ -173,7 +236,6 @@ function bp_admin_repair_friend_count() {
 		return;
 	}
 
-	/* translators: %s: the result of the action performed by the repair tool */
 	$statement = __( 'Counting the number of friends for each user&hellip; %s', 'buddypress' );
 	$result    = __( 'Failed!', 'buddypress' );
 
@@ -232,7 +294,6 @@ function bp_admin_repair_group_count() {
 		return;
 	}
 
-	/* translators: %s: the result of the action performed by the repair tool */
 	$statement = __( 'Counting the number of groups for each user&hellip; %s', 'buddypress' );
 	$result    = __( 'Failed!', 'buddypress' );
 
@@ -275,7 +336,7 @@ function bp_admin_repair_group_count() {
  */
 function bp_admin_repair_blog_records() {
 
-	/* translators: %s: the result of the action performed by the repair tool */
+	// Description of this tool, displayed to the user.
 	$statement = __( 'Repopulating Blogs records&hellip; %s', 'buddypress' );
 
 	// Default to failure text.
@@ -304,7 +365,6 @@ function bp_admin_repair_blog_records() {
  * @since 2.0.0
  */
 function bp_admin_repair_count_members() {
-	/* translators: %s: the result of the action performed by the repair tool */
 	$statement = __( 'Counting the number of active members on the site&hellip; %s', 'buddypress' );
 	delete_transient( 'bp_active_member_count' );
 	bp_core_get_active_member_count();
@@ -319,7 +379,6 @@ function bp_admin_repair_count_members() {
  * @since 2.0.0
  */
 function bp_admin_repair_last_activity() {
-	/* translators: %s: the result of the action performed by the repair tool */
 	$statement = __( 'Determining last activity dates for each user&hellip; %s', 'buddypress' );
 	bp_last_activity_migrate();
 	return array( 0, sprintf( $statement, __( 'Complete!', 'buddypress' ) ) );
@@ -411,13 +470,7 @@ function bp_core_admin_available_tools_intro() {
 		<h2><?php esc_html_e( 'BuddyPress Tools', 'buddypress' ) ?></h2>
 		<p>
 			<?php esc_html_e( 'BuddyPress keeps track of various relationships between users, groups, and activity items. Occasionally these relationships become out of sync, most often after an import, update, or migration.', 'buddypress' ); ?>
-			<?php
-			printf(
-				/* translators: %s: the link to the BuddyPress repair tools */
-				esc_html_x( 'Use the %s to repair these relationships.', 'buddypress tools intro', 'buddypress' ),
-				'<a href="' . esc_url( $url ) . '">' . esc_html__( 'BuddyPress Tools', 'buddypress' ) . '</a>'
-			);
-			?>
+			<?php printf( esc_html_x( 'Use the %s to repair these relationships.', 'buddypress tools intro', 'buddypress' ), '<a href="' . esc_url( $url ) . '">' . esc_html__( 'BuddyPress Tools', 'buddypress' ) . '</a>' ); ?>
 		</p>
 	</div>
 	<?php
