本文整理汇总了PHP中bbp_topic_id函数的典型用法代码示例。如果您正苦于以下问题:PHP bbp_topic_id函数的具体用法?PHP bbp_topic_id怎么用?PHP bbp_topic_id使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bbp_topic_id函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bbp_topic_id
/**
* 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>
示例2: bbp_merge_topic_form_fields
/**
* 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());
}
示例3: add_topic_access_key
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";
?>
//.........这里部分代码省略.........
示例4: bbp_topic_id
<div id="no-reply-<?php bbp_topic_id(); ?>" class="bbp-no-reply">
<div class="bbp-template-notice">
<p><?php printf( __( 'The topic ‘%s’ 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 ‘%s’ 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; ?>
示例5: do_action
<?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>
示例6: do_action
<?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 ‘%s’ 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; ?>