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


PHP BP_Groups_Group::get_id_from_slug方法代码示例

本文整理汇总了PHP中BP_Groups_Group::get_id_from_slug方法的典型用法代码示例。如果您正苦于以下问题:PHP BP_Groups_Group::get_id_from_slug方法的具体用法?PHP BP_Groups_Group::get_id_from_slug怎么用?PHP BP_Groups_Group::get_id_from_slug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BP_Groups_Group的用法示例。


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

示例1: bp_groups_template

	function bp_groups_template( $user_id, $type, $page, $per_page, $max, $slug, $search_terms, $populate_extras ) {
		global $bp;

		$this->pag_page = isset( $_REQUEST['grpage'] ) ? intval( $_REQUEST['grpage'] ) : $page;
		$this->pag_num  = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;

		if ( 'invites' == $type ) {
			$this->groups = groups_get_invites_for_user( $user_id, $this->pag_num, $this->pag_page );
		} else if ( 'single-group' == $type ) {
			$group = new stdClass;
			$group->group_id = BP_Groups_Group::get_id_from_slug($slug);
			$this->groups    = array( $group );
		} else {
			$this->groups = groups_get_groups( array( 'type' => $type, 'per_page' => $this->pag_num, 'page' =>$this->pag_page, 'user_id' => $user_id, 'search_terms' => $search_terms, 'populate_extras' => $populate_extras ) );
		}

		if ( 'invites' == $type ) {
			$this->total_group_count = (int)$this->groups['total'];
			$this->group_count       = (int)$this->groups['total'];
			$this->groups            = $this->groups['groups'];
		} else if ( 'single-group' == $type ) {
			$this->single_group      = true;
			$this->total_group_count = 1;
			$this->group_count       = 1;
		} else {
			if ( !$max || $max >= (int)$this->groups['total'] ) {
				$this->total_group_count = (int)$this->groups['total'];
			} else {
				$this->total_group_count = (int)$max;
			}

			$this->groups = $this->groups['groups'];

			if ( $max ) {
				if ( $max >= count($this->groups) ) {
					$this->group_count = count( $this->groups );
				} else {
					$this->group_count = (int)$max;
				}
			} else {
				$this->group_count = count( $this->groups );
			}
		}

		// Build pagination links
		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, 's' => $search_terms, '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
			) );
		}
	}
开发者ID:n-sane,项目名称:zaroka,代码行数:57,代码来源:bp-groups-templatetags.php

示例2: __construct

 function __construct($args = array())
 {
     // Backward compatibility with old method of passing arguments
     if (!is_array($args) || func_num_args() > 1) {
         _deprecated_argument(__METHOD__, '1.7', 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 => 'type', 2 => 'page', 3 => 'per_page', 4 => 'max', 5 => 'slug', 6 => 'search_terms', 7 => 'populate_extras', 8 => 'include', 9 => 'exclude', 10 => 'show_hidden', 11 => 'page_arg');
         $func_args = func_get_args();
         $args = bp_core_parse_args_array($old_args_keys, $func_args);
     }
     $defaults = array('type' => 'active', 'page' => 1, 'per_page' => 20, 'max' => false, 'show_hidden' => false, 'page_arg' => 'grpage', 'user_id' => 0, 'slug' => false, 'include' => false, 'exclude' => false, 'search_terms' => '', 'meta_query' => false, 'populate_extras' => true, 'update_meta_cache' => true);
     $r = wp_parse_args($args, $defaults);
     extract($r);
     $this->pag_page = isset($_REQUEST[$page_arg]) ? intval($_REQUEST[$page_arg]) : $page;
     $this->pag_num = isset($_REQUEST['num']) ? intval($_REQUEST['num']) : $per_page;
     if (bp_current_user_can('bp_moderate') || is_user_logged_in() && $user_id == bp_loggedin_user_id()) {
         $show_hidden = true;
     }
     if ('invites' == $type) {
         $this->groups = groups_get_invites_for_user($user_id, $this->pag_num, $this->pag_page, $exclude);
     } else {
         if ('single-group' == $type) {
             $this->single_group = true;
             if (groups_get_current_group()) {
                 $group = groups_get_current_group();
             } else {
                 $group = groups_get_group(array('group_id' => BP_Groups_Group::get_id_from_slug($r['slug']), 'populate_extras' => $r['populate_extras']));
             }
             // backwards compatibility - the 'group_id' variable is not part of the
             // BP_Groups_Group object, but we add it here for devs doing checks against it
             //
             // @see https://buddypress.trac.wordpress.org/changeset/3540
             //
             // this is subject to removal in a future release; devs should check against
             // $group->id instead
             $group->group_id = $group->id;
             $this->groups = array($group);
         } else {
             $this->groups = groups_get_groups(array('type' => $type, 'order' => $order, 'orderby' => $orderby, 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'user_id' => $user_id, 'search_terms' => $search_terms, 'meta_query' => $meta_query, 'include' => $include, 'exclude' => $exclude, 'populate_extras' => $populate_extras, 'update_meta_cache' => $update_meta_cache, 'show_hidden' => $show_hidden));
         }
     }
     if ('invites' == $type) {
         $this->total_group_count = (int) $this->groups['total'];
         $this->group_count = (int) $this->groups['total'];
         $this->groups = $this->groups['groups'];
     } else {
         if ('single-group' == $type) {
             if (empty($group->id)) {
                 $this->total_group_count = 0;
                 $this->group_count = 0;
             } else {
                 $this->total_group_count = 1;
                 $this->group_count = 1;
             }
         } else {
             if (empty($max) || $max >= (int) $this->groups['total']) {
                 $this->total_group_count = (int) $this->groups['total'];
             } else {
                 $this->total_group_count = (int) $max;
             }
             $this->groups = $this->groups['groups'];
             if (!empty($max)) {
                 if ($max >= count($this->groups)) {
                     $this->group_count = count($this->groups);
                 } else {
                     $this->group_count = (int) $max;
                 }
             } else {
                 $this->group_count = count($this->groups);
             }
         }
     }
     // Build pagination links
     if ((int) $this->total_group_count && (int) $this->pag_num) {
         $this->pag_links = paginate_links(array('base' => add_query_arg(array($page_arg => '%#%', 'num' => $this->pag_num, 's' => $search_terms, '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' => _x('←', 'Group pagination previous text', 'buddypress'), 'next_text' => _x('→', 'Group pagination next text', 'buddypress'), 'mid_size' => 1));
     }
 }
开发者ID:kd5ytx,项目名称:Empirical-Wordpress,代码行数:76,代码来源:bp-groups-template.php

示例3: humcore_deposit_form

/**
 * Render the content for deposits/item/new.
 */
function humcore_deposit_form()
{
    if (!empty($_POST)) {
        $deposit_id = humcore_deposit_file();
        if ($deposit_id) {
            $review_url = sprintf('/deposits/item/%1$s/review/', $deposit_id);
            wp_redirect($review_url);
            exit;
        }
    }
    if (!humcore_check_externals()) {
        echo '<h3>New <em>CORE</em> Deposit</h3>';
        echo "<p>We're so sorry, but one of the components of <em>CORE</em> is currently down and it can't accept deposits just now. We're working on it (and we're delighted that you want to share your work) so please come back and try again later.</p>";
        $wp_referer = wp_get_referer();
        printf('<a href="%1$s" class="button white" style="line-height: 1.2em;">Go Back</a>', !empty($wp_referer) && !strpos($wp_referer, 'item/new') ? $wp_referer : '/deposits/');
        return;
    }
    $current_group_id = '';
    preg_match('~.*?/groups/(.*[^/]?)/deposits/~i', wp_get_referer(), $slug_match);
    if (!empty($slug_match)) {
        $current_group_id = BP_Groups_Group::get_id_from_slug($slug_match[1]);
    }
    $user_id = bp_loggedin_user_id();
    $user_firstname = get_the_author_meta('first_name', $user_id);
    $user_lastname = get_the_author_meta('last_name', $user_id);
    ?>

<script type="text/javascript">
	var MyAjax = {
		ajaxurl : '<?php 
    echo esc_url(admin_url('admin-ajax.php'));
    ?>
',
		flash_swf_url : '<?php 
    echo esc_url(includes_url('/js/plupload/Moxie.swf'));
    ?>
',
		silverlight_xap_url : '<?php 
    echo esc_url(includes_url('/js/plupload/Moxie.xap'));
    ?>
',
		_ajax_nonce : '<?php 
    echo esc_attr(wp_create_nonce('file-upload'));
    ?>
',
	};
</script>

<h3>New CORE Deposit</h3>
<div id="filelist">Your browser doesn't have Flash, Silverlight or HTML5 support.</div>
<div id="progressbar">
	<div id="indicator"></div>
</div>
<div id="console">Select the file you wish to upload and deposit. *</div>

<div id="container">
	<button id="pickfile">Select File</button> 
<!--    <button id="uploadfile">Upload</button> -->
	<?php 
    $wp_referer = wp_get_referer();
    printf('<a href="%1$s" class="button white" style="line-height: 1.2em;">Cancel</a>', !empty($wp_referer) && !strpos($wp_referer, 'item/new') ? $wp_referer : '/deposits/');
    ?>
</div>

<script type='text/javascript' src='/js/retrieveDOI.js'></script>

<form id="deposit-form" class="standard-form" method="post" action="" enctype="multipart/form-data">

	<input type="hidden" name="action" id="action" value="deposit_file" />
	<?php 
    wp_nonce_field('new_core_deposit', 'new_core_deposit_nonce');
    ?>

        <input type="hidden" name="selected_temp_name" id="selected_temp_name" value="<?php 
    if (!empty($_POST['selected_temp_name'])) {
        echo sanitize_text_field($_POST['selected_temp_name']);
    }
    ?>
" />
        <input type="hidden" name="selected_file_name" id="selected_file_name" value="<?php 
    if (!empty($_POST['selected_file_name'])) {
        echo sanitize_text_field($_POST['selected_file_name']);
    }
    ?>
" />
        <input type="hidden" name="selected_file_type" id="selected_file_type" value="<?php 
    if (!empty($_POST['selected_file_type'])) {
        echo sanitize_text_field($_POST['selected_file_type']);
    }
    ?>
" />
        <input type="hidden" name="selected_file_size" id="selected_file_size" value="<?php 
    if (!empty($_POST['selected_file_type'])) {
        echo sanitize_text_field($_POST['selected_file_size']);
    }
    ?>
" />
//.........这里部分代码省略.........
开发者ID:MartinPaulEve,项目名称:humcore,代码行数:101,代码来源:screens.php

示例4: __construct

 function __construct($user_id, $type, $page, $per_page, $max, $slug, $search_terms, $populate_extras, $include = false, $exclude = false, $show_hidden = false)
 {
     global $bp;
     $this->pag_page = isset($_REQUEST['grpage']) ? intval($_REQUEST['grpage']) : $page;
     $this->pag_num = isset($_REQUEST['num']) ? intval($_REQUEST['num']) : $per_page;
     if (bp_current_user_can('bp_moderate') || is_user_logged_in() && $user_id == bp_loggedin_user_id()) {
         $show_hidden = true;
     }
     if ('invites' == $type) {
         $this->groups = groups_get_invites_for_user($user_id, $this->pag_num, $this->pag_page, $exclude);
     } else {
         if ('single-group' == $type) {
             $group = new stdClass();
             $group->group_id = BP_Groups_Group::get_id_from_slug($slug);
             $this->groups = array($group);
         } else {
             $this->groups = groups_get_groups(array('type' => $type, 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'user_id' => $user_id, 'search_terms' => $search_terms, 'include' => $include, 'exclude' => $exclude, 'populate_extras' => $populate_extras, 'show_hidden' => $show_hidden));
         }
     }
     if ('invites' == $type) {
         $this->total_group_count = (int) $this->groups['total'];
         $this->group_count = (int) $this->groups['total'];
         $this->groups = $this->groups['groups'];
     } else {
         if ('single-group' == $type) {
             $this->single_group = true;
             $this->total_group_count = 1;
             $this->group_count = 1;
         } else {
             if (empty($max) || $max >= (int) $this->groups['total']) {
                 $this->total_group_count = (int) $this->groups['total'];
             } else {
                 $this->total_group_count = (int) $max;
             }
             $this->groups = $this->groups['groups'];
             if (!empty($max)) {
                 if ($max >= count($this->groups)) {
                     $this->group_count = count($this->groups);
                 } else {
                     $this->group_count = (int) $max;
                 }
             } else {
                 $this->group_count = count($this->groups);
             }
         }
     }
     // Build pagination links
     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, 's' => $search_terms, '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' => _x('&larr;', 'Group pagination previous text', 'buddypress'), 'next_text' => _x('&rarr;', 'Group pagination next text', 'buddypress'), 'mid_size' => 1));
     }
 }
开发者ID:newington,项目名称:buddypress,代码行数:51,代码来源:bp-groups-template.php

示例5: get_access_options

 public static function get_access_options($options, $settings_field, $doc_id = 0, $group_id = 0)
 {
     if (!$group_id) {
         $group_id = bp_docs_get_associated_group_id($doc_id);
     }
     // If this is the Doc creation page, check to see whether a
     // group id has been passed somewhere
     if (empty($group_id)) {
         if (isset($_POST['associated_group_id'])) {
             $group_id = intval($_POST['associated_group_id']);
         } else {
             if (isset($_GET['associated_group_id'])) {
                 $group_id = intval($_GET['associated_group_id']);
             } else {
                 if (isset($_GET['group'])) {
                     $maybe_group = BP_Groups_Group::get_id_from_slug($_GET['group']);
                     if ($maybe_group) {
                         $group_id = $maybe_group;
                     }
                 }
             }
         }
     }
     if ($group_id && current_user_can('bp_docs_associate_with_group', $group_id)) {
         $group = groups_get_group(array('group_id' => intval($group_id)));
         $options[40] = array('name' => 'group-members', 'label' => sprintf(__('Members of %s', 'bp-docs'), $group->name));
         // "Admins and mods" setting only available to admins and mods
         // Otherwise users end up locking themselves out
         $group_settings = bp_docs_get_group_settings($group_id);
         $is_admin = groups_is_user_admin(bp_loggedin_user_id(), $group_id);
         $is_mod = groups_is_user_mod(bp_loggedin_user_id(), $group_id);
         if ($is_admin || $is_mod) {
             $options[50] = array('name' => 'admins-mods', 'label' => sprintf(__('Admins and mods of %s', 'bp-docs'), $group->name));
         }
         // Group-associated docs should have the edit/post
         // permissions limited to group-members by default. If
         // the group is non-public, set the other permissions
         // to group-members as well
         if ('public' != $group->status || in_array($settings_field, array('edit', 'post_comments'))) {
             // First, unset existing defaults
             foreach ($options as &$option) {
                 $option['default'] = 0;
             }
             $options[40]['default'] = 1;
         }
     }
     return $options;
 }
开发者ID:projectestac,项目名称:wordpress-buddypress-docs,代码行数:48,代码来源:integration-groups.php

示例6: bd_docs_get_current_group_id

 /**
  * figure out the current used buddypress group_id
  *
  * @since   0.1
  * @access public
  * @returns int  $group_id
  */
 public function bd_docs_get_current_group_id()
 {
     $group_id = false;
     if (bp_docs_is_bp_docs_page() && NULL !== bp_docs_get_current_doc()) {
         $group_id = bp_docs_get_associated_group_id(get_the_ID());
     } else {
         $path = $_SERVER['REQUEST_URI'];
         $p_arr = explode('/', $path);
         if (isset($p_arr[1]) && $p_arr[1] == bp_get_groups_root_slug()) {
             $slug = $p_arr[2];
             $group_id = BP_Groups_Group::get_id_from_slug($slug);
         } else {
             $u = parse_url(wp_get_referer());
             $path = $u['path'];
             $p_arr = explode('/', $path);
             if (isset($p_arr[1]) && $p_arr[1] == bp_get_groups_root_slug()) {
                 $slug = $p_arr[2];
                 $group_id = BP_Groups_Group::get_id_from_slug($slug);
             }
         }
     }
     return $group_id;
 }
开发者ID:rpi-virtuell,项目名称:rw-social-learner,代码行数:30,代码来源:RW_BuddyPress_Docs_Tree.php

示例7: bp_docs_associated_group_summary

/**
 * Display a summary of the associated group
 *
 * @since 1.2
 *
 * @param int $group_id
 */
function bp_docs_associated_group_summary($group_id = 0)
{
    $html = '';
    if (!$group_id) {
        if (isset($_GET['group'])) {
            $group_slug = $_GET['group'];
            $group_id = BP_Groups_Group::get_id_from_slug($group_slug);
        } else {
            $doc_id = is_singular() ? get_the_ID() : 0;
            $group_id = bp_docs_get_associated_group_id($doc_id);
        }
    }
    $group_id = intval($group_id);
    if ($group_id) {
        $group = groups_get_group('group_id=' . $group_id);
        if (!empty($group->name)) {
            $group_link = esc_url(bp_get_group_permalink($group));
            $group_avatar = bp_core_fetch_avatar(array('item_id' => $group_id, 'object' => 'group', 'type' => 'thumb', 'width' => '40', 'height' => '40'));
            $group_member_count = sprintf(1 == $group->total_member_count ? __('%s member', 'bp-docs') : __('%s members', 'bp-docs'), intval($group->total_member_count));
            switch ($group->status) {
                case 'public':
                    $group_type_string = __('Public Group', 'bp-docs');
                    break;
                case 'private':
                    $group_type_string = __('Private Group', 'bp-docs');
                    break;
                case 'hidden':
                    $group_type_string = __('Hidden Group', 'bp-docs');
                    break;
                default:
                    $group_type_string = '';
                    break;
            }
            $html .= '<a href="' . $group_link . '">' . $group_avatar . '</a>';
            $html .= '<div class="item">';
            $html .= '<a href="' . $group_link . '">' . esc_html($group->name) . '</a>';
            $html .= '<div class="meta">' . $group_type_string . ' / ' . $group_member_count . '</div>';
            $html .= '</div>';
        }
    }
    echo $html;
}
开发者ID:ExpectancyLearning,项目名称:buddypress-docs,代码行数:49,代码来源:templatetags.php

示例8: bp_docs_folders_meta_box

/**
 * Add the meta box to the edit page.
 *
 * @since 1.9
 */
function bp_docs_folders_meta_box()
{
    $doc_id = get_the_ID();
    $associated_group_id = bp_is_active('groups') ? bp_docs_get_associated_group_id($doc_id) : 0;
    if (!$associated_group_id && isset($_GET['group'])) {
        $group_id = BP_Groups_Group::get_id_from_slug(urldecode($_GET['group']));
        if (current_user_can('bp_docs_associate_with_group', $group_id)) {
            $associated_group_id = $group_id;
        }
    }
    // On the Create screen, respect the 'folder' $_GET param
    if (bp_docs_is_doc_create()) {
        $folder_id = bp_docs_get_current_folder_id();
    } else {
        $folder_id = bp_docs_get_doc_folder($doc_id);
    }
    ?>

	<div id="doc-folders" class="doc-meta-box">
		<div class="toggleable <?php 
    bp_docs_toggleable_open_or_closed_class();
    ?>
">
			<p id="folders-toggle-edit" class="toggle-switch">
				<span class="hide-if-js toggle-link-no-js"><?php 
    _e('Folders', 'bp-docs');
    ?>
</span>
				<a class="hide-if-no-js toggle-link" id="folders-toggle-link" href="#"><span class="show-pane plus-or-minus"></span><span class="toggle-title"><?php 
    _e('Folders', 'bp-docs');
    ?>
</span></a>
			</p>

			<div class="toggle-content">
				<table class="toggle-table" id="toggle-table-tags">
					<tr>
						<td class="desc-column">
							<label for="bp_docs_tag"><?php 
    _e('Select a folder for this Doc.', 'bp-docs');
    ?>
</label>
						</td>

						<td>
							<div class="existing-or-new-selector">
								<input type="radio" name="existing-or-new-folder" id="use-existing-folder" value="existing" checked="checked" />
								<label for="use-existing-folder" class="radio-label"><?php 
    _e('Use an existing folder', 'bp-docs');
    ?>
</label><br />
								<div class="selector-content">
									<?php 
    bp_docs_folder_selector(array('name' => 'bp-docs-folder', 'id' => 'bp-docs-folder', 'group_id' => $associated_group_id, 'selected' => $folder_id));
    ?>
								</div>
							</div>

							<div class="existing-or-new-selector" id="new-folder-block">
								<input type="radio" name="existing-or-new-folder" id="create-new-folder" value="new" />
								<label for="create-new-folder" class="radio-label"><?php 
    _e('Create a new folder', 'bp-docs');
    ?>
</label>
								<div class="selector-content">

									<?php 
    bp_docs_create_new_folder_markup(array('group_id' => $associated_group_id, 'selected' => $associated_group_id));
    ?>
								</div><!-- .selector-content -->
							</div>
						</td>
					</tr>
				</table>
			</div>
		</div>
	</div>

	<?php 
}
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:85,代码来源:addon-folders.php

示例9: get_access_options

 public static function get_access_options($options, $settings_field, $doc_id = 0, $group_id = 0)
 {
     if (!$group_id) {
         $group_id = bp_docs_get_associated_group_id($doc_id);
     }
     // If this is the Doc creation page, check to see whether a
     // group id has been passed somewhere
     if (empty($group_id)) {
         if (isset($_POST['associated_group_id'])) {
             $group_id = intval($_POST['associated_group_id']);
         } else {
             if (isset($_GET['associated_group_id'])) {
                 $group_id = intval($_GET['associated_group_id']);
             } else {
                 if (isset($_GET['group'])) {
                     $maybe_group = BP_Groups_Group::get_id_from_slug($_GET['group']);
                     if ($maybe_group) {
                         $group_id = $maybe_group;
                     }
                 }
             }
         }
     }
     $can_associate = self::user_can_associate_doc_with_group(bp_loggedin_user_id(), $group_id);
     if ($can_associate) {
         $group = groups_get_group('group_id=' . intval($group_id));
         $options[40] = array('name' => 'group-members', 'label' => sprintf(__('Members of %s', 'bp-docs'), $group->name));
         $options[50] = array('name' => 'admins-mods', 'label' => sprintf(__('Admins and mods of %s', 'bp-docs'), $group->name));
         // Group-associated docs should have the edit/post
         // permissions limited to group-members by default. If
         // the group is non-public, set the other permissions
         // to group-members as well
         // First, unset existing defaults
         foreach ($options as &$option) {
             $option['default'] = 0;
         }
         // Now, set new defaults
         if ('public' != $group->status || in_array($settings_field, array('edit', 'post-comments'))) {
             $options[40]['default'] = 1;
         }
     }
     return $options;
 }
开发者ID:adisonc,项目名称:MaineLearning,代码行数:43,代码来源:integration-groups.php

示例10: bp_group_hierarchy_fixup_permalink

/**
 * Override the group slug in permalinks with a group's full path
 */
function bp_group_hierarchy_fixup_permalink($permalink)
{
    global $bp;
    $group_slug = substr($permalink, strlen($bp->root_domain . '/' . bp_get_groups_root_slug() . '/'), -1);
    if (strpos($group_slug, '/')) {
        return $permalink;
    }
    $group_id = BP_Groups_Group::get_id_from_slug($group_slug);
    if ($group_id) {
        $group_path = BP_Groups_Hierarchy::get_path($group_id);
        return str_replace('/' . $group_slug . '/', '/' . $group_path . '/', $permalink);
    }
    return $permalink;
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:17,代码来源:bp-group-hierarchy-filters.php

示例11: bp_groups_user_groups_template

 function bp_groups_user_groups_template($user_id, $type, $per_page, $max, $slug, $filter)
 {
     global $bp;
     if (!$user_id) {
         $user_id = $bp->displayed_user->id;
     }
     $this->pag_page = isset($_REQUEST['grpage']) ? intval($_REQUEST['grpage']) : 1;
     $this->pag_num = isset($_REQUEST['num']) ? intval($_REQUEST['num']) : $per_page;
     switch ($type) {
         case 'recently-joined':
             $this->groups = groups_get_recently_joined_for_user($user_id, $this->pag_num, $this->pag_page, $filter);
             break;
         case 'popular':
             $this->groups = groups_get_most_popular_for_user($user_id, $this->pag_num, $this->pag_page, $filter);
             break;
         case 'admin-of':
             $this->groups = groups_get_user_is_admin_of($user_id, $this->pag_num, $this->pag_page, $filter);
             break;
         case 'mod-of':
             $this->groups = groups_get_user_is_mod_of($user_id, $this->pag_num, $this->pag_page, $filter);
             break;
         case 'alphabetical':
             $this->groups = groups_get_alphabetically_for_user($user_id, $this->pag_num, $this->pag_page, $filter);
             break;
         case 'invites':
             $this->groups = groups_get_invites_for_user();
             break;
         case 'single-group':
             $group = new stdClass();
             $group->group_id = BP_Groups_Group::get_id_from_slug($slug);
             $this->groups = array($group);
             break;
         case 'active':
         default:
             $this->groups = groups_get_recently_active_for_user($user_id, $this->pag_num, $this->pag_page, $filter);
             break;
     }
     if ('invites' == $type) {
         $this->total_group_count = count($this->groups);
         $this->group_count = count($this->groups);
     } else {
         if ('single-group' == $type) {
             $this->single_group = true;
             $this->total_group_count = 1;
             $this->group_count = 1;
         } else {
             if (!$max) {
                 $this->total_group_count = (int) $this->groups['total'];
             } else {
                 $this->total_group_count = (int) $max;
             }
             $this->groups = $this->groups['groups'];
             if ($max) {
                 if ($max >= count($this->groups)) {
                     $this->group_count = count($this->groups);
                 } else {
                     $this->group_count = (int) $max;
                 }
             } else {
                 $this->group_count = count($this->groups);
             }
         }
     }
     $this->pag_links = paginate_links(array('base' => add_query_arg(array('grpage' => '%#%', 'num' => $this->pag_num, 's' => $_REQUEST['s'], 'sortby' => $this->sort_by, 'order' => $this->order)), 'format' => '', 'total' => ceil($this->total_group_count / $this->pag_num), 'current' => $this->pag_page, 'prev_text' => '&laquo;', 'next_text' => '&raquo;', 'mid_size' => 1));
 }
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:65,代码来源:bp-groups-templatetags.php


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