• Resolved andyjay83

    (@andyjay83)


    Hey Guys, thanks for your time.

    I’m using the latest version of wordpress, buddypress, bbpress and mycred.

    I’m using the sell content add-on to sell acccess to a certain page on my site. I want it to expire really quickly so I found this code on the forum to translate the expiration from hours to seconds.

    Here’s the code:

    add_filter( ‘mycred_sell_exp_title’, ‘adjust_mycred_exp_title’ );
    function adjust_mycred_exp_title( $title ) {
    return ‘Seconds’;
    }

    add_filter( ‘mycred_sell_expire_calc’, ‘adjust_mycred_exp_fomula’, 10, 4 );
    function adjust_mycred_exp_fomula( $result, $length, $user_id, $post_id ) {
    return abs( $length * 60 );
    }

    However, it’s not working.
    I’ve installed it into my child theme. Is that the right spot? Should I install it into the plugin itself?

    Is the code right?

    Any insight would be greatly appreciated.
    Thanks for your time 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor mycred

    (@mycred)

    Hi @andyjay83!

    Thanks for using myCred, you have to use the following code to set the expiry time from HOURS to SECONDS ( 1 hour ).

    add_filter( ‘mycred_sell_expire_calc’, ‘mycredpro_adjust_expiration_length’, 10, 4 );
    function mycredpro_adjust_expiration_length( $expire, $length, $user_id, $post_id ) {
    return HOUR_IN_SECONDS;
    }

    If you want to change the expiry time in the future so there are predefined times you can set.

    MINUTE_IN_SECONDS ( 1 minute )
    HOUR_IN_SECONDS ( 1 hour )
    DAY_IN_SECONDS ( 1 day )
    WEEK_IN_SECONDS ( 1 week )
    MONTH_IN_SECONDS ( 1 second )
    YEAR_IN_SECONDS ( 1 year )

    If you have any question regarding this issue, Please contact us at support@mycred.me

    Thanks!

    myCred Support Team

    Plugin Contributor mycred

    (@mycred)

    Hi @andyjay83

    If you have any question please contact us at mycred.me/support/

    Thank you

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

The topic ‘Sell Content Expiration Time’ is closed to new replies.