Forum Replies Created
-
Hello… ^^
Been on this for a week now and can’t figure how to do it… π
If someone has an idea for this I would be really grateful, or then… think I will just abandon the idea :/
Thanks@hnla ok no problem thank you for your answer π
I see you are a moderator, maybe you could just change my topic title to be more explicit for people to help, for example “Leave/Join Group Button shortcode on any Posts/Pages” please? π
Thank you very muchHello @hnla thank you for your answer π
But I can see the button already in the Group page it is working well, I just want to be able to put the join/leave button for a specific group on a WordPress Post or a Page for example π
(That is why at first I wanted to put a simple button with a Link to the Group URL but it is not working, I should have changed my topic title but I can’t edit anything)
That is why I thought it would be easier to create a shortcode for it πHi again π
Can someone just tell me if it is not possible at all? :/
Trying things for 6 days already… can someone just tell me if I am on the right path or if I am totally wrong ^^
Thank you πIn reply to: Hide favouritesHello, try to add this in your functions.php (root of your theme folder)
function my_remove_bp_nav() { global $bp; bp_core_remove_subnav_item($bp->activity->slug,'favorites'); } add_action( 'bp_setup_nav', 'my_remove_bp_nav' );In reply to: Only showing administrator-created groupsHello π
If you uncheck the User Groups in Buddypress settings (first tab) you disable all the Group system that is why all your groups disappeared.I guess you are talking about the checking box on the FIRST tab of the buddypress settings, did you see the other one on the THIRD tab (called settings, just after the “Pages” tab) ? (at the top of the page)
You have a box to check to allow/disallow users to create groups.
Hope you are talking about that πIn reply to: Use images in Medias folder for Groups AvatarOoh I see π
ok, thank you @danbp for your fast answer πIn reply to: Hide Group Admin from the group member listThank you @danbp I will try this! π
In reply to: Hide Group Admin from the group member listHello thanks for your answer @danbp π
Yes I have already deleted this line in group-header.php π
Sorry if I was not clear enough, I was talking about the “members list” tab in the group itself πIn reply to: Help! Where is the private message option?Hi π
Did you enable the messaging system in the first place?
If not you can activate it in : Settings/Buddypress/ and on the first page, check the messaging boxIf you enabled this option already you should have a tab in your profil to send private message
[Edit] Wait what do you mean by “forums”? there are no forums on buddypress, are you talking about bbpress?
I 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; }In reply to: Hide or Show content for specific BP Groupsresolved, just used what I copied pasted earlier and created a shortcode with it…
Hello again… ummm someone? an idea? π
Should I just copy paste the button function to make a url work…? thank youIn reply to: Hide or Show content for specific BP GroupsI 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 πHi @flashbytes π
Did you find how to do that? I am also interested π
thank you very much