| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Single Topic Lead Content Part |
| 5 |
* |
| 6 |
* @package bbPress |
| 7 |
* @subpackage Theme |
| 8 |
*/ |
| 9 |
|
| 10 |
// Exit if accessed directly. |
| 11 |
defined( 'ABSPATH' ) || exit; |
| 12 |
|
| 13 |
do_action( 'bbp_template_before_lead_topic' ); |
| 14 |
|
| 15 |
$topic_tag_list = bbp_get_topic_tag_list( |
| 16 |
get_the_ID(), |
| 17 |
array( |
| 18 |
'before' => '', |
| 19 |
'after' => '', |
| 20 |
'sep' => ', ', |
| 21 |
'none' => '', |
| 22 |
) |
| 23 |
); |
| 24 |
$has_topic_tags = ! empty( $topic_tag_list ); |
| 25 |
$action_btns_class = $has_topic_tags ? 'has-topic-tags' : 'no-topic-tags'; |
| 26 |
?> |
| 27 |
<div class="main-post"> |
| 28 |
<div class="topic-content-wrapper"> |
| 29 |
|
| 30 |
<div class="forum-post-top"> |
| 31 |
<div class="bbp-author-wrap"> |
| 32 |
<div class="author-avatar bbp-author-link"> |
| 33 |
<?php |
| 34 |
echo bbp_get_topic_author_link( |
| 35 |
array( |
| 36 |
'post_id' => get_the_ID(), |
| 37 |
'size' => 40, |
| 38 |
'type' => 'avatar', |
| 39 |
) |
| 40 |
); |
| 41 |
?> |
| 42 |
</div> |
| 43 |
|
| 44 |
<div class="forum-post-author"> |
| 45 |
<div class="topic-author author-flex author-gap"> |
| 46 |
<?php |
| 47 |
echo bbp_get_topic_author_link( |
| 48 |
array( |
| 49 |
'post_id' => get_the_ID(), |
| 50 |
'type' => 'name', |
| 51 |
) |
| 52 |
); |
| 53 |
?> |
| 54 |
<div class="author-badge badge <?php echo esc_attr( sanitize_title( forumax_get_bbp_user_role() ) ); ?>"> |
| 55 |
<?php forumax_bbp_user_role_icon(); ?> |
| 56 |
<span><?php echo esc_html( forumax_get_bbp_user_role() ); ?></span> |
| 57 |
</div> |
| 58 |
</div> |
| 59 |
|
| 60 |
<div class="forum-author-meta meta"> |
| 61 |
<span title="<?php bbp_topic_post_date( get_the_ID() ); ?>"> |
| 62 |
<?php bbp_topic_post_date( get_the_ID(), true ); ?> |
| 63 |
</span> |
| 64 |
<span class="dot"></span> |
| 65 |
<?php $lead_reply_count = bbp_get_topic_reply_count( bbp_get_topic_id() ); ?> |
| 66 |
<a href="#topic-<?php bbp_topic_id(); ?>-replies" class="replies-count"> |
| 67 |
<?php |
| 68 |
printf( |
| 69 |
/* translators: %s: number of replies */ |
| 70 |
esc_html( _n( '%s Reply', '%s Replies', $lead_reply_count, 'forumax' ) ), |
| 71 |
esc_html( number_format_i18n( $lead_reply_count ) ) |
| 72 |
); |
| 73 |
?> |
| 74 |
</a> |
| 75 |
</div> |
| 76 |
</div> |
| 77 |
</div> |
| 78 |
|
| 79 |
<div class="action-button-container"> |
| 80 |
<?php |
| 81 |
if ( is_user_logged_in() ) : |
| 82 |
bbp_topic_subscription_link( |
| 83 |
array( |
| 84 |
'before' => '', |
| 85 |
'after' => '', |
| 86 |
'unsubscribe' => esc_html__( 'Subscribed', 'forumax' ), |
| 87 |
) |
| 88 |
); |
| 89 |
else : |
| 90 |
if ( get_option( '_bbp_enable_subscriptions' ) == 1 && forumax_get_opt( 'is_topic_subscription' ) == 1 ) : |
| 91 |
?> |
| 92 |
<div class="frmx-inline-login-prompt frmx-inline-login-prompt--compact"> |
| 93 |
<h3 class="frmx-inline-login-title"><?php echo esc_html( forumax_get_opt( 'subscription_modal_title' ) ); ?></h3> |
| 94 |
<p class="frmx-inline-login-subtitle"><?php echo esc_html( forumax_get_opt( 'subscription_modal_subtitle' ) ); ?></p> |
| 95 |
<div class="frmx-subscription-login-form"> |
| 96 |
<?php if ( function_exists( 'forumax_get_opt' ) && forumax_get_opt( 'topic_login_shortcode' ) ) : ?> |
| 97 |
<?php echo do_shortcode( forumax_get_opt( 'topic_login_shortcode' ) ); ?> |
| 98 |
<?php else : ?> |
| 99 |
<form method="post" action="<?php bbp_wp_login_action( array( 'context' => 'login_post' ) ); ?>" class="bbp-login-form"> |
| 100 |
<fieldset class="bbp-form"> |
| 101 |
<legend><?php esc_html_e( 'Log In', 'forumax' ); ?></legend> |
| 102 |
|
| 103 |
<div class="bbp-username"> |
| 104 |
<label for="frmx-subscription-user-login"><?php esc_html_e( 'Username', 'forumax' ); ?>: </label> |
| 105 |
<input type="text" name="log" value="" size="20" maxlength="100" id="frmx-subscription-user-login" placeholder="<?php esc_attr_e( 'Username or Email', 'forumax' ); ?>" autocomplete="off" /> |
| 106 |
</div> |
| 107 |
|
| 108 |
<div class="bbp-password"> |
| 109 |
<label for="frmx-subscription-user-pass"><?php esc_html_e( 'Password', 'forumax' ); ?>: </label> |
| 110 |
<input type="password" name="pwd" value="" size="20" id="frmx-subscription-user-pass" placeholder="<?php esc_attr_e( 'Password', 'forumax' ); ?>" autocomplete="off" /> |
| 111 |
</div> |
| 112 |
|
| 113 |
<div class="bbp-remember-me"> |
| 114 |
<input type="checkbox" name="rememberme" value="forever" id="frmx-subscription-rememberme" /> |
| 115 |
<label for="frmx-subscription-rememberme"><?php esc_html_e( 'Keep me signed in', 'forumax' ); ?></label> |
| 116 |
</div> |
| 117 |
|
| 118 |
<?php do_action( 'login_form' ); ?> |
| 119 |
|
| 120 |
<div class="bbp-submit-wrapper"> |
| 121 |
<button type="submit" name="user-submit" id="frmx-subscription-user-submit" class="button submit user-submit fill-brand"><?php esc_html_e( 'Log In', 'forumax' ); ?></button> |
| 122 |
<?php bbp_user_login_fields(); ?> |
| 123 |
</div> |
| 124 |
</fieldset> |
| 125 |
</form> |
| 126 |
<?php endif; ?> |
| 127 |
</div> |
| 128 |
</div> |
| 129 |
<?php |
| 130 |
endif; |
| 131 |
endif; |
| 132 |
?> |
| 133 |
|
| 134 |
<?php |
| 135 |
/** |
| 136 |
* Topic admin links dropdown (⋯ three-dot menu). |
| 137 |
* Placed next to Subscribe for quick access. |
| 138 |
*/ |
| 139 |
if ( is_user_logged_in() && function_exists( 'forumax_get_topic_admin_links' ) ) { |
| 140 |
echo forumax_get_topic_admin_links(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 141 |
} |
| 142 |
?> |
| 143 |
</div> |
| 144 |
</div> |
| 145 |
|
| 146 |
<div class="q-title"> |
| 147 |
<?php |
| 148 |
$topic_prefix = forumax_get_opt( 'topic_title_prefix', 'Q:' ); |
| 149 |
if ( ! empty( $topic_prefix ) ) : |
| 150 |
?> |
| 151 |
<span class="question-icon" title="Question"> |
| 152 |
<?php echo esc_html( $topic_prefix ); ?> |
| 153 |
</span> |
| 154 |
<?php endif; ?> |
| 155 |
<h1> |
| 156 |
<?php do_action( 'bbp_theme_before_topic_title' ); ?> |
| 157 |
<?php |
| 158 |
the_title(); |
| 159 |
do_action( 'bbpc-resolved-topics' ); |
| 160 |
?> |
| 161 |
</h1> |
| 162 |
</div> |
| 163 |
|
| 164 |
<div class="forum-post-content"> |
| 165 |
<?php do_action('bbp_theme_after_topic_author_details'); ?> |
| 166 |
<div class="topic-content-layout"> |
| 167 |
<?php |
| 168 |
$topic_post = get_post(); |
| 169 |
$forum_id = $topic_post ? bbp_get_topic_forum_id( $topic_post->ID ) : 0; |
| 170 |
$forum_vote = $forum_id ? get_post_meta( $forum_id, 'bbp_voting_forum_enable_topics', true ) : ''; |
| 171 |
|
| 172 |
// Note: despite the option id name, this switcher is used as an enable flag in the voting frontend. |
| 173 |
$topic_voting_enabled = ! empty( forumax_get_opt( 'is_voting_disabled_topics', 0 ) ); |
| 174 |
$voting_feature_on = (bool) forumax_get_opt( 'is_votes', true ); |
| 175 |
|
| 176 |
$show_vote_column = $voting_feature_on |
| 177 |
&& (bool) has_action( 'bbp_voting_cpt' ) |
| 178 |
&& ( ( ! empty( $forum_vote ) && $forum_vote !== 'false' ) || ( empty( $forum_vote ) && $topic_voting_enabled ) ); |
| 179 |
?> |
| 180 |
<?php if ( $show_vote_column ) : ?> |
| 181 |
<div class="topic-vote-column"> |
| 182 |
<?php |
| 183 |
/** |
| 184 |
* Render only the voting UI in the left column. |
| 185 |
*/ |
| 186 |
do_action( 'bbp_voting_cpt', $topic_post ); |
| 187 |
?> |
| 188 |
</div> |
| 189 |
<?php endif; ?> |
| 190 |
|
| 191 |
<div class="topic-content-body"> |
| 192 |
<div class="content editor-content"> |
| 193 |
<?php do_action('bbp_theme_before_topic_content'); ?> |
| 194 |
<?php bbp_topic_content(); ?> |
| 195 |
</div> |
| 196 |
|
| 197 |
<div class="action-button-container action-btns <?php echo esc_attr( $action_btns_class ); ?>"> |
| 198 |
<?php |
| 199 |
if ( has_action( 'bbp_theme_after_topic_content', 'bbp_voting_buttons' ) ) { |
| 200 |
remove_action( 'bbp_theme_after_topic_content', 'bbp_voting_buttons' ); |
| 201 |
} |
| 202 |
?> |
| 203 |
<?php do_action('bbp_theme_after_topic_content'); ?> |
| 204 |
<?php if ( $has_topic_tags ) : ?> |
| 205 |
<div class="taxonomy forum-post-tags"> |
| 206 |
<?php |
| 207 |
echo wp_kses_post( |
| 208 |
'<span class="tags-label">' . esc_html__( 'Tags:', 'forumax' ) . '</span> <span class="tags">' . $topic_tag_list . '</span>' |
| 209 |
); |
| 210 |
?> |
| 211 |
</div> |
| 212 |
<?php endif; ?> |
| 213 |
|
| 214 |
<div class="frmx-action-btns-right"> |
| 215 |
<?php |
| 216 |
bbp_topic_favorite_link( |
| 217 |
array( |
| 218 |
'before' => '', |
| 219 |
) |
| 220 |
); |
| 221 |
?> |
| 222 |
<?php |
| 223 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 224 |
echo forumax_topic_social_share(); |
| 225 |
?> |
| 226 |
</div> |
| 227 |
</div> |
| 228 |
</div> |
| 229 |
</div> |
| 230 |
</div> |
| 231 |
|
| 232 |
</div> |
| 233 |
</div> |
| 234 |
|
| 235 |
<?php |
| 236 |
do_action( 'bbp_template_after_lead_topic' ); |
| 237 |
|