| 1 |
<?php |
| 2 |
/** |
| 3 |
* This template contains the Friends Settings. |
| 4 |
* |
| 5 |
* @package Friends |
| 6 |
*/ |
| 7 |
|
| 8 |
$comment_registration_class = ''; |
| 9 |
if ( ! $args['comment_registration'] ) { |
| 10 |
$comment_registration_class = 'hidden'; |
| 11 |
} |
| 12 |
|
| 13 |
$codeword_class = ''; |
| 14 |
if ( 'friends' === $args['codeword'] || ! $args['require_codeword'] ) { |
| 15 |
$codeword_class = 'hidden'; |
| 16 |
} |
| 17 |
|
| 18 |
do_action( 'friends_settings_before_form' ); |
| 19 |
|
| 20 |
?> |
| 21 |
<form method="post"> |
| 22 |
<?php wp_nonce_field( 'friends-settings' ); ?> |
| 23 |
<table class="form-table"> |
| 24 |
<tbody> |
| 25 |
<?php if ( current_user_can( 'manage_options' ) ) : ?> |
| 26 |
<tr> |
| 27 |
<th scope="row"><?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_html_e( 'Comments' ); ?></th> |
| 28 |
<td> |
| 29 |
<fieldset> |
| 30 |
<label for="comment_registration"> |
| 31 |
<input name="comment_registration" type="checkbox" id="comment_registration" value="1" <?php checked( '1', $args['comment_registration'] ); ?> /> |
| 32 |
<span><?php esc_html_e( 'Only people in your network can comment.', 'friends' ); ?></span> |
| 33 |
</label> |
| 34 |
</fieldset> |
| 35 |
<div id="comment_registration_options" class="<?php echo esc_attr( $comment_registration_class ); ?>"> |
| 36 |
<fieldset> |
| 37 |
<label for="comment_registration_message"> |
| 38 |
<p><?php esc_html_e( 'Display this message for logged-out users:', 'friends' ); ?></p> |
| 39 |
</label> |
| 40 |
<p> |
| 41 |
<textarea name="comment_registration_message" id="comment_registration_message" class="regular-text" rows="3" cols="80" placeholder="<?php echo esc_attr( $args['comment_registration_default'] ); ?>"><?php echo esc_html( $args['comment_registration_message'] ); ?></textarea> |
| 42 |
</p> |
| 43 |
<p class="description"> |
| 44 |
<?php |
| 45 |
echo wp_kses( |
| 46 |
sprintf( |
| 47 |
// translators: %1$s is the translation for "my network", %2$s is the URL for your public profile page. |
| 48 |
__( 'We\'ll link "%1$s" to <a href=%2$s>your public profile page</a>.', 'friends' ), |
| 49 |
$args['my_network'], |
| 50 |
$args['public_profile_link'] |
| 51 |
), |
| 52 |
array( |
| 53 |
'a' => array( |
| 54 |
'href' => array(), |
| 55 |
), |
| 56 |
) |
| 57 |
); |
| 58 |
?> |
| 59 |
</p> |
| 60 |
</fieldset> |
| 61 |
</div> |
| 62 |
</td> |
| 63 |
</tr> |
| 64 |
<?php |
| 65 |
endif; |
| 66 |
if ( $args['potential_main_users']->get_total() > 1 ) : |
| 67 |
?> |
| 68 |
<tr> |
| 69 |
<th scope="row"><?php esc_html_e( 'Main Friend User', 'friends' ); ?></th> |
| 70 |
<td> |
| 71 |
<?php if ( current_user_can( 'manage_options' ) ) { ?> |
| 72 |
<select name="main_user_id"> |
| 73 |
<?php foreach ( $args['potential_main_users']->get_results() as $potential_main_user ) : ?> |
| 74 |
<option value="<?php echo esc_attr( $potential_main_user->ID ); ?>" <?php selected( $args['main_user_id'], $potential_main_user->ID ); ?>><?php echo esc_html( $potential_main_user->display_name ); ?></option> |
| 75 |
|
| 76 |
<?php endforeach; ?> |
| 77 |
</select> |
| 78 |
<p class="description"><span><?php esc_html_e( 'Since there are multiple users on this site, we need to know which one should be considered the main one.', 'friends' ); ?></span> <span><?php esc_html_e( 'They can edit friends-related settings.', 'friends' ); ?></span> <span><?php esc_html_e( 'Whenever a friends-related action needs to be associated with a user, this one will be chosen.', 'friends' ); ?></span></p> |
| 79 |
<?php |
| 80 |
} else { |
| 81 |
$c = 0; |
| 82 |
foreach ( $args['potential_main_users']->get_results() as $potential_main_user ) { |
| 83 |
++$c; |
| 84 |
if ( $potential_main_user->ID === $args['main_user_id'] ) { |
| 85 |
?> |
| 86 |
<span id="main_user_id"><?php echo esc_html( $potential_main_user->display_name ); ?></span> |
| 87 |
<?php |
| 88 |
} |
| 89 |
} |
| 90 |
?> |
| 91 |
<span> ( |
| 92 |
<?php |
| 93 |
echo esc_html( |
| 94 |
sprintf( |
| 95 |
// translators: %s is a number of users. |
| 96 |
_n( '%s potential user', '%s potential users', $c, 'friends' ), |
| 97 |
$c |
| 98 |
) |
| 99 |
); |
| 100 |
?> |
| 101 |
) </span> |
| 102 |
<p class="description"><?php esc_html_e( 'An administrator can change this.', 'friends' ); ?></p> |
| 103 |
<?php |
| 104 |
} |
| 105 |
?> |
| 106 |
</td> |
| 107 |
</tr> |
| 108 |
<?php |
| 109 |
endif; |
| 110 |
?> |
| 111 |
<tr> |
| 112 |
<th scope="row"><?php esc_html_e( 'Friend Requests', 'friends' ); ?></th> |
| 113 |
<td> |
| 114 |
<fieldset> |
| 115 |
<label for="require_codeword"> |
| 116 |
<input name="require_codeword" type="checkbox" id="require_codeword" value="1" <?php checked( '', $codeword_class ); ?>> |
| 117 |
<span><?php esc_html_e( 'Require a code word to send you friend request', 'friends' ); ?></span> |
| 118 |
</label> |
| 119 |
</fieldset> |
| 120 |
<div id="codeword_options" class="<?php echo esc_attr( $codeword_class ); ?>"> |
| 121 |
<fieldset> |
| 122 |
<label for="codeword"> |
| 123 |
<span><?php esc_html_e( 'This code word must be provided to send you a friend request:', 'friends' ); ?></span> |
| 124 |
<input name="codeword" type="text" id="codeword" placeholder="friends" value="<?php echo esc_attr( $args['codeword'] ); ?>" /> |
| 125 |
</label> |
| 126 |
<p class="description"> |
| 127 |
<?php esc_html_e( "You'll need to communicate the code word to potential friends through another medium.", 'friends' ); ?> |
| 128 |
</p> |
| 129 |
</fieldset> |
| 130 |
<fieldset> |
| 131 |
<label for="wrong_codeword_message"> |
| 132 |
<p><?php esc_html_e( 'Error message for a wrong code word:', 'friends' ); ?></p> |
| 133 |
</label> |
| 134 |
<p> |
| 135 |
<textarea name="wrong_codeword_message" id="wrong_codeword_message" class="regular-text" rows="3" cols="80" placeholder="<?php echo esc_attr( __( 'Return this message to the friend requestor if a wrong code word was provided.', 'friends' ) ); ?>"><?php echo esc_html( $args['wrong_codeword_message'] ); ?></textarea> |
| 136 |
</p> |
| 137 |
</fieldset> |
| 138 |
</div> |
| 139 |
</td> |
| 140 |
</tr> |
| 141 |
<tr> |
| 142 |
<th scope="row"><?php esc_html_e( 'Roles', 'friends' ); ?></th> |
| 143 |
<td> |
| 144 |
<select name="default_role"> |
| 145 |
<?php |
| 146 |
foreach ( $args['friend_roles'] as $_role => $_title ) : |
| 147 |
?> |
| 148 |
<option value="<?php echo esc_attr( $_role ); ?>" <?php selected( $args['default_role'], $_role ); ?>><?php echo esc_html( $_title ); ?></option> |
| 149 |
|
| 150 |
<?php endforeach; ?> |
| 151 |
</select> |
| 152 |
<p class="description"> |
| 153 |
<span><?php esc_html_e( 'When accepting a friend request, first assign this role.', 'friends' ); ?></span> |
| 154 |
<span><?php esc_html_e( 'An Acquaintance has friend status but cannot read private posts.', 'friends' ); ?></span> |
| 155 |
</p> |
| 156 |
</td> |
| 157 |
</tr> |
| 158 |
</tbody> |
| 159 |
</table> |
| 160 |
<?php do_action( 'friends_settings_form_bottom' ); ?> |
| 161 |
<p class="submit"> |
| 162 |
<input type="submit" id="submit" class="button button-primary" value="<?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_html_e( 'Save Changes' ); ?>"> |
| 163 |
</p> |
| 164 |
<?php if ( ! current_user_can( 'manage_options' ) ) : ?> |
| 165 |
<p class="description"> |
| 166 |
<?php esc_html_e( 'Administrators have access to these additional settings:', 'friends' ); ?> |
| 167 |
<ul class="ul-disc"> |
| 168 |
<?php |
| 169 |
foreach ( array( |
| 170 |
__( 'Comments' ), // phpcs:ignore WordPress.WP.I18n.MissingArgDomain |
| 171 |
__( 'Post Formats', 'friends' ), |
| 172 |
) as $setting ) : |
| 173 |
?> |
| 174 |
<li><?php echo esc_html( $setting ); ?></li> |
| 175 |
<?php endforeach; ?> |
| 176 |
</ul> |
| 177 |
</p> |
| 178 |
<?php endif; ?> |
| 179 |
</form> |
| 180 |
<?php |
| 181 |
do_action( 'friends_settings_after_form' ); |
| 182 |
|