function rcp_email_subscription_status($user_id, $status = 'active')
{
    global $rcp_options;
    $user_info = get_userdata($user_id);
    $message = '';
    $admin_message = '';
    $admin_emails = array();
    $admin_emails[] = get_option('admin_email');
    $admin_emails = apply_filters('rcp_admin_notice_emails', $admin_emails);
    $site_name = stripslashes_deep(html_entity_decode(get_bloginfo('name'), ENT_COMPAT, 'UTF-8'));
    $from_name = isset($rcp_options['from_name']) ? $rcp_options['from_name'] : $site_name;
    $from_name = apply_filters('rcp_emails_from_name', $from_name, $user_id, $status);
    $from_email = isset($rcp_options['from_email']) ? $rcp_options['from_email'] : get_option('admin_email');
    $from_email = apply_filters('rcp_emails_from_address', $from_email);
    $headers = "From: " . stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8')) . " <{$from_email}>\r\n";
    $headers .= "Reply-To: " . $from_email . "\r\n";
    $headers = apply_filters('rcp_email_headers', $headers, $user_id, $status);
    // Allow add-ons to add file attachments.
    $attachments = apply_filters('rcp_email_attachments', array(), $user_id, $status);
    switch ($status) {
        case "active":
            if (rcp_is_trialing($user_id)) {
                break;
            }
            if (!isset($rcp_options['disable_active_email'])) {
                $message = isset($rcp_options['active_email']) ? $rcp_options['active_email'] : '';
                $message = apply_filters('rcp_subscription_active_email', $message, $user_id, $status);
                $subject = isset($rcp_options['active_subject']) ? $rcp_options['active_subject'] : '';
                $subject = apply_filters('rcp_subscription_active_subject', $subject, $user_id, $status);
                wp_mail($user_info->user_email, $subject, rcp_filter_email_tags($message, $user_id, $user_info->display_name), $headers, $attachments);
            }
            if (!isset($rcp_options['disable_new_user_notices'])) {
                $admin_message = __('Hello', 'rcp') . "\n\n" . $user_info->display_name . ' (' . $user_info->user_login . ') ' . __('is now subscribed to', 'rcp') . ' ' . $site_name . ".\n\n" . __('Subscription level', 'rcp') . ': ' . rcp_get_subscription($user_id) . "\n\n";
                $admin_message = apply_filters('rcp_before_admin_email_active_thanks', $admin_message, $user_id);
                $admin_message .= __('Thank you', 'rcp');
                wp_mail($admin_emails, __('New subscription on ', 'rcp') . $site_name, $admin_message, $headers, $attachments);
            }
            break;
        case "cancelled":
            if (!isset($rcp_options['disable_cancelled_email'])) {
                $message = isset($rcp_options['cancelled_email']) ? $rcp_options['cancelled_email'] : '';
                $message = apply_filters('rcp_subscription_cancelled_email', $message, $user_id, $status);
                $subject = isset($rcp_options['cancelled_subject']) ? $rcp_options['cancelled_subject'] : '';
                $subject = apply_filters('rcp_subscription_cancelled_subject', $subject, $user_id, $status);
                wp_mail($user_info->user_email, $subject, rcp_filter_email_tags($message, $user_id, $user_info->display_name), $headers, $attachments);
            }
            if (!isset($rcp_options['disable_new_user_notices'])) {
                $admin_message = __('Hello', 'rcp') . "\n\n" . $user_info->display_name . ' (' . $user_info->user_login . ') ' . __('has cancelled their subscription to', 'rcp') . ' ' . $site_name . ".\n\n" . __('Their subscription level was', 'rcp') . ': ' . rcp_get_subscription($user_id) . "\n\n";
                $admin_message = apply_filters('rcp_before_admin_email_cancelled_thanks', $admin_message, $user_id);
                $admin_message .= __('Thank you', 'rcp');
                wp_mail($admin_emails, __('Cancelled subscription on ', 'rcp') . $site_name, $admin_message, $headers, $attachments);
            }
            break;
        case "expired":
            if (!isset($rcp_options['disable_expired_email'])) {
                $message = isset($rcp_options['expired_email']) ? $rcp_options['expired_email'] : '';
                $message = apply_filters('rcp_subscription_expired_email', $message, $user_id, $status);
                $subject = isset($rcp_options['expired_subject']) ? $rcp_options['expired_subject'] : '';
                $subject = apply_filters('rcp_subscription_expired_subject', $subject, $user_id, $status);
                wp_mail($user_info->user_email, $subject, rcp_filter_email_tags($message, $user_id, $user_info->display_name), $headers, $attachments);
                add_user_meta($user_id, '_rcp_expired_email_sent', 'yes');
            }
            if (!isset($rcp_options['disable_new_user_notices'])) {
                $admin_message = __('Hello', 'rcp') . "\n\n" . $user_info->display_name . "'s " . __('subscription has expired', 'rcp') . "\n\n";
                $admin_message = apply_filters('rcp_before_admin_email_expired_thanks', $admin_message, $user_id);
                $admin_message .= __('Thank you', 'rcp');
                wp_mail($admin_emails, __('Expired subscription on ', 'rcp') . $site_name, $admin_message, $headers, $attachments);
            }
            break;
        case "free":
            if (!isset($rcp_options['disable_free_email'])) {
                $message = isset($rcp_options['free_email']) ? $rcp_options['free_email'] : '';
                $message = apply_filters('rcp_subscription_free_email', $message, $user_id, $status);
                $subject = isset($rcp_options['free_subject']) ? $rcp_options['free_subject'] : '';
                $subject = apply_filters('rcp_subscription_free_subject', $subject, $user_id, $status);
                wp_mail($user_info->user_email, $subject, rcp_filter_email_tags($message, $user_id, $user_info->display_name), $headers, $attachments);
            }
            if (!isset($rcp_options['disable_new_user_notices'])) {
                $admin_message = __('Hello', 'rcp') . "\n\n" . $user_info->display_name . ' (' . $user_info->user_login . ') ' . __('is now subscribed to', 'rcp') . ' ' . $site_name . ".\n\n" . __('Subscription level', 'rcp') . ': ' . rcp_get_subscription($user_id) . "\n\n";
                $admin_message = apply_filters('rcp_before_admin_email_free_thanks', $admin_message, $user_id);
                $admin_message .= __('Thank you', 'rcp');
                wp_mail($admin_emails, __('New free subscription on ', 'rcp') . $site_name, $admin_message, $headers, $attachments);
            }
            break;
        case "trial":
            if (!isset($rcp_options['disable_trial_email'])) {
                $message = isset($rcp_options['trial_email']) ? $rcp_options['trial_email'] : '';
                $message = apply_filters('rcp_subscription_trial_email', $message, $user_id, $status);
                $subject = isset($rcp_options['trial_subject']) ? $rcp_options['trial_subject'] : '';
                $subject = apply_filters('rcp_subscription_trial_subject', $subject, $user_id, $status);
                wp_mail($user_info->user_email, $subject, rcp_filter_email_tags($message, $user_id, $user_info->display_name), $headers, $attachments);
            }
            if (!isset($rcp_options['disable_new_user_notices'])) {
                $admin_message = __('Hello', 'rcp') . "\n\n" . $user_info->display_name . ' (' . $user_info->user_login . ') ' . __('is now subscribed to', 'rcp') . ' ' . $site_name . ".\n\n" . __('Subscription level', 'rcp') . ': ' . rcp_get_subscription($user_id) . "\n\n";
                $admin_message = apply_filters('rcp_before_admin_email_trial_thanks', $admin_message, $user_id);
                $admin_message .= __('Thank you', 'rcp');
                wp_mail($admin_emails, __('New trial subscription on ', 'rcp') . $site_name, $admin_message, $headers, $attachments);
            }
            break;
        default:
            break;
    }
}
Пример #2
0
						<?php 
_e('Is this user\'s subscription recurring?', 'rcp');
?>
					</label>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row" valign="top">
					<?php 
_e('Trialing', 'rcp');
?>
				</th>
				<td>
					<label for="rcp-trialing">
						<input name="trialing" id="rcp-trialing" type="checkbox" value="1" <?php 
checked(1, rcp_is_trialing($member->ID));
?>
/>
						<?php 
_e('Does this user have a trial membership?', 'rcp');
?>
					</label>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row" valign="top">
					<?php 
_e('Sign Up Method', 'rcp');
?>
				</th>
				<td>
Пример #3
0
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;
}
Пример #4
0
						<?php 
_e('Is this user\'s subscription recurring?', 'rcp');
?>
					</label>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row" valign="top">
					<?php 
_e('Trialing', 'rcp');
?>
				</th>
				<td>
					<label for="rcp-trialing">
						<input name="trialing" id="rcp-trialing" type="checkbox" value="1" <?php 
checked(1, rcp_is_trialing($user->ID));
?>
/>
						<?php 
_e('Does this user have a trial membership?', 'rcp');
?>
					</label>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row" valign="top">
					<?php 
_e('Sign Up Method', 'rcp');
?>
				</th>
				<td>