get_joined_date() public méthode

Retrieves the joined date for a subscription
Since: 2.6
public get_joined_date ( $subscription_id ) : string
Résultat string Joined date
/**
 * Prevents the "Cancel your subscription" link from showing
 * until the member has been subscribed to his or her current
 * subscription for 3 months.
 */
function jp_rcp_member_can_cancel($ret, $user_id)
{
    global $rcp_options;
    // Only do this on the Account Page
    if (empty($rcp_options['account_page']) || !is_page($rcp_options['account_page'])) {
        return $ret;
    }
    // Return early if other conditions aren't already met.
    if (!$ret) {
        return false;
    }
    $timezone = get_option('timezone_string');
    $timezone = !empty($timezone) ? $timezone : 'UTC';
    $member = new RCP_Member($user_id);
    $cancel_date = new \DateTime($member->get_joined_date(), new \DateTimeZone($timezone));
    $cancel_date->modify('+3 months');
    // change this if you want a different time period
    $now = new \DateTime('now', new \DateTimeZone($timezone));
    if ($ret && $now < $cancel_date) {
        $ret = false;
    }
    return $ret;
}