Skip to:
Content
Pages
Categories
Search
Top
Bottom

Announcements tab like CUNY?

  • @drwebstein

    Member

    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

Viewing 3 replies - 1 through 3 (of 3 total)
  • @jimgroom

    Participant

    *bump*

    @gunju2221

    Participant

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

    The HTML for my creation step goes here.

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

    name ) ?>

    Edit steps here

    <?php
    wp_nonce_field( ‘groups_edit_save_’ . $this->slug );
    }

    function edit_screen_save() {
    global $bp;

    if ( !isset( $_POST ) )
    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() { ?>

    name ) ?>

    You could display a small snippet of information from your group extension here. It will show on the group
    home screen.

    <?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.

    @boonebgorges

    Keymaster
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Announcements tab like CUNY?’ is closed to new replies.
Skip to toolbar