BuddyDev

Search

Tweaking bp_get_group_join_button

  • Participant
    Level: Enlightened
    Posts: 147
    NikB on #37522

    Hi there

    I’m wanting to change what happens when the user clicks on the Request Membership page ie. I want to divert them to a different page rather than send a request but not sure how best to approach this.

    I know I can add a filter to bp_get_group_join_button and thought maybe I could just edit the link_href attribute but that doesn’t work. Im guessing maybe because the ajax gets in the way and not sure how to prevent that?

    Alternatively, I guess I could remove the Request Membership button altogether and then add my own in its place somehow but not entirely sure how to achieve that either.

    Any/all suggestions would be very much appreciated.

    With many thanks in advance.
    Nik

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2459
    Ravi on #37533

    Hello Nik,

    Thank you for posting. Please do let me know which theme and template pack you are using and further flow of the button i.e. Are you looking to redirect to a custom page or anything else.
    So that I can better assists you with this.

    Regards
    Ravi

  • Participant
    Level: Enlightened
    Posts: 147
    NikB on #37537

    Hi Ravi

    Thank you so much for getting back to me.

    It’s actually quite a complex set up but I suspect the main things you need to know are that I’m using BuddyBoss & BuddyBoss theme with the Nouveau template pack.

    It may/may not be relevant but as a bit of background, what I’m trying to create (and as far as I am aware, no single plugin currently handles this fully, at least not in the way I need) is a situation where members have to pay to join a group. Using a couple of other plugins and some custom coding, I now have a “Join Now” button which appears underneath the group_header_meta and links to the relevant Woocommerce product. This all works perfectly and as intended but in order to tidy things up, what I’d really like is for the “Request Membership” button to have this same link so that it will appear in the same place as the other “group action” buttons and I can get rid of the additional button under the meta.

    So… essentially my query is as above ie. I’d like to be able to make the “Request Membership” button link to a url for which I can probably generate the string myself (but will be something like $url = get_permalink( $product_id )) although for the purposes of any example you might be able to offer, simply a link to say, the home page, would be fine and I can then tweak the code a little further from there myself.

    Hope that makes sense and hasn’t over-complicated things too much. The bottom line is that all I want the “Request Membership” button to do is to link to another page 😉

    With fingers crossed and very many thanks in advance.
    Nik

  • Keymaster
    (BuddyDev Team)
    Posts: 21814
    Brajesh Singh on #37571

    Hi Nik,
    Thank you for the details.

    I will suggest contacting BuddyBoss support for the solution. We provide limited support for BuddyBoss specific to our plugins compatibility with BuddyBoss platform & theme.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 147
    NikB on #37572

    Hi Brajesh

    Thank you for your reply although I don’t really think it’s a BuddyBoss issue (and perhaps I have explained badly).

    Essentially I have a function called bp_change_group_button which runs on – add_filter( ‘bp_get_group_join_button’, ‘bp_change_group_button’ ).

    The bit of code within the function which I want to change is –

    if ( !bp_group_has_requested_membership( $group ) ) {
    						$button = array(
    							'id'                => 'request_membership',
    							'component'         => 'groups',
    							'must_be_logged_in' => false,
    							'block_self'        => false,
    							'wrapper_class'     => 'group-button ' . $group->status,
    							'wrapper_id'        => 'groupbutton-' . $group->id,
    							'link_href'         => wp_nonce_url( bp_get_group_permalink( $group ) . 'request-membership', 'groups_request_membership' ),
    							'link_text'         => __( 'Request Membership', 'buddypress' ),
    							'link_title'        => __( 'Request Membership', 'buddypress' ),
    							'link_class'        => 'group-button request-membership',
    						);

    ie. instead of prompting a membership request, I simply want to somehow add a link to that particular button so that it will divert to a particular page. It feels as if that really shouldn’t be a particularly complicated requirement so maybe I’m being an idiot or missing something obvious which is why I thought I might ask you guys who are so familiar with BuddyPress, but I do also fully appreciate that you may feel it’s outside of your scope 😉

    Thank you so much for your time anyway and I shall do a bit more investigation myself.
    Nik

  • Keymaster
    (BuddyDev Team)
    Posts: 21814
    Brajesh Singh on #37622

    Hi Nik,
    Thank you for sharing.

    I regret my team’s inability to assist you with this. Due to lack of available time, We are unable to dedicate time testing a solution(though I assume it should be easy to achieve).

    We are prioritising our own plugin updates/issues and I hope that we will be able to resume our free support for community( with custom code) again in near future.

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved