当前位置: 首页>>代码示例>>PHP>>正文


PHP is_user_logged_in函数代码示例

本文整理汇总了PHP中is_user_logged_in函数的典型用法代码示例。如果您正苦于以下问题:PHP is_user_logged_in函数的具体用法?PHP is_user_logged_in怎么用?PHP is_user_logged_in使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了is_user_logged_in函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: user_menu

 /**
  * 
  *  Woo User Menu
  */
 function user_menu()
 {
     $_Twoot_Woo = new Twoot_Woo();
     $url = $_Twoot_Woo->shop_urls();
     $user_data = get_userdata(get_current_user_id());
     $avatar = get_option('show_avatars') ? '<span class="avatar">' . get_avatar(get_current_user_id(), 20) . '</span>' : '';
     $tag = get_option('permalink_structure') == false ? '&' : '?';
     $html = '<nav id="woo-user-menu">';
     $html .= '<ul class="sf-menu clearfix">';
     if (is_user_logged_in()) {
         $html .= '<li class="my-account"><a href="' . $url['account_overview'] . '">' . $avatar . esc_attr__('Howdy, ', 'Twoot') . $user_data->display_name . '</a>';
         $html .= '<ul>';
         $html .= '<li class="account-change-pw"><a href="' . $url['account_change_pw'] . '">' . esc_attr__('Change Password', 'Twoot') . '</a></li>';
         $html .= '<li class="account-edit-adress"><a href="' . $url['account_edit_adress'] . '">' . esc_attr__('Edit Address', 'Twoot') . '</a></li>';
         $html .= '<li class="account-view-order"><a href="' . $url['account_view_order'] . '">' . esc_attr__('View Order', 'Twoot') . '</a></li>';
         $html .= '<li class="cart"><a href="' . $url['cart'] . '">' . esc_attr__('Shopping Cart', 'Twoot') . '</a></li>';
         $html .= '<li class="checkout"><a href="' . $url['checkout'] . '">' . esc_attr__('Checkout', 'Twoot') . '</a></li>';
         $html .= '</ul>';
         $html .= '</li>';
         $html .= '<li class="logout last"><a href="' . $url['logout'] . '">' . esc_attr__('Sign Out', 'Twoot') . '</a></li>';
     } else {
         if (get_option('users_can_register') && get_option('woocommerce_enable_myaccount_registration') == 'yes') {
             $html .= '<li class="register"><a href="' . $url['register'] . $tag . 'user_account=register">' . esc_attr__('Create Account', 'Twoot') . '</a></li>';
         }
         $html .= '<li class="login last"><a href="' . $url['account_overview'] . $tag . 'user_account=login">' . esc_attr__('Sign In', 'Twoot') . '</a></li>';
     }
     $html .= '</ul>';
     $html .= '</nav>';
     return $html;
 }
开发者ID:sniezekjp,项目名称:prod-fs,代码行数:34,代码来源:woo-generator.php

示例2: bbconnect_add_local_avatar_form

function bbconnect_add_local_avatar_form($args = null)
{
    // SET THE DEFAULTS TO BE OVERRIDDEN AS DESIRED
    $defaults = array('fdata' => false, 'fvalue' => false, 'faction' => false, 'ftype' => false);
    // PARSE THE INCOMING ARGS
    $args = wp_parse_args($args, $defaults);
    // EXTRACT THE VARIABLES
    extract($args, EXTR_SKIP);
    if (is_user_logged_in()) {
        if ('-edit' == $faction) {
            if (is_plugin_active('add-local-avatar/avatars.php') && false != $fdata) {
                $ala = new add_local_avatars();
                $ala->avatar_uploader_option($fdata);
            }
        } else {
            if ('-view' == $faction) {
                echo '<div class="user-avatar-wrap"><div id="user-avatar-display-image">' . get_avatar($fdata->ID, 150) . '</div></div>';
            } else {
            }
        }
    } else {
        if (false != $fdata) {
            echo '<div class="user-avatar-wrap"><div id="user-avatar-display-image">' . get_avatar($fdata->ID, 150) . '</div></div>';
        }
    }
}
开发者ID:whatthefork,项目名称:bbconnect,代码行数:26,代码来源:bbconnect-user-plugins.php

示例3: ajax_refresh_static_posts

 function ajax_refresh_static_posts()
 {
     check_ajax_referer('refreshstaticposts');
     if (isset($_POST['number'])) {
         $number = absint($_POST['number']);
         $action = sanitize_text_field($_POST['action']);
         $name = sanitize_text_field($_POST['name']);
         //Get the SRP widgets
         $settings = get_option($name);
         $widget = $settings[$number];
         //Get the new post IDs
         $widget = $this->build_posts(intval($widget['postlimit']), $widget);
         $post_ids = $widget['posts'];
         //Save the settings
         $settings[$number] = $widget;
         //Only save if user is admin
         if (is_user_logged_in() && current_user_can('administrator')) {
             update_option($name, $settings);
             //Let's clean up the cache
             //Update WP Super Cache if available
             if (function_exists("wp_cache_clean_cache")) {
                 @wp_cache_clean_cache('wp-cache-');
             }
         }
         //Build and send the response
         die($this->print_posts($post_ids, false));
     }
     exit;
 }
开发者ID:NishantNick,项目名称:bcapps,代码行数:29,代码来源:static-random-posts.php

示例4: jobman_display_login

function jobman_display_login()
{
    global $current_user;
    get_currentuserinfo();
    $options = get_option('jobman_options');
    $content = '';
    if (is_user_logged_in()) {
        $loggedin_html = '<div id="jobman_loggedin"><span class="message">';
        $loggedin_html .= apply_filters('jobman_loggedin_msg', sprintf(__('Welcome, %1s!', 'jobman'), $current_user->display_name));
        $loggedin_html .= '</span>';
        $loggedin_html .= '</div>';
        $content .= apply_filters('jobman_loggedin_html', $loggedin_html);
    } else {
        $login_html = '<form action="" method="post">';
        $login_html .= '<div id="jobman_login">';
        $login_html .= '<span class="message">';
        $login_html .= apply_filters('jobman_login_msg', __("If you've registered with us previously, please login now. If you'd like to register, please click the 'Register' link below.", 'jobman'));
        $login_html .= '</span>';
        $login_html .= '<label class="username" for="jobman_username">' . __('Username', 'jobman') . '</label>: ';
        $login_html .= '<input type="text" name="jobman_username" id="jobman_username" class="username" />';
        $login_html .= '<label class="password" for="jobman_password">' . __('Password', 'jobman') . '</label>: ';
        $login_html .= '<input type="password" name="jobman_password" id="jobman_password" class="password" />';
        $login_html .= '<input class="submit" type="submit" name="submit" value="' . __('Login', 'jobman') . '" />';
        $login_html .= '<span><a href="' . get_page_link($options['register_page']) . '">' . __('Register', 'jobman') . '</a> | <a href="' . wp_lostpassword_url(urlencode(jobman_current_url())) . '">' . __('Forgot your password?', 'jobman') . '</a></span></div>';
        $login_html .= '</form>';
        $content .= apply_filters('jobman_login_html', $login_html);
    }
    return $content;
}
开发者ID:spontaneouslypresent,项目名称:job-manager,代码行数:29,代码来源:frontend-user.php

示例5: amr_check_if_widget_debug

function amr_check_if_widget_debug()
{
    global $said;
    // only do these debug if we are logged in and are the administrator
    if (is_admin()) {
        return false;
    }
    // if running in backend, then do not do debug.  20151217
    if (!is_user_logged_in() or !current_user_can('administrator')) {
        return false;
    }
    if (isset($_REQUEST['do_widget_debug'])) {
        if (empty($said)) {
            $said = true;
        } else {
            return true;
        }
        $url_without_debug_query = esc_url(remove_query_arg('do_widget_debug'));
        $eek = '<a href="' . $url_without_debug_query . '">Remove debug</a>';
        echo '<br/>Note: Debug help is only shown to a logged-in Administrator.' . $eek . '<br />';
        $text = amr_show_shortcode_widget_possibilities();
        echo $text;
        return true;
    } else {
        return false;
    }
}
开发者ID:gpreets,项目名称:newlab,代码行数:27,代码来源:amr-utilities.php

示例6: wpcf7_mathcaptcha_shortcode_handler

function wpcf7_mathcaptcha_shortcode_handler($tag)
{
    if (!is_user_logged_in() || is_user_logged_in() && !Math_Captcha()->options['general']['hide_for_logged_users']) {
        $tag = new WPCF7_Shortcode($tag);
        if (empty($tag->name)) {
            return '';
        }
        $validation_error = wpcf7_get_validation_error($tag->name);
        $class = wpcf7_form_controls_class($tag->type);
        if ($validation_error) {
            $class .= ' wpcf7-not-valid';
        }
        $atts = array();
        $atts['size'] = 2;
        $atts['maxlength'] = 2;
        $atts['class'] = $tag->get_class_option($class);
        $atts['id'] = $tag->get_option('id', 'id', true);
        $atts['tabindex'] = $tag->get_option('tabindex', 'int', true);
        $atts['aria-required'] = 'true';
        $atts['type'] = 'text';
        $atts['name'] = $tag->name;
        $atts['value'] = '';
        $atts = wpcf7_format_atts($atts);
        $mc_form = Math_Captcha()->core->generate_captcha_phrase('cf7');
        $mc_form[$mc_form['input']] = '<input %2$s />';
        $math_captcha_title = apply_filters('math_captcha_title', Math_Captcha()->options['general']['title']);
        return sprintf((empty($math_captcha_title) ? '' : $math_captcha_title) . '<span class="wpcf7-form-control-wrap %1$s">' . $mc_form[1] . $mc_form[2] . $mc_form[3] . '%3$s</span><input type="hidden" value="' . (Math_Captcha()->core->session_number - 1) . '" name="' . $tag->name . '-sn" />', $tag->name, $atts, $validation_error);
    }
}
开发者ID:developmentDM2,项目名称:The-Haute-Mess,代码行数:29,代码来源:contact-form-7.php

示例7: Dashboard

 function Dashboard()
 {
     global $wp_query;
     if (!is_user_logged_in()) {
         include wpdm_tpl_path('wpdm-be-member.php');
         return;
     }
     $udb_page = isset($wp_query->query_vars['udb_page']) ? $wp_query->query_vars['udb_page'] : '';
     $udb_page_parts = explode("/", $udb_page);
     $udb_page = $udb_page_parts[0];
     if (isset($this->dashboard_menu[$udb_page]['callback'])) {
         $dashboard_contents = call_user_func($this->dashboard_menu[$udb_page]['callback'], $udb_page_parts);
     } else {
         if (isset($this->dashboard_menu[$udb_page]['shortcode'])) {
             $dashboard_contents = do_shortcode($this->dashboard_menu[$udb_page]['shortcode']);
         } else {
             if (isset($this->dashboard_menu_actions[$udb_page])) {
                 $dashboard_contents = call_user_func($this->dashboard_menu_actions[$udb_page], $udb_page_parts);
             }
         }
     }
     //else if(isset($this->dashboard_menu_actions[$udb_page]['shortcode']))
     //    $dashboard_contents = do_shortcode($this->dashboard_menu_actions[$udb_page]['shortcode']);
     include_once wpdm_tpl_path('wpdm-dashboard.php');
 }
开发者ID:RA2WP,项目名称:RA2WP,代码行数:25,代码来源:class.UserDashboard.php

示例8: __construct

 /**
  * Constructor
  * @since 1.8
  * @uses string $pagenow
  * @uses bool $show_avatars
  * @uses object $wpua_admin
  * @uses bool $wpua_allow_upload
  * @uses add_action()
  * @uses add_filterI]()
  * @uses is_admin()
  * @uses is_user_logged_in()
  * @uses wpua_is_author_or_above()
  * @uses wpua_is_menu_page()
  */
 public function __construct()
 {
     global $pagenow, $show_avatars, $wpua_admin, $wpua_allow_upload;
     // Add WPUA to profile for users with permission
     if ($this->wpua_is_author_or_above() || (bool) $wpua_allow_upload == 1 && is_user_logged_in()) {
         // Profile functions and scripts
         add_action('show_user_profile', array('wp_user_avatar', 'wpua_action_show_user_profile'));
         add_action('personal_options_update', array($this, 'wpua_action_process_option_update'));
         add_action('edit_user_profile', array('wp_user_avatar', 'wpua_action_show_user_profile'));
         add_action('edit_user_profile_update', array($this, 'wpua_action_process_option_update'));
         add_action('user_new_form', array($this, 'wpua_action_show_user_profile'));
         add_action('user_register', array($this, 'wpua_action_process_option_update'));
         // Admin scripts
         $pages = array('profile.php', 'options-discussion.php', 'user-edit.php', 'user-new.php');
         if (in_array($pagenow, $pages) || $wpua_admin->wpua_is_menu_page()) {
             add_action('admin_enqueue_scripts', array($this, 'wpua_media_upload_scripts'));
         }
         // Front pages
         if (!is_admin()) {
             add_action('show_user_profile', array('wp_user_avatar', 'wpua_media_upload_scripts'));
             add_action('edit_user_profile', array('wp_user_avatar', 'wpua_media_upload_scripts'));
         }
         if (!$this->wpua_is_author_or_above()) {
             // Upload errors
             add_action('user_profile_update_errors', array($this, 'wpua_upload_errors'), 10, 3);
             // Prefilter upload size
             add_filter('wp_handle_upload_prefilter', array($this, 'wpua_handle_upload_prefilter'));
         }
     }
     add_filter('media_view_settings', array($this, 'wpua_media_view_settings'), 10, 1);
 }
开发者ID:luskyj89,项目名称:mt-wordpress,代码行数:45,代码来源:class-wp-user-avatar.php

示例9: edd_has_user_purchased

/**
 * Has User Purchased
 *
 * Checks to see if a user has purchased a download.
 *
 * @access      public
 * @since       1.0
 * @param       int $user_id - the ID of the user to check
 * @param       array $downloads - Array of IDs to check if purchased. If an int is passed, it will be converted to an array
 * @param       int $variable_price_id - the variable price ID to check for
 * @return      boolean - true if has purchased, false otherwise
 */
function edd_has_user_purchased($user_id, $downloads, $variable_price_id = null)
{
    if (!is_user_logged_in()) {
        return false;
    }
    // At some point this should support email checking
    $users_purchases = edd_get_users_purchases($user_id);
    $return = false;
    if (!is_array($downloads)) {
        $downloads = array($downloads);
    }
    if ($users_purchases) {
        foreach ($users_purchases as $purchase) {
            $purchased_files = edd_get_payment_meta_downloads($purchase->ID);
            if (is_array($purchased_files)) {
                foreach ($purchased_files as $download) {
                    if (in_array($download['id'], $downloads)) {
                        $variable_prices = edd_has_variable_prices($download['id']);
                        if ($variable_prices && !is_null($variable_price_id) && $variable_price_id !== false) {
                            if (isset($download['options']['price_id']) && $variable_price_id == $download['options']['price_id']) {
                                return true;
                            } else {
                                $return = false;
                            }
                        } else {
                            $return = true;
                        }
                    }
                }
            }
        }
    }
    return $return;
}
开发者ID:bangtienmanh,项目名称:Easy-Digital-Downloads,代码行数:46,代码来源:user-functions.php

示例10: ForgotPassForm

    public function ForgotPassForm()
    {
        if (!session_id()) {
            @session_start();
        }
        $this->error_message();
        if (!is_user_logged_in()) {
            ?>
			<div id="log_forms forgot_pass">
			<form name="forgot" id="forgot" method="post" action="">
			<input type="hidden" name="option" value="afo_forgot_pass" />
			<div class="form-group">
				<label for="email"><?php 
            _e('Email', 'login-sidebar-widget');
            ?>
 </label>
				<input type="text" name="user_username" required="required"/>
			</div>
			<div class="form-group"><label for="login">&nbsp;</label><input name="forgot" type="submit" value="<?php 
            _e('Submit', 'login-sidebar-widget');
            ?>
" /></div>
			<div class="form-group forgot-text"><?php 
            _e('Please enter your email. The password reset link will be provided in your email.', 'login-sidebar-widget');
            ?>
</div>
			</form>
			</div>
		<?php 
        }
    }
开发者ID:cherbst,项目名称:login-sidebar-widget,代码行数:31,代码来源:forgot_pass_class.php

示例11: widget

    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $not_login = esc_attr($instance['not_login']);
        $register_like_button = esc_attr($instance['register_like_button']);
        if (empty($not_login) || !is_user_logged_in()) {
            echo $before_widget;
            if ($title) {
                echo $before_title . esc_attr($title) . $after_title;
            }
            ?>
				<div class="widget_login">
					<?php 
            if (!is_user_logged_in()) {
                echo '<div class="form-style form-style-2">
							' . do_shortcode("[ask_login" . (isset($register_like_button) && $register_like_button == "on" ? " register='button'" : "") . "]");
                if (empty($register_like_button)) {
                    echo '<ul class="login-links login-links-r">
									<li><a href="#">' . __("Register", "vbegy") . '</a></li>
								</ul>';
                }
                echo '<div class="clearfix"></div>
						</div>';
            } else {
                echo do_shortcode("[ask_login]");
            }
            ?>
				</div>
				<?php 
            echo $after_widget;
        }
    }
开发者ID:bunnywong,项目名称:freshlinker,代码行数:33,代码来源:login.php

示例12: __construct

 public function __construct()
 {
     // Objects
     $this->oBase64 = new FetchTweets_Base64();
     // For transient (cache) renewal events
     add_action('fetch_tweets_action_transient_renewal', array($this, '_replyToRenewTransients'));
     // For transient (cache) formatting events - adds oEmbed elements.
     add_action('fetch_tweets_action_transient_add_oembed_elements', array($this, '_replyToAddOEmbedElements'));
     // For SimplePie cache renewal events
     add_action('fetch_tweets_action_simplepie_renew_cache', array($this, '_replyToRenewSimplePieCaches'));
     // This must be called after the above action hooks are added.
     if ('intense' == $GLOBALS['oFetchTweets_Option']->aOptions['cache_settings']['caching_mode']) {
         new FetchTweets_Cron(apply_filters('fetch_tweets_filter_plugin_cron_actions', array('fetch_tweets_action_transient_renewal', 'fetch_tweets_action_transient_add_oembed_elements', 'fetch_tweets_action_simplepie_renew_cache')));
     } else {
         if (FetchTweets_Cron::isBackground()) {
             exit;
         }
     }
     // Redirects
     if (isset($_GET['fetch_tweets_link']) && $_GET['fetch_tweets_link']) {
         $_oRedirect = new FetchTweets_Redirects();
         $_oRedirect->go($_GET['fetch_tweets_link']);
         // will exit there.
     }
     // Draw the cached image.
     if (isset($_GET['fetch_tweets_image']) && $_GET['fetch_tweets_image'] && is_user_logged_in()) {
         $_oImageLoader = new FetchTweets_ImageHandler('FTWS');
         $_oImageLoader->draw($_GET['fetch_tweets_image']);
         exit;
     }
     // For the activation hook
     add_action('fetch_tweets_action_setup_transients', array($this, '_replyToSetUpTransients'));
 }
开发者ID:deronjohnson,项目名称:fuzzy,代码行数:33,代码来源:FetchTweets_Event_.php

示例13: wpbo_page_has_popup

/**
 * Check if a popup is available for the current page.
 *
 * The function checks, in this order, if a popup is available for:
 * - The current post
 * - The current post type
 * - The whole site
 *
 * @since  1.0.0
 *
 * @param int $post_id Optional post ID to check for popup availability
 *
 * @return bool|int Popup ID if a popup is available, false otherwise
 */
function wpbo_page_has_popup($post_id = 0)
{
    /**
     * Checks in order:
     *
     * 1. Front-page
     * 2. Homepage
     * 3. Archives
     *  3.1 Search
     *  3.2 Post type
     * 4. 404
     * 5. Singular
     */
    $post_id = wpbo_get_post_id($post_id);
    /**
     * First of all let's check if the user is an admin
     * and if popups are hidden for admins.
     */
    if (is_user_logged_in() && current_user_can('administrator') && true === (bool) wpbo_get_option('hide_admins', false)) {
        return false;
    }
    // Try to get the popup from the cache
    $popup_id = wpbo_get_cached_popup($post_id);
    if (false === $popup_id) {
        $popup_id = wpbo_get_popup($post_id);
    }
    // Cache popup ID to avoid calculating again on page refresh */
    if (false !== $popup_id) {
        wpbo_cache_popup($popup_id, $post_id);
    }
    return $popup_id;
}
开发者ID:simfatic,项目名称:BetterOptin,代码行数:46,代码来源:functions-popup.php

示例14: bp_members_admin_bar_my_account_menu

/**
 * Add the "My Account" menu and all submenus.
 *
 * @since 1.6.0
 *
 * @todo Deprecate WP 3.2 Toolbar compatibility when we drop 3.2 support
 */
function bp_members_admin_bar_my_account_menu()
{
    global $wp_admin_bar;
    // Bail if this is an ajax request
    if (defined('DOING_AJAX')) {
        return;
    }
    // Logged in user
    if (is_user_logged_in()) {
        $bp = buddypress();
        // Stored in the global so we can add menus easily later on
        $bp->my_account_menu_id = 'my-account-buddypress';
        // Create the main 'My Account' menu
        $wp_admin_bar->add_menu(array('id' => $bp->my_account_menu_id, 'group' => true, 'title' => __('Edit My Profile', 'buddypress'), 'href' => bp_loggedin_user_domain(), 'meta' => array('class' => 'ab-sub-secondary')));
        // Show login and sign-up links
    } elseif (!empty($wp_admin_bar)) {
        add_filter('show_admin_bar', '__return_true');
        // Create the main 'My Account' menu
        $wp_admin_bar->add_menu(array('id' => 'bp-login', 'title' => __('Log in', 'buddypress'), 'href' => wp_login_url(bp_get_requested_url())));
        // Sign up
        if (bp_get_signup_allowed()) {
            $wp_admin_bar->add_menu(array('id' => 'bp-register', 'title' => __('Register', 'buddypress'), 'href' => bp_get_signup_page()));
        }
    }
}
开发者ID:jasonmcalpin,项目名称:BuddyPress,代码行数:32,代码来源:bp-members-adminbar.php

示例15: widget

    /**
     * Render the widget.
     *
     * @see WP_Widget::widget() for a description of parameters.
     *
     * @param array $args See {@WP_Widget::widget()}.
     * @param array $args See {@WP_Widget::widget()}.
     */
    public function widget($args, $instance)
    {
        if (!is_user_logged_in()) {
            return;
        }
        // Don't display the widget if there are no Notices to show
        $notices = BP_Messages_Notice::get_active();
        if (empty($notices)) {
            return;
        }
        extract($args);
        $title = !empty($instance['title']) ? $instance['title'] : '';
        $title = apply_filters('widget_title', $title, $instance);
        echo $before_widget;
        echo $before_title . $title . $after_title;
        ?>

		<div class="bp-site-wide-message">
			<?php 
        bp_message_get_notices();
        ?>
		</div>

		<?php 
        echo $after_widget;
    }
开发者ID:eresyyl,项目名称:mk,代码行数:34,代码来源:bp-messages-widgets.php


注:本文中的is_user_logged_in函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。