Skip to:
Content
Pages
Categories
Search
Top
Bottom

enable_create_step only after checkbox in options is checked

  • @rogopag

    Member

    Hi all,

    I’m new to BP and I’m enjoying quite a lot working with it.

    I’m writing a plugin for a project and I’m using the BP_Group_Extension API, everything is working pretty well but I want to enable creation, edit and preview tabs only if the user has checked a checkbox in the settings page.

    I’m filling up a groupmeta at that stage but I’m not able to get the group id when i create my BP_Group_Extension – because it is before the group creation – and not able to override this settings:

    $this->enable_create_step = true;
    $this->enable_edit_item = true;
    $this->enable_nav_item = true;

    right after this step if the user is posting the right value by checking the checkbox.

    Everything is working fine and the function I’m using to control the groupmeta is working in the next steps.

    How can I achieve that? What is the most suitable structure I have to give to my plugin?

    Right now I’m doing somethig like this:

    load.php
    function bppInit() {
    require_once( dirname( __FILE__ ) . ‘/promote_manager.php’ );
    }
    add_action( ‘bp_include’, ‘bppInit’ );

    promote_manager.php
    include_once ‘classes/promote_manager_core_class.php’;
    include_once ‘classes/promote_manager_settings_class.php’;
    include_once ‘classes/promote_manager_setup_class.php’;

    add_action(‘init’, create_function(”, ‘global $promoteCore; $promoteCore = new PromoteManagerCore();’), 10);
    add_action(‘init’, create_function(”, ‘global $promoteSettings; $promoteSettings = new PromoteManagerSettings();’), 11);
    bp_register_group_extension( ‘bpGroupsPromote’ );

    If I’m trying to evoque the bp_register_group_extension hook in the PromoteManagerCore constructor nothing happens, neither in other places…

    Can someone give me any advice on this?

  • The topic ‘enable_create_step only after checkbox in options is checked’ is closed to new replies.
Skip to toolbar