function show_badges() { $badges = get_badges(get_post_author_id()); // Print array of badges foreach ($badges as $badge) { echo $badge; } }
function nm_rewrite_user_group_name($post_id = 0) { $title = get_post_author_title($post_id); if (false === $title) { $r = __('Unregistered'); } else { $r = '<a href="' . attribute_escape(get_user_profile_link(get_post_author_id($post_id))) . '">' . $title . '</a>'; } $ug_name = apply_filters('post_author_title', $r); if ($ug_name == "Member") { $ug_name = bloginfo() . " Member"; } elseif ($ug_name == "Key Master") { $ug_name = bloginfo() . " Administrator"; } elseif ($ug_name == "Moderator") { $ug_name = bloginfo() . " Moderator"; } elseif ($ug_name == "Administrator") { $ug_name = bloginfo() . " Administrator"; } else { $ug_name = bloginfo() . " Member"; } return $ug_name; }
function bb_admin_list_posts() { global $bb_posts, $bb_post; if (!$bb_posts) { ?> <p class="no-results"><?php _e('No posts found.'); ?> </p> <?php } else { ?> <table id="posts-list" class="widefat" cellspacing="0" cellpadding="0"> <thead> <tr> <th scope="col" class="check-column"><input type="checkbox" /></th> <th scope="col"><?php _e('Post'); ?> </th> <th scope="col"><?php _e('Author'); ?> </th> <th scope="col"><?php _e('Topic'); ?> </th> <th scope="col"><?php _e('Date'); ?> </th> </tr> </thead> <tfoot> <tr> <th scope="col" class="check-column"><input type="checkbox" /></th> <th scope="col"><?php _e('Post'); ?> </th> <th scope="col"><?php _e('Author'); ?> </th> <th scope="col"><?php _e('Topic'); ?> </th> <th scope="col"><?php _e('Date'); ?> </th> </tr> </tfoot> <tbody> <?php foreach ($bb_posts as $bb_post) { ?> <tr id="post-<?php post_id(); ?> "<?php alt_class('post', post_del_class()); ?> > <td class="check-column"><input type="checkbox" name="post[]" value="<?php post_id(); ?> " /></td> <td class="post"> <?php post_text(); ?> <div> <span class="row-actions"> <a href="<?php echo esc_url(get_post_link()); ?> "><?php _e('View'); ?> </a> <?php bb_post_admin(array('before_each' => ' | ', 'each' => array('undelete' => array('before' => ' ')), 'last_each' => array('before' => ' | '))); ?> </span> </div> </td> <td class="author"> <?php if (get_post_author_id()) { ?> <a href="<?php user_profile_link(get_post_author_id()); ?> "> <?php post_author_avatar('16'); ?> <?php post_author(); ?> </a> <?php } else { ?> <span> <?php post_author_avatar('16'); ?> <?php post_author(); ?> </span> <?php } ?> </td> <td class="topic"> <a href="<?php topic_link($bb_post->topic_id); ?> "><?php topic_title($bb_post->topic_id); ?> </a> </td> <td class="date"> <?php if (bb_get_post_time('U') < time() - 86400) { bb_post_time('Y/m/d\\<\\b\\r \\/\\>H:i:s'); } else { printf(__('%s ago'), bb_get_post_time('since')); } ?> </td> </tr> <?php } ?> </tbody> </table> <?php } }
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); }
$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 foreach (array('post_author', 'post_email', 'post_url') as $field) { if (!empty(${$field})) { $post_data[$field] = ${$field}; } }
?> <p> <label for="post_content"><?php _e('Post:'); ?> <br /> <textarea name="post_content" cols="50" rows="8" tabindex="32" id="post_content"><?php echo apply_filters('edit_text', get_post_text()); ?> </textarea> </label> </p> <?php if (bb_get_user(get_post_author_id()) && bb_is_subscriptions_active()) { ?> <p id="post-form-subscription-container" class="left"> <?php bb_user_subscribe_checkbox('tab=33'); ?> </p> <?php } ?> <p class="submit"> <input type="submit" name="Submit" value="<?php esc_attr_e('Edit Post »'); ?> " tabindex="34" />
function bb_attachments_post_attachments($post_id = 0) { global $bbdb, $bb_attachments, $bb_attachments_cache, $bb_current_user; $output = ""; if ($post_id && ($bb_attachments['role']['see'] == "read" || bb_current_user_can($bb_attachments['role']['see']))) { $time = time() - 60; $can_delete = false; $self = false; $admin = false; $filter = true; // " AND status = 0 "; // speedup checks with flag if ($bb_current_user->ID == get_post_author_id($post_id)) { $self = true; } if ((!is_topic() || isset($_GET['bb_attachments'])) && bb_current_user_can('moderate')) { $filter = ""; $admin = bb_current_user_can('administrate'); } if (bb_current_user_can($bb_attachments['role']['delete']) && bb_current_user_can('edit_post', $post_id)) { $can_delete = true; } $location = bb_attachments_location(); $can_inline = true; if (!($bb_attachments['role']['inline'] == "read" || bb_current_user_can($bb_attachments['role']['inline']))) { $can_inline = false; } if (!isset($bb_attachments_cache[$post_id])) { $bb_attachments_cache[$post_id] = $bbdb->get_results("SELECT * FROM " . $bb_attachments['db'] . " WHERE post_id = {$post_id} ORDER BY time DESC LIMIT 999"); } if (count($bb_attachments_cache[$post_id])) { foreach ($bb_attachments_cache[$post_id] as $attachment) { $showerror = $self && $attachment->time > $time ? true : false; if ($attachment->status == 0 || empty($filter) || $showerror) { $attachment->filename = stripslashes($attachment->filename); $output .= "<li>"; $output .= "<span" . ($attachment->status > 0 ? " class='deleted' " : "") . "> "; if ($attachment->status > 0) { $icon = "missing.gif"; } else { if (isset($bb_attachments['icons'][$attachment->ext])) { $icon = $bb_attachments['icons'][$attachment->ext]; } else { $icon = $bb_attachments['icons']['default']; } } $output .= " <img align='absmiddle' title='" . $attachment->ext . "' src='" . $bb_attachments['icons']['url'] . $icon . "' /> "; if ($attachment->status > 0 && (empty($filter) || $showerror)) { $output .= " [" . __($bb_attachments['status'][$attachment->status]) . "] {$attachment->filename} "; } if ($attachment->status == 0) { $output .= " " . "<a href='" . attribute_escape(add_query_arg('bbat', $attachment->id, add_query_arg('bb_attachments', $attachment->post_id, remove_query_arg(array('bb_attachments', 'bbat', 'bbat_delete'))))) . "'>" . $attachment->filename . "</a> " . " "; } $output .= " <span class='num'>(" . round($attachment->size / 1024, 1) . " KB"; if ($attachment->status < 2) { $output .= ", " . bb_number_format_i18n($attachment->downloads) . " " . __('downloads'); } $output .= ")</span> "; if ($attachment->time < $time) { $output .= " <small>" . bb_since($attachment->time) . " " . __('old') . "</small> "; } if ($admin) { $output .= ' [<a href="' . attribute_escape(bb_get_option('uri') . 'bb-admin/view-ip.php?ip=' . long2ip($attachment->user_ip)) . '">' . long2ip($attachment->user_ip) . '</a>] '; } if ($attachment->status == 0 && $can_delete) { $output .= ' [<a onClick="return confirm(' . "'" . __('Delete') . " {$attachment->filename} ?" . "'" . ')" href="' . add_query_arg('bbat_delete', $attachment->id) . '">x</a>] '; } if ($attachment->status == 0 && $location == "edit.php" && $can_inline) { $fullpath = $bb_attachments['path'] . floor($attachment->id / 1000) . "/" . $attachment->id . "." . $attachment->filename; if (list($width, $height, $type) = getimagesize($fullpath)) { $output .= " [<strong><a href='#' onclick='bbat_inline_insert({$attachment->post_id},{$attachment->id}); return false;'>" . __("INSERT") . "</a></strong>] "; } } $output .= " </span></li>"; } } } if ($output) { $output = "<h3>" . __("Attachments") . "</h3><ol>" . $output . "</ol>"; } if ($location == "edit.php") { $output .= '<scr' . 'ipt type="text/javascript" defer="defer"> function bbat_inline_insert(post_id,id) { bbat_field = document.getElementsByTagName("textarea")[0]; bbat_value="[attachment="+post_id+","+id+"]"; if (document.selection) {bbat_field.focus(); sel = document.selection.createRange();sel.text = bbat_value;} else if (bbat_field.selectionStart || bbat_field.selectionStart == "0") {var startPos = bbat_field.selectionStart; var endPos = bbat_field.selectionEnd; bbat_field.value = bbat_field.value.substring(0, startPos)+ bbat_value+ bbat_field.value.substring(endPos, bbat_field.value.length); } else {bbat_field.value += bbat_value;} return false;} </script>'; } } if (is_bb_feed()) { $output = wp_specialchars($output); } return $output; }
/** * Outputs the post form subscription checkbox. * * Checks if user is subscribed and outputs checkbox based on status. * * @since 1.1 */ function bb_user_subscribe_checkbox($args = null) { if (!bb_is_user_logged_in()) { return false; } $is_current = false; $defaults = array('tab' => false); $args = wp_parse_args($args, $defaults); $tab = $args['tab'] !== false ? ' tabindex="' . $args['tab'] . '"' : ''; $is_current = bb_get_user_id(get_post_author_id()) == bb_get_current_user_info('id'); // Change subscription checkbox message if current or moderating if (bb_is_topic_edit() && !$is_current) { $text = __('This user should be notified of follow-up posts via email'); } else { $text = __('Notify me of follow-up posts via email'); } echo ' <label for="subscription_checkbox"> <input name="subscription_checkbox" id="subscription_checkbox" type="checkbox" value="subscribe" ' . checked(true, bb_is_user_subscribed(), false) . $tab . ' /> ' . apply_filters('bb_user_subscribe_checkbox_label', $text, (bool) $is_current) . ' </label>'; }