tpl->layout_exists( 3 ) ) {
$string = wpforo_phrase( 'Your Answer', false, 'default' );
}
return $string;
}
add_filter( 'wpforo_reply_form_head', 'wpforo_classic_reply_form_head', 1, 2 );
function wpforo_forum_layout_editors( $settings, $editor ) {
if( $editor === 'post' && 4 === wpfval( WPF()->current_object, 'layout' ) ) {
$settings['tinymce']['toolbar1'] = 'fontsizeselect,bold,italic,underline,forecolor,bullist,numlist,alignleft,aligncenter,alignright,link,unlink,blockquote,pre,wpf_spoil,pastetext,source_code,emoticons';
$settings['editor_height'] = 100;
}
return $settings;
}
add_filter( 'wpforo_editor_settings', 'wpforo_forum_layout_editors', 1, 2 );
function wpforo_get_topic_overview_chunk( $topicid, $row_count = 5, $offset = 0 ) {
$roots = WPF()->post->get_posts( [ 'topicid' => $topicid, 'is_first_post' => 0, 'parentid' => 0, 'offset' => $offset, 'row_count' => $row_count ], $roots_count );
$tree = [];
foreach( $roots as $root ) {
$tree[ wpforo_bigintval( $root['postid'] ) ] = wpforo_bigintval( $root['parentid'] );
$posts = WPF()->post->get_posts( [ 'root' => $root['postid'] ] );
foreach( $posts as $post ) $tree[ wpforo_bigintval( $post['postid'] ) ] = wpforo_bigintval( $post['parentid'] );
}
return [ 'html' => ( $tree ? wpforo_thread_tree( 0, $tree ) : '' ), 'roots_count' => intval( $roots_count ), 'nomore' => ! ( $roots_count > ( $offset + $row_count ) ) ];
}
function wpforo_topic_head_top( $forum, $topic ) {
?>
post->get_users_stats_for_topic( $topicid, 40 ) ) return '';
$html = '';
foreach( $users_stats_for_topic as $users_stats ) {
$user = wpforo_member( $users_stats['userid'] );
if( $user && WPF()->usergroup->can( 'va' ) && wpforo_setting( 'profiles', 'avatars' ) ) {
$html .= sprintf(
'',
wpforo_member_link( $user, '', 96, '', false, 'avatar' ),
$users_stats['posts']
);
}
}
return sprintf(
'',
wpforo_phrase( 'Active Participants', false ),
$html
);
}
function wpforo_topic_overview( $topicid ) {
if( ! ( $first_postid = wpforo_bigintval( wpforo_topic( $topicid, 'first_postid' ) ) ) ) return '';
$chunk_size = apply_filters( 'wpforo_topic_overview_chunk_size', 5 );
$chunk = wpforo_get_topic_overview_chunk( $topicid, $chunk_size );
return sprintf(
'',
wpforo_phrase( 'Topic Overview', false ),
$chunk_size,
intval( $chunk['nomore'] ),
wpforo_thread_tree_item( $first_postid, 0 ),
$chunk['html'],
wpforo_phrase( 'Load more replies...', false )
);
}
function wpforo_topic_head( $forum, $topic ) {
?>
0 ) {
$html .= '';
foreach( $tree as $child => $parent ) {
if( $parent === $root ) {
unset( $tree[ $child ] );
$html .= wpforo_thread_tree_item( $child, $level );
$html .= wpforo_thread_tree( $child, $tree, $level + 1 );
$html .= '';
}
}
$html .= '
';
}
return $html;
}
function wpforo_thread_tree_item( $postid, $level, $post = [], $member = [] ) {
$level = intval( $level );
if( $level < 0 ) $level = 0;
$repeate = $level - 1;
if( $repeate < 0 ) $repeate = 0;
if( empty( $post ) ) if( ! $post = wpforo_post( $postid ) ) return '';
if( empty( $member ) ) $member = wpforo_member( $post );
return '' . ( $level > 0 ? ' └ ─' : '' ) . str_repeat(
' ┴ ─',
$repeate
) . wpforo_user_avatar( $member, 20 ) . ' ' . wpforo_member_link( $member, '', 7, 'wpfto-author', false ) . ' ' . wpforo_date(
$post['created'],
'ago-date',
false
) . ' • ' . '' . wpforo_text( $post['body'], 70, false ) . '' . '
';
}
function wpforo_l2_print_avatars( $userids ) {
$ulimit = (int) apply_filters( 'wpforo_item_participant_avatars_count', 3 );
if( ! $ulimit ) $ulimit = 7;
if( $ucount = count( $userids ) ) {
foreach( $userids as $k => $userid ) {
if( ! ( $k < $ulimit ) ) break;
$user = wpforo_member( $userid );
if( wpforo_setting( 'profiles', 'avatars' ) && WPF()->usergroup->can( 'va' ) ) {
echo wpforo_user_avatar( $user, 40 );
}
}
}
if( ! $ucount || $ucount > $ulimit ) {
printf(
'%1$s
',
( $ucount ? "+" . ( $ucount - $ulimit ) : wpforo_phrase( 'No Participants', false ) )
);
}
}
function wpforo_l2_forum_users( $forumid ) {
wpforo_l2_print_avatars( WPF()->post->get_userids_for_forum( $forumid ) );
}
function wpforo_l2_topic_users( $topicid ) {
wpforo_l2_print_avatars( WPF()->post->get_userids_for_topic( $topicid ) );
}