本文整理汇总了PHP中bp_is_item_mod函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_is_item_mod函数的具体用法?PHP bp_is_item_mod怎么用?PHP bp_is_item_mod使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_is_item_mod函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bp_get_the_topic_admin_links
/**
* Return the admin links for the current topic in the loop.
*
* @param array $args {
* @type string $seperator The character to use when separating
* links. Default: '|'.
* }
* @return HTML string containing the admin links for the current topic.
*/
function bp_get_the_topic_admin_links($args = '')
{
global $forum_template;
$defaults = array('seperator' => '|');
$r = wp_parse_args($args, $defaults);
extract($r, EXTR_SKIP);
$links[] = '<a href="' . wp_nonce_url(bp_get_the_topic_permalink() . 'edit', 'bp_forums_edit_topic') . '">' . __('Edit Topic', 'buddypress') . '</a>';
if (bp_is_item_admin() || bp_is_item_mod() || bp_current_user_can('bp_moderate')) {
if (0 == (int) $forum_template->topic->topic_sticky) {
$links[] = '<a href="' . wp_nonce_url(bp_get_the_topic_permalink() . 'stick', 'bp_forums_stick_topic') . '">' . __('Sticky Topic', 'buddypress') . '</a>';
} else {
$links[] = '<a href="' . wp_nonce_url(bp_get_the_topic_permalink() . 'unstick', 'bp_forums_unstick_topic') . '">' . __('Un-stick Topic', 'buddypress') . '</a>';
}
if (0 == (int) $forum_template->topic->topic_open) {
$links[] = '<a href="' . wp_nonce_url(bp_get_the_topic_permalink() . 'open', 'bp_forums_open_topic') . '">' . __('Open Topic', 'buddypress') . '</a>';
} else {
$links[] = '<a href="' . wp_nonce_url(bp_get_the_topic_permalink() . 'close', 'bp_forums_close_topic') . '">' . __('Close Topic', 'buddypress') . '</a>';
}
$links[] = '<a class="confirm" id="topic-delete-link" href="' . wp_nonce_url(bp_get_the_topic_permalink() . 'delete', 'bp_forums_delete_topic') . '">' . __('Delete Topic', 'buddypress') . '</a>';
}
return implode(' ' . $seperator . ' ', (array) $links);
}
示例2: bp_group_is_mod
function bp_group_is_mod()
{
return bp_is_item_mod();
}
示例3: groups_screen_group_forum
/**
* This screen function handles actions related to group forums.
*/
function groups_screen_group_forum()
{
if (!bp_is_active('forums') || !bp_forums_is_installed_correctly()) {
return false;
}
if (bp_action_variable(0) && !bp_is_action_variable('topic', 0)) {
bp_do_404();
return;
}
$bp = buddypress();
if (!$bp->groups->current_group->user_has_access) {
bp_core_no_access();
return;
}
if (!bp_is_single_item()) {
return false;
}
// Fetch the details we need.
$topic_slug = (string) bp_action_variable(1);
$topic_id = bp_forums_get_topic_id_from_slug($topic_slug);
$forum_id = groups_get_groupmeta($bp->groups->current_group->id, 'forum_id');
$user_is_banned = false;
if (!bp_current_user_can('bp_moderate') && groups_is_user_banned(bp_loggedin_user_id(), $bp->groups->current_group->id)) {
$user_is_banned = true;
}
if (!empty($topic_slug) && !empty($topic_id)) {
// Posting a reply.
if (!$user_is_banned && !bp_action_variable(2) && isset($_POST['submit_reply'])) {
// Check the nonce.
check_admin_referer('bp_forums_new_reply');
// Auto join this user if they are not yet a member of this group.
if (bp_groups_auto_join() && !bp_current_user_can('bp_moderate') && 'public' == $bp->groups->current_group->status && !groups_is_user_member(bp_loggedin_user_id(), $bp->groups->current_group->id)) {
groups_join_group($bp->groups->current_group->id, bp_loggedin_user_id());
}
$topic_page = isset($_GET['topic_page']) ? $_GET['topic_page'] : false;
// Don't allow reply flooding.
if (bp_forums_reply_exists($_POST['reply_text'], $topic_id, bp_loggedin_user_id())) {
bp_core_add_message(__('It looks like you\'ve already said that!', 'buddypress'), 'error');
} else {
if (!($post_id = groups_new_group_forum_post($_POST['reply_text'], $topic_id, $topic_page))) {
bp_core_add_message(__('There was an error when replying to that topic', 'buddypress'), 'error');
} else {
bp_core_add_message(__('Your reply was posted successfully', 'buddypress'));
}
}
$query_vars = isset($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : '';
$redirect = bp_get_group_permalink(groups_get_current_group()) . 'forum/topic/' . $topic_slug . '/' . $query_vars;
if (!empty($post_id)) {
$redirect .= '#post-' . $post_id;
}
bp_core_redirect($redirect);
} elseif (bp_is_action_variable('stick', 2) && (bp_is_item_admin() || bp_is_item_mod())) {
// Check the nonce.
check_admin_referer('bp_forums_stick_topic');
if (!bp_forums_sticky_topic(array('topic_id' => $topic_id))) {
bp_core_add_message(__('There was an error when making that topic a sticky', 'buddypress'), 'error');
} else {
bp_core_add_message(__('The topic was made sticky successfully', 'buddypress'));
}
/**
* Fires after a group forum topic has been stickied.
*
* @since 1.1.0
*
* @param int $topic_id ID of the topic being stickied.
*/
do_action('groups_stick_forum_topic', $topic_id);
bp_core_redirect(wp_get_referer());
} elseif (bp_is_action_variable('unstick', 2) && (bp_is_item_admin() || bp_is_item_mod())) {
// Check the nonce.
check_admin_referer('bp_forums_unstick_topic');
if (!bp_forums_sticky_topic(array('topic_id' => $topic_id, 'mode' => 'unstick'))) {
bp_core_add_message(__('There was an error when unsticking that topic', 'buddypress'), 'error');
} else {
bp_core_add_message(__('The topic was unstuck successfully', 'buddypress'));
}
/**
* Fires after a group forum topic has been un-stickied.
*
* @since 1.1.0
*
* @param int $topic_id ID of the topic being un-stickied.
*/
do_action('groups_unstick_forum_topic', $topic_id);
bp_core_redirect(wp_get_referer());
} elseif (bp_is_action_variable('close', 2) && (bp_is_item_admin() || bp_is_item_mod())) {
// Check the nonce.
check_admin_referer('bp_forums_close_topic');
if (!bp_forums_openclose_topic(array('topic_id' => $topic_id))) {
bp_core_add_message(__('There was an error when closing that topic', 'buddypress'), 'error');
} else {
bp_core_add_message(__('The topic was closed successfully', 'buddypress'));
}
/**
* Fires after a group forum topic has been closed.
*
* @since 1.1.0
//.........这里部分代码省略.........
示例4: bp_group_admin_tabs
function bp_group_admin_tabs($group = false)
{
global $bp, $groups_template;
if (empty($group)) {
$group = $groups_template->group ? $groups_template->group : $bp->groups->current_group;
}
$current_tab = bp_get_group_current_admin_tab();
if (bp_is_item_admin() || bp_is_item_mod()) {
?>
<li<?php
if ('edit-details' == $current_tab || empty($current_tab)) {
?>
class="current"<?php
}
?>
><a href="<?php
echo trailingslashit(bp_get_group_permalink($group) . 'admin/edit-details');
?>
"><?php
_e('Details', 'buddypress');
?>
</a></li>
<?php
}
?>
<?php
if (!bp_is_item_admin()) {
return false;
}
?>
<li<?php
if ('group-settings' == $current_tab) {
?>
class="current"<?php
}
?>
><a href="<?php
echo trailingslashit(bp_get_group_permalink($group) . 'admin/group-settings');
?>
"><?php
_e('Settings', 'buddypress');
?>
</a></li>
<?php
if (!(int) bp_get_option('bp-disable-avatar-uploads')) {
?>
<li<?php
if ('group-avatar' == $current_tab) {
?>
class="current"<?php
}
?>
><a href="<?php
echo trailingslashit(bp_get_group_permalink($group) . 'admin/group-avatar');
?>
"><?php
_e('Avatar', 'buddypress');
?>
</a></li>
<?php
}
?>
<li<?php
if ('manage-members' == $current_tab) {
?>
class="current"<?php
}
?>
><a href="<?php
echo trailingslashit(bp_get_group_permalink($group) . 'admin/manage-members');
?>
"><?php
_e('Members', 'buddypress');
?>
</a></li>
<?php
if ($groups_template->group->status == 'private') {
?>
<li<?php
if ('membership-requests' == $current_tab) {
?>
class="current"<?php
}
?>
><a href="<?php
echo trailingslashit(bp_get_group_permalink($group) . 'admin/membership-requests');
?>
"><?php
_e('Requests', 'buddypress');
?>
//.........这里部分代码省略.........
示例5: bp_link_is_mod
function bp_link_is_mod()
{
return true === bp_is_item_mod() || true === bp_links_is_mod();
}
示例6: setup_nav
/**
* Setup BuddyBar navigation
*
* @global BuddyPress $bp The one true BuddyPress instance
*/
function setup_nav()
{
// Define local variables
$sub_nav = array();
// Add 'Groups' to the main navigation
$main_nav = array('name' => sprintf(__('Groups <span>%d</span>', 'buddypress'), groups_total_groups_for_user()), 'slug' => $this->slug, 'position' => 70, 'screen_function' => 'groups_screen_my_groups', 'default_subnav_slug' => 'my-groups', 'item_css_id' => $this->id);
$groups_link = trailingslashit(bp_loggedin_user_domain() . $this->slug);
// Add the My Groups nav item
$sub_nav[] = array('name' => __('Memberships', 'buddypress'), 'slug' => 'my-groups', 'parent_url' => $groups_link, 'parent_slug' => $this->slug, 'screen_function' => 'groups_screen_my_groups', 'position' => 10, 'item_css_id' => 'groups-my-groups');
// Add the Group Invites nav item
$sub_nav[] = array('name' => __('Invitations', 'buddypress'), 'slug' => 'invites', 'parent_url' => $groups_link, 'parent_slug' => $this->slug, 'screen_function' => 'groups_screen_group_invites', 'user_has_access' => bp_is_my_profile(), 'position' => 30);
parent::setup_nav($main_nav, $sub_nav);
if (bp_is_groups_component() && bp_is_single_item()) {
// Reset sub nav
$sub_nav = array();
// Add 'Groups' to the main navigation
$main_nav = array('name' => __('Memberships', 'buddypress'), 'slug' => $this->current_group->slug, 'position' => -1, 'screen_function' => 'groups_screen_group_home', 'default_subnav_slug' => $this->default_extension, 'item_css_id' => $this->id);
$group_link = bp_get_group_permalink($this->current_group);
// Add the "Home" subnav item, as this will always be present
$sub_nav[] = array('name' => _x('Home', 'Group home navigation title', 'buddypress'), 'slug' => 'home', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_home', 'position' => 10, 'item_css_id' => 'home');
// If this is a private group, and the user is not a member, show a "Request Membership" nav item.
if (is_user_logged_in() && !bp_current_user_can('bp_moderate') && !$this->current_group->is_user_member && !groups_check_for_membership_request(bp_loggedin_user_id(), $this->current_group->id) && $this->current_group->status == 'private') {
$sub_nav[] = array('name' => __('Request Membership', 'buddypress'), 'slug' => 'request-membership', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_request_membership', 'position' => 30);
}
// Forums are enabled and turned on
if ($this->current_group->enable_forum && bp_is_active('forums')) {
$sub_nav[] = array('name' => __('Forum', 'buddypress'), 'slug' => 'forum', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_forum', 'position' => 40, 'user_has_access' => $this->current_group->user_has_access, 'item_css_id' => 'forums');
}
$sub_nav[] = array('name' => sprintf(__('Members <span>%s</span>', 'buddypress'), number_format($this->current_group->total_member_count)), 'slug' => 'members', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_members', 'position' => 60, 'user_has_access' => $this->current_group->user_has_access, 'item_css_id' => 'members');
if (bp_is_active('friends') && bp_groups_user_can_send_invites()) {
$sub_nav[] = array('name' => __('Send Invites', 'buddypress'), 'slug' => 'send-invites', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_invite', 'item_css_id' => 'invite', 'position' => 70, 'user_has_access' => $this->current_group->user_has_access);
}
// If the user is a group mod or more, then show the group admin nav item
if (bp_is_item_admin() || bp_is_item_mod()) {
$sub_nav[] = array('name' => __('Admin', 'buddypress'), 'slug' => 'admin', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_admin', 'position' => 1000, 'user_has_access' => true, 'item_css_id' => 'admin');
}
parent::setup_nav($main_nav, $sub_nav);
}
if (isset($this->current_group->user_has_access)) {
do_action('groups_setup_nav', $this->current_group->user_has_access);
} else {
do_action('groups_setup_nav');
}
}
示例7: groups_screen_group_admin_edit_details
function groups_screen_group_admin_edit_details()
{
global $bp;
if ('edit-details' == bp_get_group_current_admin_tab()) {
if (bp_is_item_admin() || bp_is_item_mod()) {
// If the edit form has been submitted, save the edited details
if (isset($_POST['save'])) {
// Check the nonce
if (!check_admin_referer('groups_edit_group_details')) {
return false;
}
if (!groups_edit_base_group_details($_POST['group-id'], $_POST['group-name'], $_POST['group-desc'], (int) $_POST['group-notify-members'])) {
bp_core_add_message(__('There was an error updating group details, please try again.', 'buddypress'), 'error');
} else {
bp_core_add_message(__('Group details were successfully updated.', 'buddypress'));
}
do_action('groups_group_details_edited', $bp->groups->current_group->id);
bp_core_redirect(bp_get_group_permalink(groups_get_current_group()) . 'admin/edit-details/');
}
do_action('groups_screen_group_admin_edit_details', $bp->groups->current_group->id);
bp_core_load_template(apply_filters('groups_template_group_admin', 'groups/single/home'));
}
}
}
示例8: topic_row_actions
/**
* Add topic row action HTML when viewing group forum admin
*
* @since bbPress (r3653)
* @uses bp_is_item_admin()
* @uses bbp_get_forum_id()
*/
public function topic_row_actions()
{
// Only admins can take actions on forums
if (is_super_admin() || current_user_can('moderate') || bp_is_item_admin() || bp_is_item_mod()) {
?>
<div class="row-actions">
<?php
echo 'Edit | View | Trash | Close | Stick (To Front) | Spam';
?>
</div>
<?php
}
}
示例9: display_forums
/**
* Output the forums for a group in the edit screens
*
* @since bbPress (r3653)
* @uses bp_get_current_group_id()
* @uses bbp_get_group_forum_ids()
* @uses bbp_has_forums()
* @uses bbp_get_template_part()
*/
public function display_forums($offset = 0)
{
// Allow actions immediately before group forum output
do_action('bbp_before_group_forum_display');
// Load up bbPress once
$bbp = bbpress();
// Forum data
$forum_slug = bp_action_variable($offset);
$forum_ids = bbp_get_group_forum_ids(bp_get_current_group_id());
$forum_args = array('post__in' => $forum_ids, 'post_parent' => null);
// Unset global queries
$bbp->forum_query = new stdClass();
$bbp->topic_query = new stdClass();
$bbp->reply_query = new stdClass();
// Unset global ID's
$bbp->current_forum_id = 0;
$bbp->current_topic_id = 0;
$bbp->current_reply_id = 0;
$bbp->current_topic_tag_id = 0;
// Reset the post data
wp_reset_postdata();
// Allow admins special views
$post_status = array(bbp_get_closed_status_id(), bbp_get_public_status_id());
if (is_super_admin() || current_user_can('moderate') || bp_is_item_admin() || bp_is_item_mod()) {
$post_status = array_merge($post_status, array(bbp_get_spam_status_id(), bbp_get_trash_status_id()));
}
?>
<div id="bbpress-forums">
<?php
// Looking at the group forum root
if (empty($forum_slug) || 'page' == $forum_slug) {
// Query forums and show them if they exist
if (!empty($forum_ids) && bbp_has_forums($forum_args)) {
// Only one forum found
if (1 == $bbp->forum_query->post_count) {
// Remove 'name' check for paginated requests
if ('page' == $forum_slug) {
$forum_args = array('post_type' => bbp_get_forum_post_type());
} else {
$forum_args = array('name' => $forum_slug, 'post_type' => bbp_get_forum_post_type());
}
// Get the forums
$forums = get_posts($forum_args);
bbp_the_forum();
// Forum exists
if (!empty($forums)) {
$forum = $forums[0];
// Suppress subforums for now
add_filter('bbp_get_forum_subforum_count', '__return_false');
// Set up forum data
bbpress()->current_forum_id = $forum->ID;
bbp_set_query_name('bbp_single_forum');
?>
<h3><?php
bbp_forum_title();
?>
</h3>
<?php
bbp_get_template_part('content', 'single-forum');
?>
<?php
// Remove the subforum suppression filter
remove_filter('bbp_get_forum_subforum_count', '__return_false');
?>
<?php
} else {
?>
<?php
bbp_get_template_part('feedback', 'no-topics');
?>
<?php
bbp_get_template_part('form', 'topic');
?>
<?php
}
// More than 1 forum found or group forum admin screen
} elseif (1 < $bbp->forum_query->post_count) {
?>
<h3><?php
_e('Forums', 'bbpress');
?>
//.........这里部分代码省略.........