Esempio n. 1
0
function thanks_output_details($post_id, $uid, $logged_in = true)
{
    $out = "";
    $meta = bb_get_post_meta("thanks", $post_id);
    $report_length = 0;
    if (isset($meta)) {
        $vote_count = count($meta);
        $msg_type = $vote_count == 0 ? "none" : ($vote_count == 1 ? "one" : "many");
        $msg = thanks_get_voting_phrase("thanks_output_" . $msg_type);
        $report_length = strlen($msg);
        $out .= str_replace("#", "" . $vote_count, $msg);
        $should_show_voters = thanks_get_voting_phrase("thanks_voters");
        if ($should_show_voters == "yes") {
            $out .= ' ' . thanks_get_voting_phrase("thanks_voters_prefix");
            for ($i = 0; $i < count($meta); $i++) {
                $link = get_user_profile_link($meta[$i]);
                $voter = bb_get_user($meta[$i]);
                if ($i > 0) {
                    $out .= ", ";
                }
                $out .= '<a href="' . $link . '">' . $voter->display_name . '</a>';
            }
            $out .= thanks_get_voting_phrase("thanks_voters_suffix");
        }
    }
    if ($logged_in) {
        if (!in_array($uid, $meta)) {
            if (isset($meta) && $report_length > 0) {
                $out .= "&nbsp;&nbsp;|&nbsp;&nbsp;";
            }
            $msg = thanks_get_voting_phrase("thanks_voting");
            $out .= "<a class=\"thanks-vote\" user=\"" . $uid . "\" id=\"" . $post_id . "\">" . $msg . "</a>";
        }
    }
    return $out;
}
function post_author_type($post_id = 0)
{
    $id = get_post_author_id($post_id);
    $type = get_user_type($id);
    if (false === $type) {
        if (bb_get_post_meta('pingback_uri', $post_id)) {
            $r = __('PingBack');
        } else {
            $r = __('Unregistered');
        }
        // This should never happen
    } else {
        $r = '<a href="' . esc_attr(get_user_profile_link($id)) . '">' . $type . '</a>';
    }
    echo apply_filters('post_author_type', $r, $post_id);
}
<?php

// Setup $current_poster varaible on post edit
if (bb_is_topic_edit()) {
    foreach (array('post_author', 'post_email', 'post_url') as $post_author_meta) {
        $current_poster[$post_author_meta] = bb_get_post_meta($post_author_meta, $post_id);
    }
    // Shift $current_poster values from cookie
} else {
    $current_poster = bb_get_current_poster();
    $current_poster['post_email'] = $current_poster['post_author_email'];
    $current_poster['post_url'] = $current_poster['post_author_url'];
}
?>

	<p id="post-form-author-container">
		<label for="author"><?php 
_e('Author');
?>
			<input type="text" name="author" id="author" size="50" tabindex="30" aria-required="true" value="<?php 
echo esc_attr($current_poster['post_author']);
?>
" />
		</label>
	</p>

	<p id="post-form-email-container">
		<label for="email"><?php 
_e('Email');
?>
			<input type="text" name="email" id="email" size="50" tabindex="31" aria-required="true" value="<?php 
Esempio n. 4
0
<?php

require_once '../../bb-load.php';
require_once "thanks-output.php";
$post_id = $_POST['post_id'];
$user_id = $_POST['user_id'];
$meta = bb_get_post_meta("thanks", $post_id);
if (!isset($meta)) {
    $meta = array();
}
$tmp = array();
for ($i = 0; $i < count($meta); $i++) {
    $tmp[$meta[$i]] = "X";
}
$tmp[$user_id] = "X";
$meta = array_keys($tmp);
bb_update_postmeta($post_id, "thanks", $meta);
$opt = bb_get_option("thanks_posts");
if (!isset($opt)) {
    $opt = array();
}
$tmp = array();
for ($i = 0; $i < count($opt); $i++) {
    $tmp[$opt[$i]] = "X";
}
$tmp[$post_id] = "X";
$opt = array_keys($tmp);
bb_update_option('thanks_posts', $opt);
echo thanks_output_details($post_id, $user_id, true);