Group Mods

  • Profile picture of @mercime
  • Profile picture of r-a-y
  • Profile picture of Hugo

Announcements tab like CUNY? (4 posts)

Started 1 year, 4 months ago by: drwebstein

  • Profile picture of drwebstein drwebstein said 1 year, 4 months ago:

    Can anybody recommend a way for me to replicate the “Announcements” tab functionality that CUNY has put in place on a number of their groups?

    Example: http://commons.gc.cuny.edu/groups/ctl/announcements/

    I didn’t see any BuddyPress plugins designed to do exactly this, but the functionality seems quite simple. It seems as though they are just filtering updates in some way and then displaying all of the appropriate posts. The ability to create these “announcements” would need to be limited to just moderators and administrators.

    Thank you for any help you can offer.

    Adam

  • Profile picture of Jimgroom jimgroom said 1 year, 4 months ago:

    *bump*

  • Profile picture of Virtuali Virtuali said 1 year, 4 months ago:

    Creating 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;
    		?>
    
    		<p>The HTML for my creation step goes here.</p>
    
    		<?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; ?>
    
    		<h2><?php echo attribute_escape( $this->name ) ?></h2>
    
    		<p>Edit steps here</p>
    		<input type=&quot;submit&quot; name=&quot;save&quot; value=&quot;Save&quot; />
    
    		<?php
    		wp_nonce_field( 'groups_edit_save_' . $this->slug );
    	}
    
    	function edit_screen_save() {
    		global $bp;
    
    		if ( !isset( $_POST['save'] ) )
    			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() { ?>
    		<div class=&quot;info-group&quot;>
    			<h4><?php echo attribute_escape( $this->name ) ?></h4>
    			<p>
    				You could display a small snippet of information from your group extension here. It will show on the group
    				home screen.
    			</p>
    		</div>
    		<?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.

  • Profile picture of Boone Gorges Boone Gorges said 1 year, 4 months ago:

    http://teleogistic.net/2011/01/group-announcements-tab-in-buddypress/