本文整理汇总了PHP中BP_Groups_Group::get_alphabetically方法的典型用法代码示例。如果您正苦于以下问题:PHP BP_Groups_Group::get_alphabetically方法的具体用法?PHP BP_Groups_Group::get_alphabetically怎么用?PHP BP_Groups_Group::get_alphabetically使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BP_Groups_Group
的用法示例。
在下文中一共展示了BP_Groups_Group::get_alphabetically方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bp_group_documents_bulk_uploads
function bp_group_documents_bulk_uploads()
{
/* this is normally taken care of with AJAX, but it is here as well in case
something goes wrong (no javascript) and a normal form submit occurs */
bp_group_documents_check_uploads_submit();
//array to hold file names
$files = array();
$dh = opendir(BP_GROUP_DOCUMENTS_ADMIN_UPLOAD_PATH);
if ($dh) {
//read files
while (false !== ($file = readdir($dh))) {
if ($file != '.' && $file != '..') {
$files[] = $file;
}
}
if (!empty($files)) {
?>
<hr />
<div id="bp-group-documents-bulk-message"></div>
<h2><?php
_e('Bulk File Uploads', 'bp-group-documents');
?>
</h2>
<div id="bp-group-documents-bulk-upload">
<div class="doc-list">
<?php
foreach ($files as $file) {
?>
<div class="doc-single">
<form method="post" class="bp-group-documents-admin-upload" action="">
<input type="hidden" name="file" value="<?php
echo $file;
?>
" />
<div class="file"><strong><?php
echo $file;
?>
</strong></div>
<div class="group"><select name="group">
<option value="0"><?php
_e('Select Group...', 'bp-group-documents');
?>
</option>
<?php
$groups_list = BP_Groups_Group::get_alphabetically();
$groups_list = $groups_list['groups'];
foreach ($groups_list as $group) {
echo "<option value='{$group->id}'>" . stripslashes($group->name) . "</option>\n";
}
?>
</select></div>
<div class="name"><input type="text" name="name" /></div>
<div class="description"><textarea name="description"></textarea></div>
<div class="submit"><input type="submit" value="<?php
_e('Move File', 'bp-group-documents');
?>
" /></div>
</form>
<div class="clear"></div>
</div>
<?php
}
echo '</div></div>';
}
closedir($dh);
}
}
示例2: extend_search
/**
* extend_search( $groups, $params )
*
* Hooks into groups_get_groups filter and extends search to include Courseware used post types
*/
function extend_search($groups, $params)
{
// Don't bother searching if nothing queried
if (empty($params['search_terms'])) {
return $groups;
}
// A hack to make WordPress believe the taxonomy is registered
if (!taxonomy_exists('group_id')) {
global $wp_taxonomies;
$wp_taxonomies['group_id'] = '';
}
$all_groups = BP_Groups_Group::get_alphabetically();
foreach ($all_groups['groups'] as $group) {
// Search posts from current $group
$results = BPSP_WordPress::get_posts(array('group_id' => $group->id), array('assignment', 'course', 'schedule'), $params['search_terms']);
// Merge posts to $groups if new found
if (!empty($results)) {
if (!in_array($group, $groups['groups'])) {
$groups['groups'][] = $group;
$groups['total']++;
}
}
}
return $groups;
}
示例3: groups_get_groups
function groups_get_groups( $args = '' ) {
global $bp;
$defaults = array(
'type' => 'active', // active, newest, alphabetical, random, popular, most-forum-topics or most-forum-posts
'user_id' => false, // Pass a user_id to limit to only groups that this user is a member of
'search_terms' => false, // Limit to groups that match these search terms
'per_page' => 20, // The number of results to return per page
'page' => 1, // The page to return if limiting per page
'populate_extras' => true, // Fetch meta such as is_banned and is_member
);
$params = wp_parse_args( $args, $defaults );
extract( $params, EXTR_SKIP );
switch ( $type ) {
case 'active': default:
$groups = BP_Groups_Group::get_active( $per_page, $page, $user_id, $search_terms, $populate_extras );
break;
case 'newest':
$groups = BP_Groups_Group::get_newest( $per_page, $page, $user_id, $search_terms, $populate_extras );
break;
case 'popular':
$groups = BP_Groups_Group::get_popular( $per_page, $page, $user_id, $search_terms, $populate_extras );
break;
case 'alphabetical':
$groups = BP_Groups_Group::get_alphabetically( $per_page, $page, $user_id, $search_terms, $populate_extras );
break;
case 'random':
$groups = BP_Groups_Group::get_random( $per_page, $page, $user_id, $search_terms, $populate_extras );
break;
case 'most-forum-topics':
$groups = BP_Groups_Group::get_by_most_forum_topics( $per_page, $page, $user_id, $search_terms, $populate_extras );
break;
case 'most-forum-posts':
$groups = BP_Groups_Group::get_by_most_forum_posts( $per_page, $page, $user_id, $search_terms, $populate_extras );
break;
}
return apply_filters( 'groups_get_groups', $groups, &$params );
}
示例4: form
function form($instance)
{
do_action('bp_group_documents_newest_widget_form');
$instance = wp_parse_args((array) $instance, array('num_items' => 5));
$title = esc_attr($instance['title']);
$group_filter = esc_attr($instance['group_filter']);
$featured = esc_attr($instance['featured']);
$num_items = esc_attr($instance['num_items']);
?>
<p><label><?php
_e('Title:', 'bp-group-documents');
?>
</label><input class="widefat" id="<?php
echo $this->get_field_id('title');
?>
" name="<?php
echo $this->get_field_name('title');
?>
" type="text" value="<?php
echo $title;
?>
" /></p>
<?php
if (BP_GROUP_DOCUMENTS_WIDGET_GROUP_FILTER) {
?>
<p><label><?php
_e('Filter by Group:', 'bp-group-documents');
?>
</label>
<select id="<?php
echo $this->get_field_id('group_filter');
?>
" name="<?php
echo $this->get_field_name('group_filter');
?>
" >
<option value="0"><?php
_e('Select Group...', 'bp-group-documents');
?>
</option>
<?php
$groups_list = BP_Groups_Group::get_alphabetically();
foreach ($groups_list['groups'] as $group) {
echo '<option value="' . $group->id . '" ';
if ($group->id == $group_filter) {
echo 'selected="selected"';
}
echo '>' . stripslashes($group->name) . '</option>';
}
?>
</select></p>
<?php
}
?>
<?php
if (BP_GROUP_DOCUMENTS_FEATURED) {
?>
<p><input type="checkbox" id="<?php
echo $this->get_field_id('featured');
?>
" name="<?php
echo $this->get_field_name('featured');
?>
" value="1" <?php
if ($featured) {
echo 'checked="checked"';
}
?>
>
<label><?php
_e('Show featured documents only', 'bp-group-documents');
?>
</label></p>
<?php
}
?>
<p><label><?php
_e('Number of items to show:', 'bp-group-documents');
?>
</label> <input class="widefat" id="<?php
echo $this->get_field_id('num_items');
?>
" name="<?php
echo $this->get_field_name('num_items');
?>
" type="text" value="<?php
echo esc_attr($num_items);
?>
" style="width: 30%" /></p>
<?php
}