/**
 * Move Reply
 *
 * @package bbPress
 * @subpackage Theme
 */
?>

<div id="bbpress-forums">

	<?php 
if (is_user_logged_in() && current_user_can('edit_topic', bbp_get_topic_id())) {
    ?>

		<div id="move-reply-<?php 
    bbp_topic_id();
    ?>
" class="bbp-reply-move">

			<form id="move_reply" name="move_reply" method="post" action="<?php 
    the_permalink();
    ?>
">

				<fieldset class="bbp-form">

					<legend><?php 
    printf(__('Move reply "%s"', 'bbpress'), bbp_get_reply_title());
    ?>
</legend>
Example #2
0
/**
 * Merge topic form fields
 *
 * Output the required hidden fields when merging a topic
 *
 * @since bbPress (r2756)
 *
 * @uses wp_nonce_field() To generate a hidden nonce field
 * @uses bbp_topic_id() To output the topic id
 */
function bbp_merge_topic_form_fields()
{
    ?>

	<input type="hidden" name="action"       id="bbp_post_action" value="bbp-merge-topic" />
	<input type="hidden" name="bbp_topic_id" id="bbp_topic_id"    value="<?php 
    bbp_topic_id();
    ?>
" />

	<?php 
    wp_nonce_field('bbp-merge-topic_' . bbp_get_topic_id());
}
Example #3
0
function add_topic_access_key()
{
    if (is_singular('topic')) {
        $topic_url = get_permalink(bbp_get_topic_id());
        $key = get_post_meta(bbp_get_topic_id(), 'access_key', true);
        $isKey = !empty($key);
        //Если ключ доступа не верен - редирект на главную
        if ($isKey && !current_user_can('administrator') && $_GET['key'] != $key) {
            header("Location: /");
            exit;
        }
        //Подключаем плагин zClip, который понадобится для копирования ссылки в буфер обмена
        wp_enqueue_script('zClip', plugin_dir_url(__FILE__) . 'zClip/ZeroClipboard.js');
        ?>
                <style>
                #toggle{
                        outline: none;
                }
                #access-link,#copy{
                        display: <?php 
        echo $isKey ? "inline" : "none";
        ?>
;
                }
                #access-link{
                        height:30px;
                }
                #copy{
                        margin-left: 65px;
                }
                </style>
                <script>
                jQuery(document).ready(function($){
                        //Копирование ссылки
                        var client = new ZeroClipboard($("#copy"), {
                                moviePath: "<?php 
        echo plugin_dir_url(__FILE__) . 'zClip/ZeroClipboard.swf';
        ?>
"
                        });

                        client.on("load", function(client) {
                                client.on("complete", function(client, args) {
                                        alert('Ссылка была скопирована в буфер обмена.');
                                });
                        });
                        //Переключатель
                                $("#toggle").click(function(){
                                        var thisForAjax=$(this);
                                        if($(this).text()=="Выкл"){
                                                $.ajax({
                                                data: ({
                                                action: 'enable_key_access',
                                                post_id: <?php 
        bbp_topic_id();
        ?>
,
                                                }),
                                                url: "<?php 
        echo admin_url('admin-ajax.php');
        ?>
",
                                                success: function(data){
                                                        thisForAjax.removeClass('btn-default').addClass('btn-warning').text("Вкл");
                                                        $('#access-link,#copy').show();
                                                        $('#access-link').val($('#access-link').val()+'?key='+data).select();
                                                }
                                        });
                                        }else{
                                                $.ajax({
                                                        data: ({
                                                        action: 'delete_key_access',
                                                        post_id: <?php 
        bbp_topic_id();
        ?>
,
                                                        }),
                                                        url: "<?php 
        echo admin_url('admin-ajax.php');
        ?>
",
                                                        success: function(){
                                                                thisForAjax.removeClass('btn-warning').addClass('btn-default').text("Выкл");
                                                                $('#access-link,#copy').hide();
                                                                $('#access-link').val('<?php 
        echo $topic_url;
        ?>
');
                                                        }
                                                });
                                        }

                                });
                })
                </script>
                <p><b>Поделиться ссылкой</b></p>
                <div>
                <button type="button" id="toggle" class="btn <?php 
        echo $isKey ? "btn-warning" : "btn-default";
        ?>
 btn-sm"><?php 
        echo $isKey ? "Вкл" : "Выкл";
        ?>
</button>
                <input type="text" id="access-link" autocomplete="off" name="access-link" value="<?php 
        echo $topic_url;
        echo $isKey ? "?key={$key}" : "";
        ?>
">
                </div>
                <button id="copy" data-clipboard-target="access-link" class="btn btn-default btn-sm">Копировать ссылку</button>
                <?php 
    }
}
Example #4
0
	<div id="no-reply-<?php bbp_topic_id(); ?>" class="bbp-no-reply">
		<div class="bbp-template-notice">
			<p><?php printf( __( 'The topic &#8216;%s&#8217; is closed to new replies.', 'bbpress' ), bbp_get_topic_title() ); ?></p>
		</div>
	</div>

<?php elseif ( bbp_is_forum_closed( bbp_get_topic_forum_id() ) ) : ?>

	<div id="no-reply-<?php bbp_topic_id(); ?>" class="bbp-no-reply">
		<div class="bbp-template-notice">
			<p><?php printf( __( 'The forum &#8216;%s&#8217; is closed to new topics and replies.', 'bbpress' ), bbp_get_forum_title( bbp_get_topic_forum_id() ) ); ?></p>
		</div>
	</div>

<?php else : ?>

	<div id="no-reply-<?php bbp_topic_id(); ?>" class="bbp-no-reply">
		<div class="bbp-template-notice">
			<p><?php is_user_logged_in() ? _e( 'You cannot reply to this topic.', 'bbpress' ) : _e( 'You must be logged in to reply to this topic.', 'bbpress' ); ?> </p>
		<?php wp_login_form(); ?> 
		</div>
	</div>

<?php endif; ?>

<?php if ( bbp_is_reply_edit() ) : ?>

</div>

<?php endif; ?>
Example #5
0
					
					<?php do_action( 'bbp_before_main_content' ); ?>

					<?php do_action( 'bbp_template_notices' ); ?>

					<?php while ( have_posts() ) : the_post(); ?>

						<?php if ( bbp_user_can_view_forum( array( 'forum_id' => bbp_get_topic_forum_id() ) ) ) : ?>
							<div id="bbp-topic-wrapper-<?php bbp_topic_id(); ?>" class="bbp-topic-wrapper">
								<h1 class="entry-title"><?php bbp_topic_title(); ?></h1>
								<div class="entry-content">

									<?php bbp_get_template_part( 'content', 'single-topic' ); ?>

								</div>
							</div><!-- #bbp-topic-wrapper-<?php bbp_topic_id(); ?> -->

						<?php else : // Forum exists, user no access ?>

							<?php bbp_get_template_part( 'feedback', 'no-access' ); ?>

						<?php endif; ?>

					<?php endwhile; ?>

					<?php do_action( 'bbp_after_main_content' ); ?>
				</article>
			</div>
		</div>
	</div>
</div>
Example #6
0
			<?php do_action( 'bbp_theme_after_topic_form' ); ?>

		</form>
	</div>

<?php elseif ( bbp_is_forum_closed() ) : ?>

	<div id="no-topic-<?php bbp_topic_id(); ?>" class="bbp-no-topic">
		<div class="bbp-template-notice">
			<p><?php printf( __( 'The forum &#8216;%s&#8217; is closed to new topics and replies.', 'bbpress' ), bbp_get_forum_title() ); ?></p>
		</div>
	</div>

<?php else : ?>

	<div id="no-topic-<?php bbp_topic_id(); ?>" class="bbp-no-topic">
		<div class="bbp-template-notice">
			<p><?php is_user_logged_in() ? _e( 'You cannot create new topics.', 'bbpress' ) : _e( 'You must be logged in to create new topics.', 'bbpress' ); ?></p>
		</div>
		<?php wp_login_form(); ?> 
	</div>

<?php endif; ?>

<?php if ( !bbp_is_single_forum() ) : ?>

</div>

<?php endif; ?>