Search Results for 'group_id'
-
AuthorSearch Results
-
May 8, 2014 at 11:24 pm #182682
In reply to: Programmatically assigning avatars to groups?
shanebp
ModeratorGroup avatars are stored in /wp-content/uploads/group-avatars/[group_id]
So to ‘set’ each one, you have to mkdir, create file names, upload a full and & thumb version for each group. I’ve done it; it’s a pita.
Given that you’re always using the same avatar, filtering the function is easier and would be my choice.
May 4, 2014 at 6:27 am #182444In reply to: Creating xProfiles using functions.php
Hardeep Asrani
ParticipantThis isn’t doing the job either:
function field_xprofile_twitter() { $group_args = array( 'name' => 'Social Networks' ); $group_id = xprofile_insert_field_group( $group_args ); // group's ID xprofile_insert_field( $xfield_args ); $xfield_args = array ( field_group_id => $group_id, name => 'Twitter', can_delete => false, field_order => 1, is_required => false, type => 'textbox' ); }May 3, 2014 at 8:10 pm #182417In reply to: Creating xProfiles using functions.php
shanebp
ModeratorAre you sure group_id is being set?
Take another look at :
function xprofile_insert_field() in bp-xprofile\bp-xprofile-functions.phpTry passing an array to $args for xprofile_insert_field
Like you did with xprofile_insert_field_group$args = your array;
xprofile_insert_field( $args );
May 3, 2014 at 7:36 pm #182415In reply to: Creating xProfiles using functions.php
Hardeep Asrani
ParticipantI used the following code, and it’s not doing the job:
function field_xprofile_twitter() { $group_args = array( 'name' => 'Social Networks' ); $group_id = xprofile_insert_field_group( $group_args ); // group's ID xprofile_insert_field( array ( field_group_id => $group_id, name => 'Twitter', can_delete => false, field_order => 1, is_required => false, type => 'textbox' ) ); }Hope you can help 🙂
April 29, 2014 at 3:01 pm #182194Mathieu Viet
ModeratorHi,
Make sure to leave the base group profile fields available for all users
Then explore in this direction :
/* Profile display */ function excluding_group_id_depending_on_user_role( $args = array() ) { if ( user_can( bp_dispayed_user_id(), 'capability_to_check' ) { $args['exclude_groups'] = "2,3,4"; //Comma-separated list of profile field group IDs to exclude } return $args; } add_filter( 'has_profile', 'excluding_group_id_depending_on_user_role', 10, 1 );/* profile editing */
It will be a bit more complex as you’ll need to filter ‘xprofile_filter_profile_group_tabs’ and use a pattern to exclude the tabs you don’t want the role to edit.Finally to restrict group creation, i’ve shared a code on the BuddyPress fr community :
http://bp-fr.net/agora/sujet/restreindre-la-creation-des-groupes-a-des-roles-wp/April 16, 2014 at 7:18 pm #181411Brajesh Singh
ParticipantDo you want the join and leave button depending on the currently logged in user ina single shortcode or 2 different shortcode. I am not sure, so here is the code that will give you join button for any group
add_shortcode( 'group-join', 'devb_group_join_btn' ); function devb_group_join_btn( $atts = '', $content = null ){ if( !is_user_logged_in() || !bp_is_active( 'groups' ) ) return ''; $atts = shortcode_atts( array( 'group_id'=> false, 'name' => '' ), $atts ); extract( $atts ); if( !$group_id && !$name ) return ''; if( $name ){ $group_id = groups_get_id( $name ); } if( groups_is_user_member(get_current_user_id(), $group_id ) ) return ''; //now let us put the button $btn = bp_get_group_join_button( groups_get_group(array('group_id'=> $group_id ) ) ); return $btn; }please make sure to pass the slug of group as name. If you want it to be extendede and leave button added, please do reply.
April 13, 2014 at 7:13 pm #181199Boone Gorges
KeymasterIt looks like the
$group_idis not passed along to thedisplay()method in the same way as it is to the other display methods. That means you’ll need to implement your own technique to get that value. Try this:function display() { $group_id = bp_get_current_group_id(); $setting = groups_get_groupmeta( $group_id, 'whatever' ); var_dump( $setting ); }I do think that you *ought* to be able to get the
$group_idinside ofdisplay()like you can insettings_screen()etc. I’ve opened a ticket for that, which we’ll fix for 2.1. https://buddypress.trac.wordpress.org/ticket/5533#ticketMarch 8, 2014 at 11:59 am #179468In reply to: stop public groups posting to the activity stream?
mcpeanut
Participantfound this section in the bp-groups-activity.php
this seems to relate to the public groups, does anyone have any ideas on what to change here?// 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;
}
}$r = wp_parse_args( $args, array(
‘id’ => false,
‘user_id’ => bp_loggedin_user_id(),
‘action’ => ”,
‘content’ => ”,
‘primary_link’ => ”,
‘component’ => buddypress()->groups->id,
‘type’ => false,
‘item_id’ => false,
‘secondary_item_id’ => false,
‘recorded_time’ => bp_core_current_time(),
‘hide_sitewide’ => $hide_sitewide
) );return bp_activity_add( $r );
}i have tried changing the $hide_sitewide = false; to $hide_sitewide = true;
but this doesnt work properly.March 5, 2014 at 11:16 pm #179358Christian Freeman (codelion)
ParticipantOk nevermind,
I was able to fix a few syntax errors and get this working. Here’s the code:bp-custom
// Add meta fields upon group creation function bp_group_meta_save ( $group_id ) { $blog = get_blog_details( get_current_blog_id(), true ); $fields = array( 'blog_id' => $blog->blog_id, 'blog_path' => $blog->path, 'blog_name' => $blog->blogname ); foreach ( $fields as $field => $value ) { groups_update_groupmeta( $group_id, $field, $value ); } } add_action( 'groups_created_group', 'bp_group_meta_save' ); function get_groups_by_meta ( $field, $meta_key, $meta_value ) { global $wpdb; if ( is_string( $meta_value) ) $meta_value = "'" . $meta_value . "'"; $sql = $wpdb->prepare( "SELECT $field from {$wpdb->base_prefix}bp_groups_groupmeta WHERE meta_key='$meta_key' AND meta_value=$meta_value", OBJECT ); $res = $wpdb->get_results( $sql ); return $res; } // Build a list of groups with the matching blog_id value function get_groups_by_blogid ( $blog_id = 1 ) { $list = get_groups_by_meta( 'group_id', 'blog_id', $blog_id ); if ( count( $list ) ) { $res = ""; foreach ( $list as $item ) { $res .= $item->group_id . ','; } return substr( $res, 0, -1); } else { return FALSE; } }groups-loop
<?php $current_blogid = get_current_blog_id(); if ( $current_blogid > 1) { $groups_set = get_groups_by_blogid( $current_blogid ); ( $groups_set !== FALSE ) ? $extra_args = '&include=' . $groups_set : $extra_args = '&include=-1'; } if ( bp_has_groups( bp_ajax_querystring( 'groups' ) . $extra_args ) ) : ?>Thanks again to @juanlopez4691
March 5, 2014 at 11:13 pm #179357Christian Freeman (codelion)
ParticipantHey guys,
I just wanted to post an update to this.
@juanlopez4691 You’re a genius, the code still works! I’m running BuddyPress 1.9.1 now and it’s working smoothly. I think that you had some minor errors in your syntax though. Here’s the updated version:bp-custom
// Add meta fields upon group creation function bp_group_meta_save ( $group_id ) { $blog = get_blog_details( get_current_blog_id(), true ); $fields = array( 'blog_id' => $blog->blog_id, 'blog_path' => $blog->path, 'blog_name' => $blog->blogname ); foreach ( $fields as $field => $value ) { groups_update_groupmeta( $group_id, $field, $value ); } } add_action( 'groups_created_group', 'bp_group_meta_save' ); function get_groups_by_meta ( $field, $meta_key, $meta_value ) { global $wpdb; if ( is_string( $meta_value) ) $meta_value = "'" . $meta_value . "'"; $sql = $wpdb->prepare( "SELECT $field from {$wpdb->base_prefix}bp_groups_groupmeta WHERE meta_key='$meta_key' AND meta_value=$meta_value", OBJECT ); $res = $wpdb->get_results( $sql ); return $res; } // Build a list of groups with the matching blog_id value function get_groups_by_blogid ( $blog_id = 1 ) { $list = get_groups_by_meta( 'group_id', 'blog_id', $blog_id ); if ( count( $list ) ) { $res = ""; foreach ( $list as $item ) { $res .= $item->group_id . ','; } return substr( $res, 0, -1); } else { return FALSE; } }groups-loop
<?php $current_blogid = get_current_blog_id(); if ( $current_blogid > 1) { $groups_set = get_groups_by_blogid( $current_blogid ); ( $groups_set !== FALSE ) ? $extra_args = '&include=' . $groups_set : $extra_args = '&include=-1'; } if ( bp_has_groups( bp_ajax_querystring( 'groups' ) . $extra_args ) ) : ?>March 5, 2014 at 8:40 pm #179350Doremdou
ParticipantI tried to create a shortcode to show the join/leave button using the buddypress-functions but can’t make it to work… 🙁
What am I doing wrong?I would like a shortcode like this :
[groupbutton name=”party1″]
I tried with this code for a join button only at first:
add_shortcode( 'groupbutton', 'groupbutton_check_shortcode' ); function groupbutton_check_shortcode( $attr ) { extract( shortcode_atts( array( 'name' => 'read' ), $attr ) ); $current_group_id = BP_Groups_Group::get_id_from_slug($name); $group = groups_get_group( array( 'group_id' => $current_group_id ) ); if(bp_loggedin_user_id()) { if( 'public' == $group->status ) { echo '<a id="group-' . esc_attr( $current_group_id ) . '" class="join-group" rel="join" title="' . __( 'Join Group', 'buddypress' ) . '" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'join', 'groups_join_group' ) . '">' . __( 'Join Group', 'buddypress' ) . '</a>'; } } }I am not a developer at all so I dont understand everything but I am trying… :/
Cant figure what I am doing wrong… and why it does not display anything at all.Thank you for your help and sorry for my bad english 🙂
PS: I would like to use all cases of buttons like here on the buddypress-functions.php:
function bp_legacy_theme_ajax_joinleave_group() { // Bail if not a POST action if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) return; // Cast gid as integer $group_id = (int) $_POST['gid']; if ( groups_is_user_banned( bp_loggedin_user_id(), $group_id ) ) return; if ( ! $group = groups_get_group( array( 'group_id' => $group_id ) ) ) return; if ( ! groups_is_user_member( bp_loggedin_user_id(), $group->id ) ) { if ( 'public' == $group->status ) { check_ajax_referer( 'groups_join_group' ); if ( ! groups_join_group( $group->id ) ) { _e( 'Error joining group', 'buddypress' ); } else { echo '<a id="group-' . esc_attr( $group->id ) . '" class="leave-group" rel="leave" title="' . __( 'Leave Group', 'buddypress' ) . '" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'leave-group', 'groups_leave_group' ) . '">' . __( 'Leave Group', 'buddypress' ) . '</a>'; } } elseif ( 'private' == $group->status ) { // If the user has already been invited, then this is // an Accept Invitation button if ( groups_check_user_has_invite( bp_loggedin_user_id(), $group->id ) ) { check_ajax_referer( 'groups_accept_invite' ); if ( ! groups_accept_invite( bp_loggedin_user_id(), $group->id ) ) { _e( 'Error requesting membership', 'buddypress' ); } else { echo '<a id="group-' . esc_attr( $group->id ) . '" class="leave-group" rel="leave" title="' . __( 'Leave Group', 'buddypress' ) . '" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'leave-group', 'groups_leave_group' ) . '">' . __( 'Leave Group', 'buddypress' ) . '</a>'; } // Otherwise, it's a Request Membership button } else { check_ajax_referer( 'groups_request_membership' ); if ( ! groups_send_membership_request( bp_loggedin_user_id(), $group->id ) ) { _e( 'Error requesting membership', 'buddypress' ); } else { echo '<a id="group-' . esc_attr( $group->id ) . '" class="membership-requested" rel="membership-requested" title="' . __( 'Membership Requested', 'buddypress' ) . '" href="' . bp_get_group_permalink( $group ) . '">' . __( 'Membership Requested', 'buddypress' ) . '</a>'; } } } } else { check_ajax_referer( 'groups_leave_group' ); if ( ! groups_leave_group( $group->id ) ) { _e( 'Error leaving group', 'buddypress' ); } elseif ( 'public' == $group->status ) { echo '<a id="group-' . esc_attr( $group->id ) . '" class="join-group" rel="join" title="' . __( 'Join Group', 'buddypress' ) . '" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'join', 'groups_join_group' ) . '">' . __( 'Join Group', 'buddypress' ) . '</a>'; } elseif ( 'private' == $group->status ) { echo '<a id="group-' . esc_attr( $group->id ) . '" class="request-membership" rel="join" title="' . __( 'Request Membership', 'buddypress' ) . '" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . 'request-membership', 'groups_send_membership_request' ) . '">' . __( 'Request Membership', 'buddypress' ) . '</a>'; } } exit; } /** * Close and keep closed site wide notices from an admin in the sidebar, via a POST request. * * @return mixed String on error, void on success * @since BuddyPress (1.2) */ function bp_legacy_theme_ajax_close_notice() { // Bail if not a POST action if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) return; if ( ! isset( $_POST['notice_id'] ) ) { echo "-1<div id='message' class='error'><p>" . __( 'There was a problem closing the notice.', 'buddypress' ) . '</p></div>'; } else { $user_id = get_current_user_id(); $notice_ids = bp_get_user_meta( $user_id, 'closed_notices', true ); $notice_ids[] = (int) $_POST['notice_id']; bp_update_user_meta( $user_id, 'closed_notices', $notice_ids ); } exit; }March 3, 2014 at 4:34 pm #179239In reply to: Hide or Show content for specific BP Groups
Doremdou
ParticipantI just found this on WPMU dev (quite old, 2012) http://premium.wpmudev.org/forums/topic/member-part-of-a-group-in-buddypress
>>Aaron
You can pass bp_group_is_member($group) a group object. I think you can do this:
$group = new BP_Groups_Group( $group_id ); if (bp_group_is_member($group)) { //do this stuff }>>CreativeSlice
Thanks for your help Aaron. I’ve got it nearly working with your direction and am hoping you can help with the last few details.
Theif (bp_group_is_member($group))part doesn’t seem to be working so I did a
print_r($groups);and found this:
BP_Groups_Group Object ( [id] => group-three [creator_id] => [name] => [slug] => [description] => [status] => [enable_forum] => [date_created] => [admins] => [mods] => [total_member_count] => )Is there a way I can use this to see if the logged in user is a member of “group-three”?
>>Aaron
You need to get the ID number for your group. Maybe from the db.
>>caevan_sachinwalla
BP_Groups_Member::get_group_ids( $user_id );will give you the group_ids of the groups a user is a member of.
Will this work with the new version of buddypress? how can I make a shortcode with this? thank you a lot 🙂
I also found this on buddypress.org : https://buddypress.org/support/topic/check-if-an-user-is-or-not-a-group_member/
functions.php:
if(groups_is_user_member( bp_loggedin_user_id(), BP_Groups_Group::get_id_from_slug(‘VALUE’))){ ... add_action( ‘bp_setup_nav’, ‘setup_nav’, 1000 ); }Can I make a shortcode with this? I would like a shortcode like this:
[group “Group1”] Content [/group]
So how could I change the VALUE in the code with the group selected in the shortcode? (“group1”) so that I can use only one shortcode for all groups I have created.
thanks 🙂January 27, 2014 at 8:27 pm #177598In reply to: [Resolved] Group join date
meg@info
Participantdate_modified field contain the data of the latest group join ( ie: if the member join and leave then he join again a group, this field contain this date).
check the code of
function groups_join_group( $group_id, $user_id = 0 )Here a small code that can help you to fetch the join date
global $bp; $user_id = 2; //user id $group_id = 1; // your group id $join_date_sql = $wpdb->prepare( "SELECT date_modified FROM {$bp->groups->table_name_members} WHERE is_confirmed = 1 AND is_banned = 0 AND user_id = %d AND group_id= %d", $user_id, $group_id ); $join_date = $wpdb->get_var( $join_date_sql );January 25, 2014 at 3:49 pm #177510In reply to: Getting group name from id
shanebp
ModeratorTry this:
$group_ids = groups_get_user_groups( bp_loggedin_user_id() ); var_dump( $group_ids["groups"] ); foreach( $group_ids["groups"] as $id ) { $group = groups_get_group( array( 'group_id' => $id) ); echo '<pre>'; var_dump( $group ); echo '</pre>'; }December 20, 2013 at 12:36 pm #175838In reply to: Error: Missing argument 2 for wpdb::prepare
Henry
MemberTake a look at this page to see the parameters accepted:
Perhaps try using
profile_group_id:By default all groups and all fields will be displayed. If you provide the ID of a profile field group, then only the fields in this group will be displayed
So it would be:
if ( bp_has_profile( 'profile_group_id=2' ) ) :Where 2 is the ID(s) of the group you’d like to include. I think it should take a comma separated list but I haven’t tested.
December 19, 2013 at 2:04 pm #175772In reply to: Error: Missing argument 2 for wpdb::prepare
Shmoo
ParticipantIt’s my theme and I code WordPress themes for like 5 years now but I don’t see myself as a Developer it’s more a hobby 🙂
I’m solid at HTML-CSS and can read PHP when I see it happen but I can’t write PHP it out of the box.
This error shows up when I try to hide a complete xProfile-group-ID or just an unique xProfile-field-ID from the loop.
This is what I did.
Inside: my-theme/buddypress/members/single/profile/profile-loop.php
I found the start of the loop<?php if ( bp_has_profile() ) : ?> ....My first thought was, maybe there are default options here to control the output of which ID’s will be visible so I started the search how the bp_has_profile() was build and looked into plugins/buddypress/bp-xprofile/bp-xprofile-template.php and found this at line 150:
.... $defaults = array( 'user_id' => bp_displayed_user_id(), 'profile_group_id' => false, 'hide_empty_groups' => true, 'hide_empty_fields' => $hide_empty_fields_default, 'fetch_fields' => true, 'fetch_field_data' => true, 'fetch_visibility_level' => $fetch_visibility_level_default, 'exclude_groups' => false, // Comma-separated list of profile field group IDs to exclude 'exclude_fields' => false // Comma-separated list of profile field IDs to exclude );This looks very familiar to bbPress so my first thoughts was lets try to add one of those Array’s to the loop and overwrite the default value.
Just like this.<?php if ( bp_has_profile( array ( 'exclude_groups' => 1 ) ) ) : ?> ...This works perfect, it hides all xProfile-fields from the first Base primary Tab (back-end). Just like I wanted it because I didn’t want all the fields to show up front-end, I’ve got a few xProfile-fields that I use for user-customization of the profile-page. Each user can add color-codes to change the default menu-color and add background-images to their profile-page to make each profile a little more unique.
Those field-ID’s are just urls or color-codes and don’t have to be visable to the public, thats why I try to hide them front-end.
December 12, 2013 at 7:50 pm #175445In reply to: [Resolved] BP_Group_Extension For Single Group?
shanebp
ModeratorCool, a 4 year old thread that is still useful.
minor stuff:
You don’t need the $bp global
I’d put the foreach in the ‘if ( $group_id == 1 )’ conditionalI’m a bit surprised that it runs on ‘init’ rather than bp_loaded or bp_init because init seems very early – but the load order in some situations still surprises me.
December 9, 2013 at 9:22 am #175308danbp
Participanthi @matt-mcfarland,
i’m not a dev but consider this, to get a user ID:
$user_id = bp_get_member_user_id();To answer the sql question, here’s a function that doesn’t exist in buddypress, which let you get the xprofile_group name by it’s ID For inspiration…
function bpfr_get_xprofile_group_id_by_name( $name = '' ) { global $wpdb; $bp = buddypress(); if( empty( $name ) ) return false; return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->profile->table_name_groups} WHERE name = %s", $name ) ); }For the output, you have to create another function containing at least:
$user_id = bp_get_member_user_id(); $xprofile_group_id = bpfr_get_xprofile_group_id_by_name( 'the groupe name' ); if( !class_exists( 'BP_XProfile_Group' ) ) return false; $args = array( 'profile_group_id' => $xprofile_group_id, 'user_id' => $user_id, 'fetch_fields' => true, 'fetch_field_data' => true );May this help you !
November 16, 2013 at 4:40 pm #174288shanebp
ModeratorIt’s not a filter, it’s an argument.
Look at
function bp_has_members in
bp-members/bp-members-template.phpYou will see this argument
'include' => false, // Pass a user_id or a list (comma-separated or array) of user_ids to only show these usersSo write some sql, something like :
global $wpdb; $group_ids = $wpdb->get_col("SELECT user_id FROM $wpdb->bp_groups_members WHERE group_id = 9"); $group_ids = implode(',', $group_ids); if ( bp_has_members( 'include=' . $group_ids ) )October 3, 2013 at 6:43 pm #172271In reply to: Add extended profile fields programmatically
modemlooper
Moderator// Insert New Field xprofile_insert_field( array ( 'field_group_id' => 1, 'name' => 'Twitter', 'field_order' => 1, 'is_required' => false, 'type' => 'textbox' ) );September 13, 2013 at 11:29 am #171283In reply to: Manually Creating Links
myvahid
ParticipantYou can use trailingslash*t() for making safe URL
Group permalink example :
$group = groups_get_group( array( ‘group_id’ => $group_id ) );
$group_permalink = trailingslash*t( bp_get_root_domain() . ‘/’ . bp_get_groups_root_slug() . ‘/’ . $group->slug . ‘/’ ) );trailingslash*t => * = i
September 13, 2013 at 11:22 am #171282In reply to: Get Permalink From Group ID?
myvahid
ParticipantThis should work
$group = groups_get_group( array( 'group_id' => $group_id ) ); $group_permalink = trailingslash*t( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . $group->slug . '/' ) );replace *=i
August 24, 2013 at 11:30 am #170339In reply to: Activity Stream Questions – adding tags and comments
ClaireBearBunch
Participant<?php
/**
* BuddyPress – Activity Post Form
*
* @package Status
* @since 1.0
*/
?><div id=”whats-new-declare” class=”clearfix”>
<form action=”<?php bp_activity_post_form_action(); ?>” method=”post” id=”whats-new-form” name=”whats-new-form” role=”complementary”>
<?php do_action( ‘bp_before_activity_post_form’ ); ?>
<section id=”whats-new-about”>
<div id=”whats-new-avatar”>
“>
<?php bp_loggedin_user_avatar( ‘width=’ . bp_core_avatar_thumb_width() . ‘&height=’ . bp_core_avatar_thumb_height() ); ?>
</div>
<div id=”whats-new-wrapper”>
<div id=”whats-new-tail”></div>
<div id=”whats-new-textarea”>
<textarea name=”whats-new” id=”whats-new” cols=”50″ rows=”10″>topic<?php if ( isset( $_GET[‘r’] ) ) : ?><?php echo esc_attr( $_GET[‘r’] ); ?>topic<?php endif; ?>topic</textarea>
</div>
</div>
</section><section id=”whats-new-content”>
<div id=”whats-new-options”><div id=”whats-new-submit”>
<input type=”submit” name=”aw-whats-new-submit” id=”aw-whats-new-submit” value=”<?php _e( ‘Post Update’, ‘status’ ); ?>” class=”submitbutton”/>
</div>
<?php if ( bp_is_active( ‘groups’ ) && !bp_is_my_profile() && !bp_is_group() ) : ?>
<div id=”whats-new-post-in-box”>
<?php _e( ‘Post in’, ‘status’ ) ?>:
<select id=”whats-new-post-in” name=”whats-new-post-in”>
<option selected=”selected” value=”0″><?php _e( ‘My Profile’, ‘status’ ); ?></option>
<?php if ( bp_has_groups( ‘user_id=’ . bp_loggedin_user_id() . ‘&type=alphabetical&max=100&per_page=100&populate_extras=0’ ) ) :
while ( bp_groups() ) : bp_the_group(); ?>
<option value=”<?php bp_group_id(); ?>”><?php bp_group_name(); ?></option>
<?php endwhile;
endif; ?>
</select>
</div>
<input type=”hidden” id=”whats-new-post-object” name=”whats-new-post-object” value=”groups” />
<?php elseif ( bp_is_group_home() ) : ?>
<input type=”hidden” id=”whats-new-post-object” name=”whats-new-post-object” value=”groups” />
<input type=”hidden” id=”whats-new-post-in” name=”whats-new-post-in” value=”<?php bp_group_id(); ?>” />
<?php endif; ?>
<?php do_action( ‘bp_activity_post_form_options’ ); ?>
</div><!– #whats-new-options –>
</section><!– #whats-new-content –>
<?php wp_nonce_field( ‘post_update’, ‘_wpnonce_post_update’ ); ?>
<?php do_action( ‘bp_after_activity_post_form’ ); ?></form><!– #whats-new-form –>
</div>thats the right php i think, post-form.php, how could i modify a line or two here for posting my own tags?
August 22, 2013 at 7:03 pm #170253In reply to: Members directory for hidden groups
marmuel
Participant@hugo
I´ve tried to do this. But I always get the result “This group has no members”:First, I want to get the group_id of the group, which the member has joined.
<?php global $bp; $group = groups_get_group( array( ‘group_id’ => $group_id ) ); if ( bp_group_has_members( '$group' ) ) : ?> <div id="member-count" class="pag-count"> <?php bp_group_member_pagination_count() ?> </div> <div id="member-pagination" class="pagination-links"> <?php bp_group_member_pagination() ?> </div> <ul id="member-list" class="item-list"> <?php while ( bp_group_members() ) : bp_group_the_member(); ?> <li> <!-- Example template tags you can use --> <?php bp_group_member_avatar() ?> <?php bp_group_member_link() ?> <?php bp_group_member_joined_since() ?> </li> <?php endwhile; ?> </ul> <?php else: ?> <div id="message" class="info"> <p>This group has no members.</p> </div> <?php endif;?>August 6, 2013 at 2:55 pm #169453In reply to: Group Extension API questions
Boone Gorges
Keymaster– Yes,
'nav_item_name'should be translatable if you plan to distribute the plugin. If it’s for a custom installation, it doesn’t matter.– Yes, you can set
'enable_nav_item'(or any other config value) conditionally. I’d do your conditional logic *inside* of the constructor, to be sure that it’s loaded late enough:function __construct() { $show_nav_item = (bool) plugin_is_enabled( bp_get_current_group_id() ); $args = array( 'enable_nav_item' => $show_nav_item, ); parent::init( $args ); } -
AuthorSearch Results