| 1 |
<?php |
| 2 |
/** |
| 3 |
* This template shows the Friends list. |
| 4 |
* |
| 5 |
* @version 1.0 |
| 6 |
* @package Friends |
| 7 |
*/ |
| 8 |
|
| 9 |
?> |
| 10 |
<?php if ( empty( $args['friends'] ) ) : ?> |
| 11 |
<p><?php esc_html_e( "You don't have any friends or subscriptions yet.", 'friends' ); ?></a></p> |
| 12 |
<?php else : ?> |
| 13 |
<?php if ( current_user_can( 'edit_users' ) ) : ?> |
| 14 |
<p> |
| 15 |
<?php |
| 16 |
echo wp_kses( |
| 17 |
sprintf( |
| 18 |
// translators: %s is the URL to the WordPress users admin page. |
| 19 |
__( 'You can also view your friends and subscriptions <a href=%s> on the WordPress users admin page</a>.', 'friends' ), |
| 20 |
Friends\Admin::get_users_url() |
| 21 |
), |
| 22 |
array( |
| 23 |
'a' => array( 'href' => array() ), |
| 24 |
) |
| 25 |
); |
| 26 |
?> |
| 27 |
</p> |
| 28 |
<?php endif; ?> |
| 29 |
<table class="wp-list-table widefat fixed striped" style="margin-top: 2em; margin-right: 1em"> |
| 30 |
<thead> |
| 31 |
<tr> |
| 32 |
<th class="column-primary column-site"><?php esc_html_e( 'User', 'friends' ); ?></th> |
| 33 |
<th class="column-url"><?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_html_e( 'URL' ); ?></th> |
| 34 |
<th class="column-date"><?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_html_e( 'Since' ); ?></th> |
| 35 |
<th class="column-status"><?php esc_html_e( 'Status', 'friends' ); ?></th> |
| 36 |
<th class="column-type"><?php echo esc_html( _x( 'Type', 'of user', 'friends' ) ); ?></th> |
| 37 |
<th class="column-friends_posts"><?php esc_html_e( 'Friend Posts', 'friends' ); ?></th> |
| 38 |
</tr> |
| 39 |
</thead> |
| 40 |
<tbody> |
| 41 |
<?php foreach ( $args['friends'] as $friend_user ) : ?> |
| 42 |
<tr> |
| 43 |
<td class="username column-username column-primary has-row-actions" data-colname="<?php esc_attr_e( 'Site', 'friends' ); ?>"> |
| 44 |
<?php |
| 45 |
echo wp_kses( |
| 46 |
get_avatar( $friend_user->user_login, 32 ), |
| 47 |
array( |
| 48 |
'img' => array( |
| 49 |
'src' => array(), |
| 50 |
'alt' => array(), |
| 51 |
'class' => array(), |
| 52 |
'width' => array(), |
| 53 |
'height' => array(), |
| 54 |
), |
| 55 |
) |
| 56 |
); |
| 57 |
|
| 58 |
?> |
| 59 |
<a href="<?php echo esc_url( Friends\Admin::admin_edit_user_link( false, $friend_user ) ); ?>"><?php echo esc_html( $friend_user->display_name ); ?></a> |
| 60 |
<button type="button" class="toggle-row"><span class="screen-reader-text"><?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_html_e( 'Show more details' ); ?></span></button> |
| 61 |
<div class="row-actions"> |
| 62 |
<?php |
| 63 |
$actions = array( |
| 64 |
'edit' => sprintf( |
| 65 |
'<a href="%s">%s</a>', |
| 66 |
esc_url( Friends\Admin::admin_edit_user_link( false, $friend_user ) ), |
| 67 |
esc_html__( 'Edit', 'friends' ) |
| 68 |
), |
| 69 |
); |
| 70 |
|
| 71 |
if ( $friend_user->has_cap( 'friend_request' ) ) { |
| 72 |
$actions['unfriend'] = sprintf( |
| 73 |
'<a href="%s">%s</a>', |
| 74 |
esc_url( Friends\Admin::get_unfriend_link( $friend_user ) ), |
| 75 |
esc_html__( 'Delete', 'friends' ) |
| 76 |
); |
| 77 |
} else { |
| 78 |
$actions['unfriend'] = sprintf( |
| 79 |
'<a href="%s">%s</a>', |
| 80 |
esc_url( Friends\Admin::get_unfriend_link( $friend_user ) ), |
| 81 |
esc_html__( 'Unfriend', 'friends' ) |
| 82 |
); |
| 83 |
} |
| 84 |
|
| 85 |
$sep = ''; |
| 86 |
foreach ( Friends\Admin::user_row_actions( $actions, $friend_user ) as $key => $action ) { |
| 87 |
echo esc_html( $sep ); |
| 88 |
$sep = ' | '; |
| 89 |
?> |
| 90 |
<span class="<?php echo esc_attr( $key ); ?>"> |
| 91 |
<?php |
| 92 |
echo wp_kses_post( $action ); |
| 93 |
?> |
| 94 |
</span> |
| 95 |
<?php |
| 96 |
} |
| 97 |
?> |
| 98 |
</div> |
| 99 |
</td> |
| 100 |
<td class="url column-url" data-colname="<?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_attr_e( 'URL' ); ?>"><a href="<?php echo esc_url( $friend_user->user_url ); ?>"><?php echo esc_html( wp_parse_url( $friend_user->user_url, PHP_URL_HOST ) ); ?></a></td> |
| 101 |
<td class="date column-date" data-colname="<?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_attr_e( 'Since' ); ?>"><?php echo esc_html( date_i18n( __( 'F j, Y g:i a' ), strtotime( $friend_user->user_registered ) ) ); ?></td> |
| 102 |
<td class="status column-status" data-colname="<?php esc_attr_e( 'Status', 'friends' ); ?>"><?php echo esc_html( $friend_user->get_role_name() ); ?></td> |
| 103 |
<td class="status column-type" data-colname="<?php echo esc_attr( _x( 'Type', 'of user', 'friends' ) ); ?>"> |
| 104 |
<?php if ( $friend_user instanceof Friends\Subscription ) : ?> |
| 105 |
<?php esc_html_e( 'Virtual User', 'friends' ); ?> |
| 106 |
<?php if ( apply_filters( 'friends_debug', false ) ) : ?> |
| 107 |
<span class="info">ID: <?php echo esc_html( $friend_user->get_term_id() ); ?></span> |
| 108 |
<?php endif; ?> |
| 109 |
<?php else : ?> |
| 110 |
<?php esc_html_e( 'User', 'friends' ); ?> |
| 111 |
<?php if ( apply_filters( 'friends_debug', false ) ) : ?> |
| 112 |
<span class="info">ID: <?php echo esc_html( $friend_user->ID ); ?></span> |
| 113 |
<?php endif; ?> |
| 114 |
<?php endif; ?> |
| 115 |
</td> |
| 116 |
<td class="column-friends_posts" data-colname="<?php esc_attr_e( 'Friend Posts', 'friends' ); ?>"><?php echo wp_kses_post( Friends\Admin::user_list_custom_column( '', 'friends_posts', $friend_user->ID ) ); ?></td> |
| 117 |
</tr> |
| 118 |
<?php endforeach; ?> |
| 119 |
</tbody> |
| 120 |
</table> |
| 121 |
<?php endif; ?> |
| 122 |
<p><a href="<?php echo esc_url( self_admin_url( 'admin.php?page=add-friend' ) ); ?>"><?php esc_html_e( 'Add New Friend', 'friends' ); ?></a></p> |
| 123 |
|