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


PHP bb_get_post函数代码示例

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


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

示例1: nm_alert_user_wrote_forum_reply

/**
 * Alerts user when someone comments on their forum topic
 *
 * @Param: the id of the topic
 *
 * @author: Joe Hoyle
 * @version 1.0
 **/
function nm_alert_user_wrote_forum_reply($replyID)
{
    $userInfo = wp_get_current_user();
    $post = bb_get_post($replyID);
    $topicAuthor = get_topic_author($post->topic_id);
    $topicAuthor = get_userdatabylogin($topicAuthor);
    if ($post->poster_id != $topicAuthor->ID) {
        $alert = array();
        $alert['content'] = '<a href="' . getProfileLink($post->poster_id) . '" title="View ' . nm_user_public_name($post->poster_id) . 's profile">' . nm_user_public_name($post->poster_id) . '</a> has replied to your forum topic: <a href="' . get_post_link($replyID) . '" title="View ' . get_topic_title($topic_id) . '">' . get_topic_title($topic_id) . '</a>.';
        $alert['type'] = 'forum';
        nm_add_alert($topicAuthor->ID, $alert);
    }
    return $topicID;
}
开发者ID:popovdenis,项目名称:kmst,代码行数:22,代码来源:nm-user-alerts.php

示例2: post_edit_text

 function post_edit_text($post_id = 0)
 {
     $bb_post = bb_get_post(get_post_id($post_id));
     if (bb_current_user_can('edit_post', $bb_post->post_id)) {
         $parts[] = ' | <a href="' . attribute_escape(apply_filters('post_edit_uri', bb_get_option('uri') . 'edit.php?id=' . $bb_post->post_id, $bb_post->post_id)) . '">Edit</a>';
     }
     if (bb_current_user_can('delete_post', $bb_post->post_id)) {
         if (1 == $bb_post->post_status) {
             $parts[] = "<a href='" . attribute_escape(bb_nonce_url(bb_get_option('uri') . 'bb-admin/delete-post.php?id=' . $bb_post->post_id . '&status=0&view=all', 'delete-post_' . $bb_post->post_id)) . "' onclick='return confirm(\" " . js_escape(__('Are you sure you wanna undelete that?')) . " \");'>" . __('Undelete') . "</a>";
         } else {
             $parts[] = "<a href='" . attribute_escape(bb_nonce_url(bb_get_option('uri') . 'bb-admin/delete-post.php?id=' . $bb_post->post_id . '&status=1', 'delete-post_' . $bb_post->post_id)) . "' onclick='return ajaxPostDelete(" . $bb_post->post_id . ", \"" . get_post_author($post_id) . "\");'>" . __('Delete') . "</a>";
         }
     }
     if (count($parts) > 0) {
         echo implode(' | ', $parts);
     }
 }
开发者ID:billerby,项目名称:Surdeg,代码行数:17,代码来源:functions.php

示例3: bp_forums_get_post

function bp_forums_get_post($post_id)
{
    do_action('bbpress_init');
    return bb_get_post($post_id);
}
开发者ID:hscale,项目名称:webento,代码行数:5,代码来源:bp-forums-functions.php

示例4: bb_attachments_process_post

function bb_attachments_process_post($post_id = 0, $display = 0)
{
    global $bbdb, $bb_attachments;
    if (!$post_id) {
        $post_id = intval($_GET['bb_attachments']);
    }
    // only can upload if user is allowed to edit post
    $user_id = bb_get_current_user_info('id');
    if (!isset($_FILES['bb_attachments']) || !is_array($_FILES['bb_attachments']) || !$user_id || !$post_id || !bb_current_user_can('edit_post', $post_id) || !bb_current_user_can($bb_attachments['role']['upload'])) {
        return;
    }
    $user_ip = $_SERVER["REMOTE_ADDR"];
    // $GLOBALS["HTTP_SERVER_VARS"]["REMOTE_ADDR"];
    $time = time();
    $inject = "";
    $bb_post = bb_get_post($post_id);
    $topic_id = $bb_post->topic_id;
    // fetch related topic
    $topic_attachments = intval(bb_get_topicmeta($topic_id, "bb_attachments"));
    // generally how many on topic (may be off if post moved)
    $count = intval($bbdb->get_var("SELECT COUNT(*) FROM " . $bb_attachments['db'] . " WHERE post_id = {$post_id} AND status = 0"));
    // how many currently on post
    $offset = 0;
    // counter for this pass
    $strip = array(' ', '`', '"', '\'', '\\', '/', '..', '__');
    // filter for filenames
    $maxlength = bb_attachments_lookup($bb_attachments['max']['filename']);
    reset($_FILES);
    $output = "<h3>" . __("Uploads") . "</h3><ol>";
    // start output
    while (list($key, $value) = each($_FILES['bb_attachments']['name'])) {
        if (!empty($value)) {
            // don't trust these, check after upload $_FILES['bb_attachments']['type']   $_FILES['bb_attachments']['size']
            $filename = trim(str_replace($strip, '_', stripslashes($value)));
            // sanitize filename further ???
            if (empty($filename)) {
                $filename = "unknown";
            }
            if (intval($_FILES['bb_attachments']['error'][$key]) == 0 && $_FILES['bb_attachments']['size'][$key] > 0) {
                $ext = strrpos($filename, '.') === false ? "" : trim(strtolower(substr($filename, strrpos($filename, '.') + 1)));
                if (strlen($filename) > $maxlength) {
                    $filename = substr($filename, 0, $maxlength - strlen($ext) + 1) . "." . $ext;
                }
                // fix filename length
                $tmp = $bb_attachments['path'] . md5(rand(0, 99999) . time() . $_FILES['bb_attachments']['tmp_name'][$key]);
                // make random temp name that can't be guessed
                if (@is_uploaded_file($_FILES['bb_attachments']['tmp_name'][$key]) && @move_uploaded_file($_FILES['bb_attachments']['tmp_name'][$key], $tmp)) {
                    $size = filesize($tmp);
                    $mime = bb_attachments_mime_type($tmp);
                    $status = 0;
                    $id = 0;
                } else {
                    $status = 2;
                    //   file move to temp name failed for some unknown reason
                    $size = $_FILES['bb_attachments']['size'][$key];
                    // we'll trust the upload sequence for the size since it doesn't matter, it failed
                    $mime = "";
                    $id = 0;
                }
                if ($status == 0 && !in_array($ext, bb_attachments_lookup($bb_attachments['allowed']['extensions']))) {
                    $status = 3;
                }
                // disallowed extension
                if ($status == 0 && !in_array($mime, bb_attachments_lookup($bb_attachments['allowed']['mime_types']))) {
                    $status = 4;
                }
                // disallowed mime
                if ($status == 0 && $size > bb_attachments_lookup($bb_attachments['max']['size'], $ext)) {
                    $status = 5;
                }
                // disallowed size
                if ($status == 0 && $count + 1 > bb_attachments_lookup($bb_attachments['max']['per_post'])) {
                    $status = 6;
                }
                // disallowed attachment count
                if ($size > 0 && $filename) {
                    // we still save the status code if any but don't copy file until status = 0
                    $failed = $bbdb->get_var("\n\t\t\t\tINSERT INTO " . $bb_attachments['db'] . " ( time  , post_id , user_id, user_ip, status , size , ext , mime , filename )\n\t\t\t\tVALUES ('{$time}', '{$post_id}' ,  '{$user_id}' , inet_aton('{$user_ip}') , {$status}, '{$size}', '" . addslashes($ext) . "', '{$mime}', '" . addslashes($filename) . "')\t\t\t\t\n\t\t\t\t");
                    if ($status == 0 && !$failed) {
                        $id = intval($bbdb->get_var("SELECT LAST_INSERT_ID()"));
                    }
                    // fetch the assigned unique id #
                    if ($failed || !$id) {
                        $status = 2;
                    }
                    // db failure ?
                    if ($status == 0) {
                        // successful db insert - bbdb returns NULL on success so that !NULL is it's wierd way
                        $dir = $bb_attachments['path'] . floor($id / 1000);
                        if (function_exists('get_current_user') && function_exists('posix_setuid')) {
                            // try to set user's id so file/dir creation is under their account
                            $current = get_current_user();
                            if (!($current && !in_array($current, array("nobody", "httpd", "apache", "root")) && strpos(__FILE__, $current))) {
                                $current = "";
                            }
                            $x = posix_getuid();
                            if (0 == $x && $current) {
                                $org_uid = posix_getuid();
                                $pw_info = posix_getpwnam($current);
                                $uid = $pw_info["uid"];
//.........这里部分代码省略.........
开发者ID:achorg,项目名称:DH-Answers,代码行数:101,代码来源:bb-attachments.php

示例5: bb_export_post

function bb_export_post($post_id)
{
    if (!($_post = bb_get_post($post_id))) {
        return;
    }
    $_post = get_object_vars($_post);
    $atts = array('type' => 'post', 'id' => $_post['post_id'], 'author' => 'user_' . $_post['poster_id']);
    $translate = array('post_time' => 'incept', 'post_text' => '!content', 'post_status' => '?status', 'post_id' => false, 'poster_id' => false, 'forum_id' => false, 'topic_id' => false, 'post_position' => false);
    $post = _bb_translate_for_export($translate, $_post);
    $post['meta'] = $_post;
    return _bb_export_object($atts, $post, 2);
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:12,代码来源:export.php

示例6: mass_edit_get_post_link

function mass_edit_get_post_link($post_id = 0)
{
    // to do, get proper page link for delete posts based on complete post count, not position
    $bb_post = bb_get_post(get_post_id($post_id));
    $page = get_page_number($bb_post->post_position);
    $link = get_topic_link($bb_post->topic_id, $page) . "#post-{$bb_post->post_id}";
    if ($bb_post->post_status) {
        $link = add_query_arg('view', 'all', $link);
    }
    return $link;
    // apply_filters( 'get_post_link', $link, $bb_post->post_id );
}
开发者ID:achorg,项目名称:DH-Answers,代码行数:12,代码来源:mass-edit-admin.php

示例7: bb_ksd_post_delete_link

function bb_ksd_post_delete_link($parts, $args)
{
    if (!bb_current_user_can('moderate')) {
        return $parts;
    }
    $bb_post = bb_get_post(get_post_id($args['post_id']));
    if (2 == $bb_post->post_status) {
        $query = array('id' => $bb_post->post_id, 'status' => 0, 'view' => 'all');
        $display = __('Not Spam');
    } else {
        $query = array('id' => $bb_post->post_id, 'status' => 2);
        $display = __('Spam');
    }
    $uri = bb_get_uri('bb-admin/delete-post.php', $query, BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN);
    $uri = esc_url(bb_nonce_url($uri, 'delete-post_' . $bb_post->post_id));
    if (!is_array($parts)) {
        $parts = array();
        $before = '';
        $after = '';
    } else {
        $before = $args['last_each']['before'];
        $after = $args['last_each']['after'];
    }
    // Make sure that the last tag in $before gets a class (if it's there)
    if (preg_match('/.*(<[^>]+>)[^<]*/', $before, $_node)) {
        if (preg_match('/class=(\'|")(.*)\\1/U', $_node[1], $_class)) {
            $before = str_replace($_class[0], 'class=' . $_class[1] . 'before-post-spam-link ' . $_class[2] . $_class[1], $before);
        } else {
            $before = preg_replace('/(.*)<([a-z0-9_-]+)(\\s?)([^>]*)>([^<]*)/i', '$1<$2 class="before-post-spam-link"$3$4>$5', $before, 1);
        }
    }
    $parts[] = $before . '<a class="post-spam-link" href="' . $uri . '" >' . $display . '</a>' . $after;
    return $parts;
}
开发者ID:laiello,项目名称:cartonbank,代码行数:34,代码来源:akismet.php

示例8: bp_forums_get_post

/**
 * Get a single post object by ID.
 *
 * Wrapper for {@link bb_get_post()}.
 *
 * @param int $post_id ID of the post being fetched.
 * @return object Post object.
 */
function bp_forums_get_post($post_id)
{
    /** This action is documented in bp-forums/bp-forums-screens */
    do_action('bbpress_init');
    return bb_get_post($post_id);
}
开发者ID:kosir,项目名称:thatcamp-org,代码行数:14,代码来源:bp-forums-functions.php

示例9: bb_auth

<?php

require './bb-load.php';
bb_auth('logged_in');
$post_id = (int) $_POST['post_id'];
$bb_post = bb_get_post($post_id);
if (!$bb_post) {
    nxt_redirect(bb_get_uri(null, null, BB_URI_CONTEXT_HEADER));
    die;
}
if (!bb_current_user_can('edit_post', $post_id)) {
    bb_die(__('Sorry, post is too old.'));
}
bb_check_admin_referer('edit-post_' . $post_id);
if (0 != $bb_post->post_status && 'all' == $_GET['view']) {
    // We're trying to edit a deleted post
    add_filter('bb_is_first_where', 'bb_no_where');
}
// Check possible anonymous user data
$post_author = $post_email = $post_url = '';
if (!bb_get_user(get_post_author_id($post_id))) {
    if (!($post_author = sanitize_user(trim($_POST['author'])))) {
        bb_die(__('Every post needs an author name!'));
    } elseif (!($post_email = sanitize_email(trim($_POST['email'])))) {
        bb_die(__('Every post needs a valid email address!'));
    }
    if (!empty($_POST['url'])) {
        $post_url = esc_url(trim($_POST['url']));
    }
}
// Loop through possible anonymous post data
开发者ID:nxtclass,项目名称:NXTClass,代码行数:31,代码来源:bb-edit.php

示例10: best_answer_post_link

function best_answer_post_link($link, $post_id)
{
    // this needs to be rewritten for better performance somehow
    global $best_answer;
    static $posts_per_page;
    $post = bb_get_post($post_id);
    if (empty($posts_per_page)) {
        $posts_per_page = bb_get_option('page_topics');
    }
    // speedup
    if ($post->post_position > $posts_per_page) {
        // is it beyond page 1 typically?
        $topic = get_topic($post->topic_id);
        if (!empty($topic->best_answer)) {
            if (!empty($best_answer['forums']) && !isset($best_answer['forums'][$topic->forum_id])) {
                return $link;
            }
            if (!is_array($topic->best_answer)) {
                (array) ($topic->best_answer = explode(',', $topic->best_answer));
                $topic->best_answer = array_flip($topic->best_answer);
            }
            if (isset($topic->best_answer[$post_id])) {
                $link = get_topic_link($post->topic_id, 1) . "#post-{$post_id}";
            }
            // change link to page 1 for best answers
        }
    }
    return $link;
}
开发者ID:achorg,项目名称:DH-Answers,代码行数:29,代码来源:best-answer.php

示例11: bb_map_meta_cap

/**
 * Map meta capabilities to primitive capabilities.
 *
 * This does not actually compare whether the user ID has the actual capability,
 * just what the capability or capabilities are. Meta capability list value can
 * be 'delete_user', 'edit_user', 'delete_post', 'delete_page', 'edit_post',
 * 'edit_page', 'read_post', or 'read_page'.
 *
 * @since 0.7.2
 *
 * @param array $caps Previously existing capabilities
 * @param string $cap Capability name.
 * @param int $user_id User ID.
 * @return array Actual capabilities for meta capability.
 */
function bb_map_meta_cap($caps, $cap, $user_id, $args)
{
    // Unset the meta cap
    if (false !== ($cap_pos = array_search($cap, $caps))) {
        unset($caps[$cap_pos]);
    }
    switch ($cap) {
        case 'write_post':
            $caps[] = 'write_posts';
            break;
        case 'edit_post':
            // edit_posts, edit_others_posts, edit_deleted, edit_closed, ignore_edit_lock
            if (!($bb_post = bb_get_post($args[0]))) {
                $caps[] = 'magically_provide_data_given_bad_input';
                return $caps;
            }
            if ($user_id == $bb_post->poster_id) {
                $caps[] = 'edit_posts';
            } else {
                $caps[] = 'edit_others_posts';
            }
            if ($bb_post->post_status == '1') {
                $caps[] = 'edit_deleted';
            }
            if (!topic_is_open($bb_post->topic_id)) {
                $caps[] = 'edit_closed';
            }
            $post_time = bb_gmtstrtotime($bb_post->post_time);
            $curr_time = time() + 1;
            $edit_lock = bb_get_option('edit_lock');
            if ($edit_lock >= 0 && $curr_time - $post_time > $edit_lock * 60) {
                $caps[] = 'ignore_edit_lock';
            }
            break;
        case 'delete_post':
            // edit_deleted, delete_posts
            if (!($bb_post = bb_get_post($args[0]))) {
                $caps[] = 'magically_provide_data_given_bad_input';
                return $caps;
            }
            if (0 != $bb_post->post_status) {
                $caps[] = 'edit_deleted';
            }
            // NO BREAK
        // NO BREAK
        case 'manage_posts':
            // back compat
            $caps[] = 'delete_posts';
            break;
        case 'write_topic':
            $caps[] = 'write_topics';
            break;
        case 'edit_topic':
            // edit_closed, edit_deleted, edit_topics, edit_others_topics
            if (!($topic = get_topic($args[0]))) {
                $caps[] = 'magically_provide_data_given_bad_input';
                return $caps;
            }
            if (!topic_is_open($args[0])) {
                $caps[] = 'edit_closed';
            }
            if ('1' == $topic->topic_status) {
                $caps[] = 'edit_deleted';
            }
            if ($user_id == $topic->topic_poster) {
                $caps[] = 'edit_topics';
            } else {
                $caps[] = 'edit_others_topics';
            }
            break;
        case 'move_topic':
            $caps[] = 'move_topics';
            break;
        case 'stick_topic':
            $caps[] = 'stick_topics';
            break;
        case 'close_topic':
            $caps[] = 'close_topics';
            break;
        case 'delete_topic':
            $caps[] = 'delete_topics';
            add_filter('get_topic_where', 'bb_no_where', 9999);
            if (!($topic = get_topic($args[0]))) {
                $caps[] = 'magically_provide_data_given_bad_input';
                return $caps;
//.........这里部分代码省略.........
开发者ID:laiello,项目名称:cartonbank,代码行数:101,代码来源:functions.bb-capabilities.php

示例12: bb_topics_replied_on_undelete_post

function bb_topics_replied_on_undelete_post($post_id)
{
    global $bbdb;
    $bb_post = bb_get_post($post_id);
    $topic = get_topic($bb_post->topic_id);
    $user_posts = new BB_Query('post', array('post_author_id' => $bb_post->poster_id, 'topic_id' => $topic->topic_id));
    if (1 == count($user_posts) && ($user = bb_get_user($bb_post->poster_id))) {
        bb_update_usermeta($user->ID, $bbdb->prefix . 'topics_replied', $user->topics_replied + 1);
    }
}
开发者ID:abc2mit,项目名称:abc2mit.github.io,代码行数:10,代码来源:functions.bb-posts.php

示例13: bp_ning_import_process_inline_images_new

function bp_ning_import_process_inline_images_new($type, $post_ID, $post_type = 'post')
{
    switch ($post_type) {
        case 'post':
            $post = get_post($post_ID);
            $text = $post->post_content;
            break;
        case 'topic':
            $topic = bb_get_first_post($post_ID);
            $post_ID = (int) $topic->post_id;
            $text = $topic->post_text;
            break;
        case 'topic_reply':
            $reply = bb_get_post($post_ID);
            $text = $reply->post_text;
            break;
        case 'comment':
            $comment = get_comment($post_ID);
            $text = $comment->comment_content;
            break;
    }
    $ning_dir = content_url('/ning-files/');
    $real_images = array();
    // Only worry about local images
    if (preg_match_all('#"(' . $type . '/.*?\\.(?:gif|jpg|jpeg|png|bmp))(?:\\?(?:[^"]*?))?"#', $text, $images)) {
        // $images is an array of file names in import-from-ning/json/discussions. Move 'em
        foreach ($images[1] as $image) {
            $real_name = bp_ning_real_image_name($image);
            if (!isset($real_images[$real_name])) {
                $html = media_sideload_image($ning_dir . $image, $post_ID);
                if (is_wp_error($html)) {
                    continue;
                }
                preg_match("#<img src='(.*?)'#", $html, $matches);
                $url = $real_images[$real_name] = $matches[1];
            } else {
                $url = $real_images[$real_name];
            }
            $text = str_replace($image, $url, $text);
        }
    } else {
        return;
    }
    switch ($post_type) {
        case 'post':
            $args = array('ID' => $post_ID, 'post_content' => $text);
            $args = add_magic_quotes($args);
            wp_update_post($args);
            break;
        case 'topic':
        case 'topic_reply':
            $args = array('post_id' => $post_ID, 'post_text' => $text);
            bb_insert_post($args);
            break;
        case 'comment':
            $args = array('comment_ID' => $post_ID, 'comment_content' => $text);
            wp_update_comment($args);
            break;
    }
}
开发者ID:boonebgorges,项目名称:Import-from-Ning,代码行数:60,代码来源:bp-functions.php

示例14: bb_bozo_delete_post

function bb_bozo_delete_post($post_id, $new_status, $old_status)
{
    $bb_post = bb_get_post($post_id);
    if (1 < $new_status && 2 > $old_status) {
        bb_bozon($bb_post->poster_id, $bb_post->topic_id);
    } elseif (2 > $new_status && 1 < $old_status) {
        bb_fermion($bb_post->poster_id, $bb_post->topic_id);
    }
}
开发者ID:laiello,项目名称:cartonbank,代码行数:9,代码来源:bozo.php

示例15: ass_group_notification_forum_posts

/**
 * When a new forum topic or post is posted in bbPress, either:
 * 	1) Send emails to all group subscribers
 *	2) Prepares to record it for digest purposes - see {@link ass_group_forum_record_digest()}.
 *
 * Hooks into the bbPress action - 'bb_new_post' - to easily identify new forum posts vs edits.
 */
function ass_group_notification_forum_posts($post_id)
{
    global $bp, $wpdb;
    $post = bb_get_post($post_id);
    // Check to see if user has been registered long enough
    if (!ass_registered_long_enough($post->poster_id)) {
        return;
    }
    $topic = get_topic($post->topic_id);
    $group = groups_get_current_group();
    // if the current group isn't available, grab it
    if (empty($group)) {
        // get the group ID by looking up the forum ID in the groupmeta table
        $group_id = $wpdb->get_var($wpdb->prepare("\n\t\t\t\tSELECT group_id\n\t\t\t\tFROM {$bp->groups->table_name_groupmeta}\n\t\t\t\tWHERE meta_key = %s\n\t\t\t\tAND meta_value = %d\n\t\t\t", 'forum_id', $topic->forum_id));
        // now get the group
        $group = groups_get_group(array('group_id' => $group_id));
    }
    $primary_link = trailingslashit(bp_get_group_permalink($group) . 'forum/topic/' . $topic->topic_slug);
    $blogname = '[' . get_blog_option(BP_ROOT_BLOG, 'blogname') . ']';
    $is_topic = false;
    // initialize faux activity object for backpat filter reasons
    //
    // due to r-a-y being an idiot here:
    // https://github.com/boonebgorges/buddypress-group-email-subscription/commit/526b80c617fe9058a859ac4eb4cfb1d42d333aa0
    //
    // because we moved the email recording process to 'bb_new_post' from the BP activity save hook,
    // we need to ensure that 3rd-party code will continue to work as-is
    //
    // we can't add the 'id' because we're firing the filters before the activity item is created :(
    $activity = new stdClass();
    $activity->user_id = $post->poster_id;
    $activity->component = 'groups';
    $activity->item_id = $group->id;
    $activity->content = $post->post_text;
    // this is a new topic
    if ($post->post_position == 1) {
        $is_topic = true;
        // more faux activity items!
        $activity->type = 'new_forum_topic';
        $activity->secondary_item_id = $topic->topic_id;
        $activity->primary_link = $primary_link;
        $action = $activity->action = sprintf(__('%s started the forum topic "%s" in the group "%s"', 'bp-ass'), bp_core_get_user_displayname($post->poster_id), $topic->topic_title, $group->name);
        $subject = apply_filters('bp_ass_new_topic_subject', $action . ' ' . $blogname, $action, $blogname);
        $the_content = apply_filters('bp_ass_new_topic_content', $post->post_text, $activity, $topic, $group);
    } else {
        // more faux activity items!
        $activity->type = 'new_forum_post';
        $activity->secondary_item_id = $post_id;
        $action = $activity->action = sprintf(__('%s replied to the forum topic "%s" in the group "%s"', 'bp-ass'), bp_core_get_user_displayname($post->poster_id), $topic->topic_title, $group->name);
        // calculate the topic page for pagination purposes
        $pag_num = apply_filters('bp_ass_topic_pag_num', 15);
        $page = ceil($topic->topic_posts / $pag_num);
        if ($page > 1) {
            $primary_link .= '?topic_page=' . $page;
        }
        $primary_link .= "#post-" . $post_id;
        $activity->primary_link = $primary_link;
        $subject = apply_filters('bp_ass_forum_reply_subject', $action . ' ' . $blogname, $action, $blogname);
        $the_content = apply_filters('bp_ass_forum_reply_content', $post->post_text, $activity, $topic, $group);
    }
    // Convert entities and do other cleanup
    $the_content = ass_clean_content($the_content);
    // if group is not public, change primary link to login URL to verify
    // authentication and for easier redirection after logging in
    if ($group->status != 'public') {
        $primary_link = ass_get_login_redirect_url($primary_link, 'legacy_forums_view');
        $text_before_primary = __('To view or reply to this topic, go to:', 'bp-ass');
        // if public, show standard text
    } else {
        $text_before_primary = __('To view or reply to this topic, log in and go to:', 'bp-ass');
    }
    // setup the email meessage
    $message = sprintf(__('%s

"%s"

%s
%s

---------------------
', 'bp-ass'), $action . ':', $the_content, $text_before_primary, $primary_link);
    // get subscribed users
    $subscribed_users = groups_get_groupmeta($group->id, 'ass_subscribed_users');
    // do this for forum replies only
    if (!$is_topic) {
        // pre-load these arrays to reduce db calls in the loop
        $ass_replies_to_my_topic = ass_user_settings_array('ass_replies_to_my_topic');
        $ass_replies_after_me_topic = ass_user_settings_array('ass_replies_after_me_topic');
        $previous_posters = ass_get_previous_posters($post->topic_id);
        // make sure manually-subscribed topic users and regular group subscribed users are combined
        $user_topic_status = groups_get_groupmeta($group->id, 'ass_user_topic_status_' . $topic->topic_id);
        if (!empty($subscribed_users) && !empty($user_topic_status)) {
            $subscribed_users = $subscribed_users + $user_topic_status;
//.........这里部分代码省略.........
开发者ID:pausaura,项目名称:agora_nodes,代码行数:101,代码来源:bp-activity-subscription-functions.php


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