• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP bp_get_current_group_id函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: synchronize

 /**
  * Since we don't always have access to the params passed to BP_Groups_Template
  * we have to wait until after constructor has run to fill in details
  */
 function synchronize()
 {
     global $bp;
     if (isset($this->params) && array_key_exists('parent_id', $this->params)) {
         /**
          * Fill in requests by parent_id for tree traversal on admin side
          */
         $this->groups = bp_group_hierarchy_get_by_hierarchy($this->params);
         $this->total_group_count = $this->groups['total'];
         $this->groups = $this->groups['groups'];
         $this->group_count = count($this->groups);
         // Re-build pagination links with new group counts
         if ((int) $this->total_group_count && (int) $this->pag_num) {
             $this->pag_links = paginate_links(array('base' => add_query_arg(array('grpage' => '%#%', 'num' => $this->pag_num, 'sortby' => $this->sort_by, 'order' => $this->order)), 'format' => '', 'total' => ceil((int) $this->total_group_count / (int) $this->pag_num), 'current' => $this->pag_page, 'prev_text' => '←', 'next_text' => '→', 'mid_size' => 1));
         }
     } else {
         if ($this->single_group && $bp->groups->current_group) {
             /**
              * Groups with multi-level slugs are missed by the parent.
              * Fill them in from $bp->groups->current_group
              */
             $this->groups = array((object) array('group_id' => bp_get_current_group_id()));
             $this->group_count = 1;
         }
     }
 }
开发者ID:elderfd,项目名称:cfsf,代码行数:30,代码来源:bp-group-hierarchy-template.php


示例2: __construct

 /**
  * BP_Groups_Invite_Template constructor.
  *
  * @since 1.5.0
  *
  * @param array $args
  */
 public function __construct($args = array())
 {
     // Backward compatibility with old method of passing arguments.
     if (!is_array($args) || func_num_args() > 1) {
         _deprecated_argument(__METHOD__, '2.0.0', sprintf(__('Arguments passed to %1$s should be in an associative array. See the inline documentation at %2$s for more details.', 'buddypress'), __METHOD__, __FILE__));
         $old_args_keys = array(0 => 'user_id', 1 => 'group_id');
         $func_args = func_get_args();
         $args = bp_core_parse_args_array($old_args_keys, $func_args);
     }
     $r = wp_parse_args($args, array('page' => 1, 'per_page' => 10, 'page_arg' => 'invitepage', 'user_id' => bp_loggedin_user_id(), 'group_id' => bp_get_current_group_id()));
     $this->pag_arg = sanitize_key($r['page_arg']);
     $this->pag_page = bp_sanitize_pagination_arg($this->pag_arg, $r['page']);
     $this->pag_num = bp_sanitize_pagination_arg('num', $r['per_page']);
     $iquery = new BP_Group_Member_Query(array('group_id' => $r['group_id'], 'type' => 'first_joined', 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'is_confirmed' => false, 'inviter_id' => $r['user_id']));
     $this->invite_data = $iquery->results;
     $this->total_invite_count = $iquery->total_users;
     $this->invites = array_values(wp_list_pluck($this->invite_data, 'ID'));
     $this->invite_count = count($this->invites);
     // If per_page is set to 0 (show all results), don't generate
     // pag_links.
     if (!empty($this->pag_num)) {
         $this->pag_links = paginate_links(array('base' => add_query_arg($this->pag_arg, '%#%'), 'format' => '', 'total' => ceil($this->total_invite_count / $this->pag_num), 'current' => $this->pag_page, 'prev_text' => '←', 'next_text' => '→', 'mid_size' => 1, 'add_args' => array()));
     } else {
         $this->pag_links = '';
     }
 }
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:33,代码来源:class-bp-groups-invite-template.php


示例3: bcg_current_user_can_post

/**
 * Can the current user post to group blog
 * @global type $bp
 * @return type 
 */
function bcg_current_user_can_post()
{
    $user_id = bp_loggedin_user_id();
    $group_id = bp_get_current_group_id();
    $can_post = is_user_logged_in() && (groups_is_user_admin($user_id, $group_id) || groups_is_user_mod($user_id, $group_id));
    return apply_filters('bcg_current_user_can_post', $can_post, $group_id, $user_id);
}
开发者ID:WP--plugins,项目名称:blog-categories-for-groups,代码行数:12,代码来源:bcg-permissions.php


示例4: __construct

 /**
  * Here you can see more customization of the config options
  */
 function __construct()
 {
     global $buddyforms, $buddyforms_user_can;
     $buddyforms_pig = get_option('buddyforms_pig_options');
     $this->post_in_group_form_slug = groups_get_groupmeta(bp_get_current_group_id(), '_bf_pig_form_slug', true);
     $this->buddyforms_pig = groups_get_groupmeta(bp_get_current_group_id(), '_buddyforms_pig', true);
     $buddyforms_user_can = false;
     //$this->enable_create_step       = false;
     $form_slug = $this->post_in_group_form_slug;
     $name = $buddyforms[$form_slug]['name'];
     if (isset($this->buddyforms_pig['create'])) {
         switch ($this->buddyforms_pig['create']) {
             case 'admin':
                 if (groups_is_user_admin(bp_loggedin_user_id(), bp_get_current_group_id())) {
                     $buddyforms_user_can = true;
                 }
                 break;
             case 'mod':
                 if (groups_is_user_mod(bp_loggedin_user_id(), bp_get_current_group_id()) || groups_is_user_admin(bp_loggedin_user_id(), bp_get_current_group_id())) {
                     $buddyforms_user_can = true;
                 }
                 break;
             case 'member':
             default:
                 if (groups_is_user_member(bp_loggedin_user_id(), bp_get_current_group_id())) {
                     $buddyforms_user_can = true;
                 }
                 break;
         }
     }
     $args = array('slug' => $form_slug, 'name' => $name);
     switch ($buddyforms_pig['permission']) {
         case 'all':
             add_action('bp_after_group_settings_admin', array($this, 'bp_pig_after_group_manage_members_admin'), 1, 1);
             add_action('groups_group_settings_edited', array($this, 'bf_pig_groups_group_settings_edited'), 10, 1);
             add_action('bp_after_group_settings_creation_step', array($this, 'bp_pig_after_group_manage_members_admin'), 1, 1);
             add_action('groups_create_group_step_save_group-settings', array($this, 'bf_pig_groups_group_settings_edited'), 10, 1);
             break;
         case 'group-admin':
             add_action('bp_after_group_settings_admin', array($this, 'bp_pig_after_group_manage_members_admin'), 1, 1);
             add_action('groups_group_settings_edited', array($this, 'bf_pig_groups_group_settings_edited'), 10, 1);
             break;
         case 'admin':
             if (is_super_admin()) {
                 add_action('bp_after_group_settings_admin', array($this, 'bp_pig_after_group_manage_members_admin'), 1, 1);
                 add_action('groups_group_settings_edited', array($this, 'bf_pig_groups_group_settings_edited'), 10, 1);
             }
             break;
     }
     parent::init($args);
 }
开发者ID:BuddyForms,项目名称:BuddyForms-Post-in-Groups,代码行数:54,代码来源:buddyforms-post-in-groups.php


示例5: bp_em_group_events_get_default_search

function bp_em_group_events_get_default_search($searches, $array)
{
    if (!empty($array['group']) && (is_numeric($array['group']) || $array['group'] == 'my' || $array['group'] == 'this') && bp_is_active('groups')) {
        if ($array['group'] == 'this') {
            //shows current group, if applicable
            if (is_numeric(bp_get_current_group_id())) {
                $searches['group'] = bp_get_current_group_id();
            }
        } else {
            $searches['group'] = $array['group'];
        }
    }
    return $searches;
}
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:14,代码来源:bp-em-groups.php


示例6: setup_nav

 public function setup_nav($current_user_access)
 {
     $bp = buddypress();
     if (!bp_is_group()) {
         return;
     }
     $group_id = bp_get_current_group_id();
     if (bcg_is_disabled($group_id)) {
         return;
     }
     $current_group = groups_get_current_group();
     $group_link = bp_get_group_permalink($current_group);
     bp_core_new_subnav_item(array('name' => __('Blog', 'blog-categories-for-groups'), 'slug' => BCG_SLUG, 'parent_url' => $group_link, 'parent_slug' => $current_group->slug, 'screen_function' => array($this, 'display'), 'position' => 10, 'user_has_access' => $current_user_access, 'item_css_id' => 'blog'));
 }
开发者ID:WP--plugins,项目名称:blog-categories-for-groups,代码行数:14,代码来源:bcg-screens.php


示例7: group_activity_subscription

 function group_activity_subscription()
 {
     $this->name = __('Email Options', 'bp-ass');
     $this->slug = 'notifications';
     // Only enable the notifications nav item if the user is a member of the group
     if (bp_is_group() && groups_is_user_member(bp_loggedin_user_id(), bp_get_current_group_id())) {
         $this->enable_nav_item = true;
     } else {
         $this->enable_nav_item = false;
     }
     $this->nav_item_position = 91;
     $this->enable_create_step = false;
     if (get_option('ass-admin-can-send-email') == 'no') {
         $this->enable_edit_item = false;
     }
     // hook in the css and js
     add_action('wp_print_styles', array(&$this, 'add_settings_stylesheet'));
     add_action('wp_enqueue_scripts', array(&$this, 'ass_add_javascript'), 1);
 }
开发者ID:adisonc,项目名称:MaineLearning,代码行数:19,代码来源:bp-activity-subscription-main.php


示例8: __construct

 /**
  * Constructor method.
  *
  * @since 1.5.0
  *
  * @param array $args {
  *     @type int $group_id ID of the group whose membership requests
  *                         are being queried. Default: current group id.
  *     @type int $per_page Number of records to return per page of
  *                         results. Default: 10.
  *     @type int $page     Page of results to show. Default: 1.
  *     @type int $max      Max items to return. Default: false (show all)
  * }
  */
 public function __construct($args = array())
 {
     // Backward compatibility with old method of passing arguments.
     if (!is_array($args) || func_num_args() > 1) {
         _deprecated_argument(__METHOD__, '2.0.0', sprintf(__('Arguments passed to %1$s should be in an associative array. See the inline documentation at %2$s for more details.', 'buddypress'), __METHOD__, __FILE__));
         $old_args_keys = array(0 => 'group_id', 1 => 'per_page', 2 => 'max');
         $func_args = func_get_args();
         $args = bp_core_parse_args_array($old_args_keys, $func_args);
     }
     $r = wp_parse_args($args, array('page' => 1, 'per_page' => 10, 'page_arg' => 'mrpage', 'max' => false, 'type' => 'first_joined', 'group_id' => bp_get_current_group_id()));
     $this->pag_arg = sanitize_key($r['page_arg']);
     $this->pag_page = bp_sanitize_pagination_arg($this->pag_arg, $r['page']);
     $this->pag_num = bp_sanitize_pagination_arg('num', $r['per_page']);
     $mquery = new BP_Group_Member_Query(array('group_id' => $r['group_id'], 'type' => $r['type'], 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'is_confirmed' => false, 'inviter_id' => 0));
     $this->requests = array_values($mquery->results);
     $this->request_count = count($this->requests);
     // Compatibility with legacy format of request data objects.
     foreach ($this->requests as $rk => $rv) {
         // For legacy reasons, the 'id' property of each
         // request must match the membership id, not the ID of
         // the user (as it's returned by BP_Group_Member_Query).
         $this->requests[$rk]->user_id = $rv->ID;
         $this->requests[$rk]->id = $rv->membership_id;
         // Miscellaneous values.
         $this->requests[$rk]->group_id = $r['group_id'];
     }
     if (empty($r['max']) || $r['max'] >= (int) $mquery->total_users) {
         $this->total_request_count = (int) $mquery->total_users;
     } else {
         $this->total_request_count = (int) $r['max'];
     }
     if (empty($r['max']) || $r['max'] >= count($this->requests)) {
         $this->request_count = count($this->requests);
     } else {
         $this->request_count = (int) $r['max'];
     }
     $this->pag_links = paginate_links(array('base' => add_query_arg($this->pag_arg, '%#%'), 'format' => '', 'total' => ceil($this->total_request_count / $this->pag_num), 'current' => $this->pag_page, 'prev_text' => '←', 'next_text' => '→', 'mid_size' => 1, 'add_args' => array()));
 }
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:52,代码来源:class-bp-groups-membership-requests-template.php


示例9: groups_record_activity

function groups_record_activity($args = '')
{
    global $bp;
    if (!bp_is_active('activity')) {
        return false;
    }
    // Set the default for hide_sitewide by checking the status of the group
    $hide_sitewide = false;
    if (!empty($args['item_id'])) {
        if (bp_get_current_group_id() == $args['item_id']) {
            $group = groups_get_current_group();
        } else {
            $group = groups_get_group(array('group_id' => $args['item_id']));
        }
        if (isset($group->status) && 'public' != $group->status) {
            $hide_sitewide = true;
        }
    }
    $defaults = array('id' => false, 'user_id' => bp_loggedin_user_id(), 'action' => '', 'content' => '', 'primary_link' => '', 'component' => $bp->groups->id, 'type' => false, 'item_id' => false, 'secondary_item_id' => false, 'recorded_time' => bp_core_current_time(), 'hide_sitewide' => $hide_sitewide);
    $r = wp_parse_args($args, $defaults);
    extract($r);
    return bp_activity_add(array('id' => $id, 'user_id' => $user_id, 'action' => $action, 'content' => $content, 'primary_link' => $primary_link, 'component' => $component, 'type' => $type, 'item_id' => $item_id, 'secondary_item_id' => $secondary_item_id, 'recorded_time' => $recorded_time, 'hide_sitewide' => $hide_sitewide));
}
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:23,代码来源:bp-groups-activity.php


示例10: get_group_id

 /**
  * Get the group id to set its avatar.
  *
  * @since 2.3.0
  *
  * @return integer The group ID.
  */
 private function get_group_id()
 {
     $group_id = 0;
     if (bp_is_group()) {
         $group_id = bp_get_current_group_id();
     }
     return $group_id;
 }
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:15,代码来源:class-bp-attachment-avatar.php


示例11: single_template_hierarchy

 /**
  * Add custom template hierarchy to theme compat for group pages.
  *
  * This is to mirror how WordPress has
  * {@link https://codex.wordpress.org/Template_Hierarchy template hierarchy}.
  *
  * @since 1.8.0
  *
  * @param string $templates The templates from bp_get_theme_compat_templates().
  * @return array $templates Array of custom templates to look for.
  */
 public function single_template_hierarchy($templates)
 {
     // Setup some variables we're going to reference in our custom templates.
     $group = groups_get_current_group();
     /**
      * Filters the Groups single pages template hierarchy based on priority.
      *
      * @since 1.8.0
      *
      * @param array $value Array of default template files to use.
      */
     $new_templates = apply_filters('bp_template_hierarchy_groups_single_item', array('groups/single/index-id-' . sanitize_file_name(bp_get_current_group_id()) . '.php', 'groups/single/index-slug-' . sanitize_file_name(bp_get_current_group_slug()) . '.php', 'groups/single/index-action-' . sanitize_file_name(bp_current_action()) . '.php', 'groups/single/index-status-' . sanitize_file_name($group->status) . '.php', 'groups/single/index.php'));
     // Merge new templates with existing stack.
     // @see bp_get_theme_compat_templates().
     $templates = array_merge((array) $new_templates, $templates);
     return $templates;
 }
开发者ID:swissspidy,项目名称:BuddyPress,代码行数:28,代码来源:bp-groups-screens.php


示例12: bp_cover_group_handle_upload

function bp_cover_group_handle_upload($activity_id)
{
    global $bp, $wpdb;
    $group_id = bp_get_current_group_id();
    $activity_table = $wpdb->prefix . "bp_activity";
    $activity_meta_table = $wpdb->prefix . "bp_activity_meta";
    $sql = "SELECT COUNT(*) as photo_count FROM {$activity_table} a INNER JOIN {$activity_meta_table} am ON a.id = am.activity_id WHERE a.item_id = %d AND meta_key = 'all_bp_cover_group'";
    $sql = $wpdb->prepare($sql, $group_id);
    $cnt = $wpdb->get_var($sql);
    $max_cnt = bp_cover_get_max_total();
    if ($cnt < $max_cnt) {
        if ($_POST['encodedimg']) {
            $file = $_POST['imgsize'];
            $max_upload_size = bp_cover_get_max_media_size();
            if ($max_upload_size > $file) {
                $group_id = $bp->groups->current_group->id;
                $imgresponse = array();
                $uploaddir = wp_upload_dir();
                /* let's decode the base64 encoded image sent */
                $img = $_POST['encodedimg'];
                $img = str_replace('data:' . $_POST['imgtype'] . ';base64,', '', $img);
                $img = str_replace(' ', '+', $img);
                $data = base64_decode($img);
                $imgname = wp_unique_filename($uploaddir['path'], $_POST['imgname']);
                $filepath = $uploaddir['path'] . '/' . $imgname;
                $fileurl = $uploaddir['url'] . '/' . $imgname;
                /* now we write the image in dir */
                $success = file_put_contents($filepath, $data);
                if ($success) {
                    $imgresponse[0] = "1";
                    $imgresponse[1] = $fileurl;
                    $size = @getimagesize($filepath);
                    $attachment = array('post_mime_type' => $_POST['imgtype'], 'guid' => $fileurl, 'post_title' => $imgname);
                    require_once ABSPATH . 'wp-admin/includes/image.php';
                    $attachment_id = wp_insert_attachment($attachment, $filepath);
                    $attach_data = wp_generate_attachment_metadata($attachment_id, $filepath);
                    wp_update_attachment_metadata($attachment_id, $attach_data);
                    groups_update_groupmeta($group_id, 'bp_cover_group', $fileurl);
                    groups_update_groupmeta($group_id, 'bp_cover_group_position', 0);
                    $group = groups_get_group(array("group_id" => $group_id));
                    $activity_id = groups_record_activity(array('action' => sprintf(__('%s uploaded a new cover picture to the group %s', 'bp-cover'), bp_core_get_userlink($bp->loggedin_user->id), '<a href="' . bp_get_group_permalink($group) . '">' . esc_attr($group->name) . '</a>'), 'type' => 'cover_added', 'item_id' => $group_id, 'content' => bp_cover_group_get_image_scr(), 'item_id' => $group_id));
                    bp_activity_update_meta($activity_id, 'all_bp_cover_group', $attachment_id);
                    update_post_meta($attachment_id, 'bp_cover_group_thumb', $imgresponse[2]);
                } else {
                    $imgresponse[0] = "0";
                    $imgresponse[1] = __('Upload Failed! Unable to write the image on server', 'bp-cover');
                }
            } else {
                $imgresponse[0] = "0";
                $imgresponse[1] = sprintf(__('The file you uploaded is too big. Please upload a file under %s', 'bp-cover'), size_format($max_upload_size));
            }
        } else {
            $imgresponse[0] = "0";
            $imgresponse[1] = __('Upload Failed! No image sent', 'bp-cover');
        }
    } else {
        $imgresponse[0] = "0";
        $imgresponse[1] = sprintf(__('Max total images allowed %d in a cover gallery', 'bp-cover'), $max_cnt);
    }
    /* if everything is ok, we send back url to thumbnail and to full image */
    echo json_encode($imgresponse);
    die;
}
开发者ID:aghajoon,项目名称:bp-cover,代码行数:63,代码来源:bp-cover-group.php


示例13: printf

if (bp_is_group()) {
    printf(__("What's new in %s, %s?", 'buddypress'), bp_get_group_name(), bp_get_user_firstname(bp_get_loggedin_user_fullname()));
} else {
    printf(__("What's new, %s?", 'buddypress'), bp_get_user_firstname(bp_get_loggedin_user_fullname()));
}
?>
</p>

	<div id="whats-new-content">
		<div id="whats-new-textarea">
			<textarea class="bp-suggestions" name="whats-new" id="whats-new" cols="50" rows="10"
				<?php 
if (bp_is_group()) {
    ?>
data-suggestions-group-id="<?php 
    echo esc_attr((int) bp_get_current_group_id());
    ?>
" <?php 
}
?>
			><?php 
if (isset($_GET['r'])) {
    ?>
@<?php 
    echo esc_textarea($_GET['r']);
    ?>
 <?php 
}
?>
</textarea>
		</div>
开发者ID:kosir,项目名称:thatcamp-org,代码行数:31,代码来源:post-form.php


示例14: append_group_args

 /**
  * Appends the group args to rendez-vous loop arguments
  *
  * @package Rendez Vous
  * @subpackage Groups
  *
  * @since Rendez Vous (1.1.0)
  *
  * @param  array                     $args the rendez-vous loop arguments
  * @uses   bp_is_group()             to make sure the user is displaying a group
  * @uses   bp_get_current_group_id() to get the current group id
  * @return array                     the rendez-vous loop arguments
  */
 public function append_group_args($args = array())
 {
     // if in a group's single item
     if (bp_is_group()) {
         $args['group_id'] = bp_get_current_group_id();
     }
     // If viewing a single member
     if (bp_is_user()) {
         /**
          * Use this filter to show all displayed user's rendez-vous no matter if they are attached to an hidden group
          * eg: add_filter( 'rendez_vous_member_hide_hidden', '__return_false' );
          *
          * To respect the hidden group visibility, by default, a member not viewing his profile will be returned false
          * avoiding him to see the displayed member's rendez-vous attached to an hidden group
          *
          * @param bool false if a user is viewing his profile or an admin is viewing any user profile, true otherwise
          */
         $hide_hidden = apply_filters('rendez_vous_member_hide_hidden', (bool) (!bp_is_my_profile()) && !bp_current_user_can('bp_moderate'));
         if (!empty($hide_hidden)) {
             $args['exclude'] = self::get_hidden_rendez_vous();
         }
     }
     return $args;
 }
开发者ID:socialray,项目名称:surfied-2-0,代码行数:37,代码来源:rendez-vous-groups.php


示例15: implode

if (bp_displayed_user_id() == get_current_user_id()) {
    //profile personal
    $class[] = "my-profile";
}
if (bp_is_group()) {
    //single group
    $class[] = "group-single";
}
$class = implode(" ", $class);
?>

<?php 
if (bp_is_group() && !bp_is_current_action('create')) {
    // Boxed layout cover
    if (boss_get_option('boss_layout_style') == 'boxed') {
        $id = bp_get_current_group_id();
        if ($id != 0 && $id != false) {
            echo buddyboss_cover_photo("group", $id);
        }
    }
    do_action('boss_get_group_template');
    //get_template_part( 'buddypress', 'group-single' );
} else {
    if (is_post_type_archive('bp_doc') || is_single() && get_post_type() == 'bp_doc') {
        $id = boss_get_docs_group_id();
        if ($id != 0 && $id != false) {
            echo buddyboss_cover_photo("group", $id);
        }
    }
    get_template_part('buddypress', 'sidewide');
}
开发者ID:rpi-virtuell,项目名称:rw-social-learner,代码行数:31,代码来源:buddypress.php


示例16: invite_anyone_group_invite_access_test

/**
 * Determine access setting for a group/user pair.
 *
 * @param int $group_id Group ID. Default: current group ID.
 * @param int $user_id User ID. Default: current user ID.
 */
function invite_anyone_group_invite_access_test($group_id = 0, $user_id = 0)
{
    global $current_user, $bp;
    if (empty($group_id)) {
        $group_id = bp_is_group() ? bp_get_current_group_id() : 0;
    }
    if (empty($group_id) && !bp_is_group_create()) {
        return 'noone';
    }
    if (empty($user_id)) {
        $user_id = bp_loggedin_user_id();
    }
    if (empty($user_id)) {
        return 'noone';
    }
    $iaoptions = invite_anyone_options();
    if (bp_is_group_create()) {
        if (empty($iaoptions['group_invites_can_group_admin']) || $iaoptions['group_invites_can_group_admin'] == 'anyone' || !$iaoptions['group_invites_can_group_admin']) {
            return 'anyone';
        }
        if ($iaoptions['group_invites_can_group_admin'] == 'friends') {
            return 'friends';
        }
        if ($iaoptions['group_invites_can_group_admin'] == 'noone') {
            return 'noone';
        }
    }
    if (!groups_is_user_member($user_id, $group_id)) {
        return 'noone';
    }
    if (user_can($user_id, 'bp_moderate')) {
        if (empty($iaoptions['group_invites_can_admin']) || $iaoptions['group_invites_can_admin'] == 'anyone' || !$iaoptions['group_invites_can_admin']) {
            return 'anyone';
        }
        if ($iaoptions['group_invites_can_admin'] == 'friends') {
            return 'friends';
        }
        if ($iaoptions['group_invites_can_admin'] == 'noone') {
            return 'noone';
        }
    } else {
        if (groups_is_user_admin($user_id, $group_id)) {
            if (empty($iaoptions['group_invites_can_group_admin']) || $iaoptions['group_invites_can_group_admin'] == 'anyone' || !$iaoptions['group_invites_can_group_admin']) {
                return 'anyone';
            }
            if ($iaoptions['group_invites_can_group_admin'] == 'friends') {
                return 'friends';
            }
            if ($iaoptions['group_invites_can_group_admin'] == 'noone') {
                return 'noone';
            }
        } else {
            if (groups_is_user_mod($user_id, $group_id)) {
                if (empty($iaoptions['group_invites_can_group_mod']) || $iaoptions['group_invites_can_group_mod'] == 'anyone' || !$iaoptions['group_invites_can_group_mod']) {
                    return 'anyone';
                }
                if ($iaoptions['group_invites_can_group_mod'] == 'friends') {
                    return 'friends';
                }
                if ($iaoptions['group_invites_can_group_mod'] == 'noone') {
                    return 'noone';
                }
            } else {
                if (empty($iaoptions['group_invites_can_group_member']) || $iaoptions['group_invites_can_group_member'] == 'anyone' || !$iaoptions['group_invites_can_group_member']) {
                    return 'anyone';
                }
                if ($iaoptions['group_invites_can_group_member'] == 'friends') {
                    return 'friends';
                }
                if ($iaoptions['group_invites_can_group_member'] == 'noone') {
                    return 'noone';
                }
            }
        }
    }
    return 'noone';
}
开发者ID:kd5ytx,项目名称:Empirical-Wordpress,代码行数:83,代码来源:group-invites.php


示例17: bp_attachments_cover_image_ajax_upload

/**
 * Ajax Upload and set a cover image
 *
 * @since  2.4.0
 *
 * @return  string|null A json object containing success data if the upload succeeded
 *                      error message otherwise.
 */
function bp_attachments_cover_image_ajax_upload()
{
    // Bail if not a POST action
    if ('POST' !== strtoupper($_SERVER['REQUEST_METHOD'])) {
        wp_die();
    }
    /**
     * Sending the json response will be different if
     * the current Plupload runtime is html4
     */
    $is_html4 = false;
    if (!empty($_POST['html4'])) {
        $is_html4 = true;
    }
    // Check the nonce
    check_admin_referer('bp-uploader');
    // Init the BuddyPress parameters
    $bp_params = array();
    // We need it to carry on
    if (!empty($_POST['bp_params'])) {
        $bp_params = bp_parse_args($_POST['bp_params'], array('object' => 'user', 'item_id' => bp_loggedin_user_id()), 'attachments_cover_image_ajax_upload');
    } else {
        bp_attachments_json_response(false, $is_html4);
    }
    // We need the object to set the uploads dir filter
    if (empty($bp_params['object'])) {
        bp_attachments_json_response(false, $is_html4);
    }
    // Capability check
    if (!bp_attachments_current_user_can('edit_cover_image', $bp_params)) {
        bp_attachments_json_response(false, $is_html4);
    }
    $bp = buddypress();
    $needs_reset = array();
    // Member's cover image
    if ('user' === $bp_params['object']) {
        $object_data = array('dir' => 'members', 'component' => 'xprofile');
        if (!bp_displayed_user_id() && !empty($bp_params['item_id'])) {
            $needs_reset = array('key' => 'displayed_user', 'value' => $bp->displayed_user);
            $bp->displayed_user->id = $bp_params['item_id'];
        }
        // Group's cover image
    } elseif ('group' === $bp_params['object']) {
        $object_data = array('dir' => 'groups', 'component' => 'groups');
        if (!bp_get_current_group_id() && !empty($bp_params['item_id'])) {
            $needs_reset = array('component' => 'groups', 'key' => 'current_group', 'value' => $bp->groups->current_group);
            $bp->groups->current_group = groups_get_group(array('group_id' => $bp_params['item_id'], 'populate_extras' => false));
        }
        // Other object's cover image
    } else {
        $object_data = apply_filters('bp_attachments_cover_image_object_dir', array(), $bp_params['object']);
    }
    // Stop here in case of a missing parameter for the object
    if (empty($object_data['dir']) || empty($object_data['component'])) {
        bp_attachments_json_response(false, $is_html4);
    }
    $cover_image_attachment = new BP_Attachment_Cover_Image();
    $uploaded = $cover_image_attachment->upload($_FILES);
    // Reset objects
    if (!empty($needs_reset)) {
        if (!empty($needs_reset['component'])) {
            $bp->{$needs_reset['component']}->{$needs_reset['key']} = $needs_reset['value'];
        } else {
            $bp->{$needs_reset['key']} = $needs_reset['value'];
        }
    }
    if (!empty($uploaded['error'])) {
        // Upload error response
        bp_attachments_json_response(false, $is_html4, array('type' => 'upload_error', 'message' => sprintf(__('Upload Failed! Error was: %s', 'buddypress'), $uploaded['error'])));
    }
    // Default error message
    $error_message = __('There was a problem uploading the cover image.', 'buddypress');
    // Get BuddyPress Attachments Uploads Dir datas
    $bp_attachments_uploads_dir = bp_attachments_uploads_dir_get();
    // The BP Attachments Uploads Dir is not set, stop.
    if (!$bp_attachments_uploads_dir) {
        bp_attachments_json_response(false, $is_html4, array('type' => 'upload_error', 'message' => $error_message));
    }
    $cover_subdir = $object_data['dir'] . '/' . $bp_params['item_id'] . '/cover-image';
    $cover_dir = trailingslashit($bp_attachments_uploads_dir['basedir']) . $cover_subdir;
    if (!is_dir($cover_dir)) {
        // Upload error response
        bp_attachments_json_response(false, $is_html4, array('type' => 'upload_error', 'message' => $error_message));
    }
    /**
     * Generate the cover image so that it fit to feature's dimensions
     *
     * Unlike the Avatar, Uploading and generating the cover image is happening during
     * the same Ajax request, as we already instantiated the BP_Attachment_Cover_Image
     * class, let's use it.
     */
    $cover = bp_attachments_cover_image_generate_file(array('file' => $uploaded['file'], 'component' => $object_data['component'], 'cover_image_dir' => $cover_dir), $cover_image_attachment);
//.........这里部分代码省略.........
开发者ID:mawilliamson,项目名称:wordpress,代码行数:101,代码来源:bp-core-attachments.php


示例18: bp_get_the_body_class


//.........这里部分代码省略.........
    }
    if (bp_is_user_profile_edit()) {
        $bp_classes[] = 'profile-edit';
    }
    if (bp_is_user_friends_activity()) {
        $bp_classes[] = 'friends-activity';
    }
    if (bp_is_user_groups_activity()) {
        $bp_classes[] = 'groups-activity';
    }
    /* Messages **********************************************************/
    if (bp_is_messages_inbox()) {
        $bp_classes[] = 'inbox';
    }
    if (bp_is_messages_sentbox()) {
        $bp_classes[] = 'sentbox';
    }
    if (bp_is_messages_compose_screen()) {
        $bp_classes[] = 'compose';
    }
    if (bp_is_notices()) {
        $bp_classes[] = 'notices';
    }
    if (bp_is_user_friend_requests()) {
        $bp_classes[] = 'friend-requests';
    }
    if (bp_is_create_blog()) {
        $bp_classes[] = 'create-blog';
    }
    /* Groups ************************************************************/
    if (bp_is_group()) {
        $bp_classes[] = 'group-' . groups_get_current_group()->slug;
        // Add current group types.
        if ($group_types = bp_groups_get_group_type(bp_get_current_group_id(), false)) {
            foreach ($group_types as $group_type) {
                $bp_classes[] = sprintf('group-type-%s', esc_attr($group_type));
            }
        }
    }
    if (bp_is_group_leave()) {
        $bp_classes[] = 'leave-group';
    }
    if (bp_is_group_invites()) {
        $bp_classes[] = 'group-invites';
    }
    if (bp_is_group_members()) {
        $bp_classes[] = 'group-members';
    }
    if (bp_is_group_forum_topic()) {
        $bp_classes[] = 'group-forum-topic';
    }
    if (bp_is_group_forum_topic_edit()) {
        $bp_classes[] = 'group-forum-topic-edit';
    }
    if (bp_is_group_forum()) {
        $bp_classes[] = 'group-forum';
    }
    if (bp_is_group_admin_page()) {
        $bp_classes[] = 'group-admin';
        $bp_classes[] = bp_get_group_current_admin_tab();
    }
    if (bp_is_group_create()) {
        $bp_classes[] = 'group-create';
        $bp_classes[] = bp_get_groups_current_create_step();
    }
    if (bp_is_group_home()) {
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:67,代码来源:bp-core-template.php


示例19: script_data

 /**
  * Build script datas for the Uploader UI
  *
  * @since 2.4.0
  *
  * @return array the javascript localization data
  */
 public function script_data()
 {
     // Get default script data
     $script_data = parent::script_data();
     if (bp_is_user()) {
         $item_id = bp_displayed_user_id();
         $script_data['bp_params'] = array('object' => 'user', 'item_id' => $item_id, 'has_cover_image' => bp_attachments_get_user_has_cover_image($item_id), 'nonces' => array('remove' => wp_create_nonce('bp_delete_cover_image')));
         // Set feedback messages
         $script_data['feedback_messages'] = array(1 => __('Your new cover image was uploaded successfully.', 'buddypress'), 2 => __('There was a problem deleting your cover image. Please try again.', 'buddypress'), 3 => __('Your cover image was deleted successfully!', 'buddypress'));
     } elseif (bp_is_group()) {
         $item_id = bp_get_current_group_id();
         $script_data['bp_params'] = array('object' => 'group', 'item_id' => bp_get_current_group_id(), 'has_cover_image' => bp_attachments_get_group_has_cover_image($item_id), 'nonces' => array('remove' => wp_create_nonce('bp_delete_cover_image')));
         // Set feedback messages
         $script_data['feedback_messages'] = array(1 => __('The group cover image was uploaded successfully.', 'buddypress'), 2 => __('There was a problem deleting the group cover image. Please try again.', 'buddypress'), 3 => __('The group cover image was deleted successfully!', 'buddypress'));
     } else {
         /**
          * Use this filter to include specific BuddyPress params for your object.
          * e.g. Cover image for blogs single item.
          *
          * @since 2.4.0
          *
          * @param array $value The cover image specific BuddyPress parameters.
          */
         $script_data['bp_params'] = apply_filters('bp_attachment_cover_image_params', array());
     }
     // Include our specific js & css
     $script_data['extra_js'] = array('bp-cover-image');
     $script_data['extra_css'] = array('bp-avatar');
     return apply_filters('bp_attachments_cover_image_script_data', $script_data);
 }
开发者ID:mawilliamson,项目名称:wordpress,代码行数:37,代码来源:class-bp-attachment-cover-image.php


示例20: edit_screen_save

 /**
  * Save method for our extension during edits.
  *
  * @param int $group_id The group ID.
  */
 public function edit_screen_save($group_id = null)
 {
     if (!isset($_POST['save'])) {
         return false;
     }
     check_admin_referer('groups_edit_save_' . $this->slug);
     $existing_feeds = (array) groups_get_groupmeta(bp_get_current_group_id(), 'blogfeeds');
     $unfiltered_feeds = explode(',', $_POST['blogfeeds']);
     $blog_feeds = array();
     foreach ((array) $unfiltered_feeds as $blog_feed) {
         if (!empty($blog_feed)) {
             $blog_feeds[] = esc_url_raw(trim($blog_feed));
         }
     }
     /* Loop and find any feeds that have been removed, so we can delete activity stream items */
     if (!empty($existing_feeds)) {
         foreach ((array) $existing_feeds as $feed) {
             if (!in_array($feed, (array) $blog_feeds)) {
                 $removed[] = $feed;
             }
         }
     }
     if ($removed) {
         foreach ((array) $removed as $feed) {
             $existing = bp_activity_get(array('user_id' => false, 'component' => 'groups', 'type' => 'exb', 'item_id' => bp_get_curre 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP bp_get_current_group_name函数代码示例发布时间:2022-05-24
下一篇:
PHP bp_get_button函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap