Advertisement
Guest User

profile-gallery

a guest
Apr 29th, 2012
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. <?php
  2. /*
  3. Plugin Name: profile-gallery
  4. Description: Add gallery to buddypress profiles
  5. */
  6.  
  7. // Setup the navigation
  8. // Props to http://wordpress.stackexchange.com/questions/16223/add-buddypress-profile-menu-item for helping me figure this out
  9. // and http://themekraft.com/customize-profile-and-group-menus-in-buddypress/
  10. function my_setup_nav() {
  11. global $bp;
  12.  
  13. bp_core_new_nav_item( array(
  14. 'name' => __( 'My Gallery', 'buddypress' ),
  15. 'slug' => 'my-gallery',
  16. 'position' => 75,
  17. 'screen_function' => 'my_gallery_link',
  18. 'show_for_displayed_user' => true,
  19. 'default_subnav_slug' => 'my-gallery',
  20. 'item_css_id' => 'my-gallery'
  21. ) );
  22. }
  23.  
  24. add_action( 'bp_setup_nav', 'my_setup_nav', 1000 );
  25.  
  26. function my_gallery_title() {
  27. echo 'My Gallery';
  28. }
  29.  
  30. function my_gallery_content() {
  31. echo do_shortcode( '[nggallery id=3]' );
  32. }
  33.  
  34. function my_gallery_link () {
  35. add_action( 'bp_template_title', 'my_gallery_title' );
  36. add_action( 'bp_template_content', 'my_gallery_content' );
  37. bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
  38. }
  39.  
  40. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement