Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)

  • anubhavkushwaha
    Member

    @anubhavkushwaha

    ok – so here is what was missing – there needs to be an ajax call that has to be made when the button is clicked :) that is what actually does the trick

    `
    $j(“div.signupbutton a”).live(‘click’, function() {
    var gid = $j(this).parent().attr(‘id’);
    gid = gid.split(‘-‘);
    gid = gid[1];

    var nonce = $j(this).attr(‘href’);
    nonce = nonce.split(‘?_wpnonce=’);
    nonce = nonce[1].split(‘&’);
    nonce = nonce[0];

    var thelink = $j(this);

    $j.post( ajaxurl, {
    action: ‘joinleave_group’,
    ‘cookie’: encodeURIComponent(document.cookie),
    ‘gid’: gid,
    ‘_wpnonce’: nonce
    },
    function(response)
    {
    var parentdiv = thelink.parent();

    if ( !$j(‘body.directory’).length ) {
    location.href = location.href;
    //do stuff that you want to do on successful request send
    parentdiv.fadeIn(200).html(“Thanks for signing up”);
    }
    else {
    $j(parentdiv).fadeOut(200,
    function() {
    parentdiv.fadeIn(200).html(response);
    }
    );
    }
    });
    return false;
    });
    `


    anubhavkushwaha
    Member

    @anubhavkushwaha

    got it –
    this will get set if you ensure that you create a proper group – `$group2 = new BP_Groups_Group( $group1->id );` – also need to make sure that $members_template is globalized


    anubhavkushwaha
    Member

    @anubhavkushwaha

    false positive. The button does not seem to work on another page even though it has the right link. I am looking for the related form now :(


    anubhavkushwaha
    Member

    @anubhavkushwaha

    The code for the button exists in the ‘function bp_get_group_join_button( $group = false )’ which gets the button. This code can be found in the bp-groups-template.php file under buddypressbp-groups


    anubhavkushwaha
    Member

    @anubhavkushwaha

    earlier post – Ok I am guessing that I need to pass a group object to the bp_get_group_join_button function and not the name of the group. So my next question is – is there a way to get a group object if I know a group name?

    Managed to get it done finally.

    `
    <?php
    global $wpdb;
    $mgroup_name = “mygroupname”;
    $myrows = $wpdb->get_results(“SELECT * FROM wp_bp_groups where slug=’$mgroup_name’;”, OBJECT);
    if (count($myrows)>0) {
    $group1 = $myrows[0];
    $buttondata=bp_get_group_join_button($group1);
    }

    ?>

    var registrationbutton = “”;
    `


    anubhavkushwaha
    Member

    @anubhavkushwaha

    Would this code work “ to get the registration button for the group?


    anubhavkushwaha
    Member

    @anubhavkushwaha

    Update – I tried using the link /groups/group_name/request-membership/ but that is not working

Viewing 7 replies - 1 through 7 (of 7 total)
Skip to toolbar