Skip to:
Content
Pages
Categories
Search
Top
Bottom

Javascript confirm box for cancelling friends

Viewing 7 replies - 1 through 7 (of 7 total)
  • Avatar of John James Jacoby
    John James Jacoby
    Keymaster

    @johnjamesjacoby

    You can add a class of “confirm” to any link that you want a JS message box to ask you about before it takes action. It will only spit out an “Are you sure?” generic message, but it’s built into BP already.

    Avatar of Devweb
    devweb
    Participant

    @devweb

    Hi John, thanks for letting me know, been battling with it for hours!

    However, I placed a class=”confirm” onto the link in the echo function as you said, but its still not working.

    Can you advise where to put this class please? (Unless its just me being daft)

    Thanks very much

    Avatar of Devweb
    devweb
    Participant

    @devweb

    I can’t believe I just posted that.

    I know its not a CSS thing, its a PHP thing, its nearly Eriday, I’m tired, my bad!

    I’m going to look up using classes some more and figure it out. Any further advice would be brill though!

    Avatar of Devweb
    devweb
    Participant

    @devweb

    Avatar of John James Jacoby
    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Haven’t tested it myself, but something like this usually is easier on the brain…

    <a href="<?php echo loggedin_user->domain . $bp->friends->slug . '/remove-friend/' . $potential_friend_id, 'friends_remove_friend' ) ?>" title="<?php _e('Cancel Friendship', 'buddypress') ?>" id="friend-<?php echo $potential_friend_id ?>" rel="remove" class="confirm remove"><?php _e('Disconnect', 'buddypress') ?></a>

    It’s also possible that because this specific link has ajax attached to it, that it’s returning false before the additional JS message can fire on the click. In that case we’ll need to try a different route.

    Avatar of Devweb
    devweb
    Participant

    @devweb

    Thank you for supplying that code John, however unfortunately it dos not work and I am still at a loss with this, does anyone else have any suggestions as this would be most appreciated

    Thanks in advance

    Avatar of CatchThePigeon
    CatchThePigeon
    Participant

    @catchthepigeon

    Has there been any development on this in the last 4 years – I’ve had a couple of people say to me they clicked on the unfriend by accident and are too embarrassed to ask again in case they think they removed them on purpose!?

    Would be nice to have some sort of confirmation

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

You must be logged in to reply to this topic.