Skip to:
Content
Pages
Categories
Search
Top
Bottom

Struggling with Group Invites


  • buddycore
    Participant

    @buddycore

    I’m really struggling with Group Invites in this custom theme I’m building, it’s driving me to insanity.

    Could someone please help with the invitation markup and PHP that’s required for my-theme/buddypress/groups/create.php and also my-theme/buddypress/groups/single/send-invites.php

    I’ve built this theme on the bp-legacy templates that ship with the plugin and having problems here.

    It just doesn’t work as expected. Is there a guide to implement this template anywhere?

    I don’t want to have to give up at this stage of this project so help would be really appreciated to get this part working and in sync with the rest of the theme which works as intended.

    Thanks

Viewing 9 replies - 1 through 9 (of 9 total)

  • buddycore
    Participant

    @buddycore

    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' ); ?>
    

    Henry Wright
    Moderator

    @henrywright

    It just doesn’t work as expected. Is there a guide to implement this template anywhere?

    I don’t think there’s a guide available. Can you describe how it isn’t working for you?


    buddycore
    Participant

    @buddycore

    Thanks for reply, doesn’t matter. I’ve given up once again with BuddyPress, I’ll take a look back when nouveau comes out.


    buddycore
    Participant

    @buddycore

    @henrywright sorry, I was in a bit of a huff earlier on.

    1) When creating a group it goes to the step create/step/group-invites in the url, I’m then given a list of friends, I select 1, 2 or more but nothing happens. I don’t know if this is intended, the kicker here is that there is no “Finish” button, it’s removed.

    I set a height in CSS of the submit buttons, my mistake. I’ll push on and see how this turns out, there is a number 2 for invites and that’s under the manage area but I’ll come back.

    Can mark this as resolved due to user error.


    buddycore
    Participant

    @buddycore

    The ajax isn’t working, when creating a group and choosing a friend to invite to a group. The main column never gets populated.


    Henry Wright
    Moderator

    @henrywright

    Ajax fails usually because a necessary class or ID is missing from the DOM. Try doing a quick comparison against the default template to see what classes or IDs your customised template is missing


    buddycore
    Participant

    @buddycore

    I’ve published the theme for sale now, if it gets enough interest I’ll roll in support for the other areas.

    Thanks for the help.


    Henry Wright
    Moderator

    @henrywright

    No worries, good luck with your theme!


    buddycore
    Participant

    @buddycore

    Thanks again, I’ll leave it live for a while but don’t expect much interest.

Viewing 9 replies - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.
Skip to toolbar