<!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][13301] trunk/src: Introduce a function to only get the Friendship button arguments</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/13301">13301</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/13301","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>imath</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2022-07-22 10:50:40 +0000 (Fri, 22 Jul 2022)</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'>Introduce a function to only get the Friendship button arguments
`bp_get_add_friend_button_args()` eases the process of getting these arguments and removes the need for BP Nouveau's workaround.
Deprecate the `bp_nouveau_members_catch_button_args()` as no more needed.
Props hnla
See <a href="http://buddypress.trac.wordpress.org/ticket/7126">#7126</a>
See <a href="http://buddypress.trac.wordpress.org/ticket/8722">#8722</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcbpfriendsbpfriendstemplatephp">trunk/src/bp-friends/bp-friends-template.php</a></li>
<li><a href="#trunksrcbptemplatesbpnouveauincludesmembersfunctionsphp">trunk/src/bp-templates/bp-nouveau/includes/members/functions.php</a></li>
<li><a href="#trunksrcbptemplatesbpnouveauincludesmemberstemplatetagsphp">trunk/src/bp-templates/bp-nouveau/includes/members/template-tags.php</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunksrcbpcoredeprecated110php">trunk/src/bp-core/deprecated/11.0.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcbpcoredeprecated110php"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/src/bp-core/deprecated/11.0.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-core/deprecated/11.0.php (rev 0)
+++ trunk/src/bp-core/deprecated/11.0.php 2022-07-22 10:50:40 UTC (rev 13301)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,35 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Deprecated functions.
+ *
+ * @package BuddyPress
+ * @deprecated 11.0.0
+ */
+
+// Exit if accessed directly.
+if ( ! defined( 'ABSPATH' ) ) {
+ exit;
+}
+
+/**
+ * Catch the arguments for buttons
+ *
+ * @since 3.0.0
+ * @deprecated 11.0.0
+ *
+ * @param array $buttons The arguments of the button that BuddyPress is about to create.
+ *
+ * @return array An empty array to stop the button creation process.
+ */
+function bp_nouveau_members_catch_button_args( $button = array() ) {
+ _deprecated_function( __FUNCTION__, '11.0.0' );
+
+ /*
+ * Globalize the arguments so that we can use it
+ * in bp_nouveau_get_member_header_buttons().
+ */
+ bp_nouveau()->members->button_args = $button;
+
+ // return an empty array to stop the button creation process
+ return array();
+}
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/src/bp-core/deprecated/11.0.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunksrcbpfriendsbpfriendstemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-friends/bp-friends-template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-friends/bp-friends-template.php 2022-07-22 09:32:13 UTC (rev 13300)
+++ trunk/src/bp-friends/bp-friends-template.php 2022-07-22 10:50:40 UTC (rev 13301)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -360,31 +360,31 @@
</span><span class="cx" style="display: block; padding: 0 10px"> function bp_add_friend_button( $potential_friend_id = 0, $friend_status = false ) {
</span><span class="cx" style="display: block; padding: 0 10px"> echo bp_get_add_friend_button( $potential_friend_id, $friend_status );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Create the Add Friend button.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Build friend button arguments.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @since 1.1.0
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 11.0.0
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param int $potential_friend_id ID of the user to whom the button
- * applies. Default: value of {@link bp_get_potential_friend_id()}.
- * @param bool $friend_status Not currently used.
- * @return bool|string HTML for the Add Friend button. False if already friends.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int $potential_friend_id The user ID of the potential friend.
+ * @return array The friend button arguments.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function bp_get_add_friend_button( $potential_friend_id = 0, $friend_status = false ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function bp_get_add_friend_button_args( $potential_friend_id = 0 ) {
+ $button_args = array();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( empty( $potential_friend_id ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $potential_friend_id = bp_get_potential_friend_id( $potential_friend_id );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $is_friend = bp_is_friend( $potential_friend_id );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $friendship_status = bp_is_friend( $potential_friend_id );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( empty( $is_friend ) ) {
- return false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( empty( $friendship_status ) ) {
+ return $button_args;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- switch ( $is_friend ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ switch ( $friendship_status ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> case 'pending':
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $button = array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $button_args = array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'id' => 'pending',
</span><span class="cx" style="display: block; padding: 0 10px"> 'component' => 'friends',
</span><span class="cx" style="display: block; padding: 0 10px"> 'must_be_logged_in' => true,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -393,6 +393,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'wrapper_id' => 'friendship-button-' . $potential_friend_id,
</span><span class="cx" style="display: block; padding: 0 10px"> 'link_href' => wp_nonce_url( bp_loggedin_user_domain() . bp_get_friends_slug() . '/requests/cancel/' . $potential_friend_id . '/', 'friends_withdraw_friendship' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'link_text' => __( 'Cancel Friendship Request', 'buddypress' ),
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'link_title' => __( 'Cancel Friendship Requested', 'buddypress' ),
</ins><span class="cx" style="display: block; padding: 0 10px"> 'link_id' => 'friend-' . $potential_friend_id,
</span><span class="cx" style="display: block; padding: 0 10px"> 'link_rel' => 'remove',
</span><span class="cx" style="display: block; padding: 0 10px"> 'link_class' => 'friendship-button pending_friend requested',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -400,7 +401,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> case 'awaiting_response':
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $button = array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $button_args = array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'id' => 'awaiting_response',
</span><span class="cx" style="display: block; padding: 0 10px"> 'component' => 'friends',
</span><span class="cx" style="display: block; padding: 0 10px"> 'must_be_logged_in' => true,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -409,6 +410,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'wrapper_id' => 'friendship-button-' . $potential_friend_id,
</span><span class="cx" style="display: block; padding: 0 10px"> 'link_href' => bp_loggedin_user_domain() . bp_get_friends_slug() . '/requests/',
</span><span class="cx" style="display: block; padding: 0 10px"> 'link_text' => __( 'Friendship Requested', 'buddypress' ),
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'link_title' => __( 'Friendship Requested', 'buddypress' ),
</ins><span class="cx" style="display: block; padding: 0 10px"> 'link_id' => 'friend-' . $potential_friend_id,
</span><span class="cx" style="display: block; padding: 0 10px"> 'link_rel' => 'remove',
</span><span class="cx" style="display: block; padding: 0 10px"> 'link_class' => 'friendship-button awaiting_response_friend requested',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -416,7 +418,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> case 'is_friend':
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $button = array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $button_args = array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'id' => 'is_friend',
</span><span class="cx" style="display: block; padding: 0 10px"> 'component' => 'friends',
</span><span class="cx" style="display: block; padding: 0 10px"> 'must_be_logged_in' => true,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -425,6 +427,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'wrapper_id' => 'friendship-button-' . $potential_friend_id,
</span><span class="cx" style="display: block; padding: 0 10px"> 'link_href' => wp_nonce_url( bp_loggedin_user_domain() . bp_get_friends_slug() . '/remove-friend/' . $potential_friend_id . '/', 'friends_remove_friend' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'link_text' => __( 'Cancel Friendship', 'buddypress' ),
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'link_title' => __( 'Cancel Friendship', 'buddypress' ),
</ins><span class="cx" style="display: block; padding: 0 10px"> 'link_id' => 'friend-' . $potential_friend_id,
</span><span class="cx" style="display: block; padding: 0 10px"> 'link_rel' => 'remove',
</span><span class="cx" style="display: block; padding: 0 10px"> 'link_class' => 'friendship-button is_friend remove',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -432,7 +435,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> default:
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $button = array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $button_args = array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'id' => 'not_friends',
</span><span class="cx" style="display: block; padding: 0 10px"> 'component' => 'friends',
</span><span class="cx" style="display: block; padding: 0 10px"> 'must_be_logged_in' => true,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -441,6 +444,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'wrapper_id' => 'friendship-button-' . $potential_friend_id,
</span><span class="cx" style="display: block; padding: 0 10px"> 'link_href' => wp_nonce_url( bp_loggedin_user_domain() . bp_get_friends_slug() . '/add-friend/' . $potential_friend_id . '/', 'friends_add_friend' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'link_text' => __( 'Add Friend', 'buddypress' ),
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'link_title' => __( 'Add Friend', 'buddypress' ),
</ins><span class="cx" style="display: block; padding: 0 10px"> 'link_id' => 'friend-' . $potential_friend_id,
</span><span class="cx" style="display: block; padding: 0 10px"> 'link_rel' => 'add',
</span><span class="cx" style="display: block; padding: 0 10px"> 'link_class' => 'friendship-button not_friends add',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -453,11 +457,32 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 1.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $button HTML markup for add friend button.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $button_args Button arguments for add friend button.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return bp_get_button( apply_filters( 'bp_get_add_friend_button', $button ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return apply_filters( 'bp_get_add_friend_button', $button_args );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Create the Add Friend button.
+ *
+ * @since 1.1.0
+ * @since 11.0.0 uses `bp_get_add_friend_button_args()`.
+ *
+ * @param int $potential_friend_id ID of the user to whom the button
+ * applies. Default: value of {@link bp_get_potential_friend_id()}.
+ * @param bool $friend_status Not currently used.
+ * @return bool|string HTML for the Add Friend button. False if already friends.
+ */
+ function bp_get_add_friend_button( $potential_friend_id = 0, $friend_status = false ) {
+ $button_args = bp_get_add_friend_button_args( $potential_friend_id );
+
+ if ( ! array_filter( $button_args ) ) {
+ return false;
+ }
+
+ return bp_get_button( $button_args );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Get a comma-separated list of IDs of a user's friends.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span></span></pre></div>
<a id="trunksrcbptemplatesbpnouveauincludesmembersfunctionsphp"></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/includes/members/functions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-templates/bp-nouveau/includes/members/functions.php 2022-07-22 09:32:13 UTC (rev 13300)
+++ trunk/src/bp-templates/bp-nouveau/includes/members/functions.php 2022-07-22 10:50:40 UTC (rev 13301)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -158,26 +158,6 @@
</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"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Catch the arguments for buttons
- *
- * @since 3.0.0
- *
- * @param array $buttons The arguments of the button that BuddyPress is about to create.
- *
- * @return array An empty array to stop the button creation process.
- */
-function bp_nouveau_members_catch_button_args( $button = array() ) {
- /*
- * Globalize the arguments so that we can use it
- * in bp_nouveau_get_member_header_buttons().
- */
- bp_nouveau()->members->button_args = $button;
-
- // return an empty array to stop the button creation process
- return array();
-}
-
-/**
</del><span class="cx" style="display: block; padding: 0 10px"> * Catch the content hooked to the do_action hooks in single member header
</span><span class="cx" style="display: block; padding: 0 10px"> * and in the members loop.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span></span></pre></div>
<a id="trunksrcbptemplatesbpnouveauincludesmemberstemplatetagsphp"></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/includes/members/template-tags.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-templates/bp-nouveau/includes/members/template-tags.php 2022-07-22 09:32:13 UTC (rev 13300)
+++ trunk/src/bp-templates/bp-nouveau/includes/members/template-tags.php 2022-07-22 10:50:40 UTC (rev 13301)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -319,22 +319,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // It's any other members screen
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /*
- * This filter workaround is waiting for a core adaptation
- * so that we can directly get the friends button arguments
- * instead of the button.
- *
- * See https://buddypress.trac.wordpress.org/ticket/7126
- */
- add_filter( 'bp_get_add_friend_button', 'bp_nouveau_members_catch_button_args', 100, 1 );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $button_args = bp_get_add_friend_button_args( $user_id );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- bp_get_add_friend_button( $user_id );
-
- remove_filter( 'bp_get_add_friend_button', 'bp_nouveau_members_catch_button_args', 100, 1 );
-
- if ( isset( bp_nouveau()->members->button_args ) && bp_nouveau()->members->button_args ) {
- $button_args = bp_nouveau()->members->button_args;
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $button_args ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $buttons['member_friendship'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'id' => 'member_friendship',
</span><span class="cx" style="display: block; padding: 0 10px"> 'position' => 5,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -343,6 +330,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'block_self' => $button_args['block_self'],
</span><span class="cx" style="display: block; padding: 0 10px"> 'parent_element' => $parent_element,
</span><span class="cx" style="display: block; padding: 0 10px"> 'link_text' => $button_args['link_text'],
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'link_title' => $button_args['link_title'],
</ins><span class="cx" style="display: block; padding: 0 10px"> 'parent_attr' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'id' => $button_args['wrapper_id'],
</span><span class="cx" style="display: block; padding: 0 10px"> 'class' => $parent_class . ' ' . $button_args['wrapper_class'],
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -363,8 +351,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $buttons['member_friendship']['button_element'] = 'a';
</span><span class="cx" style="display: block; padding: 0 10px"> $buttons['member_friendship']['button_attr']['href'] = $button_args['link_href'];
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- unset( bp_nouveau()->members->button_args );
</del><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>
</div>
</body>
</html>