Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/27/2016 08:23:37 PM (10 years ago)
Author:
djpaul
Message:

Emails: add post type and taxonomy, and supporting wp-admin customisations.

All of BuddyPress' emails have been moved into email posts. The change includes an installation routine, but this won't be run until the db_version number is bumped in a subsequent commit. Updates to functions using wp_mail will also follow.

Tokens are used to personalise the email content (e.g. to add a link to the recipient’s user profile). Each type of email in BuddyPress has been assigned a unique type, and these are mapped to the email post through a new "email type" taxonomy.

The change includes a new HTML email template based on work by Ted Goas and contributors from the Cerberus email templates project. Ted, thank you very much. Learn more at http://tedgoas.github.io/Cerberus/

See #6592. Props timersys, mercime, boonebgorges, hnla, DJPaul.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-admin.php

    r10417 r10474  
    117117     */
    118118    private function includes() {
     119        require( $this->admin_dir . 'bp-core-admin-classes.php'    );
    119120        require( $this->admin_dir . 'bp-core-admin-actions.php'    );
    120121        require( $this->admin_dir . 'bp-core-admin-settings.php'   );
     
    175176        add_filter( 'ms_user_row_actions', 'bp_core_admin_user_row_actions', 10, 2 );
    176177        add_filter( 'user_row_actions',    'bp_core_admin_user_row_actions', 10, 2 );
     178
     179        // Emails
     180        add_filter( 'bp_admin_menu_order', array( $this, 'emails_admin_menu_order' ), 20 );
    177181    }
    178182
     
    296300        );
    297301
    298         // Fudge the highlighted subnav item when on a BuddyPress admin page.
     302        $hooks[] = add_theme_page(
     303            _x( 'Emails', 'screen heading', 'buddypress' ),
     304            _x( 'Emails', 'screen heading', 'buddypress' ),
     305            $this->capability,
     306            'bp-emails-customizer-redirect',
     307            'bp_email_redirect_to_customizer'
     308        );
     309
    299310        foreach( $hooks as $hook ) {
    300311            add_action( "admin_head-$hook", 'bp_core_modify_admin_menu_highlight' );
     
    768779                <a href="https://bbpress.org">bbPress</a>,
    769780                <a href="https://github.com/ichord/Caret.js">Caret.js</a>,
     781                <a href="http://tedgoas.github.io/Cerberus/">Cerberus</a>,
    770782                <a href="https://github.com/carhartl/jquery-cookie">jquery.cookie</a>,
    771783                <a href="https://www.mediawiki.org/wiki/MediaWiki">MediaWiki</a>,
     
    874886        // Done!
    875887        return $display;
     888    }
     889
     890    /**
     891     * Add Emails menu item to custom menus array.
     892     *
     893     * Several BuddyPress components have top-level menu items in the Dashboard,
     894     * which all appear together in the middle of the Dashboard menu. This function
     895     * adds the Emails screen to the array of these menu items.
     896     *
     897     * @since 2.4.0
     898     *
     899     * @param array $custom_menus The list of top-level BP menu items.
     900     * @return array $custom_menus List of top-level BP menu items, with Emails added.
     901     */
     902    public function emails_admin_menu_order( $custom_menus = array() ) {
     903        array_push( $custom_menus, 'edit.php?post_type=' . bp_get_email_post_type() );
     904        return $custom_menus;
    876905    }
    877906
Note: See TracChangeset for help on using the changeset viewer.