<!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][11808] trunk/src: XProfile: use `bp_get_admin_url()` where appropriate.</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 { 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/11808">11808</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/11808","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>johnjamesjacoby</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2018-01-10 21:34:15 +0000 (Wed, 10 Jan 2018)</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'>XProfile: use `bp_get_admin_url()` where appropriate.
This change updates all inline and querystring-based URL references to `users.php` to instead use the built-in supplied wrapper function. This comes with a few benefits:
* URLs will be consistent across BuddyPress installation configurations (rather than relative to the current admin dashboard area)
* Code is cleaner and easier to understand
* Variable IDs are now cast to integers as needed (where they were not all previously)
Bonus: also updates a few `bp_get_admin_url()` calls in the about page to use the second parameter of `add_query_arg()` rather than wrapping it entirely, to match the expected usage format of all `add_query_arg()` calls.
Fixes <a href="http://buddypress.trac.wordpress.org/ticket/7536">#7536</a>. Props JohnPBloch.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcbpcoreclassesclassbpadminphp">trunk/src/bp-core/classes/class-bp-admin.php</a></li>
<li><a href="#trunksrcbpxprofilebpxprofileadminphp">trunk/src/bp-xprofile/bp-xprofile-admin.php</a></li>
<li><a href="#trunksrcbpxprofileclassesclassbpxprofilefieldphp">trunk/src/bp-xprofile/classes/class-bp-xprofile-field.php</a></li>
<li><a href="#trunksrcbpxprofileclassesclassbpxprofilegroupphp">trunk/src/bp-xprofile/classes/class-bp-xprofile-group.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcbpcoreclassesclassbpadminphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-core/classes/class-bp-admin.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-core/classes/class-bp-admin.php 2018-01-10 19:34:35 UTC (rev 11807)
+++ trunk/src/bp-core/classes/class-bp-admin.php 2018-01-10 21:34:15 UTC (rev 11808)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -576,16 +576,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <h4><?php _e( 'Administration Tools', 'buddypress' ); ?></h4>
</span><span class="cx" style="display: block; padding: 0 10px"> <ul>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php if ( bp_is_active( 'members' ) ) : ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add User Profile Fields', 'buddypress' ) . '</a>', esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'bp-profile-setup' ), 'users.php' ) ) ) ); ?></li>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add User Profile Fields', 'buddypress' ) . '</a>', esc_url( add_query_arg( array( 'page' => 'bp-profile-setup' ), bp_get_admin_url( 'users.php' ) ) ) ); ?></li>
</ins><span class="cx" style="display: block; padding: 0 10px"> <?php endif; ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Manage User Signups', 'buddypress' ) . '</a>', esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'bp-signups' ), 'users.php' ) ) ) ); ?></li>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Manage User Signups', 'buddypress' ) . '</a>', esc_url( add_query_arg( array( 'page' => 'bp-signups' ), bp_get_admin_url( 'users.php' ) ) ) ); ?></li>
</ins><span class="cx" style="display: block; padding: 0 10px"> <?php if ( bp_is_active( 'activity' ) ) : ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Moderate Activity Streams', 'buddypress' ) . '</a>', esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'bp-activity' ), 'admin.php' ) ) ) ); ?></li>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Moderate Activity Streams', 'buddypress' ) . '</a>', esc_url( add_query_arg( array( 'page' => 'bp-activity' ), bp_get_admin_url( 'admin.php' ) ) ) ); ?></li>
</ins><span class="cx" style="display: block; padding: 0 10px"> <?php endif; ?>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php if ( bp_is_active( 'groups' ) ) : ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Manage Groups', 'buddypress' ) . '</a>', esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'bp-groups' ), 'admin.php' ) ) ) ); ?></li>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Manage Groups', 'buddypress' ) . '</a>', esc_url( add_query_arg( array( 'page' => 'bp-groups' ), bp_get_admin_url( 'admin.php' ) ) ) ); ?></li>
</ins><span class="cx" style="display: block; padding: 0 10px"> <?php endif; ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Repair Data', 'buddypress' ) . '</a>', esc_url( bp_get_admin_url( add_query_arg( array( 'page' => 'bp-tools' ), 'tools.php' ) ) ) ); ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Repair Data', 'buddypress' ) . '</a>', esc_url( add_query_arg( array( 'page' => 'bp-tools' ), bp_get_admin_url( 'tools.php' ) ) ) ); ?>
</ins><span class="cx" style="display: block; padding: 0 10px"> </li>
</span><span class="cx" style="display: block; padding: 0 10px"> </ul>
</span><span class="cx" style="display: block; padding: 0 10px"> </div>
</span></span></pre></div>
<a id="trunksrcbpxprofilebpxprofileadminphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-xprofile/bp-xprofile-admin.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-xprofile/bp-xprofile-admin.php 2018-01-10 19:34:35 UTC (rev 11807)
+++ trunk/src/bp-xprofile/bp-xprofile-admin.php 2018-01-10 21:34:15 UTC (rev 11808)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -124,6 +124,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function xprofile_admin_screen( $message = '', $type = 'error' ) {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Users admin URL
+ $url = bp_get_admin_url( 'users.php' );
+
+ // Add Group
+ $add_group_url = add_query_arg( array(
+ 'page' => 'bp-profile-setup',
+ 'mode' => 'add_group'
+ ), $url );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // Validate type.
</span><span class="cx" style="display: block; padding: 0 10px"> $type = preg_replace( '|[^a-z]|i', '', $type );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -137,7 +146,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <h1 class="wp-heading-inline"><?php _ex( 'Profile Fields', 'Settings page header', 'buddypress'); ?></h1>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <a id="add_group" class="page-title-action" href="users.php?page=bp-profile-setup&mode=add_group"><?php _e( 'Add New Field Group', 'buddypress' ); ?></a>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <a id="add_group" class="page-title-action" href="<?php echo esc_url( $add_group_url ); ?>"><?php _e( 'Add New Field Group', 'buddypress' ); ?></a>
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <hr class="wp-header-end">
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -145,7 +154,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <h1>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php _ex( 'Profile Fields', 'Settings page header', 'buddypress'); ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <a id="add_group" class="add-new-h2" href="users.php?page=bp-profile-setup&mode=add_group"><?php _e( 'Add New Field Group', 'buddypress' ); ?></a>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <a id="add_group" class="add-new-h2" href="<?php echo esc_url( $add_group_url ); ?>"><?php _e( 'Add New Field Group', 'buddypress' ); ?></a>
</ins><span class="cx" style="display: block; padding: 0 10px"> </h1>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php endif; ?>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -189,8 +198,29 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> </ul>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <?php if ( !empty( $groups ) ) : foreach ( $groups as $group ) : ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <?php if ( !empty( $groups ) ) : foreach ( $groups as $group ) :
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Add Field to Group URL
+ $add_field_url = add_query_arg( array(
+ 'page' => 'bp-profile-setup',
+ 'mode' => 'add_field',
+ 'group_id' => (int) $group->id
+ ), $url );
+
+ // Edit Group URL
+ $edit_group_url = add_query_arg( array(
+ 'page' => 'bp-profile-setup',
+ 'mode' => 'edit_group',
+ 'group_id' => (int) $group->id
+ ), $url );
+
+ // Delete Group URL
+ $delete_group_url = wp_nonce_url( add_query_arg( array(
+ 'page' => 'bp-profile-setup',
+ 'mode' => 'delete_group',
+ 'group_id' => (int) $group->id
+ ), $url ), 'bp_xprofile_delete_group' ); ?>
+
</ins><span class="cx" style="display: block; padding: 0 10px"> <noscript>
</span><span class="cx" style="display: block; padding: 0 10px"> <h3><?php
</span><span class="cx" style="display: block; padding: 0 10px"> /** This filter is documented in bp-xprofile/bp-xprofile-template.php */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -201,13 +231,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <div id="tabs-<?php echo esc_attr( $group->id ); ?>" class="tab-wrapper">
</span><span class="cx" style="display: block; padding: 0 10px"> <div class="tab-toolbar">
</span><span class="cx" style="display: block; padding: 0 10px"> <div class="tab-toolbar-left">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <a class="button-primary" href="users.php?page=bp-profile-setup&group_id=<?php echo esc_attr( $group->id ); ?>&mode=add_field"><?php _e( 'Add New Field', 'buddypress' ); ?></a>
- <a class="button edit" href="users.php?page=bp-profile-setup&mode=edit_group&group_id=<?php echo esc_attr( $group->id ); ?>"><?php _ex( 'Edit Group', 'Edit Profile Fields Group', 'buddypress' ); ?></a>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <a class="button-primary" href="<?php echo esc_url( $add_field_url ); ?>"><?php _e( 'Add New Field', 'buddypress' ); ?></a>
+ <a class="button edit" href="<?php echo esc_url( $edit_group_url ); ?>"><?php _ex( 'Edit Group', 'Edit Profile Fields Group', 'buddypress' ); ?></a>
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php if ( $group->can_delete ) : ?>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <div class="delete-button">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <a class="confirm submitdelete deletion ajax-option-delete" href="<?php echo esc_url( wp_nonce_url( 'users.php?page=bp-profile-setup&mode=delete_group&group_id=' . intval( $group->id ), 'bp_xprofile_delete_group' ) ); ?>"><?php _ex( 'Delete Group', 'Delete Profile Fields Group', 'buddypress' ); ?></a>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <a class="confirm submitdelete deletion ajax-option-delete" href="<?php echo esc_url( $delete_group_url ); ?>"><?php _ex( 'Delete Group', 'Delete Profile Fields Group', 'buddypress' ); ?></a>
</ins><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php endif; ?>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -283,7 +313,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php endforeach; else : ?>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <div id="message" class="error"><p><?php _ex( 'You have no groups.', 'You have no profile fields groups.', 'buddypress' ); ?></p></div>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <p><a href="users.php?page=bp-profile-setup&mode=add_group"><?php _ex( 'Add New Group', 'Add New Profile Fields Group', 'buddypress' ); ?></a></p>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <p><a href="<?php echo esc_url( $add_group_url ); ?>"><?php _ex( 'Add New Group', 'Add New Profile Fields Group', 'buddypress' ); ?></a></p>
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php endif; ?>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -619,36 +649,34 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $field = $admin_field;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $field_edit_url = add_query_arg(
- array(
- 'page' => 'bp-profile-setup',
- 'group_id' => (int) $field->group_id,
- 'field_id' => (int) $field->id,
- 'mode' => 'edit_field'
- ),
- bp_get_admin_url( 'users.php' )
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Users admin URL
+ $url = bp_get_admin_url( 'users.php' );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Edit
+ $field_edit_url = add_query_arg( array(
+ 'page' => 'bp-profile-setup',
+ 'mode' => 'edit_field',
+ 'group_id' => (int) $field->group_id,
+ 'field_id' => (int) $field->id
+ ), $url );
+
+ // Delete
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( $field->can_delete ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $field_delete_url = add_query_arg(
- array(
- 'page' => 'bp-profile-setup',
- 'field_id' => (int) $field->id,
- 'mode' => 'delete_field'
- ),
- bp_get_admin_url( 'users.php' ) . '#tabs-' . (int) $field->group_id
- );
- }
- ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $field_delete_url = add_query_arg( array(
+ 'page' => 'bp-profile-setup',
+ 'mode' => 'delete_field',
+ 'field_id' => (int) $field->id
+ ), $url . '#tabs-' . (int) $field->group_id );
+ } ?>
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <fieldset id="draggable_field_<?php echo esc_attr( $field->id ); ?>" class="sortable<?php echo ' ' . $field->type; if ( !empty( $class ) ) echo ' ' . $class; ?>">
</span><span class="cx" style="display: block; padding: 0 10px"> <legend>
</span><span class="cx" style="display: block; padding: 0 10px"> <span>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php bp_the_profile_field_name(); ?>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <?php if ( empty( $field->can_delete ) ) : ?><?php esc_html_e( '(Primary)', 'buddypress' ); endif; ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <?php if ( empty( $field->can_delete ) ) : ?><?php esc_html_e( '(Primary)', 'buddypress' ); endif; ?>
</ins><span class="cx" style="display: block; padding: 0 10px"> <?php bp_the_profile_field_required_label(); ?>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <?php if ( bp_xprofile_get_meta( $field->id, 'field', 'signup_position' ) ) : ?><?php esc_html_e( '(Sign-up)', 'buddypress' ); endif; ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <?php if ( bp_xprofile_get_meta( $field->id, 'field', 'signup_position' ) ) : ?><?php esc_html_e( '(Sign-up)', 'buddypress' ); endif; ?>
</ins><span class="cx" style="display: block; padding: 0 10px"> <?php if ( bp_get_member_types() ) : echo $field->get_member_type_label(); endif; ?>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span></span></pre></div>
<a id="trunksrcbpxprofileclassesclassbpxprofilefieldphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-xprofile/classes/class-bp-xprofile-field.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-xprofile/classes/class-bp-xprofile-field.php 2018-01-10 19:34:35 UTC (rev 11807)
+++ trunk/src/bp-xprofile/classes/class-bp-xprofile-field.php 2018-01-10 21:34:15 UTC (rev 11808)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1163,10 +1163,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $message Message to display.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function render_admin_form( $message = '' ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ // Users Admin URL
+ $users_url = bp_get_admin_url( 'users.php' );
+
+ // Add New
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( empty( $this->id ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $title = __( 'Add New Field', 'buddypress' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $action = "users.php?page=bp-profile-setup&group_id=" . $this->group_id . "&mode=add_field#tabs-" . $this->group_id;
- $button = __( 'Save', 'buddypress' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $button = __( 'Save', 'buddypress' );
+ $action = add_query_arg( array(
+ 'page' => 'bp-profile-setup',
+ 'mode' => 'add_field',
+ 'group_id' => (int) $this->group_id
+ ), $users_url . '#tabs-' . (int) $this->group_id );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( !empty( $_POST['saveField'] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->name = $_POST['title'];
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1179,10 +1188,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->order_by = $_POST["sort_order_{$this->type}"];
</span><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">+
+ // Edit
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> $title = __( 'Edit Field', 'buddypress' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $action = "users.php?page=bp-profile-setup&mode=edit_field&group_id=" . $this->group_id . "&field_id=" . $this->id . "#tabs-" . $this->group_id;
- $button = __( 'Update', 'buddypress' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $button = __( 'Update', 'buddypress' );
+ $action = add_query_arg( array(
+ 'page' => 'bp-profile-setup',
+ 'mode' => 'edit_field',
+ 'group_id' => (int) $this->group_id,
+ 'field_id' => (int) $this->id
+ ), $users_url . '#tabs-' . (int) $this->group_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"> <div class="wrap">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1286,6 +1302,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> private function submit_metabox( $button_text = '' ) {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Setup the URL for deleting
+ $users_url = bp_get_admin_url( 'users.php' );
+ $cancel_url = add_query_arg( array(
+ 'page' => 'bp-profile-setup'
+ ), $users_url );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Fires before XProfile Field submit metabox.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1323,7 +1345,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php endif; ?>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <div id="delete-action">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <a href="users.php?page=bp-profile-setup" class="deletion"><?php esc_html_e( 'Cancel', 'buddypress' ); ?></a>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <a href="<?php echo esc_url( $cancel_url ); ?>" class="deletion"><?php esc_html_e( 'Cancel', 'buddypress' ); ?></a>
</ins><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php wp_nonce_field( 'xprofile_delete_option' ); ?>
</span></span></pre></div>
<a id="trunksrcbpxprofileclassesclassbpxprofilegroupphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-xprofile/classes/class-bp-xprofile-group.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-xprofile/classes/class-bp-xprofile-group.php 2018-01-10 19:34:35 UTC (rev 11807)
+++ trunk/src/bp-xprofile/classes/class-bp-xprofile-group.php 2018-01-10 21:34:15 UTC (rev 11808)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -716,17 +716,32 @@
</span><span class="cx" style="display: block; padding: 0 10px"> public function render_admin_form() {
</span><span class="cx" style="display: block; padding: 0 10px"> global $message;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Users Admin URL
+ $users_url = bp_get_admin_url( 'users.php' );
+
+ // URL to cancel to
+ $cancel_url = add_query_arg( array(
+ 'page' => 'bp-profile-setup'
+ ), $users_url );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // New field group.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( empty( $this->id ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $title = __( 'Add New Field Group', 'buddypress' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $action = add_query_arg( array( 'page' => 'bp-profile-setup', 'mode' => 'add_group' ), 'users.php' );
- $button = __( 'Save', 'buddypress' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $button = __( 'Save', 'buddypress' );
+ $action = add_query_arg( array(
+ 'page' => 'bp-profile-setup',
+ 'mode' => 'add_group'
+ ), $users_url );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Existing field group.
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> $title = __( 'Edit Field Group', 'buddypress' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $action = add_query_arg( array( 'page' => 'bp-profile-setup', 'mode' => 'edit_group', 'group_id' => $this->id ), 'users.php' );
- $button = __( 'Update', 'buddypress' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $button = __( 'Update', 'buddypress' );
+ $action = add_query_arg( array(
+ 'page' => 'bp-profile-setup',
+ 'mode' => 'edit_group',
+ 'group_id' => (int) $this->id
+ ), $users_url );
</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"> <div class="wrap">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -813,7 +828,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <input type="submit" name="save_group" value="<?php echo esc_attr( $button ); ?>" class="button-primary"/>
</span><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><span class="cx" style="display: block; padding: 0 10px"> <div id="delete-action">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <a href="users.php?page=bp-profile-setup" class="deletion"><?php _e( 'Cancel', 'buddypress' ); ?></a>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <a href="<?php echo esc_url( $cancel_url ); ?>" class="deletion"><?php _e( 'Cancel', 'buddypress' ); ?></a>
</ins><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><span class="cx" style="display: block; padding: 0 10px"> <div class="clear"></div>
</span><span class="cx" style="display: block; padding: 0 10px"> </div>
</span></span></pre>
</div>
</div>
</body>
</html>