WordPress.org

Ready to get started?Download WordPress

Forums

myCRED
[resolved] Leaving a friendship in Buddypress throws an error (6 posts)

  1. godavid33
    Member
    Posted 4 months ago #

    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/

  2. godavid33
    Member
    Posted 4 months ago #

    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

  3. Gabriel
    Member
    Plugin Author

    Posted 4 months ago #

    Hi.

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

  4. godavid33
    Member
    Posted 4 months ago #

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

  5. godavid33
    Member
    Posted 4 months ago #

    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

  6. Gabriel
    Member
    Plugin Author

    Posted 4 months ago #

    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 );

Reply

You must log in to post.

About this Plugin

About this Topic