本文整理汇总了PHP中MS_Model_Member::is_logged_in方法的典型用法代码示例。如果您正苦于以下问题:PHP MS_Model_Member::is_logged_in方法的具体用法?PHP MS_Model_Member::is_logged_in怎么用?PHP MS_Model_Member::is_logged_in使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MS_Model_Member
的用法示例。
在下文中一共展示了MS_Model_Member::is_logged_in方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: register_form
/**
* Show register user form.
*
* Related Filter Hooks:
* - the_content
*
* @since 1.0.0
*
* @param string $content The page content to filter.
* @return string The filtered content.
*/
public function register_form($content)
{
// Check if the WordPress settings allow user registration.
if (!MS_Model_Member::can_register()) {
return __('Registration is currently not allowed.', MS_TEXT_DOMAIN);
}
// Do not parse the form when building the excerpt
global $wp_current_filter;
if (in_array('get_the_excerpt', $wp_current_filter)) {
return '';
}
/**
* Add-ons or other plugins can use this filter to define a completely
* different registration form. If this filter returns any content, then
* the default form will not be generated
*
* @since 1.0.0
* @var string
*/
$custom_code = apply_filters('ms_frontend_custom_registration_form', '', $this->register_errors, $this);
if ($custom_code) {
$content = $custom_code;
} else {
remove_filter('the_content', 'wpautop');
$did_form = MS_Helper_Shortcode::has_shortcode(MS_Helper_Shortcode::SCODE_REGISTER_USER, $content);
if (!$did_form) {
$scode = sprintf('[%s errors="%s"]', MS_Helper_Shortcode::SCODE_REGISTER_USER, str_replace('"', "'", $this->register_errors));
$reg_form = do_shortcode($scode);
if (!MS_Model_Member::is_logged_in()) {
$content = $reg_form;
} else {
$content .= $reg_form;
}
}
}
return apply_filters('ms_controller_frontend_register_form_content', $content, $this);
}
示例2: to_html
public function to_html()
{
ob_start();
?>
<div class="ms-account-wrapper">
<?php
if (MS_Model_Member::is_logged_in()) {
?>
<h2>
<?php
_e('Invoice', MS_TEXT_DOMAIN);
?>
</h2>
<table>
<thead>
<tr>
<th class="ms-col-invoice-no"><?php
_e('Invoice #', MS_TEXT_DOMAIN);
?>
</th>
<th class="ms-col-invoice-status"><?php
_e('Status', MS_TEXT_DOMAIN);
?>
</th>
<th class="ms-col-invoice-total"><?php
printf('%s (%s)', __('Total', MS_TEXT_DOMAIN), MS_Plugin::instance()->settings->currency);
?>
</th>
<th class="ms-col-invoice-title"><?php
_e('Membership', MS_TEXT_DOMAIN);
?>
</th>
<th class="ms-col-invoice-due"><?php
_e('Due date', MS_TEXT_DOMAIN);
?>
</th>
</tr>
</thead>
<tbody>
<?php
foreach ($this->data['invoices'] as $invoice) {
$inv_membership = MS_Factory::load('MS_Model_Membership', $invoice->membership_id);
$inv_classes = array('ms-invoice-' . $invoice->id, 'ms-subscription-' . $invoice->ms_relationship_id, 'ms-invoice-' . $invoice->status, 'ms-gateway-' . $invoice->gateway_id, 'ms-membership-' . $invoice->membership_id, 'ms-type-' . $inv_membership->type, 'ms-payment-' . $inv_membership->payment_type);
?>
<tr class="<?php
echo esc_attr(implode(' ', $inv_classes));
?>
">
<td class="ms-col-invoice-no"><?php
printf('<a href="%s">%s</a>', get_permalink($invoice->id), $invoice->get_invoice_number());
?>
</td>
<td class="ms-col-invoice-status"><?php
echo esc_html($invoice->status_text());
?>
</td>
<td class="ms-col-invoice-total"><?php
echo esc_html(MS_Helper_Billing::format_price($invoice->total));
?>
</td>
<td class="ms-col-invoice-title"><?php
echo esc_html($inv_membership->name);
?>
</td>
<td class="ms-col-invoice-due"><?php
echo esc_html(MS_Helper_Period::format_date($invoice->due_date, __('F j', MS_TEXT_DOMAIN)));
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
} else {
?>
<?php
$redirect = esc_url_raw(add_query_arg(array()));
$title = __('Your account', MS_TEXT_DOMAIN);
echo do_shortcode("[ms-membership-login redirect='{$redirect}' title='{$title}']");
?>
<?php
}
?>
</div>
<?php
$html = ob_get_clean();
$html = apply_filters('ms_compact_code', $html);
return $html;
}
示例3: logout_form
/**
* Returns HTML partial that contains the logout form
*
* @since 1.0.0
*
* @return string
*/
private function logout_form()
{
if (!MS_Model_Member::is_logged_in()) {
return '';
}
$member = MS_Model_Member::get_current_member();
extract($this->data);
if (empty($redirect_logout)) {
$redirect_logout = MS_Helper_Utility::home_url('/');
}
$yourname = sprintf(__('You are logged in as %s.', 'membership2'), ucfirst($member->name));
$yourname = apply_filters('ms_shortcode_logout_message', $yourname, $member);
$logout_text = apply_filters('ms_shortcode_logout_link_text', __('Logout', 'membership2'), $member);
$redirect_logout = apply_filters('ms_shortcode_logout_redirect', $redirect_logout, $member);
$html = sprintf('%1$s <a class="login_button" href="%2$s">%3$s</a>', $yourname, wp_logout_url($redirect_logout), $logout_text);
if (!empty($holder)) {
$html = sprintf('<%1$s class="%2$s">%3$s</%1$s>', esc_attr($holder), esc_attr($holderclass), $html);
}
return $html;
}
示例4: to_html
public function to_html()
{
ob_start();
?>
<div class="ms-account-wrapper">
<?php
if (MS_Model_Member::is_logged_in()) {
?>
<h2>
<?php
_e('Activity', MS_TEXT_DOMAIN);
?>
</h2>
<table>
<thead>
<tr>
<th class="ms-col-activity-date"><?php
_e('Date', MS_TEXT_DOMAIN);
?>
</th>
<th class="ms-col-activity-title"><?php
_e('Activity', MS_TEXT_DOMAIN);
?>
</th>
</tr>
</thead>
<tbody>
<?php
foreach ($this->data['events'] as $event) {
$ev_classes = array('ms-activity-topic-' . $event->topic, 'ms-activity-type-' . $event->type, 'ms-membership-' . $event->membership_id);
?>
<tr class="<?php
echo esc_attr(implode(' ', $ev_classes));
?>
">
<td class="ms-col-activity-date"><?php
echo esc_html(MS_Helper_Period::format_date($event->post_modified, __('F j (H:i)', MS_TEXT_DOMAIN)));
?>
</td>
<td class="ms-col-activity-title"><?php
echo esc_html($event->description);
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
} else {
$redirect = esc_url_raw(add_query_arg(array()));
$title = __('Your account', MS_TEXT_DOMAIN);
echo do_shortcode("[ms-membership-login redirect='{$redirect}' title='{$title}']");
}
?>
</div>
<?php
$html = ob_get_clean();
$html = apply_filters('ms_compact_code', $html);
return $html;
}
示例5: logout_form
/**
* Returns HTML partial that contains the logout form
*
* @since 1.0.0
*
* @return string
*/
private function logout_form()
{
if (!MS_Model_Member::is_logged_in()) {
return '';
}
$member = MS_Model_Member::get_current_member();
extract($this->data);
if (empty($redirect_logout)) {
$redirect_logout = home_url();
}
$yourname = sprintf(__('You are logged in as %s.', MS_TEXT_DOMAIN), ucfirst($member->username));
$html = sprintf('%1$s <a class="login_button" href="%2$s">%3$s</a>', $yourname, wp_logout_url($redirect_logout), __('Logout', MS_TEXT_DOMAIN));
if (!empty($holder)) {
$html = sprintf('<%1$s class="%2$s">%3$s</%1$s>', esc_attr($holder), esc_attr($holderclass), $html);
}
return $html;
}
示例6: protected_content
/**
* Display the "Membership2" message.
*
* @since 1.0.0
*
* @param mixed[] $atts Shortcode attributes.
*/
public function protected_content($atts)
{
MS_Helper_Shortcode::did_shortcode(MS_Helper_Shortcode::SCODE_PROTECTED);
global $post;
$setting = MS_Plugin::instance()->settings;
$member = MS_Model_Member::get_current_member();
if (count($member->subscriptions)) {
$sub = $member->get_subscription('priority');
$protection_msg = $setting->get_protection_message(MS_Model_Settings::PROTECTION_MSG_CONTENT, $sub->membership_id);
} else {
$protection_msg = $setting->get_protection_message(MS_Model_Settings::PROTECTION_MSG_CONTENT);
}
$html = '<div class="ms-protected-content">';
if (!empty($protection_msg)) {
$html .= $protection_msg;
}
if (!MS_Model_Member::is_logged_in()) {
$has_login_form = MS_Helper_Shortcode::has_shortcode(MS_Helper_Shortcode::SCODE_LOGIN, $post->post_content);
if (!$has_login_form) {
$scode = '[' . MS_Helper_Shortcode::SCODE_LOGIN . ']';
$html .= do_shortcode($scode);
}
}
$html .= '</div>';
return apply_filters('ms_controller_shortcode_protected_content', $html, $this);
}
示例7: to_html
public function to_html()
{
global $post;
/**
* Provide a customized account page.
*
* @since 1.0.0
*/
$html = apply_filters('ms_shortcode_custom_account', '', $this->data);
if (!empty($html)) {
return $html;
} else {
$html = '';
}
$member = MS_Model_Member::get_current_member();
$fields = $this->prepare_fields();
// Extract shortcode options.
extract($this->data);
ob_start();
?>
<div class="ms-account-wrapper">
<?php
if (MS_Model_Member::is_logged_in()) {
?>
<?php
// ================================================= MEMBERSHIPS
if ($show_membership) {
?>
<div id="account-membership">
<h2>
<?php
echo $membership_title;
if ($show_membership_change) {
$signup_url = MS_Model_Pages::get_page_url(MS_Model_Pages::MS_PAGE_REGISTER);
printf('<a href="%s" class="ms-edit-profile">%s</a>', $signup_url, $membership_change_label);
}
?>
</h2>
<?php
/**
* Add custom content right before the memberships list.
*
* @since 1.0.0
*/
do_action('ms_view_account_memberships_top', $member, $this);
if (MS_Model_Member::is_admin_user()) {
_e('You are an admin user and have access to all memberships', 'membership2');
} else {
if (!empty($this->data['subscription'])) {
?>
<table>
<tr>
<th class="ms-col-membership"><?php
_e('Membership name', 'membership2');
?>
</th>
<th class="ms-col-status"><?php
_e('Status', 'membership2');
?>
</th>
<th class="ms-col-expire-date"><?php
_e('Expire date', 'membership2');
?>
</th>
</tr>
<?php
$empty = true;
// These subscriptions have no expire date
$no_expire_list = array(MS_Model_Relationship::STATUS_PENDING, MS_Model_Relationship::STATUS_WAITING, MS_Model_Relationship::STATUS_DEACTIVATED);
// These subscriptions display the trial-expire date
$trial_expire_list = array(MS_Model_Relationship::STATUS_TRIAL, MS_Model_Relationship::STATUS_TRIAL_EXPIRED);
foreach ($this->data['subscription'] as $subscription) {
$empty = false;
$membership = $subscription->get_membership();
$subs_classes = array('ms-subscription-' . $subscription->id, 'ms-status-' . $subscription->status, 'ms-type-' . $membership->type, 'ms-payment-' . $membership->payment_type, 'ms-gateway-' . $subscription->gateway_id, 'ms-membership-' . $subscription->membership_id, $subscription->has_trial() ? 'ms-with-trial' : 'ms-no-trial');
?>
<tr class="<?php
echo esc_attr(implode(' ', $subs_classes));
?>
">
<td class="ms-col-membership"><?php
echo esc_html($membership->name);
?>
</td>
<td class="ms-col-status">
<?php
if (MS_Model_Relationship::STATUS_PENDING == $subscription->status) {
// Display a "Purchase" link when status is Pending
$code = sprintf('[%s id="%s" label="%s"]', MS_Helper_Shortcode::SCODE_MS_BUY, $membership->id, __('Pending', 'membership2'));
echo do_shortcode($code);
} else {
echo esc_html($subscription->status_text());
}
?>
</td>
<td class="ms-col-expire-date"><?php
if (in_array($subscription->status, $no_expire_list)) {
echo ' ';
} elseif (in_array($subscription->status, $trial_expire_list)) {
//.........这里部分代码省略.........