当前位置: 首页>>代码示例>>PHP>>正文


PHP bbp_get_topic_forum_id函数代码示例

本文整理汇总了PHP中bbp_get_topic_forum_id函数的典型用法代码示例。如果您正苦于以下问题:PHP bbp_get_topic_forum_id函数的具体用法?PHP bbp_get_topic_forum_id怎么用?PHP bbp_get_topic_forum_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了bbp_get_topic_forum_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _bbps_wp_insert_post

function _bbps_wp_insert_post($post_ID, $post, $update)
{
    if ($post->post_status == 'publish' && $post->post_type == 'reply') {
        $check = get_post_meta($post_ID, 'support_hub', true);
        $forum_id = bbp_get_topic_forum_id($post->post_parent);
        //mail('dtbaker@gmail.com','WP Insert Post Done 2',var_export($post,true).var_export($check,true)."\n" . $forum_id);
        if ($check) {
            $data = @json_decode($check, true);
            if (!is_array($data)) {
                $data = array();
            }
            if (!isset($data['done']) || !$data['done']) {
                $data['done'] = true;
                update_post_meta($post_ID, 'support_hub', json_encode($data));
                // change the flag so we don't double process during this hook
                // run the usual bbpress hooks to update thread counts, send email replies and other stuff
                do_action('bbp_new_reply', $post_ID, $post->post_parent, $forum_id, 0, $post->post_author, false, 0);
                do_action('bbp_new_reply_post_extras', $post_ID);
                // todo: only set thread status to resolved if ticked in extra data above.
                if (isset($data['thread_resolved']) && $data['thread_resolved'] == 'resolved') {
                    update_post_meta($post->post_parent, '_bbps_topic_status', 2);
                    // update the thread status to resolved
                }
            }
        }
    }
}
开发者ID:styledthemes,项目名称:bbPress-Support-Forums,代码行数:27,代码来源:bbps-envato-functions.php

示例2: tehnik_filter_buddypress_activities

function tehnik_filter_buddypress_activities($a, $activities)
{
    //if admin we want to know
    if (is_site_admin()) {
        return $activities;
    }
    foreach ($activities->activities as $key => $activity) {
        //new_member is the type name (component is 'profile')
        if ($activity->type == 'bbp_topic_create' || $activity->type == 'bbp_reply_create') {
            $post_id = $activity->secondary_item_id;
            if ($activity->type == 'bbp_reply_create') {
                $post_id = bbp_get_topic_forum_id($post_id);
            }
            if (!tehnik_bpp_can_user_view_post_id($post_id)) {
                unset($activities->activities[$key]);
                $activities->activity_count = $activities->activity_count - 1;
                $activities->total_activity_count = $activities->total_activity_count - 1;
                $activities->pag_num = $activities->pag_num - 1;
            }
        }
    }
    /* Renumber the array keys to account for missing items */
    $activities_new = array_values($activities->activities);
    $activities->activities = $activities_new;
    return $activities;
}
开发者ID:dnaleor,项目名称:Tehnik-bbPress-Permissions,代码行数:26,代码来源:tehnik_bpp_buddypress.php

示例3: bbps_is_topic_premium

function bbps_is_topic_premium()
{
    $is_premium = get_post_meta(bbp_get_topic_forum_id(), '_bbps_is_premium');
    if ($is_premium[0] == 1) {
        return true;
    } else {
        return false;
    }
}
开发者ID:styledthemes,项目名称:bbPress-Support-Forums,代码行数:9,代码来源:bbps-common-functions.php

示例4: edd_bbp_is_premium_topic

/**
 * Is this a premium topic?
 *
 * @since		1.0.0
 * @return		bool $return True if premium topic, false otherwise
 */
function edd_bbp_is_premium_topic()
{
    $is_premium = get_post_meta(bbp_get_topic_forum_id(), '_bbps_is_premium');
    if ($is_premium[0]) {
        $return = true;
    } else {
        $return = false;
    }
    return $return;
}
开发者ID:Section214,项目名称:EDD-bbPress-Support,代码行数:16,代码来源:functions.php

示例5: add_protected_meta

 /**
  * When inserting a new reply, make sure the protected meta data is set correctly.
  *
  * We can't use WP_JSON_Posts::add_meta() here because the required meta is deemed
  * protected by @see is_protected_meta().
  *
  * @see WP_JSON_Posts::insert_post()
  * @see WP_JSON_Posts::add_meta()
  */
 public function add_protected_meta($post, $data, $update)
 {
     if (!$update && $this->type == $post['post_type']) {
         // Forum meta
         $reply_meta = array('author_ip' => bbp_current_author_ip(), 'forum_id' => bbp_get_topic_forum_id($post['post_parent']), 'topic_id' => $post['post_parent']);
         // Insert reply meta
         foreach ($reply_meta as $meta_key => $meta_value) {
             update_post_meta($post['ID'], '_bbp_' . $meta_key, $meta_value);
         }
         // Update the topic
         $topic_id = bbp_get_reply_topic_id($post['ID']);
         if (!empty($topic_id)) {
             bbp_update_topic($topic_id);
         }
     }
 }
开发者ID:ntwb,项目名称:BB-API,代码行数:25,代码来源:class-bbp-json-replies.php

示例6: has_access

 /**
  * Verify access to the current content.
  *
  * @since  1.0.0
  *
  * @param int $id The content post ID to verify access.
  * @return bool|null True if has access, false otherwise.
  *     Null means: Rule not relevant for current page.
  */
 public function has_access($id, $admin_has_access = true)
 {
     global $wp_query;
     $has_access = null;
     if (empty($id)) {
         $id = $this->get_current_post_id();
     }
     if (!empty($id)) {
         $post_type = get_post_type($id);
         if (in_array($post_type, self::get_bb_cpt())) {
             $has_access = false;
             // Only verify permission if addon is enabled.
             if (MS_Addon_Bbpress::is_active()) {
                 switch ($post_type) {
                     case self::CPT_BB_FORUM:
                         $has_access = parent::has_access($id, $admin_has_access);
                         break;
                     case self::CPT_BB_TOPIC:
                         if (function_exists('bbp_get_topic_forum_id')) {
                             $forum_id = bbp_get_topic_forum_id($id);
                             $has_access = parent::has_access($forum_id, $admin_has_access);
                         }
                         break;
                     case self::CPT_BB_REPLY:
                         if (function_exists('bbp_get_reply_forum_id')) {
                             $forum_id = bbp_get_reply_forum_id($id);
                             $has_access = parent::has_access($forum_id, $admin_has_access);
                         }
                         break;
                 }
             } else {
                 $has_access = true;
             }
         }
     } else {
         /*
          * If post type is forum and no post_id, it is the forum list page, give access.
          * @todo Find another way to verify if the current page is the forum list page.
          */
         if (self::CPT_BB_FORUM === $wp_query->get('post_type')) {
             $has_access = true;
         }
     }
     return apply_filters('ms_addon_bbpress_model_rule_has_access', $has_access, $id, $this);
 }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:54,代码来源:class-ms-addon-bbpress-rule-model.php

示例7: nav_menu_css_class

 static function nav_menu_css_class($classes, $item, $args, $depth)
 {
     if ($item->object == bbp_get_forum_post_type() && is_bbpress()) {
         if (bbp_is_topic_edit() || bbp_is_single_topic()) {
             $forum_id = bbp_get_topic_forum_id();
             if ($forum_id == $item->object_id) {
                 $classes[] = 'current-menu-parent';
                 $classes[] = 'current-' . bbp_get_topic_post_type() . '-parent';
             } elseif ($ancestors = self::forum_ancestors($forum_id, array())) {
                 if (in_array($item->object_id, $ancestors)) {
                     $classes[] = 'current-menu-ancestor';
                     $classes[] = 'current-' . bbp_get_topic_post_type() . '-ancestor';
                 }
             }
         } elseif (bbp_is_reply_edit() || bbp_is_single_reply()) {
             $forum_id = bbp_get_reply_forum_id();
         }
     }
     return $classes;
 }
开发者ID:082net,项目名称:bbpresskr,代码行数:20,代码来源:nav-menu.php

示例8: tehnik_bpp_get_forum_id_from_post_id

function tehnik_bpp_get_forum_id_from_post_id($post_id, $post_type)
{
    $forum_id = 0;
    // Check post type
    switch ($post_type) {
        // Forum
        case bbp_get_forum_post_type():
            $forum_id = bbp_get_forum_id($post_id);
            break;
            // Topic
        // Topic
        case bbp_get_topic_post_type():
            $forum_id = bbp_get_topic_forum_id($post_id);
            break;
            // Reply
        // Reply
        case bbp_get_reply_post_type():
            $forum_id = bbp_get_reply_forum_id($post_id);
            break;
    }
    return $forum_id;
}
开发者ID:dnaleor,项目名称:Tehnik-bbPress-Permissions,代码行数:22,代码来源:tehnik_bpp_core.php

示例9: column_data

 /**
  * Print extra columns for the replies page
  *
  * @since 2.0.0 bbPress (r2577)
  *
  * @param string $column Column
  * @param int $reply_id reply id
  * @uses bbp_get_reply_topic_id() To get the topic id of the reply
  * @uses bbp_topic_title() To output the reply's topic title
  * @uses apply_filters() Calls 'reply_topic_row_actions' with an array
  *                        of reply topic actions
  * @uses bbp_get_topic_permalink() To get the topic permalink
  * @uses bbp_get_topic_forum_id() To get the forum id of the topic of
  *                                 the reply
  * @uses bbp_get_forum_permalink() To get the forum permalink
  * @uses admin_url() To get the admin url of post.php
  * @uses apply_filters() Calls 'reply_topic_forum_row_actions' with an
  *                        array of reply topic forum actions
  * @uses bbp_reply_author_display_name() To output the reply author name
  * @uses get_the_date() Get the reply creation date
  * @uses get_the_time() Get the reply creation time
  * @uses esc_attr() To sanitize the reply creation time
  * @uses bbp_get_reply_last_active_time() To get the time when the reply was
  *                                    last active
  * @uses do_action() Calls 'bbp_admin_replies_column_data' with the
  *                    column and reply id
  */
 public function column_data($column, $reply_id)
 {
     if ($this->bail()) {
         return;
     }
     // Get topic ID
     $topic_id = bbp_get_reply_topic_id($reply_id);
     // Populate Column Data
     switch ($column) {
         // Topic
         case 'bbp_reply_topic':
             // Output forum name
             if (!empty($topic_id)) {
                 // Topic Title
                 $topic_title = bbp_get_topic_title($topic_id);
                 if (empty($topic_title)) {
                     $topic_title = esc_html__('No Topic', 'bbpress');
                 }
                 // Output the title
                 echo $topic_title;
                 // Reply has no topic
             } else {
                 esc_html_e('No Topic', 'bbpress');
             }
             break;
             // Forum
         // Forum
         case 'bbp_reply_forum':
             // Get Forum ID's
             $reply_forum_id = bbp_get_reply_forum_id($reply_id);
             $topic_forum_id = bbp_get_topic_forum_id($topic_id);
             // Output forum name
             if (!empty($reply_forum_id)) {
                 // Forum Title
                 $forum_title = bbp_get_forum_title($reply_forum_id);
                 if (empty($forum_title)) {
                     $forum_title = esc_html__('No Forum', 'bbpress');
                 }
                 // Alert capable users of reply forum mismatch
                 if ($reply_forum_id !== $topic_forum_id) {
                     if (current_user_can('edit_others_replies') || current_user_can('moderate')) {
                         $forum_title .= '<div class="attention">' . esc_html__('(Mismatch)', 'bbpress') . '</div>';
                     }
                 }
                 // Output the title
                 echo $forum_title;
                 // Reply has no forum
             } else {
                 _e('No Forum', 'bbpress');
             }
             break;
             // Author
         // Author
         case 'bbp_reply_author':
             bbp_reply_author_display_name($reply_id);
             break;
             // Freshness
         // Freshness
         case 'bbp_reply_created':
             // Output last activity time and date
             printf('%1$s <br /> %2$s', get_the_date(), esc_attr(get_the_time()));
             break;
             // Do action for anything else
         // Do action for anything else
         default:
             do_action('bbp_admin_replies_column_data', $column, $reply_id);
             break;
     }
 }
开发者ID:joeyblake,项目名称:bbpress,代码行数:96,代码来源:replies.php

示例10: bbp_unstick_topic

/**
 * Unsticks a topic both from front and it's forum
 *
 * @since bbPress (r2754)
 *
 * @param int $topic_id Optional. Topic id
 * @uses bbp_get_topic_id() To get the topic id
 * @uses bbp_is_topic_super_sticky() To check if the topic is a super sticky
 * @uses bbp_get_topic_forum_id() To get the topic forum id
 * @uses bbp_get_stickies() To get the forum stickies
 * @uses do_action() Calls 'bbp_unstick_topic' with the topic id
 * @uses delete_option() To delete the super stickies option
 * @uses update_option() To update the super stickies option
 * @uses delete_post_meta() To delete the forum stickies meta
 * @uses update_post_meta() To update the forum stickies meta
 * @uses do_action() Calls 'bbp_unsticked_topic' with the topic id and success
 * @return bool Always true.
 */
function bbp_unstick_topic($topic_id = 0)
{
    $topic_id = bbp_get_topic_id($topic_id);
    $super = bbp_is_topic_super_sticky($topic_id);
    $forum_id = empty($super) ? bbp_get_topic_forum_id($topic_id) : 0;
    $stickies = bbp_get_stickies($forum_id);
    $offset = array_search($topic_id, $stickies);
    do_action('bbp_unstick_topic', $topic_id);
    if (empty($stickies)) {
        $success = true;
    } elseif (!in_array($topic_id, $stickies)) {
        $success = true;
    } elseif (false === $offset) {
        $success = true;
    } else {
        array_splice($stickies, $offset, 1);
        if (empty($stickies)) {
            $success = !empty($super) ? delete_option('_bbp_super_sticky_topics') : delete_post_meta($forum_id, '_bbp_sticky_topics');
        } else {
            $success = !empty($super) ? update_option('_bbp_super_sticky_topics', $stickies) : update_post_meta($forum_id, '_bbp_sticky_topics', $stickies);
        }
    }
    do_action('bbp_unsticked_topic', $topic_id, $success);
    return (bool) $success;
}
开发者ID:jenia-buianov,项目名称:all_my_sites,代码行数:43,代码来源:functions.php

示例11: bbp_get_form_topic_forum

/**
 * Return value of topic forum
 *
 * @since 2.0.0 bbPress (r2976)
 *
 * @uses bbp_is_topic_edit() To check if it's the topic edit page
 * @uses bbp_get_topic_forum_id() To get the topic forum id
 * @uses apply_filters() Calls 'bbp_get_form_topic_forum' with the forum
 * @return string Value of topic content field
 */
function bbp_get_form_topic_forum()
{
    // Get _POST data
    if (bbp_is_topic_form_post_request() && isset($_POST['bbp_forum_id'])) {
        $topic_forum = (int) $_POST['bbp_forum_id'];
        // Get edit data
    } elseif (bbp_is_topic_edit()) {
        $topic_forum = bbp_get_topic_forum_id();
        // No data
    } else {
        $topic_forum = 0;
    }
    return apply_filters('bbp_get_form_topic_forum', $topic_forum);
}
开发者ID:joeyblake,项目名称:bbpress,代码行数:24,代码来源:template.php

示例12: elseif

    ?>
</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 
开发者ID:jodawill,项目名称:autosub,代码行数:31,代码来源:form-reply.php

示例13: bbp_tab_index

							<?php 
    if (bbp_has_topics(array('show_stickies' => false, 'post_parent' => bbp_get_topic_forum_id(bbp_get_topic_id()), 'post__not_in' => array(bbp_get_topic_id())))) {
        ?>

								<div>
									<input name="bbp_topic_split_option" id="bbp_topic_split_option_existing" type="radio" value="existing" tabindex="<?php 
        bbp_tab_index();
        ?>
" />
									<label for="bbp_topic_split_option_existing"><?php 
        _e('Use an existing topic in this forum:', 'bbpress');
        ?>
</label>

									<?php 
        bbp_dropdown(array('post_type' => bbp_get_topic_post_type(), 'post_parent' => bbp_get_topic_forum_id(bbp_get_topic_id()), 'selected' => -1, 'exclude' => bbp_get_topic_id(), 'select_id' => 'bbp_destination_topic', 'none_found' => __('No other topics found!', 'bbpress')));
        ?>

								</div>

							<?php 
    }
    ?>

						</fieldset>

						<fieldset class="bbp-form">
							<legend><?php 
    _e('Topic Extras', 'bbpress');
    ?>
</legend>
开发者ID:JMulligan,项目名称:skeleton_wp,代码行数:31,代码来源:form-topic-split.php

示例14: post_stylesheets_stylesheet_uri

/**
 * Checks if a post (or any post type) has the given meta key of 'Stylesheet' when on the singular view of 
 * the post on the front of the site.  If found, the function checks within the '/css' folder of the stylesheet 
 * directory (child theme) and the template directory (parent theme).  If the file exists, it is used rather 
 * than the typical style.css file.
 *
 * @since 0.1.0
 * @todo Use features from Ticket #18302 when available. http://core.trac.wordpress.org/ticket/18302
 * @access public
 * @param string $stylesheet_uri The URI of the active theme's stylesheet.
 * @param string $stylesheet_dir_uri The directory URI of the active theme's stylesheet.
 * @return string $stylesheet_uri
 */
function post_stylesheets_stylesheet_uri($stylesheet_uri, $stylesheet_dir_uri)
{
    /* Check if viewing a singular post. */
    if (is_singular()) {
        /* If viewing a bbPress topic, use its forum object. */
        if (function_exists('bbp_is_single_topic') && bbp_is_single_topic()) {
            $post = get_post(bbp_get_topic_forum_id(get_queried_object_id()));
        } elseif (function_exists('bbp_is_single_reply') && bbp_is_single_reply()) {
            $post = get_post(bbp_get_reply_forum_id(get_queried_object_id()));
        } else {
            $post = get_queried_object();
        }
        /* Check if the post type supports 'post-stylesheets' before proceeding. */
        if (post_type_supports($post->post_type, 'post-stylesheets')) {
            /* Check if the user has set a value for the post stylesheet. */
            $stylesheet = get_post_stylesheet($post->ID);
            /* If a meta value was given and the file exists, set $stylesheet_uri to the new file. */
            if (!empty($stylesheet)) {
                /* If the stylesheet is found in the child theme, use it. */
                if (file_exists(trailingslashit(get_stylesheet_directory()) . $stylesheet)) {
                    $stylesheet_uri = trailingslashit($stylesheet_dir_uri) . $stylesheet;
                } elseif (file_exists(trailingslashit(get_template_directory()) . $stylesheet)) {
                    $stylesheet_uri = trailingslashit(get_template_directory_uri()) . $stylesheet;
                } else {
                    /* If the stylesheet is found in the child theme '/css' folder, use it. */
                    if (file_exists(trailingslashit(get_stylesheet_directory()) . "css/{$stylesheet}")) {
                        $stylesheet_uri = trailingslashit($stylesheet_dir_uri) . "css/{$stylesheet}";
                        /* Set the post stylesheet to the correct directory. */
                        set_post_stylesheet($post->ID, str_replace(get_stylesheet_directory_uri(), 'css/', $stylesheet_uri));
                    } elseif (file_exists(trailingslashit(get_template_directory()) . "css/{$stylesheet}")) {
                        $stylesheet_uri = trailingslashit(get_template_directory_uri()) . "css/{$stylesheet}";
                        /* Set the post stylesheet to the correct directory. */
                        set_post_stylesheet($post->ID, str_replace(get_template_directory_uri(), 'css/', $stylesheet_uri));
                    }
                }
            }
        }
    }
    /* Return the stylesheet URI. */
    return $stylesheet_uri;
}
开发者ID:kimyj9501,项目名称:SingMyStory,代码行数:54,代码来源:post-stylesheets.php

示例15: cupid_breadcrumb_get_bbpress_items

 function cupid_breadcrumb_get_bbpress_items()
 {
     $item = array();
     $post_type_object = get_post_type_object(bbp_get_forum_post_type());
     if (!empty($post_type_object->has_archive) && !bbp_is_forum_archive()) {
         $item[] = '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . get_post_type_archive_link(bbp_get_forum_post_type()) . '">' . bbp_get_forum_archive_title() . '</a></li>';
     }
     if (bbp_is_forum_archive()) {
         $item['last'] = bbp_get_forum_archive_title();
     } elseif (bbp_is_topic_archive()) {
         $item['last'] = bbp_get_topic_archive_title();
     } elseif (bbp_is_single_view()) {
         $item['last'] = bbp_get_view_title();
     } elseif (bbp_is_single_topic()) {
         $topic_id = get_queried_object_id();
         $item = array_merge($item, cupid_breadcrumb_get_parents(bbp_get_topic_forum_id($topic_id)));
         if (bbp_is_topic_split() || bbp_is_topic_merge() || bbp_is_topic_edit()) {
             $item[] = '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . bbp_get_topic_permalink($topic_id) . '">' . bbp_get_topic_title($topic_id) . '</a></li>';
         } else {
             $item['last'] = bbp_get_topic_title($topic_id);
         }
         if (bbp_is_topic_split()) {
             $item['last'] = __('Split', 'cupid');
         } elseif (bbp_is_topic_merge()) {
             $item['last'] = __('Merge', 'cupid');
         } elseif (bbp_is_topic_edit()) {
             $item['last'] = __('Edit', 'cupid');
         }
     } elseif (bbp_is_single_reply()) {
         $reply_id = get_queried_object_id();
         $item = array_merge($item, cupid_breadcrumb_get_parents(bbp_get_reply_topic_id($reply_id)));
         if (!bbp_is_reply_edit()) {
             $item['last'] = bbp_get_reply_title($reply_id);
         } else {
             $item[] = '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . bbp_get_reply_url($reply_id) . '">' . bbp_get_reply_title($reply_id) . '</a></li>';
             $item['last'] = __('Edit', 'cupid');
         }
     } elseif (bbp_is_single_forum()) {
         $forum_id = get_queried_object_id();
         $forum_parent_id = bbp_get_forum_parent_id($forum_id);
         if (0 !== $forum_parent_id) {
             $item = array_merge($item, cupid_breadcrumb_get_parents($forum_parent_id));
         }
         $item['last'] = bbp_get_forum_title($forum_id);
     } elseif (bbp_is_single_user() || bbp_is_single_user_edit()) {
         if (bbp_is_single_user_edit()) {
             $item[] = '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . bbp_get_user_profile_url() . '">' . bbp_get_displayed_user_field('display_name') . '</a></li>';
             $item['last'] = __('Edit', 'cupid');
         } else {
             $item['last'] = bbp_get_displayed_user_field('display_name');
         }
     }
     return apply_filters('cupid_breadcrumb_get_bbpress_items', $item);
 }
开发者ID:adwleg,项目名称:site,代码行数:54,代码来源:breadcrumb.php


注:本文中的bbp_get_topic_forum_id函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。