• Just want to check… we modded our Buddypress TDLC Birthdays plugin before to award a user 5000 cubepoints in the past, but switched to MyCRED.. could you please advise me if i have modded this correct for myCRED?

    if ( !in_array($userobj->user_id, $postedBd) ) {
    					//cp_alterPoints($userobj->user_id, 5000);
    					//cp_log('birthday', $userobj->user_id, 5000, false);
    
    					/**** Greg - Hook into myCRED to give birthday user some moolah ******/
    
    					if ( !mycred_exclude_user( $userobj->user_id ) ) {
    					mycred_add( 'birthday_present', $userobj->user_id, 5000, 'Birthday %plural%!', date( 'y' ) );
    					}

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author myCred

    (@designbymerovingi)

    It looks correct. One thing I would change is this:

    if ( !mycred_exclude_user( $userobj->user_id ) ) {
    	mycred_add( 'birthday_present', $userobj->user_id, 5000, 'Birthday %plural%!', date( 'y' ) );
    }

    to:

    if ( function_exists( 'mycred_exclude_user' ) && !mycred_exclude_user( $userobj->user_id ) ) {
    	mycred_add( 'birthday_present', $userobj->user_id, 5000, 'Birthday %plural%!', date( 'y' ) );
    }

    It’s always a good idea to use function_exists to make sure your site will not crash when you disable myCRED and this code is executed as it will lead to a fatal PHP error.

    Thread Starter maddogmcewan

    (@maddogmcewan)

    Thanx Gabriel !!! I have to say… never came across better support from any any any plugin dev… you are on the ball

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘TDLC-BIRTHDAY plugin mod’ is closed to new replies.