<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[BuddyPress][12951] trunk/src: Member Invites: Change screen file loading logic.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://buddypress.trac.wordpress.org/changeset/12951">12951</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://buddypress.trac.wordpress.org/changeset/12951","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>dcavins</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2021-05-17 23:57:00 +0000 (Mon, 17 May 2021)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Member Invites: Change screen file loading logic.
{U+2022} Move send and list invitations load actions to single screen file.
This avoids an issue where the current action isn't known
as of `late_includes` and could, in unusual cases, cause the
wrong screen file to be loaded.
{U+2022} Replace several vestigial 'network_invitations' mentions.
Props imath.
See <a href="http://buddypress.trac.wordpress.org/ticket/8139">#8139</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcbpmembersactionsinvitationsbulkmanagephp">trunk/src/bp-members/actions/invitations-bulk-manage.php</a></li>
<li><a href="#trunksrcbpmembersbpmemberstemplatephp">trunk/src/bp-members/bp-members-template.php</a></li>
<li><a href="#trunksrcbpmembersclassesclassbpmemberscomponentphp">trunk/src/bp-members/classes/class-bp-members-component.php</a></li>
<li><a href="#trunksrcbptemplatesbplegacybuddypressmemberssingleinvitationsinvitationsloopphp">trunk/src/bp-templates/bp-legacy/buddypress/members/single/invitations/invitations-loop.php</a></li>
<li><a href="#trunksrcbptemplatesbplegacybuddypressmemberssingleinvitationssendinvitesphp">trunk/src/bp-templates/bp-legacy/buddypress/members/single/invitations/send-invites.php</a></li>
<li><a href="#trunksrcbptemplatesbpnouveaubuddypressmemberssingleinvitationsinvitationsloopphp">trunk/src/bp-templates/bp-nouveau/buddypress/members/single/invitations/invitations-loop.php</a></li>
<li><a href="#trunksrcbptemplatesbpnouveaubuddypressmemberssingleinvitationssendinvitesphp">trunk/src/bp-templates/bp-nouveau/buddypress/members/single/invitations/send-invites.php</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunksrcbpmembersscreensinvitationsphp">trunk/src/bp-members/screens/invitations.php</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunksrcbpmembersscreenslistinvitesphp">trunk/src/bp-members/screens/list-invites.php</a></li>
<li><a href="#trunksrcbpmembersscreenssendinvitesphp">trunk/src/bp-members/screens/send-invites.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcbpmembersactionsinvitationsbulkmanagephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-members/actions/invitations-bulk-manage.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-members/actions/invitations-bulk-manage.php 2021-05-14 05:23:02 UTC (rev 12950)
+++ trunk/src/bp-members/actions/invitations-bulk-manage.php 2021-05-17 23:57:00 UTC (rev 12951)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -24,7 +24,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Get the parameters.
</span><span class="cx" style="display: block; padding: 0 10px"> $action = ! empty( $_POST['invitation_bulk_action'] ) ? $_POST['invitation_bulk_action'] : '';
</span><span class="cx" style="display: block; padding: 0 10px"> $nonce = ! empty( $_POST['invitations_bulk_nonce'] ) ? $_POST['invitations_bulk_nonce'] : '';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $invitations = ! empty( $_POST['network_invitations'] ) ? $_POST['network_invitations'] : '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $invitations = ! empty( $_POST['members_invitations'] ) ? $_POST['members_invitations'] : '';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Bail if no action or no IDs.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ( ! in_array( $action, array( 'cancel', 'resend' ), true ) ) || empty( $invitations ) || empty( $nonce ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -79,4 +79,4 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Redirect.
</span><span class="cx" style="display: block; padding: 0 10px"> bp_core_redirect( bp_displayed_user_domain() . bp_get_members_invitations_slug() . '/' . bp_current_action() . '/' );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-add_action( 'bp_actions', 'bp_members_invitations_action_bulk_manage' );
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+add_action( 'bp_actions', 'bp_members_invitations_action_bulk_manage' );
</ins></span></pre></div>
<a id="trunksrcbpmembersbpmemberstemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-members/bp-members-template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-members/bp-members-template.php 2021-05-14 05:23:02 UTC (rev 12950)
+++ trunk/src/bp-members/bp-members-template.php 2021-05-17 23:57:00 UTC (rev 12951)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3291,7 +3291,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $url = add_query_arg( $args, $link );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Add the nonce.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $url = wp_nonce_url( $url, 'bp_network_invitation_resend_' . $id );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $url = wp_nonce_url( $url, 'bp_members_invitation_resend_' . $id );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Filters the URL used for resending a single invitation.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3499,4 +3499,4 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <input type="submit" id="invitation-bulk-manage" class="button action" value="<?php echo esc_attr_x( 'Apply', 'button', 'buddypress' ); ?>">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-}
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+}
</ins></span></pre></div>
<a id="trunksrcbpmembersclassesclassbpmemberscomponentphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-members/classes/class-bp-members-component.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-members/classes/class-bp-members-component.php 2021-05-14 05:23:02 UTC (rev 12950)
+++ trunk/src/bp-members/classes/class-bp-members-component.php 2021-05-17 23:57:00 UTC (rev 12951)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -144,16 +144,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Invitations.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( is_user_logged_in() && bp_is_user_members_invitations() ) {
</span><span class="cx" style="display: block; padding: 0 10px"> // Actions.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( bp_is_post_request() ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( isset( $_POST['members_invitations'] ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> require $this->path . 'bp-members/actions/invitations-bulk-manage.php';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Screens.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( bp_is_user_members_invitations_list() ) {
- require $this->path . 'bp-members/screens/list-invites.php';
- } else {
- require $this->path . 'bp-members/screens/send-invites.php';
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ require $this->path . 'bp-members/screens/invitations.php';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunksrcbpmembersscreensinvitationsphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/src/bp-members/screens/invitations.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-members/screens/invitations.php (rev 0)
+++ trunk/src/bp-members/screens/invitations.php 2021-05-17 23:57:00 UTC (rev 12951)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,120 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * BuddyPress Members: Invitations screens
+ *
+ * @package BuddyPress
+ * @subpackage MembersScreens
+ * @since 8.0.0
+ */
+
+// Exit if accessed directly.
+defined( 'ABSPATH' ) || exit;
+
+/**
+ * Catch and process the Send Invites page.
+ *
+ * @since 8.0.0
+ */
+function members_screen_send_invites() {
+
+ // Chack if there's an invitation to send.
+ if ( isset( $_REQUEST['action'] ) && 'send-invite' === wp_unslash( $_REQUEST['action'] ) ) {
+ $user_id = bp_displayed_user_id();
+ $default_args = array(
+ 'invitee_email' => '',
+ 'inviter_id' => $user_id,
+ 'content' => '',
+ 'send_invite' => 1,
+ );
+
+ $invite_args = wp_parse_args( array_map( 'wp_unslash', $_REQUEST ), $default_args );
+ $invite_args = array_intersect_key( $invite_args, $default_args );
+
+ // Check the nonce and delete the invitation.
+ if ( bp_verify_nonce_request( 'bp_members_invitation_send_' . $user_id ) && bp_members_invitations_invite_user( $invite_args ) ) {
+ bp_core_add_message( __( 'Invitation successfully sent!', 'buddypress' ) );
+ } else {
+ bp_core_add_message( __( 'There was a problem sending that invitation. The user could already be a member of the site or have chosen not to receive invitations from this site.', 'buddypress' ), 'error' );
+ }
+
+ // Redirect.
+ bp_core_redirect( bp_get_members_invitations_send_invites_permalink( $user_id ) );
+ }
+
+ /**
+ * Fires before the loading of template for the send membership invitations page.
+ *
+ * @since 8.0.0
+ */
+ do_action( 'members_screen_send_invites' );
+
+ /**
+ * Filters the template used to display the send membership invitations page.
+ *
+ * @since 8.0.0
+ *
+ * @param string $template Path to the send membership invitations template to load.
+ */
+ bp_core_load_template( apply_filters( 'members_template_send_invites', 'members/single/invitations' ) );
+}
+
+/**
+ * Catch and process the Pending Invites page.
+ *
+ * @since 8.0.0
+ */
+function members_screen_list_sent_invites() {
+
+ // Chack if there's an invitation to cancel or resend.
+ if ( isset( $_GET['action'], $_GET['invitation_id'] ) && $_GET['action'] && $_GET['invitation_id'] ) {
+ $action = wp_unslash( $_GET['action'] );
+ $invitation_id = (int) wp_unslash( $_GET['invitation_id'] );
+ $user_id = bp_displayed_user_id();
+
+ if ( 'cancel' === $action ) {
+ // Check the nonce and delete the invitation.
+ if ( bp_verify_nonce_request( 'bp_members_invitations_cancel_' . $invitation_id ) && bp_members_invitations_delete_by_id( $invitation_id ) ) {
+ bp_core_add_message( __( 'Invitation successfully canceled.', 'buddypress' ) );
+ } else {
+ bp_core_add_message( __( 'There was a problem canceling that invitation.', 'buddypress' ), 'error' );
+ }
+ } elseif ( 'resend' === $action ) {
+ // Check the nonce and resend the invitation.
+ if ( bp_verify_nonce_request( 'bp_members_invitation_resend_' . $invitation_id ) && bp_members_invitation_resend_by_id( $invitation_id ) ) {
+ bp_core_add_message( __( 'Invitation successfully resent.', 'buddypress' ) );
+ } else {
+ bp_core_add_message( __( 'There was a problem resending that invitation.', 'buddypress' ), 'error' );
+ }
+ } else {
+ /**
+ * Hook here to handle custom actions.
+ *
+ * @since 8.0.0
+ *
+ * @param string $action The action name.
+ * @param int $invitation_id The invitation ID.
+ * @param int $user_id The displayed user ID.
+ */
+ do_action( 'bp_members_invitations_list_invites_action', $action, $invitation_id, $user_id );
+ }
+
+ // Redirect.
+ bp_core_redirect( bp_get_members_invitations_list_invites_permalink( $user_id ) );
+ }
+
+ /**
+ * Fires before the loading of template for the send membership invitations page.
+ *
+ * @since 8.0.0
+ */
+ do_action( 'members_screen_list_sent_invites' );
+
+ /**
+ * Filters the template used to display the send membership invitations page.
+ *
+ * @since 8.0.0
+ *
+ * @param string $template Path to the send membership invitations template to load.
+ */
+ bp_core_load_template( apply_filters( 'members_template_list_sent_invites', 'members/single/invitations' ) );
+}
</ins></span></pre></div>
<a id="trunksrcbpmembersscreenslistinvitesphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: trunk/src/bp-members/screens/list-invites.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-members/screens/list-invites.php 2021-05-14 05:23:02 UTC (rev 12950)
+++ trunk/src/bp-members/screens/list-invites.php 2021-05-17 23:57:00 UTC (rev 12951)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,80 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-/**
- * Members: Sent Invitations Status
- *
- * @package BuddyPress
- * @subpackage MembersScreens
- * @since 8.0.0
- */
-
-/**
- * Catch and process the Send Invites page.
- *
- * @since 8.0.0
- */
-function members_screen_list_sent_invites() {
-
- /**
- * Fires before the loading of template for the send membership invitations page.
- *
- * @since 8.0.0
- */
- do_action( 'members_screen_list_sent_invites' );
-
- /**
- * Filters the template used to display the send membership invitations page.
- *
- * @since 8.0.0
- *
- * @param string $template Path to the send membership invitations template to load.
- */
- bp_core_load_template( apply_filters( 'members_template_list_sent_invites', 'members/single/invitations' ) );
-}
-
-/**
- * Handle canceling or resending single invitations.
- *
- * @since 8.0.0
- *
- * @return bool
- */
-function bp_members_invitations_action_handling() {
-
- // Bail if not the read screen.
- if ( ! bp_is_user_members_invitations_list() ) {
- return false;
- }
-
- // Get the action.
- $action = ! empty( $_GET['action'] ) ? $_GET['action'] : '';
- $nonce = ! empty( $_GET['_wpnonce'] ) ? $_GET['_wpnonce'] : '';
- $id = ! empty( $_GET['invitation_id'] ) ? $_GET['invitation_id'] : '';
-
- // Bail if no action or no ID.
- if ( empty( $action ) || empty( $id ) ) {
- return false;
- }
-
- if ( 'cancel' === $action ) {
- // Check the nonce and delete the invitation.
- if ( bp_verify_nonce_request( 'bp_members_invitations_cancel_' . $id ) && bp_members_invitations_delete_by_id( $id ) ) {
- bp_core_add_message( __( 'Invitation successfully canceled.', 'buddypress' ) );
- } else {
- bp_core_add_message( __( 'There was a problem canceling that invitation.', 'buddypress' ), 'error' );
- }
- } else if ( 'resend' === $action ) {
- // Check the nonce and resend the invitation.
- if ( bp_verify_nonce_request( 'bp_network_invitation_resend_' . $id ) && bp_members_invitation_resend_by_id( $id ) ) {
- bp_core_add_message( __( 'Invitation successfully resent.', 'buddypress' ) );
- } else {
- bp_core_add_message( __( 'There was a problem resending that invitation.', 'buddypress' ), 'error' );
- }
- } else {
- return false;
- }
-
- // Redirect.
- $user_id = bp_displayed_user_id();
- bp_core_redirect( bp_get_members_invitations_list_invites_permalink( $user_id ) );
-}
-add_action( 'bp_actions', 'bp_members_invitations_action_handling' );
</del></span></pre></div>
<a id="trunksrcbpmembersscreenssendinvitesphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: trunk/src/bp-members/screens/send-invites.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-members/screens/send-invites.php 2021-05-14 05:23:02 UTC (rev 12950)
+++ trunk/src/bp-members/screens/send-invites.php 2021-05-17 23:57:00 UTC (rev 12951)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,77 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-/**
- * Members: Send Invitations
- *
- * @package BuddyPress
- * @subpackage MembersScreens
- * @since 8.0.0
- */
-
-/**
- * Catch and process the Send Invites page.
- *
- * @since 8.0.0
- */
-function members_screen_send_invites() {
-
- /**
- * Fires before the loading of template for the send membership invitations page.
- *
- * @since 8.0.0
- */
- do_action( 'members_screen_send_invites' );
-
- /**
- * Filters the template used to display the send membership invitations page.
- *
- * @since 8.0.0
- *
- * @param string $template Path to the send membership invitations template to load.
- */
- bp_core_load_template( apply_filters( 'members_template_send_invites', 'members/single/invitations' ) );
-}
-
-/**
- * Handle sending invitations.
- *
- * @since 8.0.0
- *
- * @return bool
- */
-function bp_network_invitations_catch_send_action() {
-
- // Bail if not the read screen.
- if ( ! bp_is_user_members_invitations_send_screen() ) {
- return false;
- }
-
- // Get the action.
- $action = ! empty( $_REQUEST['action'] ) ? $_REQUEST['action'] : '';
- $nonce = ! empty( $_REQUEST['_wpnonce'] ) ? $_REQUEST['_wpnonce'] : '';
- $email = ! empty( $_REQUEST['invitee_email'] ) ? $_REQUEST['invitee_email'] : '';
- $message = ! empty( $_REQUEST['invite_message'] ) ? $_REQUEST['invite_message'] : '';
-
- // Bail if missing required info.
- if ( ( 'send-invite' !== $action ) ) {
- return false;
- }
-
- $invite_args = array(
- 'invitee_email' => $email,
- 'inviter_id' => bp_displayed_user_id(),
- 'content' => $message,
- 'send_invite' => 1
- );
-
- // Check the nonce and delete the invitation.
- if ( bp_verify_nonce_request( 'bp_members_invitation_send_' . bp_displayed_user_id() ) && bp_members_invitations_invite_user( $invite_args ) ) {
- bp_core_add_message( __( 'Invitation successfully sent!', 'buddypress' ) );
- } else {
- bp_core_add_message( __( 'There was a problem sending that invitation. The user could already be a member of the site or have chosen not to receive invitations from this site.', 'buddypress' ), 'error' );
- }
-
- // Redirect.
- $user_id = bp_displayed_user_id();
- bp_core_redirect( bp_get_members_invitations_send_invites_permalink( $user_id ) );
-}
-add_action( 'bp_actions', 'bp_network_invitations_catch_send_action' );
</del></span></pre></div>
<a id="trunksrcbptemplatesbplegacybuddypressmemberssingleinvitationsinvitationsloopphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-templates/bp-legacy/buddypress/members/single/invitations/invitations-loop.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-templates/bp-legacy/buddypress/members/single/invitations/invitations-loop.php 2021-05-14 05:23:02 UTC (rev 12950)
+++ trunk/src/bp-templates/bp-legacy/buddypress/members/single/invitations/invitations-loop.php 2021-05-17 23:57:00 UTC (rev 12951)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -36,7 +36,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <tr>
</span><span class="cx" style="display: block; padding: 0 10px"> <td class="bulk-select-check">
</span><span class="cx" style="display: block; padding: 0 10px"> <label for="<?php bp_the_members_invitation_property( 'id', 'attribute' ); ?>">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <input id="<?php bp_the_members_invitation_property( 'id', 'attribute' ); ?>" type="checkbox" name="network_invitations[]" value="<?php bp_the_members_invitation_property( 'id', 'attribute' ); ?>" class="invitation-check">
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <input id="<?php bp_the_members_invitation_property( 'id', 'attribute' ); ?>" type="checkbox" name="members_invitations[]" value="<?php bp_the_members_invitation_property( 'id', 'attribute' ); ?>" class="invitation-check">
</ins><span class="cx" style="display: block; padding: 0 10px"> <span class="bp-screen-reader-text">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px"> /* translators: accessibility text */
</span></span></pre></div>
<a id="trunksrcbptemplatesbplegacybuddypressmemberssingleinvitationssendinvitesphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-templates/bp-legacy/buddypress/members/single/invitations/send-invites.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-templates/bp-legacy/buddypress/members/single/invitations/send-invites.php 2021-05-14 05:23:02 UTC (rev 12950)
+++ trunk/src/bp-templates/bp-legacy/buddypress/members/single/invitations/send-invites.php 2021-05-17 23:57:00 UTC (rev 12951)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -23,7 +23,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <input id="bp_members_invitation_invitee_email" type="email" name="invitee_email" required="required">
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <label for="bp_members_invitation_message"><?php esc_html_e( 'Add a personalized message to the invitation (optional)', 'buddypress' ); ?></label>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <textarea id="bp_members_invitation_message" name="invite_message"></textarea>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <textarea id="bp_members_invitation_message" name="content"></textarea>
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <input type="hidden" name="action" value="send-invite">
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunksrcbptemplatesbpnouveaubuddypressmemberssingleinvitationsinvitationsloopphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-templates/bp-nouveau/buddypress/members/single/invitations/invitations-loop.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-templates/bp-nouveau/buddypress/members/single/invitations/invitations-loop.php 2021-05-14 05:23:02 UTC (rev 12950)
+++ trunk/src/bp-templates/bp-nouveau/buddypress/members/single/invitations/invitations-loop.php 2021-05-17 23:57:00 UTC (rev 12951)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -34,7 +34,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <tr>
</span><span class="cx" style="display: block; padding: 0 10px"> <td class="bulk-select-check">
</span><span class="cx" style="display: block; padding: 0 10px"> <label for="<?php bp_the_members_invitation_property( 'id', 'attribute' ); ?>">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <input id="<?php bp_the_members_invitation_property( 'id', 'attribute' ); ?>" type="checkbox" name="network_invitations[]" value="<?php bp_the_members_invitation_property( 'id', 'attribute' ); ?>" class="invitation-check">
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <input id="<?php bp_the_members_invitation_property( 'id', 'attribute' ); ?>" type="checkbox" name="members_invitations[]" value="<?php bp_the_members_invitation_property( 'id', 'attribute' ); ?>" class="invitation-check">
</ins><span class="cx" style="display: block; padding: 0 10px"> <span class="bp-screen-reader-text">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px"> /* translators: accessibility text */
</span></span></pre></div>
<a id="trunksrcbptemplatesbpnouveaubuddypressmemberssingleinvitationssendinvitesphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-templates/bp-nouveau/buddypress/members/single/invitations/send-invites.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-templates/bp-nouveau/buddypress/members/single/invitations/send-invites.php 2021-05-14 05:23:02 UTC (rev 12950)
+++ trunk/src/bp-templates/bp-nouveau/buddypress/members/single/invitations/send-invites.php 2021-05-17 23:57:00 UTC (rev 12951)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -27,7 +27,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <label for="bp_members_invitation_message">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php esc_html_e( 'Add a personalized message to the invitation (optional)', 'buddypress' ); ?>
</span><span class="cx" style="display: block; padding: 0 10px"> </label>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <textarea id="bp_members_invitation_message" name="invite_message"></textarea>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <textarea id="bp_members_invitation_message" name="content"></textarea>
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <input type="hidden" name="action" value="send-invite">
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre>
</div>
</div>
</body>
</html>