PluginProbe
Friends / 2.8.7
Friends v2.8.7
4.3.2 4.3.1 4.3.0 4.2.2 4.2.1 4.2.0 4.1.0 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.8.9 2.9.0 2.9.1 All 88 releases
friends / templates / admin / edit-friend.php

edit-friend.php in Friends 2.8.7, at templates/admin/edit-friend.php

167 lines 10.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * This template contains the friend editor.
4 *
5 * @version 1.0
6 * @package Friends
7 */
8
9 $available_avatars = apply_filters( 'friends_potential_avatars', array(), $args['friend'] );
10
11 ?><form method="post">
12 <?php wp_nonce_field( 'edit-friend-' . $args['friend']->user_login ); ?>
13 <table class="form-table">
14 <tbody>
15 <tr>
16 <th><label for="friends_avatar"><?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_html_e( 'Avatar' ); ?></label></th>
17 <td>
18 <?php echo get_avatar( $args['friend']->user_login ); ?>
19 </td>
20 </tr>
21 <tr>
22 <th><label for="friends_set_avatar"><?php esc_html_e( 'Update Avatar', 'friends' ); ?></label></th>
23 <td id="friend-avatar-setting">
24 <?php
25 foreach ( $available_avatars as $avatar => $title ) {
26 ?>
27 <a href="" data-nonce="<?php echo esc_attr( wp_create_nonce( 'set-avatar-' . $args['friend']->ID ) ); ?>" data-id="<?php echo esc_attr( $args['friend']->ID ); ?>" class="set-avatar"><img src="<?php echo esc_url( $avatar ); ?>" alt="<?php echo esc_attr( $title ); ?>" title="<?php echo esc_attr( $title ); ?>" width="32" height="32" /></a>
28 <?php
29 }
30 if ( ! empty( $available_avatars ) ) :
31 ?>
32 <p class="description">
33 <?php esc_html_e( 'Click to set as new avatar.', 'friends' ); ?><br/>
34 </p>
35 <?php else : ?>
36 <input type="url" id="new-avatar-url" placeholder="<?php esc_attr_e( 'Enter an image URL', 'friends' ); ?>" data-nonce="<?php echo esc_attr( wp_create_nonce( 'set-avatar-' . $args['friend']->ID ) ); ?>" data-id="<?php echo esc_attr( $args['friend']->ID ); ?>" value="<?php echo esc_attr( $args['friend']->get_avatar_url() ); ?>"/>
37 <button id='set-avatar-url'><?php esc_html_e( 'Use this URL', 'friends' ); ?></button>
38 <p class="description">
39 <?php esc_html_e( 'Please specify a square, not too large image URL here.', 'friends' ); ?><br/>
40 </p>
41 <?php endif; ?>
42 </td>
43 </tr>
44
45 <?php do_action( 'friends_edit_friend_after_avatar', $args['friend'] ); ?>
46 <tr>
47 <th><label for="friends_display_name"><?php esc_html_e( 'Display Name', 'friends' ); ?></label></th>
48 <td><input type="text" name="friends_display_name" id="friends_display_name" value="<?php echo esc_attr( $args['friend']->display_name ); ?>" class="regular-text" /> <p class="description"><?php esc_html_e( 'Careful, your friend can discover this.', 'friends' ); ?></p></td>
49 </tr>
50 <tr>
51 <th><label for="friends_description"><?php esc_html_e( 'Description', 'friends' ); ?></label></th>
52 <td><textarea name="friends_description" id="friends_description" rows="5" cols="30"><?php echo esc_html( $args['friend']->description ); ?></textarea><p class="description"><?php esc_html_e( 'Careful, your friend can discover this.', 'friends' ); ?></p></td>
53 </tr>
54 <tr>
55 <th><label for="url"><?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_html_e( 'URL' ); ?></label></th>
56 <td><input type="text" name="user_url" value="<?php echo esc_attr( $args['friend']->user_url ); ?>" class="regular-text" /></td>
57 </tr>
58 <tr>
59 <th><?php esc_html_e( 'Created', 'friends' ); ?></th>
60 <td><?php echo esc_html( date_i18n( /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ __( 'F j, Y g:i a' ), strtotime( $args['friend']->user_registered ) ) ); ?></td>
61 </tr>
62 <tr>
63 <th><label for="status"><?php echo esc_html( _x( 'Type', 'of user', 'friends' ) ); ?></label></th>
64 <td>
65 <?php if ( $args['friend'] instanceof Friends\Subscription ) : ?>
66 <?php esc_html_e( 'Virtual User', 'friends' ); ?>
67 <?php if ( apply_filters( 'friends_debug', false ) ) : ?>
68 <span class="info">ID: <?php echo esc_html( $args['friend']->get_term_id() ); ?></span>
69 <?php endif; ?>
70 <p class="description">
71 <a href="<?php echo esc_url( wp_nonce_url( add_query_arg( '_wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), self_admin_url( 'admin.php?page=edit-friend&user=' . $args['friend']->user_login ) ), 'convert-to-user-' . $args['friend']->user_login, 'convert-to-user' ) ); ?>"><?php esc_html_e( 'Convert to User', 'friends' ); ?></a>
72 </p>
73 <?php else : ?>
74 <?php esc_html_e( 'User', 'friends' ); ?>
75 <?php if ( apply_filters( 'friends_debug', false ) ) : ?>
76 <span class="info">ID: <?php echo esc_html( $args['friend']->ID ); ?></span>
77 <?php endif; ?>
78 <p class="description">
79 <?php if ( $args['friend']->has_cap( 'friend' ) || $args['friend']->has_cap( 'pending_friend_request' ) || $args['friend']->has_cap( 'friend_request' ) ) : ?>
80 <?php else : ?>
81 <a href="<?php echo esc_url( wp_nonce_url( add_query_arg( '_wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), self_admin_url( 'admin.php?page=edit-friend&user=' . $args['friend']->user_login ) ), 'convert-from-user-' . $args['friend']->user_login, 'convert-from-user' ) ); ?>"><?php esc_html_e( 'Convert to Virtual User', 'friends' ); ?></a>
82 <?php endif; ?>
83 </p>
84 <?php endif; ?>
85 </td>
86 </tr>
87 <tr>
88 <th><label for="status"><?php esc_html_e( 'Status', 'friends' ); ?></label></th>
89 <td>
90 <?php echo esc_html( $args['friend']->get_role_name() ); ?>
91 <?php if ( $args['friend']->has_cap( 'friend_request' ) ) : ?>
92 <p class="description">
93 <a href="<?php echo esc_url( wp_nonce_url( add_query_arg( '_wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), self_admin_url( 'admin.php?page=edit-friend&user=' . $args['friend']->user_login ) ), 'accept-friend-request-' . $args['friend']->user_login, 'accept-friend-request' ) ); ?>"><?php esc_html_e( 'Accept Friend Request', 'friends' ); ?></a>
94 </p>
95 <?php elseif ( $args['friend']->has_cap( 'pending_friend_request' ) ) : ?>
96 <p class="description">
97 <a href="<?php echo esc_url( wp_nonce_url( add_query_arg( '_wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), self_admin_url( 'admin.php?page=edit-friend&user=' . $args['friend']->user_login ) ), 'add-friend-' . $args['friend']->user_login, 'add-friend' ) ); ?>"><?php esc_html_e( 'Resend Friend Request', 'friends' ); ?></a>
98 </p>
99 <?php elseif ( $args['friend']->has_cap( 'subscription' ) ) : ?>
100 <p class="description">
101 <a href="<?php echo esc_url( wp_nonce_url( add_query_arg( '_wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), self_admin_url( 'admin.php?page=edit-friend&user=' . $args['friend']->user_login ) ), 'add-friend-' . $args['friend']->user_login, 'add-friend' ) ); ?>"><?php esc_html_e( 'Send Friend Request', 'friends' ); ?></a>
102 </p>
103 <?php elseif ( $args['friend']->has_cap( 'acquaintance' ) ) : ?>
104 <p class="description">
105 <?php
106 // translators: %s is a friend role.
107 echo wp_kses( sprintf( __( 'Change to %s.', 'friends' ), '<a href="' . esc_url( wp_nonce_url( add_query_arg( '_wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), self_admin_url( 'admin.php?page=edit-friend&user=' . $args['friend']->user_login ) ), 'change-to-friend-' . $args['friend']->user_login, 'change-to-friend' ) ) . '">' . __( 'Friend', 'friends' ) . '</a>' ), array( 'a' => array( 'href' => array() ) ) );
108 ?>
109 <?php esc_html_e( 'An Acquaintance has friend status but cannot read private posts.', 'friends' ); ?>
110 </p>
111 <?php elseif ( $args['friend']->has_cap( 'friend' ) ) : ?>
112 <p class="description">
113 <?php
114 // translators: %s is a friend role.
115 echo wp_kses( sprintf( __( 'Change to %s.', 'friends' ), '<a href="' . esc_url( wp_nonce_url( add_query_arg( '_wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), self_admin_url( 'admin.php?page=edit-friend&user=' . $args['friend']->user_login ) ), 'change-to-restricted-friend-' . $args['friend']->user_login, 'change-to-restricted-friend' ) ) . '">' . __( 'Acquaintance', 'friends' ) . '</a>' ), array( 'a' => array( 'href' => array() ) ) );
116 ?>
117 <?php esc_html_e( 'An Acquaintance has friend status but cannot read private posts.', 'friends' ); ?>
118 </p>
119 <?php endif; ?>
120 </td>
121 </tr>
122 <?php if ( $args['friend']->can_refresh_feeds() ) : ?>
123 <tr>
124 <th><?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_html_e( 'Posts' ); ?></th>
125 <td>
126 <fieldset>
127 <label for="show_on_friends_page">
128 <input name="show_on_friends_page" type="checkbox" id="show_on_friends_page" value="1" <?php checked( '1', ! in_array( $args['friend']->user_login, $args['hide_from_friends_page'] ) ); ?>>
129 <?php esc_html_e( 'Show posts on your friends page', 'friends' ); ?>
130 </label>
131 </fieldset>
132 <fieldset>
133 <a href="<?php echo esc_url( $args['friend']->get_local_friends_page_url() ); ?>">
134 <?php
135 // translators: %d is the number of posts.
136 echo esc_html( sprintf( _n( 'View %d post', 'View %d posts', $args['post_count'], 'friends' ), $args['post_count'] ) );
137 ?>
138 </a>
139 <?php if ( apply_filters( 'friends_debug', false ) ) : ?>
140 | <a href="<?php echo esc_url( self_admin_url( 'edit.php?post_type=' . Friends\Friends::CPT . '&author=' . $args['friend']->user_login ) ); ?>">
141 <?php
142 // translators: %d is the number of posts.
143 echo esc_html( sprintf( _n( 'View %d cached post', 'View %d cached posts', $args['post_count'], 'friends' ), $args['post_count'] ) );
144 ?>
145 </a>
146
147 <?php endif; ?>
148 </fieldset>
149 <p class="description">
150 <?php
151 // translators: %s is a URL.
152 printf( __( '<a href=%s>Refresh</a> this feed now.', 'friends' ), esc_url( self_admin_url( 'admin.php?page=friends-refresh&user=' . $args['friend']->user_login ) ) );
153 ?>
154 </p>
155 </td>
156 </tr>
157 <?php endif; ?>
158 <?php do_action( 'friends_edit_friend_table_end', $args['friend'] ); ?>
159 </tbody>
160 </table>
161 <?php do_action( 'friends_edit_friend_after_form', $args['friend'] ); ?>
162 <p class="submit">
163 <input type="submit" id="submit" class="button button-primary" value="<?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_html_e( 'Save Changes' ); ?>">
164 <span class="unfriend"><a class="unfriend" href="<?php echo esc_url( Friends\Admin::get_unfriend_link( $args['friend'] ) ); ?>"><?php esc_html_e( 'Unfriend', 'friends' ); ?></a></span>
165 </p>
166 </form>
167