SELL CONTENT expire time

front page Forums Community SELL CONTENT expire time

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #5562

    Hi Gabriel. I guess you are very busy with 1.4. When you have a moment could you help me configure expire time in minutes (I need very short time, less than one hour, validity). Thanks in advance. JF


    Here is how you do it:

    First we need to change the label from “Hours” to “Minutes”. For this we will use the mycred_sell_exp_title filter:

    add_filter( 'mycred_sell_exp_title', 'adjust_mycred_exp_title' );
    function adjust_mycred_exp_title( $title ) {
    return 'Minutes';

    Then we need to adjust the expiration time formula. myCRED uses by default the following formula:

    $length * 3600

    This means that myCRED will apply the number of hours * 3600 seconds so a length of 2 will result in 7200 seconds = 2 hours.

    To adjust the formula we will use the mycred_sell_expire_calc filter:

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

    This will return your set length times 60 so if you set the expiration to i.e. 5 minutes, the formula will multiply 5 by 60.

    You can use these two filters for any timeframe. You could change from hours to seconds, days, weeks, months or years.


    Thanks Gabriel for your quick and well documented answer. Have a nice day. JF

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘SELL CONTENT expire time’ is closed to new replies.