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


PHP bp_get_current_group_id函数代码示例

本文整理汇总了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函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


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