Reply To: [Resolved] Group Extension API – Display() under Admin
I tested and get correctly anything from the plugin. What i did:
– installed the plugin
– create a new page called job
– added the shortcode [jobs] [submit_job_form] [job_dashboard]
– saved
In bp-custom i added this snippet, similar to the previous but who let’s you add a page to a group.
function bpfr_add_page_to_group() {
if ( class_exists( 'BP_Group_Extension' ) ) :
class BPFR_Custom_Group_Extension extends BP_Group_Extension {
// building the tab
function __construct() {
$args = array(
'slug' => 'jobs', // tab slug - mandatory
'name' => 'Job Center' // tab name - mandatory
);
parent::init( $args );
} // end construct()
// content display
function display() {
// grab page or post ID
$id = 240;
$p = get_post($id);
// output the title
echo '<h3>'.apply_filters('the_content', $p->post_title).'</h3>';
// output the post
echo apply_filters('the_content', $p->post_content);
// end option
} // end display()
} // end class
bp_register_group_extension( 'BPFR_Custom_Group_Extension' );
endif;
}
add_filter('bp_groups_default_extension', 'bpfr_add_page_to_group' );
So far i see everything is working !
EDIT: working yes, but not on the admin tab.
@shanebp you’re right, but it’s only an example for how things can be done. 😉