Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Plugin Name: TCH BP Posts On Profile
- Plugin URI: http://azchipka.thechipkahouse.com/services/technology/development/wordpress-plugins
- Description: Adds a tab to Buddy Press User Profile displaying the posts they have published.
- Version: 0.1
- Author: Avery Z Chipka
- Author URI: http://azchipka.thechipkahouse.com
- License: GPLv2 or later
- */
- // Make sure we don't expose any info if called directly
- if ( !function_exists( 'add_action' ) ) {
- echo '404';
- exit;
- }
- define('TCH_PostsOnProfilesVersion', '0.1');
- define('TCH_PostsOnProfilesVersion_PLUGIN_URL', plugin_dir_url( __FILE__ ));
- function my_setup_nav() {
- if (!user_can(bp_displayed_user_id(), 'edit_posts')) return false;
- global $bp;
- bp_core_new_nav_item( array(
- 'name' => __( 'Articles', 'buddypress' ),
- 'slug' => 'articles',
- 'position' => 75,
- 'screen_function' => 'my_posts_hooks',
- 'show_for_displayed_user' => true,
- 'default_subnav_slug' => 'articles',
- 'item_css_id' => 'articles'
- ) );
- }
- add_action( 'bp_setup_nav', 'my_setup_nav', 1000 );
- function my_posts_title() {
- echo 'Articles';
- }
- function my_posts_content() {
- locate_template( array( 'members/single/posts/loop-posts.php' ), true );
- }
- function my_posts_hooks () {
- add_action( 'bp_template_title', 'my_posts_title' );
- add_action( 'bp_template_content', 'my_posts_content' );
- bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement