Skip to:
Content
Pages
Categories
Search
Top
Bottom

Group Extension API – Getting group info in constructor

  • @crisp330

    Member

    I’m trying to have a function that will process a form upload then redirect to another page. I thought of doing this in the constructor, but the current group information is not available there. ie:

    class My_Group_Extension extends BP_Group_Extension {
    function my_group_extension() {
    global $bp;

    // Do stuff, needing group info, like the current group ID

    wp_redirect($bp->root_domain .’/’. $bp->current_component .’/’. bp_get_group_slug() .’/’);
    // The bp_get_group_slug is also not available
    }

    None of the group info is available here, but it is in any functions after this. However, after this function the headers have already been sent and I cannot redirect. How can I accomplish this, or what is the proper way to do it?

    Thanks!!

Viewing 1 replies (of 1 total)
  • @crisp330

    Member

    PS: in reality, the constructor would just delegate to another function, like

    if ($_POST == ‘looking-for’)
    $this->processingFunction()

    and processingFunction() would handle the upload and then redirect

Viewing 1 replies (of 1 total)
  • The topic ‘Group Extension API – Getting group info in constructor’ is closed to new replies.
Skip to toolbar