Search Results for 'group_id'
-
AuthorSearch Results
-
March 14, 2011 at 1:54 am #107717
In reply to: How to display the Group’s recent activity
Virtuali
ParticipantThis only works on the group-loop (group index), you could probably hook it into others as well.
Put in bp-custom
`function my_group_loop_activity_item() {
global $bp, $activities_template;if ( !bp_is_active( ‘activity’ ) )
return;if ( !bp_group_is_visible() )
return;$show_hidden = false;
/* Group filtering */
$object = $bp->groups->id;
$primary_id = bp_get_group_id();if ( ‘public’ != $bp->groups->current_group->status && groups_is_user_member( $bp->loggedin_user->id, bp_get_group_id() ) )
$show_hidden = true;/* Note: any params used for filtering can be a single value, or multiple values comma separated. */
$defaults = array(
‘display_comments’ => false, // false for none, stream/threaded – show comments in the stream or threaded under items
‘sort’ => ‘DESC’, // sort DESC or ASC
‘page’ => 1, // which page to load
‘per_page’ => false, // number of items per page
‘max’ => 2, // max number to return
‘include’ => false, // pass an activity_id or string of ID’s comma separated
‘show_hidden’ => $show_hidden, // Show activity items that are hidden site-wide?/* Filtering */
‘object’ => $object, // object to filter on e.g. groups, profile, status, friends
‘primary_id’ => $primary_id, // object ID to filter on e.g. a group_id or forum_id or blog_id etc.
‘action’ => false, // action to filter on e.g. activity_update, new_forum_post, profile_updated
‘secondary_id’ => false, // secondary object ID to filter on e.g. a post_id/* Searching */
‘search_terms’ => false // specify terms to search on
);$r = wp_parse_args( $args, $defaults );
extract( $r );$filter = array( ‘user_id’ => false, ‘object’ => $object, ‘action’ => $action, ‘primary_id’ => $primary_id, ‘secondary_id’ => $secondary_id );
$activities_template = new BP_Activity_Template( $page, $per_page, $max, $include, $sort, $filter, $search_terms, $display_comments, $show_hidden );
while ( bp_activities() ) : bp_the_activity(); ?>
<div class="item-desc" id="activity-“><a href="”><?php endwhile;
}
add_action( ‘bp_directory_groups_item’, ‘my_group_loop_activity_item’ );`March 6, 2011 at 5:53 pm #106982In reply to: Check if an user is or not a group_member :
Paul Wong-Gibbs
Keymaster`groups_is_user_member( $user_id, $group_id )`
February 13, 2011 at 8:32 pm #105321r-a-y
KeymasterTo find the profile group id, navigate to “BuddyPress > Profile Field Setup”.
Then under the profile group you want, hover over the “Edit” or “Delete” link.
You should see a link that looks like this:
`/wp-admin/admin.php?page=bp-profile-setup&mode=edit_group&group_id=2`“group_id” is the variable you’re looking for.
—
The alternative is to remove the `’profile_group_id=1’` declaration in the register template, that should show all profile fields that you have created.
February 7, 2011 at 10:43 pm #104870In reply to: Checking if a user is in a group
Paul Wong-Gibbs
Keymaster`
groups_is_user_member( bp_displayed_user_id(), $group_id )
`February 1, 2011 at 5:38 pm #104399In reply to: The groups loop and group meta
Sven Lehnert
ParticipantI have the same problem,
I have added a group metadata “featured” to have featured groups displayed separately. It’s just a checkbox. All is working, but now I stuck, how to filter the metadata in bp_has_groups().https://codex.buddypress.org/developer-docs/custom-buddypress-loops/the-groups-loop/
At the moment I check it in the loop, but this is realy dirty
if(groups_get_groupmeta( bp_get_group_id(), ‘bp_featured_group’ ) == ‘Featured’):
wold be great to know how you have done this.
Did you build a function groups_get_groups? If yes, would be great if you could share it here
February 1, 2011 at 10:48 am #104375In reply to: Insert Buddypress Forums in WordPress blog and pages
arpit.tambi.in
ParticipantOkay I figured it out and used following code in wordpress page template –
`<?php
global $bp;
$bp->groups->current_group = groups_get_group( array( ‘group_id’ => 1 ) );
locate_template( array( ‘forums/forum-loop.php’ ), true );
?>`January 17, 2011 at 3:45 am #103088In reply to: Forums Posting Problems: The definitive post
Virtuali
ParticipantGo the group your attempting to post in and delete the forum_id, don’t delete the group_id.
So it would require going to the group, — forum — forum_id
And re-enabling forums is going into the group, under “admin”, then “group settings, and unchecking-and rechecking and see if that works
January 17, 2011 at 3:32 am #103084In reply to: Forums Posting Problems: The definitive post
cmroybal
MemberSVC:
Would that be the “id” or “group_id” value in the table? (I don’t see one named “forum_id”)
January 10, 2011 at 11:43 pm #102524In reply to: Announcements tab like CUNY?
Virtuali
ParticipantCreating a custom tab in the groups page is quite simple, all it takes is a added code to the bp-custom.php file:
`class My_Group_Extension extends BP_Group_Extension {
function my_group_extension() {
$this->name = ‘My Group Extension’;
$this->slug = ‘my-group-extension’;$this->create_step_position = 21;
$this->nav_item_position = 31;
}function create_screen() {
if ( !bp_is_group_creation_step( $this->slug ) )
return false;
?>The HTML for my creation step goes here.
<?php
wp_nonce_field( ‘groups_create_save_’ . $this->slug );
}function create_screen_save() {
global $bp;check_admin_referer( ‘groups_create_save_’ . $this->slug );
/* Save any details submitted here */
groups_update_groupmeta( $bp->groups->new_group_id, ‘my_meta_name’, ‘value’ );
}function edit_screen() {
if ( !bp_is_group_admin_screen( $this->slug ) )
return false; ?>name ) ?>
Edit steps here
<?php
wp_nonce_field( ‘groups_edit_save_’ . $this->slug );
}function edit_screen_save() {
global $bp;if ( !isset( $_POST ) )
return false;check_admin_referer( ‘groups_edit_save_’ . $this->slug );
/* Insert your edit screen save code here */
/* To post an error/success message to the screen, use the following */
if ( !$success )
bp_core_add_message( __( ‘There was an error saving, please try again’, ‘buddypress’ ), ‘error’ );
else
bp_core_add_message( __( ‘Settings saved successfully’, ‘buddypress’ ) );bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . ‘/admin/’ . $this->slug );
}function display() {
/* Use this function to display the actual content of your group extension when the nav item is selected */
}function widget_display() { ?>
name ) ?>
You could display a small snippet of information from your group extension here. It will show on the group
home screen.<?php
}
}
bp_register_group_extension( ‘My_Group_Extension’ );
`edit the: $this->name = ‘My Group Extension’;
$this->slug = ‘my-group-extension’;to the names and slugs of your likings.
January 5, 2011 at 7:08 am #101948dmillasich
MemberThe php server error log provided this information:
_____________________________________________________________________________________________________________________________________________________________________
[05-Jan-2011 05:38:20] PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 30720 bytes) in /social.nanocrowd.com/wp-admin/includes/post.php on line 748
[05-Jan-2011 05:52:02] WordPress database error Table ‘social.wp_bp_xprofile_data’ doesn’t exist for query SELECT value FROM wp_bp_xprofile_data WHERE field_id = 1 AND user_id = 1 made by require_once, require_once, require_once, require_once, do_action, call_user_func_array, bp_loaded, do_action, call_user_func_array, bp_setup_globals, do_action, call_user_func_array, bp_core_setup_globals, bp_core_get_user_displayname, xprofile_get_field_data, BP_XProfile_ProfileData->get_value_byid
[05-Jan-2011 05:52:02] WordPress database error Table ‘social.wp_bp_xprofile_fields’ doesn’t exist for query SELECT * FROM wp_bp_xprofile_fields WHERE id = 1 made by require_once, require_once, require_once, require_once, do_action, call_user_func_array, bp_loaded, do_action, call_user_func_array, bp_setup_globals, do_action, call_user_func_array, bp_core_setup_globals, bp_core_get_user_displayname, xprofile_set_field_data, BP_XProfile_Field->bp_xprofile_field, BP_XProfile_Field->populate
[05-Jan-2011 05:52:02] WordPress database error Table ‘social.wp_bp_xprofile_fields’ doesn’t exist for query SELECT id FROM wp_bp_xprofile_fields WHERE id = 1 made by require_once, require_once, require_once, require_once, do_action, call_user_func_array, bp_loaded, do_action, call_user_func_array, bp_setup_globals, do_action, call_user_func_array, bp_core_setup_globals, bp_core_get_user_displayname, xprofile_set_field_data, BP_XProfile_ProfileData->save, BP_XProfile_ProfileData->is_valid_field
[05-Jan-2011 05:52:02] WordPress database error Table ‘social.wp_bp_groups_members’ doesn’t exist for query SELECT COUNT(DISTINCT m.group_id) FROM wp_bp_groups_members m, wp_bp_groups g WHERE m.group_id = g.id AND m.user_id = 1 AND m.is_confirmed = 1 AND m.is_banned = 0 made by require_once, require_once, require_once, require_once, do_action, call_user_func_array, bp_loaded, do_action, call_user_func_array, bp_setup_nav, do_action, call_user_func_array, groups_setup_nav, groups_total_groups_for_user, BP_Groups_Member->total_group_count
[05-Jan-2011 05:52:02] WordPress database error Table ‘social.wp_bp_messages_recipients’ doesn’t exist for query SELECT unread_count FROM wp_bp_messages_recipients WHERE user_id = 1 AND is_deleted = 0 AND sender_only = 0 made by require_once, require_once, require_once, require_once, do_action, call_user_func_array, bp_loaded, do_action, call_user_func_array, bp_setup_nav, do_action, call_user_func_array, messages_setup_nav, messages_get_unread_count, BP_Messages_Thread->get_inbox_count
[05-Jan-2011 05:52:02] PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 30720 bytes) in /social.nanocrowd.com/wp-admin/includes/post.php on line 748
[05-Jan-2011 05:56:08] WordPress database error Table ‘social.wp_bp_xprofile_data’ doesn’t exist for query SELECT value FROM wp_bp_xprofile_data WHERE field_id = 1 AND user_id = 1 made by require_once, require_once, require_once, require_once, do_action, call_user_func_array, bp_loaded, do_action, call_user_func_array, bp_setup_globals, do_action, call_user_func_array, bp_core_setup_globals, bp_core_get_user_displayname, xprofile_get_field_data, BP_XProfile_ProfileData->get_value_byid
[05-Jan-2011 05:56:08] WordPress database error Table ‘social.wp_bp_xprofile_fields’ doesn’t exist for query SELECT * FROM wp_bp_xprofile_fields WHERE id = 1 made by require_once, require_once, require_once, require_once, do_action, call_user_func_array, bp_loaded, do_action, call_user_func_array, bp_setup_globals, do_action, call_user_func_array, bp_core_setup_globals, bp_core_get_user_displayname, xprofile_set_field_data, BP_XProfile_Field->bp_xprofile_field, BP_XProfile_Field->populate
[05-Jan-2011 05:56:08] WordPress database error Table ‘social.wp_bp_xprofile_fields’ doesn’t exist for query SELECT id FROM wp_bp_xprofile_fields WHERE id = 1 made by require_once, require_once, require_once, require_once, do_action, call_user_func_array, bp_loaded, do_action, call_user_func_array, bp_setup_globals, do_action, call_user_func_array, bp_core_setup_globals, bp_core_get_user_displayname, xprofile_set_field_data, BP_XProfile_ProfileData->save, BP_XProfile_ProfileData->is_valid_field
[05-Jan-2011 05:56:08] WordPress database error Table ‘social.wp_bp_groups_members’ doesn’t exist for query SELECT COUNT(DISTINCT m.group_id) FROM wp_bp_groups_members m, wp_bp_groups g WHERE m.group_id = g.id AND m.user_id = 1 AND m.is_confirmed = 1 AND m.is_banned = 0 made by require_once, require_once, require_once, require_once, do_action, call_user_func_array, bp_loaded, do_action, call_user_func_array, bp_setup_nav, do_action, call_user_func_array, groups_setup_nav, groups_total_groups_for_user, BP_Groups_Member->total_group_count
[05-Jan-2011 05:56:08] WordPress database error Table ‘social.wp_bp_messages_recipients’ doesn’t exist for query SELECT unread_count FROM wp_bp_messages_recipients WHERE user_id = 1 AND is_deleted = 0 AND sender_only = 0 made by require_once, require_once, require_once, require_once, do_action, call_user_func_array, bp_loaded, do_action, call_user_func_array, bp_setup_nav, do_action, call_user_func_array, messages_setup_nav, messages_get_unread_count, BP_Messages_Thread->get_inbox_count
[05-Jan-2011 05:56:08] PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 30720 bytes) in /social.nanocrowd.com/wp-admin/includes/post.php on line 1038
[05-Jan-2011 05:56:16] WordPress database error Table ‘social.wp_bp_xprofile_data’ doesn’t exist for query SELECT value FROM wp_bp_xprofile_data WHERE field_id = 1 AND user_id = 1 made by require_once, require_once, require_once, require_once, do_action, call_user_func_array, bp_loaded, do_action, call_user_func_array, bp_setup_globals, do_action, call_user_func_array, bp_core_setup_globals, bp_core_get_user_displayname, xprofile_get_field_data, BP_XProfile_ProfileData->get_value_byid
[05-Jan-2011 05:56:16] WordPress database error Table ‘social.wp_bp_xprofile_fields’ doesn’t exist for query SELECT * FROM wp_bp_xprofile_fields WHERE id = 1 made by require_once, require_once, require_once, require_once, do_action, call_user_func_array, bp_loaded, do_action, call_user_func_array, bp_setup_globals, do_action, call_user_func_array, bp_core_setup_globals, bp_core_get_user_displayname, xprofile_set_field_data, BP_XProfile_Field->bp_xprofile_field, BP_XProfile_Field->populate
[05-Jan-2011 05:56:16] WordPress database error Table ‘social.wp_bp_xprofile_fields’ doesn’t exist for query SELECT id FROM wp_bp_xprofile_fields WHERE id = 1 made by require_once, require_once, require_once, require_once, do_action, call_user_func_array, bp_loaded, do_action, call_user_func_array, bp_setup_globals, do_action, call_user_func_array, bp_core_setup_globals, bp_core_get_user_displayname, xprofile_set_field_data, BP_XProfile_ProfileData->save, BP_XProfile_ProfileData->is_valid_field
[05-Jan-2011 05:56:16] WordPress database error Table ‘social.wp_bp_groups_members’ doesn’t exist for query SELECT COUNT(DISTINCT m.group_id) FROM wp_bp_groups_members m, wp_bp_groups g WHERE m.group_id = g.id AND m.user_id = 1 AND m.is_confirmed = 1 AND m.is_banned = 0 made by require_once, require_once, require_once, require_once, do_action, call_user_func_array, bp_loaded, do_action, call_user_func_array, bp_setup_nav, do_action, call_user_func_array, groups_setup_nav, groups_total_groups_for_user, BP_Groups_Member->total_group_count
[05-Jan-2011 05:56:16] WordPress database error Table ‘social.wp_bp_messages_recipients’ doesn’t exist for query SELECT unread_count FROM wp_bp_messages_recipients WHERE user_id = 1 AND is_deleted = 0 AND sender_only = 0 made by require_once, require_once, require_once, require_once, do_action, call_user_func_array, bp_loaded, do_action, call_user_func_array, bp_setup_nav, do_action, call_user_func_array, messages_setup_nav, messages_get_unread_count, BP_Messages_Thread->get_inbox_count
[05-Jan-2011 05:56:16] PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 122880 bytes) in /social.nanocrowd.com/wp-admin/includes/template.php on line 154
[05-Jan-2011 06:24:03] WordPress database error Table ‘social.wp_bp_xprofile_data’ doesn’t exist for query SELECT value FROM wp_bp_xprofile_data WHERE field_id = 1 AND user_id = 1 made by require_once, require_once, require_once, require_once, do_action, call_user_func_array, bp_loaded, do_action, call_user_func_array, bp_setup_globals, do_action, call_user_func_array, bp_core_setup_globals, bp_core_get_user_displayname, xprofile_get_field_data, BP_XProfile_ProfileData->get_value_byid
[05-Jan-2011 06:24:03] WordPress database error Table ‘social.wp_bp_xprofile_fields’ doesn’t exist for query SELECT * FROM wp_bp_xprofile_fields WHERE id = 1 made by require_once, require_once, require_once, require_once, do_action, call_user_func_array, bp_loaded, do_action, call_user_func_array, bp_setup_globals, do_action, call_user_func_array, bp_core_setup_globals, bp_core_get_user_displayname, xprofile_set_field_data, BP_XProfile_Field->bp_xprofile_field, BP_XProfile_Field->populate
[05-Jan-2011 06:24:03] WordPress database error Table ‘social.wp_bp_xprofile_fields’ doesn’t exist for query SELECT id FROM wp_bp_xprofile_fields WHERE id = 1 made by require_once, require_once, require_once, require_once, do_action, call_user_func_array, bp_loaded, do_action, call_user_func_array, bp_setup_globals, do_action, call_user_func_array, bp_core_setup_globals, bp_core_get_user_displayname, xprofile_set_field_data, BP_XProfile_ProfileData->save, BP_XProfile_ProfileData->is_valid_field
[05-Jan-2011 06:24:03] WordPress database error Table ‘social.wp_bp_groups_members’ doesn’t exist for query SELECT COUNT(DISTINCT m.group_id) FROM wp_bp_groups_members m, wp_bp_groups g WHERE m.group_id = g.id AND m.user_id = 1 AND m.is_confirmed = 1 AND m.is_banned = 0 made by require_once, require_once, require_once, require_once, do_action, call_user_func_array, bp_loaded, do_action, call_user_func_array, bp_setup_nav, do_action, call_user_func_array, groups_setup_nav, groups_total_groups_for_user, BP_Groups_Member->total_group_count
[05-Jan-2011 06:24:03] WordPress database error Table ‘social.wp_bp_messages_recipients’ doesn’t exist for query SELECT unread_count FROM wp_bp_messages_recipients WHERE user_id = 1 AND is_deleted = 0 AND sender_only = 0 made by require_once, require_once, require_once, require_once, do_action, call_user_func_array, bp_loaded, do_action, call_user_func_array, bp_setup_nav, do_action, call_user_func_array, messages_setup_nav, messages_get_unread_count, BP_Messages_Thread->get_inbox_count
[05-Jan-2011 06:24:03] PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 122880 bytes) in /social.nanocrowd.com/wp-admin/includes/post.php on line 318
[05-Jan-2011 06:49:18] WordPress database error Table ‘social.wp_bp_xprofile_data’ doesn’t exist for query SELECT value FROM wp_bp_xprofile_data WHERE field_id = 1 AND user_id = 1 made by require_once, require_once, require_once, require_once, do_action, call_user_func_array, bp_loaded, do_action, call_user_func_array, bp_setup_globals, do_action, call_user_func_array, bp_core_setup_globals, bp_core_get_user_displayname, xprofile_get_field_data, BP_XProfile_ProfileData->get_value_byid
[05-Jan-2011 06:49:18] WordPress database error Table ‘social.wp_bp_xprofile_fields’ doesn’t exist for query SELECT * FROM wp_bp_xprofile_fields WHERE id = 1 made by require_once, require_once, require_once, require_once, do_action, call_user_func_array, bp_loaded, do_action, call_user_func_array, bp_setup_globals, do_action, call_user_func_array, bp_core_setup_globals, bp_core_get_user_displayname, xprofile_set_field_data, BP_XProfile_Field->bp_xprofile_field, BP_XProfile_Field->populate
[05-Jan-2011 06:49:18] WordPress database error Table ‘social.wp_bp_xprofile_fields’ doesn’t exist for query SELECT id FROM wp_bp_xprofile_fields WHERE id = 1 made by require_once, require_once, require_once, require_once, do_action, call_user_func_array, bp_loaded, do_action, call_user_func_array, bp_setup_globals, do_action, call_user_func_array, bp_core_setup_globals, bp_core_get_user_displayname, xprofile_set_field_data, BP_XProfile_ProfileData->save, BP_XProfile_ProfileData->is_valid_field
[05-Jan-2011 06:49:18] WordPress database error Table ‘social.wp_bp_groups_members’ doesn’t exist for query SELECT COUNT(DISTINCT m.group_id) FROM wp_bp_groups_members m, wp_bp_groups g WHERE m.group_id = g.id AND m.user_id = 1 AND m.is_confirmed = 1 AND m.is_banned = 0 made by require_once, require_once, require_once, require_once, do_action, call_user_func_array, bp_loaded, do_action, call_user_func_array, bp_setup_nav, do_action, call_user_func_array, groups_setup_nav, groups_total_groups_for_user, BP_Groups_Member->total_group_count
[05-Jan-2011 06:49:18] WordPress database error Table ‘social.wp_bp_messages_recipients’ doesn’t exist for query SELECT unread_count FROM wp_bp_messages_recipients WHERE user_id = 1 AND is_deleted = 0 AND sender_only = 0 made by require_once, require_once, require_once, require_once, do_action, call_user_func_array, bp_loaded, do_action, call_user_func_array, bp_setup_nav, do_action, call_user_func_array, messages_setup_nav, messages_get_unread_count, BP_Messages_Thread->get_inbox_count
[05-Jan-2011 06:49:19] PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 122880 bytes) in /social.nanocrowd.com/wp-admin/includes/post.php on line 318
____________________________________________________________________________________________________________________________________________________________________Is there a memory threshold problem with my shared php server? I’m using Rackspace cloud. This would be the first time a memory issue has surfaced using them.
January 5, 2011 at 2:49 am #101937In reply to: Using a .csv-file for creating groups
wwwanders
MemberI got a dump from the script and fixed some glitches:
Hers the dump:
‘Array ( [0] => Array ( [group_id] => 2 [creator_id] => 1 [name] => GroupName1 [description] => Interesting description1 [slug] => groupname1 [date_created] => 2011-01-05 02:33:54 [status] => public [enable_forum] => 1 ) [1] => Array ( [group_id] => 3 [creator_id] => 1 [name] => GroupName2 [description] => Interesting description2 [slug] => groupname2 [date_created] => 2011-01-05 02:33:54 [status] => public [enable_forum] => 1 )’
It seems fine but it doesn’t create any groups! ARG!
December 31, 2010 at 3:43 pm #101581Boone Gorges
KeymasterYou will have te create a custom function, either in your theme’s functions.php or in plugins/bp-custom.php, that filters the output of that function and replaces it with the avatar of your choice. Eg, if your blog_id is 5,
‘function my_blog_avatar( $old_avatar ) {
// Do some stuff to get the avatar you want, then
return $new_avatar;
}
add_filter( ‘bp_get_blog_avatar_5’, ‘my_blog_avatar’ );`The ‘do some stuff’ part will depend highly on your setup. If by ‘the associated group’ you mean that you are using bp-groupblog, then you will likely have to do some direct queries of the groupmeta database table to find the group that is associated with a particular blog (I don’t think that the plugin stores that info in a place that is easily accessible by blog_id). Then you will use some permutation of bp_core_fetch_avatar() to pull up the avatar for that group_id.
Good luck!
December 22, 2010 at 4:40 pm #101138In reply to: How to query for groups
David
ParticipantTo extend on Travel-Junkie
`$group = new BP_Groups_Group( $group_id );
foreach ($group as $key => $value)
{echo $key . ‘ = ‘ . $value. ‘‘;}`this will break down in list form all the information you need for the group.
Here is another nice little trick that works hand in hand with information returned from the above script. Lets say you want to show an excerpt from the groups description .
This passes the description in the bp_create_excerpt() function as well as set how many words you want returned…then echo out the results.
`$description = $group -> description;
$descibe_excerpt = bp_create_excerpt( $description, 20 );
echo $descibe_excerpt;`December 22, 2010 at 3:04 pm #101128In reply to: How to query for groups
Anonymous User 96400
InactiveSomething like this will work:
`$group = new BP_Groups_Group( $group_id );echo $group->name;
echo bp_get_group_permalink( $group );`December 22, 2010 at 2:53 pm #101127In reply to: How to query for groups
yu
ParticipantAnother question for groups query experts.
—
How to extract for example group name, permalink, status, description from group ID ?
Something like bp_has_groups ( “group_id = ‘.$ID.’ “) ? Or maybe bp_get_group_name ( $ID) ?
Cause this two functions doesn’t work for me..December 20, 2010 at 6:02 am #100975In reply to: Group Component Activity
Jason Nathan
ParticipantThe groups loop works brilliantly:
`<?php if ( bp_has_groups( bp_ajax_querystring( 'groups' ) ) )
>-
<?php
-
<a href="”>
<a href="”>
id ) ?>
/id ) ?>
-
<a href="”>
<a href="”>
id ) ?>
/id ) ?>
// get all the ids of all the groups
global $groups_template, $bp; $group_ids = custom_group_type::get_current_group_ids();foreach( $groups_template->groups as $group ):
//check if child group – )
// function is_child_group() returns parent group id if true or false if not.if( $parent_group_id = custom_group_type::is_child_group( $group->id ) )
{
//remove the child group so it doesn’t appear in the main groups loop
unset( $group );// Check if parent group is already in the loop
if( in_array( $parent_group_id, $group_ids ) )
{
continue;
}
else
{
// if the parent group is not in the loop, initiate it and display it.
$parent_group = groups_get_group( array( ‘group_id’ => $parent_group_id ) );?>
<?php
}
}
// continue with the normal loop
else
{
?><?php
}
endforeach; ?>`
December 12, 2010 at 5:46 am #100325In reply to: How to query for groups
David
Participant@boonebgorges I know this is a old thread, but it is exactly what I am looking for, but it is not working for me. I should say it is working, but I can’t get one parameter to work. I am using the bp_has_groups() to filter the groups loop and I need to only display certain groups either by id’s (which does not seem to be a option other the user_id) or by slug which will work, but it does not for what ever reason. I am building a search function that will search for groups within a radius of a zip code entered in by the user. My search code is not in play yet so that is not causing the issue…just trying to find a way to hook my search code into a query for the loops page and the slug option looks to be the only way unless I can use group_id’s somehow. This is how I used the slug as parameter.
`$args = array(
‘slug’ => ‘group_slug’,
‘max’ => 3,
‘user_id’ => $user_id);
if ( bp_has_groups ( $args ) ) { …’I looked in the data base for the slug name in the bp_groups table. Not sure if that is right, but it is not working. Like I said though…the other parameters seem to work.
Thanks for any help you can give me.
DavidNovember 20, 2010 at 3:51 pm #98747In reply to: New Group creation fields
Boone Gorges
KeymasterI just took a peek at the BP source, and it looks like the group *has* been created by the point in question, but the information hasn’t been loaded into $bp->groups->current_group yet. Here’s a variant on the code that might work (or something like it):
`
function bbg_save_extra_group_details() {
global $bp;if ( $bp->groups->new_group_id )
$group_id = $bp->groups->new_group_id;
else
$group_id = $bp->groups->current_group->id;if ( ‘yes’ == groups_get_groupmeta( $group_id, ‘is_this_group_a’ ) ) {
// do some group A stuff
} else {
// do some group B stuff
}
}
`November 17, 2010 at 12:55 am #98456pcwriter
ParticipantHave you tried the Widget Logic plugin? You can determine the placement of widgets using both WP and BP conditional tags. That means you can create custom sidebars for ANY component, category, tag, post, page, etc… Give it a whirl; it’s a lot easier than trying to code stuff from scratch

https://wordpress.org/extend/plugins/widget-logic/November 2, 2010 at 9:20 pm #97278In reply to: Accessing the Group Meta table
Enej Bajgorić
ParticipantFound it…
`groups_delete_groupmeta( $group_id, $meta_key = false, $meta_value = false )`
`groups_get_groupmeta( $group_id, $meta_key = ”) `
`groups_update_groupmeta( $group_id, $meta_key, $meta_value )`in bp-groups.php
November 2, 2010 at 2:50 pm #97238joshkadis
Memberawesome, thanks!
November 1, 2010 at 12:22 pm #97111Anonymous User 96400
InactiveSomething like this will work as well:
`$group = new BP_Groups_Group( $group_id );
return $group->name;`November 1, 2010 at 12:02 pm #97109rich! @ etiviti
Participantcan use `groups_get_group` which returns a group object then pass the object to `bp_get_group_name`
October 30, 2010 at 10:57 pm #97032Boone Gorges
Keymaster`groups_is_user_mod( $user_id, $group_id )`
`groups_is_user_admin( $user_id, $group_id )`Check out their definitions in bp-groups.php. They check whether the user is a mod/admin of a particular group.
But that won’t work all that well on a profile page, because a user could be a member of a number of groups, so you won’t have a specific group_id to feed into the function. In what circumstances will the Moderator button appear? If they’re a moderator of *any* groups?
October 28, 2010 at 11:31 am #96792In reply to: Template Tag “is_user_in_group()” ???
rich! @ etiviti
Participant`
function groups_is_user_member( $user_id, $group_id )
` -
-
AuthorSearch Results