/**
 * Determines if a member can renew their subscription
 *
 * @access      public
 * @since       2.3
 */
function rcp_can_member_renew($user_id = 0)
{
    if (empty($user_id)) {
        $user_id = get_current_user_id();
    }
    $ret = true;
    $member = new RCP_Member($user_id);
    if ($member->is_recurring() && $member->is_active() && 'cancelled' !== $member->get_status()) {
        $ret = false;
    }
    if ('free' == $member->get_status()) {
        $ret = false;
    }
    if (!rcp_subscription_upgrade_possible($user_id)) {
        $ret = false;
    }
    return apply_filters('rcp_member_can_renew', $ret, $user_id);
}
rcp_print_status();
?>
</td>
			<td><?php 
echo rcp_get_subscription();
?>
</td>
			<td><?php 
echo rcp_get_expiration_date();
?>
</td>
			<td>
				<?php 
if ((rcp_is_expired($user_ID) || !rcp_is_recurring($user_ID) || rcp_get_status($user_ID) == 'cancelled') && rcp_subscription_upgrade_possible($user_ID)) {
    echo '<a href="' . esc_url(get_permalink($rcp_options['registration_page'])) . '" title="' . __('Renew your subscription', 'rcp') . '" class="rcp_sub_details_renew">' . __('Renew your subscription', 'rcp') . '</a>';
} elseif (!rcp_is_active($user_ID) && rcp_subscription_upgrade_possible($user_ID)) {
    echo '<a href="' . esc_url(get_permalink($rcp_options['registration_page'])) . '" title="' . __('Upgrade your subscription', 'rcp') . '" class="rcp_sub_details_renew">' . __('Upgrade your subscription', 'rcp') . '</a>';
} elseif (rcp_is_active($user_ID) && rcp_is_paypal_subscriber()) {
    echo '<a href="https://www.paypal.com/cgi-bin/customerprofileweb?cmd=_manage-paylist" target="_blank" title="' . __('Cancel your subscription', 'rcp') . '">' . __('Cancel your subscription', 'rcp') . '</a>';
}
do_action('rcp_subscription_details_action_links');
?>
			</td>
		</tr>
	</tbody>
</table>
<table class="rcp-table" id="rcp-payment-history">
	<thead>
		<tr>
			<th><?php 
_e('Invoice #', 'rcp');
function rcp_registration_form( $atts, $content = null ) {
	extract( shortcode_atts( array(
		'id' => null,
		'registered_message' => __( 'You are already registered and have an active subscription.', 'rcp' )
	), $atts ) );

	global $user_ID;

	// only show the registration form to non-logged-in members
	if( ! rcp_is_active( $user_ID ) || rcp_is_trialing( $user_ID ) || rcp_subscription_upgrade_possible( $user_ID ) ) {

		global $rcp_options, $rcp_load_css, $rcp_load_scripts;

		// set this to true so the CSS and JS scripts are loaded
		$rcp_load_css = true;
		$rcp_load_scripts = true;

		$output = rcp_registration_form_fields( $id );

	} else {
		$output = $registered_message;
	}
	return $output;
}
</td>
			<td><?php 
echo rcp_get_subscription();
?>
</td>
			<td><?php 
echo rcp_get_expiration_date();
?>
</td>
			<td>
				<?php 
$links = array();
if (rcp_can_member_renew()) {
    $links[] = apply_filters('rcp_subscription_details_action_renew', '<a href="' . esc_url(get_permalink($rcp_options['registration_page'])) . '" title="' . __('Renew your subscription', 'rcp') . '" class="rcp_sub_details_renew">' . __('Renew your subscription', 'rcp') . '</a>', $user_ID);
}
if (rcp_subscription_upgrade_possible($user_ID)) {
    $links[] = apply_filters('rcp_subscription_details_action_upgrade', '<a href="' . esc_url(get_permalink($rcp_options['registration_page'])) . '" title="' . __('Upgrade or change your subscription', 'rcp') . '" class="rcp_sub_details_renew">' . __('Upgrade or change your subscription', 'rcp') . '</a>', $user_ID);
}
if (rcp_is_active($user_ID) && rcp_can_member_cancel($user_ID)) {
    $links[] = apply_filters('rcp_subscription_details_action_cancel', '<a href="' . rcp_get_member_cancel_url($user_ID) . '" title="' . __('Cancel your subscription', 'rcp') . '">' . __('Cancel your subscription', 'rcp') . '</a>', $user_ID);
}
echo apply_filters('rcp_subscription_details_actions', implode('<br/>', $links), $links, $user_ID);
do_action('rcp_subscription_details_action_links', $links);
?>
			</td>
		</tr>
	</tbody>
</table>
<table class="rcp-table" id="rcp-payment-history">
	<thead>
		<tr>