PluginProbe
Friends / 2.9.1
Friends v2.9.1
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 / frontend / author-header.php

author-header.php in Friends 2.9.1, at templates/frontend/author-header.php

131 lines 5.6 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 author header on /friends/.
4 *
5 * @package Friends
6 */
7
8 $edit_user_link = $args['friends']->admin->admin_edit_user_link( false, $args['friend_user'] );
9 $feeds = count( $args['friend_user']->get_feeds() );
10 $rules = count( $args['friend_user']->get_feed_rules() );
11 $active_feeds = count( $args['friend_user']->get_active_feeds() );
12 $hidden_post_count = $args['friend_user']->get_post_in_trash_count();
13
14 ?><div id="author-header" class="mb-2">
15 <h2 id="page-title">
16 <?php if ( $args['friend_user']->is_starred() ) : ?>
17 <a href="" class="dashicons dashicons-star-filled starred" data-id="<?php echo esc_attr( $args['friend_user']->user_login ); ?>" data-nonce="<?php echo esc_attr( wp_create_nonce( 'star-' . $args['friend_user']->user_login ) ); ?>"></a>
18 <?php else : ?>
19 <a href="" class="dashicons dashicons-star-empty not-starred" data-id="<?php echo esc_attr( $args['friend_user']->user_login ); ?>" data-nonce="<?php echo esc_attr( wp_create_nonce( 'star-' . $args['friend_user']->user_login ) ); ?>"></a>
20 <?php endif; ?>
21 <a href="<?php echo esc_attr( $args['friend_user']->get_local_friends_page_url() ); ?>">
22 <?php
23 if ( $args['friends']->frontend->reaction ) {
24 echo esc_html(
25 sprintf(
26 // translators: %1$s is an emoji reaction, %2$s is a type of feed, e.g. "Main Feed".
27 __( 'My %1$s reactions on %2$s', 'friends' ),
28 $args['friends']->frontend->reaction,
29 $args['friend_user']->display_name
30 )
31 );
32 } else {
33 echo esc_html( $args['friend_user']->display_name );
34 }
35 ?>
36 </a>
37 <?php
38 $args['friends']->frontend->link(
39 $args['friend_user']->user_url,
40 '',
41 array(
42 'class' => 'label dashicons dashicons-external',
43 'style' => 'vertical-align: middle; margin-left: .5em;',
44 ),
45 $args['friend_user']
46 );
47 ?>
48
49 </h2>
50
51 <?php if ( $args['friend_user']->description ) : ?>
52 <p>
53 <?php
54 echo wp_kses(
55 str_replace( '</p>', '<br/>', $args['friend_user']->description ),
56 array(
57 'a' => array( 'href' => array() ),
58 'span' => array( 'class' => array() ),
59 'br' => array(),
60 )
61 );
62 ?>
63 </p>
64 <?php endif; ?>
65
66 <span class="chip"><?php echo esc_html( $args['friend_user']->get_role_name() ); ?></span>
67
68 <?php if ( apply_filters( 'friends_debug', false ) ) : ?>
69 <span class="chip"><?php echo esc_html( get_class( $args['friend_user'] ) ); ?></span>
70 <?php endif; ?>
71
72 <span class="chip"><?php echo /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_html( sprintf( /* translators: %s is a localized date (F j, Y) */__( 'Since %s', 'friends' ), date_i18n( __( 'F j, Y' ), strtotime( $args['friend_user']->user_registered ) ) ) ); ?></span>
73
74 <?php foreach ( $args['friend_user']->get_post_count_by_post_format() as $post_format => $count ) : ?>
75 <a class="chip" href="<?php echo esc_attr( $args['friend_user']->get_local_friends_page_post_format_url( $post_format ) ); ?>"><?php echo esc_html( $args['friends']->get_post_format_plural_string( $post_format, $count ) ); ?></a>
76 <?php endforeach; ?>
77 <?php if ( isset( $_GET['show-hidden'] ) ) : ?>
78 <a class="chip" href="<?php echo esc_attr( remove_query_arg( 'show-hidden' ) ); ?>">
79 <?php echo esc_html__( 'Hide hidden items', 'friends' ); ?>
80 </a>
81 <?php elseif ( $hidden_post_count > 0 ) : ?>
82 <a class="chip" href="<?php echo esc_attr( add_query_arg( 'show-hidden', 1 ) ); ?>">
83 <?php echo esc_html( sprintf( /* translators: %s is the number of hidden posts */_n( '%s hidden items', '%s hidden items', $hidden_post_count, 'friends' ), number_format_i18n( $hidden_post_count ) ) ); ?>
84 </a>
85 <?php endif; ?>
86
87 <?php foreach ( Friends\Reactions::get_available_emojis() as $slug => $reaction ) : ?>
88 <a class="chip" href="<?php echo esc_attr( $args['friend_user']->get_local_friends_page_reaction_url( $slug ) ); ?>">
89 <?php
90 echo esc_html(
91 sprintf(
92 // translators: %s is an emoji.
93 __( 'Reacted with %s', 'friends' ),
94 $reaction->char
95 )
96 );
97 ?>
98 </a>
99 <?php endforeach; ?>
100
101 <?php if ( apply_filters( 'friends_show_author_edit', true, $args['friend_user'] ) ) : ?>
102 <a class="chip" href="<?php echo esc_attr( self_admin_url( 'admin.php?page=edit-friend-feeds&user=' . $args['friend_user']->user_login ) ); ?>">
103 <?php echo esc_html( sprintf( /* translators: %s is the number of feeds */_n( '%s feed', '%s feeds', $active_feeds, 'friends' ), number_format_i18n( $active_feeds ) ) ); ?>
104
105 <?php if ( $feeds - $active_feeds > 1 ) : ?>
106 &nbsp;<small><?php echo esc_html( sprintf( /* translators: %s is the number of feeds */_n( '(+%s more)', '(+%s more)', $feeds - $active_feeds, 'friends' ), number_format_i18n( $feeds - $active_feeds ) ) ); ?></small>
107 <?php endif; ?>
108 </a>
109
110 <?php if ( $rules > 0 ) : ?>
111 <a class="chip" href="<?php echo esc_attr( self_admin_url( 'admin.php?page=edit-friend-rules&user=' . $args['friend_user']->user_login ) ); ?>">
112 <?php
113 // translators: %d is the number of rules.
114 echo esc_html( sprintf( _n( '%d rule', '%d rules', $rules, 'friends' ), $rules ) );
115 ?>
116 </a>
117 <?php endif; ?>
118
119 <a class="chip" href="<?php echo esc_attr( $edit_user_link ); ?>"><?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_html_e( 'Edit' ); ?></a>
120 <?php endif; ?>
121
122 <?php if ( 'status' === $args['friends']->frontend->post_format ) : ?>
123 <a class="chip quick-post-panel-toggle" href="#"><?php esc_html_e( 'Quick Post Panel', 'friends' ); ?></a>
124 <?php endif; ?>
125
126 <?php if ( $args['friend_user']->can_refresh_feeds() && apply_filters( 'friends_debug', false ) ) : ?>
127 <a class="chip" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'user', $args['friend_user']->user_login, self_admin_url( 'admin.php?page=friends-refresh' ) ), 'friends-refresh' ) ); ?>"><?php esc_html_e( 'Refresh', 'friends' ); ?></a>
128 <?php endif; ?>
129 <?php do_action( 'friends_author_header', $args['friend_user'], $args ); ?>
130 </div>
131