A free points management plugin for WordPress.
myCRED Logo
myCRED Logo
  • Membership New
  • Chapters
    • Chapter I – Introduction
    • Chapter II – Getting Started
    • Chapter III – Add-ons
    • Chapter IV – Premium Add-ons
    • Chapter V – For Developers
    • Chapter VI – Reference Guides
  • Categories
    • Actions
    • Classes
    • Constants
    • Filters
    • Functions
    • Objects
    • Shortcodes
    • Hooks
    • Template Tags
  • Packages
    • mycred/api
    • mycred/badge
    • mycred/balance
    • mycred/banking
    • mycred/content
    • mycred/core
    • mycred/coupon
    • mycred/email
    • mycred/game
    • mycred/log
    • mycred/notice
    • mycred/payment
    • mycred/purchase
    • mycred/rank
    • mycred/transfer
  • Store
  • Download
    Navigation
    • Loading navigation ...
    All Filters
    myCRED filters
    1. mycred_add
    2. mycred_add_finished
    3. mycred_affiliate_cookie
    4. mycred_affiliate_key
    5. mycred_all_references
    6. mycred_allowed_tags
    7. mycred_apply_exchange_rate
    8. mycred_badge_image
    9. mycred_badge_user_value
    10. mycred_banking_save_interest
    11. mycred_banking_save_recurring
    12. mycred_bp_leaderboard_{$column_id}_ ...
    13. mycred_bp_leaderboard_columns
    14. mycred_bp_leaderboard_find_position
    15. mycred_bp_leaderboard_get
    16. mycred_bp_leaderboard_types
    17. mycred_bp_rank_in_header
    18. mycred_bp_rank_in_profile
    19. mycred_buycred_get_cost
    20. mycred_central_banking_ignore
    21. mycred_compound_max_limit
    22. mycred_compound_pay_max_limit
    23. mycred_decline_store_purchase
    24. mycred_delete_hook_ref
    25. mycred_em_approve_on_pay
    26. mycred_email_before_send
    27. mycred_email_instances
    28. mycred_exclude_user
    29. mycred_export_headers
    30. mycred_find_users_rank
    31. mycred_format_creds
    32. mycred_format_number
    33. mycred_get_content_price
    34. mycred_get_users_cred
    35. mycred_give_run
    36. mycred_has_entry
    37. mycred_have_ranks
    38. mycred_label
    39. mycred_label_my_balance
    40. mycred_link
    41. mycred_log_{column}
    42. mycred_log_bulk_actions
    43. mycred_log_column_{type}_headers
    44. mycred_log_column_headers
    45. mycred_log_date
    46. mycred_log_row_classes
    47. mycred_lotto_payout_type
    48. mycred_lotto_times12
    49. mycred_lotto_times24
    50. mycred_notice_js
    51. mycred_notifications
    52. mycred_notifications_note
    53. mycred_parse_tags_amount
    54. mycred_parse_tags_comment
    55. mycred_parse_tags_general
    56. mycred_parse_tags_post
    57. mycred_parse_tags_user
    58. mycred_post_is_for_sale
    59. mycred_pt_get_fee
    60. mycred_publish_hook_new
    61. mycred_publish_hook_old
    62. mycred_publish_hook_ref
    63. mycred_query_log_args
    64. mycred_rank_list
    65. mycred_ranking_row
    66. mycred_ranking_sql
    67. mycred_recurring_max_limit
    68. mycred_register_ranks
    69. mycred_run_this
    70. mycred_scratch_card_templates
    71. mycred_scratch_everyonewins
    72. mycred_sell_content_priority
    73. mycred_sell_exp_title
    74. mycred_sell_expire_calc
    75. mycred_sell_this_button
    76. mycred_sell_this_label
    77. mycred_send_language
    78. mycred_setup_addons
    79. mycred_setup_banking
    80. mycred_setup_hooks
    81. mycred_transfer_acc_limit
    82. mycred_transfer_autofill_by
    83. mycred_transfer_messages
    84. mycred_twilio_format_phone_number
    85. mycred_twilio_get_sender
    86. mycred_twilio_get_senders_id
    87. mycred_twilio_get_users_number
    88. mycred_twilio_parse_sms
    89. mycred_twilio_phone_number
    90. mycred_twilio_xml_response
    91. mycred_user_has_paid_for_content
    92. mycred_user_row_actions
    93. mycred_userpro_insufficient
    94. mycred_userpro_stop_message
    95. mycred_users_of_rank
    96. mycred_users_profile_url
    97. mycred_video_output
    98. mycred_video_query_youtube
    99. mycred_woo_order_cost
    100. mycred_woo_reward_cap
    101. mycred_woo_reward_log
    Categories
    Filter by category
    1. Actions
    2. Classes
    3. Filters
    4. Functions
    5. Hooks
    6. Objects
    7. Shortcodes
    8. Template Tags
    Chapters
    Documentation
    1. Chapter I - Introduction
    2. Chapter II - Getting Started
    3. Chapter III - Add-ons
    4. Chapter IV - Premium Add-ons
    5. Chapter V - For Developers
    6. Chapter VI - Reference Guides
mycred_sell_expire_calc

Codex / mycred/content / Filters / mycred_sell_expire_calc

Description

By default, myCRED allows you to let purchases expire after a certain number of hours. This filter lets you change this calculation from hours to any other time measurement. If you use this filter you should also consult the mycred_sell_exp_title filter.

Remember! The returned number is added to the purchase time and compared to see if it is still in the future (purchase valid) or if that time has passed (purchase expired). For this reason the value you return must be in seconds.

Available since version 1.4

Parameters
Param Type Required Description
$expiration int No

The expiration length in seconds. This value is multiplied with the length you set e.g. 2 hours, and added to the time a user last paid.

$length int No

The length set for this particular post.

$user_id int No

The numeric ID of the user this calculation is related to.

$post_id int No

The post ID.

Used By
Package Prio. Description
mycred/content 10 Used by the mycred_content_purchase_has_expired function.
Example

Example 1: Change the expiration length calculation from using hours to days.

About myCRED

myCRED is a free, open-source and developer friendly points management tool for WordPress powered websites.

Download Rate Plugin

Documentation

  • Add-ons
  • Core Shortcodes
  • F.A.Q.
  • Tutorials
  • Third Party Plugins
  • Code Snippets

Support

  • Product Licenses
  • Customization
  • Support Forums
  • Plugin Changelog
  • Contact

Copyright 2013 - 2021 byWPExperts; All rights reserved. myCRED is licensed under GPL 2.0

Terms & Conditions • Use of Cookies • Store Policy • Community Rules

Suggest Codex Example

You can submit suggestions for codex examples that you have available as a public gist. If you are a member on the mycred.me website, you can earn Tokens for each submission. To claim these Tokens, make sure you provide your mycred.me username.

Please make sure the example you submit is relevant and if you include documentation, it's provided in English.

logo
  • Membership New
  • Chapters
    • Chapter I – Introduction
    • Chapter II – Getting Started
    • Chapter III – Add-ons
    • Chapter IV – Premium Add-ons
    • Chapter V – For Developers
    • Chapter VI – Reference Guides
  • Categories
    • Actions
    • Classes
    • Constants
    • Filters
    • Functions
    • Objects
    • Shortcodes
    • Hooks
    • Template Tags
  • Packages
    • mycred/api
    • mycred/badge
    • mycred/balance
    • mycred/banking
    • mycred/content
    • mycred/core
    • mycred/coupon
    • mycred/email
    • mycred/game
    • mycred/log
    • mycred/notice
    • mycred/payment
    • mycred/purchase
    • mycred/rank
    • mycred/transfer
  • Store
  • Download