Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'how to invite to groups'

Viewing 25 results - 76 through 100 (of 351 total)
  • Author
    Search Results
  • #257327
    danbp
    Participant

    Hi,

    two snippets to remove profile and group items.

    function bpex_hide_profile_menu_tabs() {
    
    	if( bp_is_active( 'xprofile' ) ) :
    
    	if ( bp_is_user() && !is_super_admin() && !bp_is_my_profile() ) {
    	//	BP's profile main menu items. Comment those to show.
    	//	bp_core_remove_nav_item( 'activity' );
    		bp_core_remove_nav_item( 'profile' );
    		bp_core_remove_nav_item( 'friends' );
    		bp_core_remove_nav_item( 'groups' );
    	//	exist only if you use bbPress
    		bp_core_remove_nav_item( 'forums' ); 
    
    	//	BP's profile main menu items. Comment those to show.
    	//	bp_core_remove_subnav_item( 'activity', 'personnal' );
    		bp_core_remove_subnav_item( 'activity', 'mentions' );
    		bp_core_remove_subnav_item( 'activity', 'favorites' );
    		bp_core_remove_subnav_item( 'activity', 'friends' );
    		bp_core_remove_subnav_item( 'activity', 'groups' );
    	}
    	endif; 
    }
    add_action( 'bp_setup_nav', 'bpex_hide_profile_menu_tabs', 15 );
    
    function bpex_remove_group_tabs() {  
    
    	if ( ! bp_is_group() ) {
    		return;
    	}
    
    	$slug = bp_get_current_group_slug();
    
    		// hide items to all users except site admin
    	if ( !is_super_admin() ) {
    
    	//	bp_core_remove_subnav_item( $slug, 'members' );
    		bp_core_remove_subnav_item( $slug, 'send-invites' );
    	//	bp_core_remove_subnav_item( $slug, 'admin' );
    	//	bp_core_remove_subnav_item( $slug, 'forum' );
    	}
    
    }
    add_action( 'bp_actions', 'bpex_remove_group_tabs' );
    #257144
    buddycore
    Participant

    First you are creating a custom function called automatic_group_membership() this takes one parameter $user_id.

    This function terminates if there is no $user_id provided, meaning you don’t run rogue code and your site is more optimised.

    When a $user_id is present the groups_accept_invite() function is run. This function is a BuddyPress core function you can find it in wp-content/plugins/buddypress/bp-groups/bp-groups-functions.php on line 1400.

    It accepts two parameters a $user_id and a $group_id. You need both in order to create the relationship.

    This function is “hooked” with add_action() which is a WordPress core function. This function add_action() has many hooks available for various situations. You can read more about hooks here https://codex.wordpress.org/Plugin_API/Hooks.

    Essentially it’s an opportunity to run your own code against WordPress core, or in this case BuddyPress core. BuddyPress provides the hook and we use them to achieve cool things.

    So the hook in this case is bp_core_activated_user and the code we want to run when this hook is available would be the customer function automatic_group_membership which is passed as a second parameter.

    I’m not sure where the $user_id gets populated along the way here, nor the $group_id maybe someone can help?

    Otherwise, I would do this not on activation but when a user has logged in for the first time.

    Then we have access to global $bp which contains a loggedin_user->id which can be used with this function and you could manually set the $group_id in bp-custom.php

    #257139
    peterBerlin
    Participant

    Hi,

    For a newbie like me, could I kindly ask to see how the code:

    function automatic_group_membership( $user_id ) {
    if( !$user_id ) return false;

    groups_accept_invite( $user_id, $group_id );
    }
    add_action( ‘bp_core_activated_user’, ‘automatic_group_membership’ );

    As its supposed to look so its ready for use in bp-custom.php

    Kind regards and have a nice Sunday.

    #256859
    buddycore
    Participant

    my-theme/buddypress/groups/create.php

    <?php if(bp_is_group_creation_step('group-invites')) : ?>
    
    	<?php do_action('bp_before_group_invites_creation_step'); ?>
    
    	<?php if(bp_is_active('friends') && bp_get_total_friend_count(bp_loggedin_user_id())) : ?>
    
    		<div class="left-menu">
    
    			<div id="invite-list">
    				<ul>
    					<?php bp_new_group_invite_friend_list(); ?>
    				</ul>
    
    				<?php wp_nonce_field('groups_invite_uninvite_user', '_wpnonce_invite_uninvite_user'); ?>
    			</div>
    
    		</div><!-- LEFT -->
    
    		<div class="main-column">
    
    			<div id="message" class="info">
    				<p><?php _e('Select people to invite from your friends list.', 'buddypress'); ?></p>
    			</div>
    
    			<ul id="friend-list" class="item-list">
    
    			<?php if(bp_group_has_invites()) : ?>
    
    				<?php while(bp_group_invites()) : bp_group_the_invite(); ?>
    
    					<li id="<?php bp_group_invite_item_id(); ?>">
    
    						<?php bp_group_invite_user_avatar(); ?>
    
    						<h4><?php bp_group_invite_user_link(); ?></h4>
    						<span class="activity"><?php bp_group_invite_user_last_active(); ?></span>
    
    						<div class="action">
    							<a class="remove" href="<?php bp_group_invite_user_remove_invite_url(); ?>" id="<?php bp_group_invite_item_id(); ?>"><?php _e('Remove Invite', 'buddypress'); ?></a>
    						</div>
    					</li>
    
    				<?php endwhile; ?>
    
    				<?php wp_nonce_field('groups_send_invites', '_wpnonce_send_invites'); ?>
    
    			<?php endif; ?>
    
    			</ul>
    
    		</div><!-- MAIN -->
    
    	<?php else : ?>
    
    		<div id="message" class="info">
    			<p><?php _e('Once you have built up friend connections you will be able to invite others to your group.', 'buddypress'); ?></p>
    		</div>
    
    	<?php endif; ?>
    
    	<?php wp_nonce_field('groups_create_save_group-invites'); ?>
    
    	<?php do_action('bp_after_group_invites_creation_step'); ?>
    
    <?php endif; ?>

    my-theme/buddypress/groups/single/send-invites.php

    <?php
    /**
     * BuddyPress - Groups Send Invites
     *
     * @package BuddyPress
     * @subpackage bp-legacy
     */
    
    /**
     * Fires before the send invites content.
     *
     * @since 1.1.0
     */
    do_action( 'bp_before_group_send_invites_content' ); ?>
    
    <?php
    /* Does the user have friends that could be invited to the group? */
    if ( bp_get_new_group_invite_friend_list() ) : ?>
    
        <?php /* 'send-invite-form' is important for AJAX support */ ?>
        <form action="<?php bp_group_send_invite_form_action(); ?>" method="post" id="send-invite-form" class="standard-form">
    
            <div class="invite">
                <?php bp_get_template_part( 'groups/single/invites-loop' ); ?>
            </div>
    
            <div class="submit">
                <input type="submit" name="submit" id="submit" value="<?php esc_attr_e( 'Send Invites', 'buddypress' ); ?>" />
            </div>
    
            <?php wp_nonce_field( 'groups_send_invites', '_wpnonce_send_invites' ); ?>
    
            <?php /* This is important, don't forget it */ ?>
            <input type="hidden" name="group_id" id="group_id" value="<?php bp_group_id(); ?>" />
    
        </form><!-- #send-invite-form -->
    
    <?php
    /* No eligible friends? Maybe the user doesn't have any friends yet. */
    elseif ( 0 == bp_get_total_friend_count( bp_loggedin_user_id() ) ) : ?>
    
        <div id="message" class="info">
            <p class="notice"><?php _e( 'Group invitations can only be extended to friends.', 'buddypress' ); ?></p>
            <p class="message-body"><?php _e( "Once you've made some friendships, you'll be able to invite those members to this group.", 'buddypress' ); ?></p>
        </div>
    
    <?php
    /* The user does have friends, but none are eligible to be invited to this group. */
    else : ?>
    
        <div id="message" class="info">
            <p class="notice"><?php _e( 'All of your friends already belong to this group.', 'buddypress' ); ?></p>
        </div>
    
    <?php endif; ?>
    
    <?php
    
    /**
     * Fires after the send invites content.
     *
     * @since 1.2.0
     */
    do_action( 'bp_after_group_send_invites_content' ); ?>
    
    #256419
    danbp
    Participant

    It’s the same principle, but not the same syntax since 2.6

    To hide tabs on groups, you need to specify the component. Note that all menu items (nav and subnav items) are considered as sub-nav, they have not the same distinction as on member or activity menus.

    Use another function for groups. Try this.

    function bpex_remove_group_tabs() {  
    
    	if ( ! bp_is_group() ) {
    		return;
    	}
    
    	$slug = bp_get_current_group_slug();
    
    		// hide items to all users except site admin
    	if ( !is_super_admin() ) {
    
    	//	bp_core_remove_subnav_item( $slug, 'members' );
    		bp_core_remove_subnav_item( $slug, 'send-invites' );
    	//	bp_core_remove_subnav_item( $slug, 'admin' );
    	//	bp_core_remove_subnav_item( $slug, 'forum' );
    	}
    
    }
    add_action( 'bp_actions', 'bpex_remove_group_tabs' );

    To get more usage examples, see here:

    Navigation API

    #256031
    javierllinas
    Participant

    Hello,

    Working perfect for subnav items, but not for main nav in my case. Can’t get this to work:

    function my_remove_group_tab() {
    
        bp_core_remove_nav_item( 'send-invites', 'groups' );
    
    }
    add_action( 'bp_actions', 'my_remove_group_tab', 9 ); 

    I don’t now what I’m missing here.

    Appreciate any help.

    #255297
    javierllinas
    Participant

    Thanks, @danbp!

    You are right: only the fallback was working bp_core_redirect( bp_get_group_permalink( groups_get_current_group() ) );.
    Adding the $component (which defaults to ‘members’) is the key:

    bp_core_remove_subnav_item( $parent_nav_slug, $tab, 'groups' );

    These functions are located in ‘bp-core/bp-core-buddybar.php’.
    I’d also want to get rid of ‘send-invites’ in group primary navigation, but this is not working for me:

    bp_core_remove_nav_item( 'send-invites', 'groups' );

    Thank you,
    Javier

    #252327
    janhart
    Participant

    The thing is that every site member is a admin in buddypress and his group.
    Therefore it is possible to delete or leave a group and invite other users.
    Only every member have to edit/uplaod a picture, change the description etc.
    The site will not add more users or groups. Everything is fine with that.
    Only the depth of the rules are not ideal.

    #251826
    mattheoh
    Participant

    it’s always the same for each link ? YES

    OK , I didn’t know ! thanks

    Groupes is french. If you use your mentionned code, you have to enter the slug used on your site, in your language. If it’s english, try ‘groups‘ instead.

    Of course, I would have correct it myself.
    with your code I managed to insert the slug article

    $href = get_home_url().'/groupes/'.get_the_slug($id).'/join?_wpnonce=6b826ee77d';
    But I will be stuck with the nonce cause it’s proper for each group :-/

    Also this will never work like you expect.
    bp_loggedin_user_domain() output gives your-site.com/members/username/groups/

    OK thanks for the precision

    And i suppose there is no utility to invite from within a post, a user to join a group of which he’s already member of ?!!!
    Can you better explain the relation between post, author and join group ?
    Do you mean, an author can invite readers to join (selectively) a group he’s member of ?

    You’re right, I m going to clarify my needs by the begining ! 😉
    In fact, I want to post some articles to talk about some contests / tests.
    Only identified buddypress members will be able to see this articles (I make a restriction on them)
    At the end of the articles, I wanted to add a button , that give them the possibility to participate to the test.
    In fact, I don’t car using groups… I just need to register people who wants to participate (and then be able to do an export with export user data plugin that I m using actually)
    I thought using groups to qualify this people, cause I thought it was the easier way… (When I write an article about a new test, I create a new group… So people when they click on participate button, update automatically their profile by joining the group related to the article – that’s why I wanted to put the same slug for group and article)
    My final aim is just to export these infos… (complete profile informations and groups particpations)
    So you’re right if someone is already member of a group (so has already clicked on this button), he shouldn’t be able to see the button (or ideally, a different message “you have always sent your participation”)

    I hope it’s a little more comprehensible !
    If you think group is not the good solution, I m listening 😉
    My final purpose is just that user can be tagged as participant and that I can export this information)

    Thanks a lot to have read this cause it was a bit long 😉

    #251824
    danbp
    Participant

    it’s always the same for each link ? YES

    Groupes is french. If you use your mentionned code, you have to enter the slug used on your site, in your language. If it’s english, try ‘groups‘ instead.

    Also this will never work like you expect.
    bp_loggedin_user_domain() output gives your-site.com/members/username/groups/

    And i suppose there is no utility to invite from within a post, a user to join a group of which he’s already member of ?!!!

    Can you better explain the relation between post, author and join group ?
    Do you mean, an author can invite readers to join (selectively) a group he’s member of ?

    Jek-fdrv
    Participant

    Thank you. Can you please help me with this ticket?

    #249222
    lolotrgeek
    Participant

    I was having this same problem and after a long mostly fruitless search I finally found a solid/working answer. The way buddypress currently handles these tabs is quite unwieldy so removing each tab requires a different method…

    How to remove group settings tab:

    function bp_remove_group_step_settings($array) {
    	
    	$array = array(
    		'group-details'  => array(
    			'name'       => _x( 'Details', 'Group screen nav', 'buddypress' ),
    			'position'   => 0
    		)
    	);
    	
    	return $array;
    }
    add_filter ('groups_create_group_steps', 'bp_remove_group_step_settings', 10, 1);

    (reference)
    How to remove group avatar and cover photo tabs:
    1. go to Dashboard » BuddyPress » Settings
    2. untick Group Photo Uploads and Group Cover Image Uploads

    How to remove group invite tab:

    function bp_remove_group_step_invites() {
    
    	global $bp;
    	
    	unset( $bp->groups->group_creation_steps['group-invites'] );
    	
    }
    add_action( 'bp_init', 'bp_remove_group_step_invites', 9999 ); 

    How to remove forums tab:
    Disable forums for buddypress…still havent figured out a more practical answer…

    Hope this helps though!

    #247097
    Henry Wright
    Moderator

    After a particular member has reached the 1 private group limit, you’d probably want to stop the member:

    • requesting to join a new private group
    • from being invited to join a private group
    • from creating a new private group

    You mention the member can belong to multiple public groups so your checks should be specific for private groups (also note there is a hidden group type).

    With reference to what hook to use, you’d probably need to use 3 different hooks depending on the actions mentioned above. Take a look through bp-groups/bp-groups-functions.php to start with to see what’s available.

    #246586

    In reply to: No Profile Tabs

    Michael Bryner
    Participant

    It only shows avatar and cover photo space with no tabs and activity on profile page only. Groups is just about the same. No original tabs just home, forum, members. send invites, manage tabs. As long as this plugin has been out since 2008 its still does not work with all themes? I am so tempted to just give up on it. It looks outdated still and the only thing you add is cover photos and it does not even work right.

    The rest of the other plugins that compare and look a heck of a lot better but to get the features of this plugin you have to pay their outrageous prices for extensions. I might just be better off with no community software for social network and just use bbPress only.

    #245638
    JMunce
    Participant

    Thanks @danbp , Yes when I have something presentable I’ll offer it to the codex.

    I’ve been able to edit the header (profile and group), but

    where can I find the code for undernieth the header? The section that has Activity Profile Notifications Messages etc on “Profile” and Home Members Send Invites on “Groups”?

    #245028

    In reply to: business page

    Henry Wright
    Moderator

    If you can think of business pages as “groups” then BuddyPress comes with that functionality. You just need to enable the Groups component and your members will be able to create and invite more members to join the group.

    #244817
    danbp
    Participant

    Hi,

    simply remove the delete group button from group admin. Give this a try, only site admin will see the button. Add snippet to bp-custom.php

    function kwahlquist_remove_group_admin_tab() {
    global $bp;
    	if ( ! bp_is_group() || ! ( bp_is_current_action( 'admin' ) && bp_action_variable( 0 ) ) || is_super_admin() ) {
    		return;
    	}
    	// Add the admin subnav slug you want to hide in the following array
    	// other admin subnav items are: group-settings, group-avatar, group-invites, manage-members
    	$hide_tabs = array(    		
    		'delete-group' => 1
    	);
            // since BP 2.2
    	$slug = bp_get_current_group_slug() . '_manage'; 
    	
    	// Remove the nav item
    	foreach ( array_keys( $hide_tabs ) as $tab ) {
    		bp_core_remove_subnav_item( $slug, $tab );
    	}
    }
    add_action( 'bp_groups_setup_nav', 'kwahlquist_remove_group_admin_tab', 9 );
    #244254
    djsteveb
    Participant

    @nithin270 – any changes you make for search spiders is going to take weeks (at minimum) before they are reflected in the search results.

    I suggest doing some robots.txt additions (will list mine below) – however realize that long ago google made a decisions that even if your robots.txt says to disallow crawling something, if another page on the web links to your subpage that is blocked by robots.txt, it will still show the url in the search results – but have a description something like “this sites robots.txt prevents google from displaying description of this result”.

    There has been debate about that decision, but it is what it is.

    The only way to really prevent a page showing up in results is to hide it behind a password (like htpasswd) – however google does normally remove results if that page (or header info of images) includes “noindex” in the head of the page (there is a tricky way to add this to images – it was pointed out to me in the google webmaster forums)

    given that bp pages like members are kind of pseudo pages, using something like yoast (currently as far as I know) – will not give you an option to add noindex, nofollow to your member pages..

    you may be able to modify the code I got from wpmudev that checks “if is member page, then add meta description as…” –
    ( http://premium.wpmudev.org/forums/topic/bp-meta-tite-description-for-groups-and-members-pages#post-806736 )
    to… also check “if is members page” – then add “meta name=”robots” content “noindex, nofollow”..
    (something like that)

    that should remove your members pages next time google crawls your site and the crawlers send the info back to the main algo/index..

    I think there is a way to log into google webmaster tools if you have claimed /verified your site and click on urls to ask the big G to remove them as well. (I have not messed with that stuff in a while )

    I also suggest adding a robots.txt file similar to this:

    Disallow: */activity/p/*
    Disallow: /docs/
    Disallow: *send-invites*
    Disallow: */groups/*members*
    Disallow: */groups/*media*
    Disallow: *widget-title*
    Disallow: *members/*activity*
    Disallow: *members/*notifications*
    Disallow: *members/*friends*
    Disallow: *members/*groups*
    Disallow: *members/*docs*
    Disallow: *members/*media*
    Disallow: *acpage*
    Disallow: *messages*
    Disallow: *friends*
    Disallow: *settings*
    Disallow: /*/comment-page*
    Disallow: *register*
    Disallow: *login*
    Disallow: *profile*
    Disallow: *admin*
    Disallow: *includes*
    Disallow: *content*

    to prevent some other quirky indexing issues with bp.

    If your member profile stuff is sacred, then I would hunt the forums here for what others have been messing with that prevents profile info from being displayed if a user is not logged in… as there are plenty of indexing spiders that will not follow the robots.txt or robots index rules in <head> – in fact some specifically look for these things and purposely crawl and scrape stuff that is blocked –

    Disclaimer: I am not an expert, not a real coder. Research these things with other sources, your situation may vary.

    #244119
    danbp
    Participant

    Yes ! You need to use template overload, then you can remove that part from the template.
    While creating a new group:
    See bp-templates/bp-legacy/buddypress/groups/create.php
    While modifying a group:
    bp-templates/bp-legacy/buddypress/groups/single/admin.php

    Caution: if you do this, you can only use public or private groups. Hidden groups are “invite users” only.

    #242869

    In reply to: Group upload

    djsteveb
    Participant

    @devbynature
    kind of a mashup of these two I guess – https://wordpress.org/plugins/buddypress-groups-import/

    https://wordpress.org/plugins/invite-anyone/

    with an extra email out instead of just within the bp internal mail thing I guess.

    Interesting idea.

    Not sure if anyone has made anything more along these lines..

    #242158
    brettlewis
    Participant

    Try this out:

    add_action( 'user_register', 'assign_membership_on_register', 10, 1 );
    function assign_membership_on_register( $user_id ){
    	$user_info = get_userdata( $user_id );
    	$email = $user_info->user_email;
    	$data = array(
    		      'school1.edu' => array(
    				'bp_id' => 2,
    			),
    		      'school2.edu' => array(
    				'bp_id' => 3,
    			)
    		      );
    
    	$output = substr(strrchr($email, "@"), 1);
    	groups_accept_invite( $user_id, $data[$output]['bp_id'] );
    
    }
    #241903
    @mercime
    Participant

    @rglennnall
    > either the Groups associated with each User

    Groups → Memberships

    > to show Users associated with each Group
    Just go to yoursite.com/groups/[nameofgroup]/members and you’ll find the list of members who joined or were invited to the group

    #241044
    shanebp
    Moderator

    If the role is set to vendor and xprofile fields are not involved, then there is a WP hook for that.

    Assuming the group_id is 8, try:

    function jeffery_join_vendor_group( $user_id, $role, $old_roles ) {
    	if( $role == 'vendor' ) {
    		groups_accept_invite( $user_id, 8 );
    	}
    }
    add_action( 'set_user_role', 'jeffery_join_vendor_group', 11, 3 );
    #241036
    danbp
    Participant

    Hi @dcsenterprise,

    in brief, the snippet tells 'user_register to add a new user automatically to a group after the register process.

    If this is the scenario you want to use, you have to ensure that the Vendor role is in a xprofile field or at least, that this role is somewhere on the user profile, added by the WC plugin.

    Assuming that it’s the case, you can use this:

    function automatic_group_membership( $user_id ) {
    
    if( !$user_id ) return false;
    
       $join_group = xprofile_get_field_data('WCRole', $user_id); // field name (case sensitive) containing the role
       // conditionnal
       if ($join_group == 'vendor') // role name
          $group_id = '8'; // the id of the Vendor group to auto-join
    
    // action
    groups_accept_invite( $user_id, $group_id );
    
    }
    add_action( 'bp_core_activated_user', 'automatic_group_membership' );

    How it works ?

    – a field or select field on register page, with evtl. options
    field name = WCRole
    option0 = vendor
    option1 = manager
    option3 = director
    etc…

    If several options for different groups, you simply add it as conditionnal to the function:

     if...
     $group_id =

    Hope to be clear !

    #240887
    shanebp
    Moderator

    afaik, there is no BP function for that.
    You could gather all the group ids like so:

    function get_all_group_membership_requests( $user_id ) {
    	global $wpdb;
    
    	$bp = buddypress();
    
    	return $wpdb->get_col( $wpdb->prepare( "SELECT group_id FROM {$bp->groups->table_name_members} WHERE user_id = %d AND is_confirmed = 0 AND inviter_id = 0", $user_id ) );
    }

    Use:
    $pending_group_ids = get_all_group_membership_requests( bp_loggedin_user_id() );

Viewing 25 results - 76 through 100 (of 351 total)
Skip to toolbar