BP_Groupblog_Extension

Group API.

Defined (1)

The class is defined in the following location(s).

/bp-groupblog-classes.php  
  1. class BP_Groupblog_Extension extends BP_Group_Extension { 
  2.  
  3. function bp_groupblog_extension() { 
  4. global $bp; 
  5.  
  6. $this->name = __( 'Group Blog', 'groupblog' ); 
  7. $this->slug = 'group-blog'; 
  8.  
  9. $this->enable_create_step = true; 
  10. $this->create_step_position = 15; 
  11.  
  12. $this->enable_edit_item = true; 
  13.  
  14. $this->nav_item_name = 'Blog'; 
  15. $this->nav_item_position = 30; 
  16. //$this->enable_nav_item = $this->enable_nav_item(); 
  17. $this->enable_nav_item = false; 
  18. $this->template_file = 'groupblog/blog'; 
  19.  
  20. function create_screen( $group_id = null ) { 
  21. global $bp, $groupblog_create_screen; 
  22.  
  23. if ( !bp_is_group_creation_step( $this->slug ) ) 
  24. return false; 
  25.  
  26. $groupblog_create_screen = true; 
  27.  
  28. // Attach the nonce fields in a hook. Mainly for backward compatibility 
  29. add_action( 'signup_blogform', array( &$this, 'nonce_fields_create' ) ); 
  30.  
  31. // Attaching the markup via a hook, so that plugins can unhook and replace with 
  32. // their own markup. This is a bit of a hack. 
  33. add_action( 'bp_groupblog_create_screen_markup', 'bp_groupblog_signup_blog' ); 
  34. do_action( 'bp_groupblog_create_screen_markup' ); 
  35.  
  36. echo '<input type="hidden" name="groupblog-group-id" value="' . $bp->groups->current_group->id . '" />'; 
  37. echo '<input type="hidden" name="groupblog-create-save" value="groupblog-create-save" />'; 
  38.  
  39. function create_screen_save( $group_id = null ) { 
  40. if ( isset( $_POST['save'] ) ) { 
  41. check_admin_referer( 'groups_create_save_' . $this->slug ); 
  42. groupblog_edit_settings(); 
  43.  
  44. function edit_screen( $group_id = null ) { 
  45. global $bp; 
  46.  
  47. if ( !bp_is_group_admin_screen( $this->slug ) ) 
  48. return false; 
  49.  
  50. // Attach the nonce fields in a hook. Mainly for backward compatibility 
  51. add_action( 'signup_blogform', array( &$this, 'nonce_fields_edit' ) ); 
  52.  
  53. // Attaching the markup via a hook, so that plugins can unhook and replace with 
  54. // their own markup. This is a bit of a hack. 
  55. add_action( 'bp_groupblog_edit_screen_markup', 'bp_groupblog_signup_blog' ); 
  56. do_action( 'bp_groupblog_edit_screen_markup' ); 
  57.  
  58. function edit_screen_save( $group_id = null ) { 
  59. if ( isset( $_POST['save'] ) ) { 
  60. check_admin_referer( 'groups_edit_save_' . $this->slug ); 
  61. groupblog_edit_settings(); 
  62.  
  63. function nonce_fields_edit() { 
  64. $this->nonce_fields( 'edit' ); 
  65.  
  66. function nonce_fields_create() { 
  67. $this->nonce_fields( 'create' ); 
  68.  
  69. function nonce_fields( $type = 'edit' ) { 
  70. wp_nonce_field( 'groups_' . $type . '_save_' . $this->slug ); 
  71.  
  72. function display() { 
  73.  
  74. function widget_display() { 
  75.  
  76. function enable_nav_item() { 
  77. return bp_is_group() && groups_get_groupmeta( bp_get_current_group_id(), 'groupblog_enable_blog' ); 
  78.