WordPress.org

Support

Support » Plugins and Hacks » myCRED » [Resolved] Leaving a friendship in Buddypress throws an error

[Resolved] Leaving a friendship in Buddypress throws an error

  • Hey Gabriel,

    just wanted to let you know that leaving a friendship on buddypress throws a php error for me:

    Warning: Missing argument 2 for myCRED_BuddyPress_Profile::friendship_leave() in plugins/mycred/plugins/mycred-hook-buddypress.php on line 226

    Might try and fix it manually for now. Let me know if you what is causing it though.

    Thanks,
    Gabriel

    https://wordpress.org/plugins/mycred/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Actually, here’s jsut all 3 errors thrown:

    Warning: Missing argument 2 for myCRED_BuddyPress_Profile::friendship_leave() in /plugins/mycred/plugins/mycred-hook-buddypress.php on line 226

    Warning: Missing argument 3 for myCRED_BuddyPress_Profile::friendship_leave() in /plugins/mycred/plugins/mycred-hook-buddypress.php on line 226

    Warning: Cannot modify header information – headers already sent by (output started at /plugins/mycred/plugins/mycred-hook-buddypress.php:226) in /wp-includes/pluggable.php on line 1121

    Plugin Author Gabriel

    @designbymerovingi

    Hi.

    Can you tell me what version you are using for WP and BP? Are you using the new version of BuddyPress?

    Oh my apologies, yes I’m using BP 2.0 and WP 3.9

    So do you happen to know why this is being caused?

    My guess is that BP changed the parameters for leaving friendship, either removing the initiator and recipient IDs or it is now storing it in one array or object and passing that as a single parameter. For now, I just commented out the body of the function and put a blank return. I also removed the last two parameters and this seemed to work.

    To save functionality, what I could have done was just used the first parameter (friendship ID) to figure out the id’s of the two people involved and use these instead. For now, I can live without the function of it.

    Let me know if/when you make any progress on this. Hope I was able to help at least a little bit

    Plugin Author Gabriel

    @designbymerovingi

    Hey.

    Sorry for my delay but I was off during Easter.

    After looking into this, I think the issue is with how myCRED hooks into BuddyPress.
    Try this:

    Open the mycred-hook-buddypress.php file located in the plugins/mycred/plugins/ folder and on line 107 change:

    add_action( 'friends_friendship_deleted', array( $this, 'friendship_leave' ) );

    to:

    add_action( 'friends_friendship_deleted', array( $this, 'friendship_leave' ), 10, 3 );

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] Leaving a friendship in Buddypress throws an error’ is closed to new replies.
Skip to toolbar