function add_login_logout_link($items, $args)
 {
     if (is_user_logged_in()) {
         $items .= '<li><a href="' . esc_url(wp_logout_url('/')) . '">Salir</a></li>';
     }
     return $items;
 }
Exemple #2
0
 function ac_redirect_on_logout($links)
 {
     if (in_array('redirect_on_logout', (array) self::$options->general_settings)) {
         $links[15] = '| <a href="' . wp_logout_url(home_url()) . '" title="Log Out">Log Out</a>';
     }
     return $links;
 }
Exemple #3
0
 /**
  * create the widget's public face
  */
 public function widget($args, $instance)
 {
     if (!isset($instance['title'])) {
         $instance['title'] = '';
     }
     $text = __('Admin', 'teaberry');
     $title = $instance['title'] == '' ? $text : $instance['title'];
     $title = apply_filters('widget_title', $title);
     /* before and after widget args */
     echo $args['before_widget'];
     if (!empty($title)) {
         echo $args['before_title'] . $title . $args['after_title'];
     }
     echo '<ul>';
     echo wp_register('<li>', '</li>', false);
     $redirect = is_home() ? false : get_permalink();
     /* show different link based on user status */
     if (is_user_logged_in()) {
         $url = wp_logout_url($redirect);
         $text = __('Logout', 'teaberry');
         echo '<li><a href="' . $url . '" title="Logout">' . $text . '</a></li>';
     } else {
         $url = wp_login_url($redirect);
         $text = __('Login', 'teaberry');
         echo '<li><a href="' . $url . '" title="Login">' . $text . '</a></li>';
     }
     echo '</ul>';
     echo $args['after_widget'];
 }
function lrl_custom_form_filters($args = array(), $post_id = null)
{
    global $id;
    $options = get_option('bootstrap_theme');
    $custom_comment_message = isset($options['comment_form_text']) ? $options['comment_form_text'] : null;
    if (null === $post_id) {
        $post_id = $id;
    } else {
        $id = $post_id;
    }
    $commenter = wp_get_current_commenter();
    $user = wp_get_current_user();
    $user_identity = $user->exists() ? $user->display_name : '';
    $req = get_option('require_name_email');
    $aria_req = $req ? " aria-required='true'" : '';
    $fields = array('author' => '
			<div class="comment-form-author clearfix">' . ' ' . '<input id="author" name="author" placeholder="Enter your Name..." type="text" value="' . esc_attr($commenter['comment_author']) . '" size="30"' . $aria_req . ' />
			</div>', 'email' => '
			<div class="comment-form-email clearfix">
			' . '<input id="email" name="email" placeholder="Enter your Email Address..." type="text" value="' . esc_attr($commenter['comment_author_email']) . '" size="30"' . $aria_req . ' />
			</div>', 'url' => '
			<div class="comment-form-url clearfix">
			' . '<input id="url" name="url" placeholder="Enter your Website..." type="text" value="' . esc_attr($commenter['comment_author_url']) . '" size="30" />
			</div>');
    $required_text = sprintf(' ' . __('Required fields are marked %s', 'bootstrap'), '<span class="required">*</span>');
    $defaults = array('fields' => apply_filters('comment_form_default_fields', $fields), 'comment_field' => '<textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea>', '', 'must_log_in' => '<p class="must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', 'bootstrap'), wp_login_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</p>', 'logged_in_as' => '<p class="logged-in-as">' . sprintf(__('Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>', 'bootstrap'), admin_url('profile.php'), $user_identity, wp_logout_url(apply_filters('the_permalink', get_permalink($post_id)))) . '</p>', 'comment_notes_before' => null, 'comment_notes_after' => null, 'id_form' => 'commentform', 'id_submit' => 'submit', 'title_reply' => sprintf(__('Have a Comment?', 'bootstrap'), apply_filters('lrl_comment_form_message', $custom_comment_message)), 'title_reply_to' => __('Leave a Reply to %s', 'bootstrap'), 'cancel_reply_link' => __('Cancel', 'bootstrap'), 'label_submit' => __('Submit Comment', 'bootstrap'));
    return $defaults;
}
/**
 * Handle redirects before content is output - hooked into template_redirect so is_page works.
 *
 * @return void
 */
function wc_template_redirect()
{
    global $wp_query, $wp;
    // When default permalinks are enabled, redirect shop page to post type archive url
    if (!empty($_GET['page_id']) && get_option('permalink_structure') == "" && $_GET['page_id'] == wc_get_page_id('shop')) {
        wp_safe_redirect(get_post_type_archive_link('product'));
        exit;
    } elseif (is_page(wc_get_page_id('checkout')) && sizeof(WC()->cart->get_cart()) == 0 && empty($wp->query_vars['order-pay']) && !isset($wp->query_vars['order-received'])) {
        wp_redirect(get_permalink(wc_get_page_id('cart')));
        exit;
    } elseif (isset($wp->query_vars['customer-logout'])) {
        wp_redirect(str_replace('&amp;', '&', wp_logout_url(get_permalink(wc_get_page_id('myaccount')))));
        exit;
    } elseif (is_search() && is_post_type_archive('product') && apply_filters('woocommerce_redirect_single_search_result', true) && $wp_query->found_posts == 1) {
        $product = wc_get_product($wp_query->post);
        if ($product->is_visible()) {
            wp_safe_redirect(get_permalink($product->id), 302);
            exit;
        }
    } elseif (is_add_payment_method_page()) {
        WC()->payment_gateways();
    } elseif (is_checkout()) {
        // Buffer the checkout page
        ob_start();
        // Ensure gateways and shipping methods are loaded early
        WC()->payment_gateways();
        WC()->shipping();
    }
}
function wepromotethis_search_form($form)
{
    global $hop;
    $plink = "http://www.wepromotethis.com/hop/" . $hop;
    $eplink = urlencode($plink);
    $socialLink = '';
    if (function_exists('display_social4i')) {
        $socialLink = display_social4i("large", "align-right");
        // Modify $socialLink so that the twitter, facebook, and google plus buttons display properly
        $socialLink = preg_replace('/data-url="([^"]+)"/i', 'data-url="' . $plink . '" ', $socialLink);
        $socialLink = preg_replace('/data-counturl="([^"]+)"/i', 'data-counturl="wepromotethis.com" ', $socialLink);
        $socialLink = preg_replace('/data-text="([^"]+)"/i', 'data-text="I just turned my computer into an ATM. Thanks #WPT !!! " ', $socialLink);
        $socialLink = preg_replace('/(<g:plusone.* href=)"([^"]+)"/i', '$1"https://plus.google.com/106500919528675853199"', $socialLink);
        $socialLink = preg_replace('/(<fb:like.* href=|fb-like.* data-href=)"([^"]+)"/i', '$1"https://www.facebook.com/pages/WePromoteThiscom/367519556648222?ref=hl"', $socialLink);
    }
    if (function_exists('theme_my_login')) {
        //global $theme_my_login;
        //$themeMyLoginForm = $theme_my_login -> shortcode(wp_parse_args('[widget_theme_my_login]'));
        //$themeMyLoginForm = $theme_my_login -> shortcode(wp_parse_args('[theme_my_login]'));
        ob_start();
        theme_my_login(wp_parse_args('[widget_theme_my_login]'));
        //theme_my_login(wp_parse_args('[theme_my_login]'));
        $themeMyLoginForm = ob_get_contents();
        ob_end_clean();
    }
    //$themeMyLoginForm = wp_login_form( array('echo' => false) );
    $form .= "<div class='register_button wpt_loggedout'>\r\n    <div>\r\n    " . $themeMyLoginForm . "\r\n    </div>\r\n    </div>\r\n\r\n    <div class='logout_button wpt_loggedin'>\r\n    <a href='" . wp_logout_url(home_url()) . "' title='Logout'>Logout</a>\r\n    </div>\r\n    \r\n    <div class='sociallink_page_header'>\r\n    " . $socialLink . "\r\n    </div>\r\n    ";
    return $form;
}
function ellak_social_links()
{
    ?>
	<div class="header-login">
				<?php 
    if (is_user_logged_in()) {
        ?>
				<a href="<?php 
        echo esc_url(get_edit_user_link());
        ?>
"><?php 
        _e('Ο λογαριασμός μου', 'gpchild-ellak');
        ?>
</a>
				<a href="<?php 
        echo esc_url(wp_logout_url(get_permalink()));
        ?>
"><?php 
        _e('Αποσύνδεση', 'gpchild-ellak');
        ?>
</a>

				<?php 
    } else {
        if (get_option('users_can_register')) {
            ?>
				<a href="<?php 
            echo esc_url(wp_registration_url());
            ?>
"><?php 
            _e('Εγγραφή', 'gpchild-ellak');
            ?>
</a>
				<?php 
        }
        // get_option
        ?>

				<a href="<?php 
        echo esc_url(wp_login_url());
        ?>
"><?php 
        _e('Συνδεση', 'gpchild-ellak');
        ?>
</a>

				<?php 
    }
    // is_user_logged_in
    ?>
			</div>
	<div class="header-social-links">
		<ul class="social-links">
			<li class="social-link-facebook"><a href="https://www.facebook.com/CreativeCommonsGreece" target="_blank"><span>Facebook</span></a></li>
			<li class="social-link-twitter"><a href="https://www.twitter.com/cc_greece" target="_blank"><span>Twitter</span></a></li>
			<li class="social-link-rss"><a href="https://ellak.gr/rss-feeds/" target="_blank"><span>RSS</span></a></li>
		</ul>
	</div><!-- .header-social-links -->
<?php 
}
Exemple #8
0
function evc_lock_unlock($url)
{
    global $user_ID, $post;
    $options = get_option('evc_lock');
    if (!$options || !isset($options['vk_lock_text'])) {
        $options['vk_lock_text'] = 'Чтобы увидеть скрытое содержимое, нужно';
    }
    $id = evc_get_vk_id($url);
    if (!$id) {
        return 'Cant get vk item id';
    }
    // Cant get vk item id
    if (isset($_COOKIE['vkUnLock' . $id]) && $_COOKIE['vkUnLock' . $id] == $id) {
        return $id;
    }
    if (!is_user_logged_in()) {
        // Need Enter via VK and Subscribe
        return '<p>' . $options['vk_lock_text'] . ' <a href= "' . evc_auth_login_url() . '" title = "Войти на сайт через ВКонтакте">войти на сайт через ВКонтакте</a>.</p>';
    }
    if (false == ($vk_user_id = get_user_meta($user_ID, 'vk_item_id', true))) {
        // Need Enter via VK
        return '<p>' . $options['vk_lock_text'] . ' <a href= "' . wp_logout_url(get_permalink($post->ID)) . '" title = "Выйти из своей учетной записи">выйти</a> и <a href= "' . evc_auth_login_url() . '" title = "Войти на сайт через ВКонтакте">войти на сайт через ВКонтакте</a>.</p>';
    }
    if (!isset($_COOKIE['vkUnLock' . $id]) || $_COOKIE['vkUnLock' . $id] != $id) {
        //$id = ($id < 0) ? -1 * $id : $id;
        $is_member = evc_vkapi_groups_is_member(array('group_id' => $id < 0 ? -1 * $id : $id, 'user_id' => $vk_user_id));
        if (!$is_member) {
            // Need Subscribe
            return '<p>' . $options['vk_lock_text'] . ' ' . evc_widget_subscribe(null, array(), $id, 'evc-vk-lock') . '</p>';
        }
        //setcookie("vkUnLock", $id, time() + DAY_IN_SECONDS);
    }
    return $id;
}
        protected function get_wp_login_form($args = array())
        {
            $defaults = array('echo' => false, 'redirect' => (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'form_id' => 'loginform', 'label_username' => _x('Username', 'shortcode simple login', 'the7mk2'), 'label_password' => _x('Password', 'shortcode simple login', 'the7mk2'), 'label_remember' => _x('Remember Me', 'shortcode simple login', 'the7mk2'), 'label_log_in' => _x('Log In', 'shortcode simple login', 'the7mk2'), 'id_username' => 'user_login', 'id_password' => 'user_pass', 'id_remember' => 'rememberme', 'id_submit' => 'wp-submit', 'remember' => true, 'value_username' => '', 'value_remember' => false);
            $args = wp_parse_args($args, apply_filters('login_form_defaults', $defaults));
            if (is_user_logged_in()) {
                global $user_identity;
                get_currentuserinfo();
                $form = '<p class="logged-in-as">' . sprintf(_x('Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>', 'shortcode simple login', 'the7mk2'), get_edit_user_link(), $user_identity, wp_logout_url(apply_filters('the_permalink', get_permalink()))) . '</p>';
            } else {
                $login_form_top = apply_filters('login_form_top', '', $args);
                $login_form_middle = apply_filters('login_form_middle', '', $args);
                $login_form_bottom = apply_filters('login_form_bottom', '', $args);
                $form = '
					<form name="' . $args['form_id'] . '" id="' . $args['form_id'] . '" action="' . esc_url(site_url('wp-login.php', 'login_post')) . '" method="post">
						' . $login_form_top . '
						<p class="login-username">
							<label class="assistive-text" for="' . esc_attr($args['id_username']) . '">' . esc_html($args['label_username']) . '</label>
							<input type="text" name="log" placeholder="' . esc_attr($args['label_username']) . '" id="' . esc_attr($args['id_username']) . '" class="input" value="' . esc_attr($args['value_username']) . '" size="20" />
						</p>
						<p class="login-password">
							<label class="assistive-text" for="' . esc_attr($args['id_password']) . '">' . esc_html($args['label_password']) . '</label>
							<input type="password" name="pwd" placeholder="' . esc_attr($args['label_password']) . '" id="' . esc_attr($args['id_password']) . '" class="input" value="" size="20" />
						</p>
						' . $login_form_middle . '
						' . ($args['remember'] ? '<p class="login-remember"><label><input name="rememberme" type="checkbox" id="' . esc_attr($args['id_remember']) . '" value="forever"' . ($args['value_remember'] ? ' checked="checked"' : '') . ' /> ' . esc_html($args['label_remember']) . '</label></p>' : '') . '
						<p class="login-submit">
							<input type="submit" name="wp-submit" id="' . esc_attr($args['id_submit']) . '" class="button-primary" value="' . esc_attr($args['label_log_in']) . '" />
							<input type="hidden" name="redirect_to" value="' . esc_url($args['redirect']) . '" />
						</p>
						' . $login_form_bottom . '
					</form>';
            }
            return $form;
        }
Exemple #10
0
function zm_ajax_login_register_localized_js()
{
    $redirect_url = get_option('ajax_login_register_redirect');
    // Just use the current page
    if (empty($redirect_url)) {
        global $wp;
        $formatted_url = trailingslashit(add_query_arg('', '', network_site_url($wp->request)));
    } elseif (strpos($redirect_url, 'http') === false) {
        $formatted_url = network_site_url($redirect_url);
    } else {
        $formatted_url = esc_url($redirect_url);
    }
    $redirect_url = apply_filters('zm_ajax_login_redirect', $formatted_url);
    $width = array('default' => 265, 'wide' => 440, 'extra_buttons' => 666, 'mobile' => 300);
    $style = get_option('ajax_login_register_default_style');
    $fb_button = get_option('ajax_login_register_facebook');
    if ($style == 'wide' && $fb_button) {
        $key = 'extra_buttons';
    } elseif (wp_is_mobile()) {
        $key = 'mobile';
    } elseif ($style == 'wide') {
        $key = 'wide';
    } else {
        $key = 'default';
    }
    $defaults = array('ajaxurl' => admin_url("admin-ajax.php"), 'login_handle' => get_option('ajax_login_register_advanced_usage_login'), 'register_handle' => get_option('ajax_login_register_advanced_usage_register'), 'redirect' => $redirect_url, 'dialog_width' => $width[$key], 'match_error' => AjaxLogin::status('passwords_do_not_match', 'description'), 'is_user_logged_in' => is_user_logged_in() ? 1 : 0, 'wp_logout_url' => wp_logout_url(site_url()), 'logout_text' => __('Logout', 'ajax_login_register'), 'close_text' => __('Close', 'ajax_login_register'), 'pre_load_forms' => get_option('ajax_login_register_pre_load_forms'));
    $localized = apply_filters('zm_ajax_login_register_localized_js', $defaults);
    return $localized;
}
Exemple #11
0
function url_shortcode($atts)
{
    // Attributes
    extract(shortcode_atts(array('type' => '', 'id' => '0', 'path' => '', 'title' => '', 'action' => '', 'class' => ''), $atts));
    if (!$id && !$path && !$title && !$action) {
        return home_url();
    } else {
        $page_id = 0;
        if ($id && is_numeric($id)) {
            $page_id = $id;
        }
        if ($path != '') {
            $page_id = get_page_by_path($path);
        }
        if ($title != '') {
            $page_id = get_page_by_title($title);
        }
        if ($action != '') {
            if ($action == 'logout') {
                return wp_logout_url();
            }
        }
        if ($page_id) {
            return get_page_link($page_id);
        } else {
            return null;
        }
    }
}
Exemple #12
0
/**
 * Include the logout link template
 * @param  string $label   	Link text. Default: 'Logout'
 * @param  string $classes 	Classes to add to the <a> tag. Default: 'logout'
 */
function tpl_link_logout($label = null, $classes = 'logout')
{
    if (is_null($label)) {
        $label = __('Logout', 'theme');
    }
    tpl('link', 'login', array('url' => wp_logout_url(), 'label' => $label, 'classes' => $classes));
}
    function widget($args, $instance)
    {
        global $wpdb;
        $user_id = get_current_user_id();
        $page_name = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_title ='" . get_option('wkmp_seller_login_page_tile') . "'");
        $seller_info = $wpdb->get_var("SELECT user_id FROM " . $wpdb->prefix . "mpsellerinfo WHERE user_id = '" . $user_id . "' and seller_value='1'");
        if ($seller_info > 0) {
            do_action('chat_with_me');
            echo '<div class="wk_seller"><h2>' . get_option('wkmp_seller_menu_tile') . '</h2>';
            echo '<ul class="wk_sellermenu">';
            echo '<li class="selleritem"><a href="' . home_url("?page_id=" . $page_name) . '&page=mpProfile">My Profile</a></li>
				 <li class="selleritem"><a href="' . home_url("?page_id=" . $page_name) . '&page=Product">Add Product</a></li>
				 <li class="selleritem"><a href="' . home_url("?page_id=" . $page_name) . '&page=List">Product List</a></li>
				 <li class="selleritem"><a href="' . home_url("?page_id=" . $page_name) . '&page=History">Order History</a></li>
				 <li class="selleritem"><a href="' . home_url("?page_id=" . $page_name) . '&page=Dashboard">Dashboard</a></li>
				 <li class="selleritem"><a href="' . home_url("?page_id=" . $page_name) . '&page=payment">My Payments</a></li>
				 <li class="selleritem"><a href="' . home_url("?page_id=" . $page_name) . '&page=epschg">Change Password</a></li>
				 <li class="selleritem"><a href="' . home_url("?page_id=" . $page_name) . '&page=To">Ask To Admin</a></li>
				 <li class="selleritem"><a href="' . wp_logout_url() . '" title="Logout">Logout</a></li>
				 </ul></div>';
        }
        if ($user_id > 0 && $seller_info == 0) {
            echo '<div class="wk_seller"><h2>Buyer Menu</h2>';
            echo '<ul class="wk_sellermenu">';
            echo '<li class="selleritem"><a href="' . home_url("?page_id=" . $page_name) . '&page=mpProfile">My Profile</a></li>
				 <li class="selleritem"><a href="' . wp_logout_url() . '" title="Logout">Logout</a></li>
Exemple #14
0
 public static function login_link($args)
 {
     add_thickbox();
     global $ultimatemember;
     $out = '';
     if (is_user_logged_in()) {
         $out .= sprintf('<a href="%s" class="profile-link n8prp-button">Profile</a>', um_user_profile_url());
         $account_page_id = $ultimatemember->permalinks->core['account'];
         if (!empty($account_page_id)) {
             $out .= sprintf('<a href="%s" class="account-link n8prp-button">Account</a>', get_permalink($account_page_id));
         }
         $out .= sprintf('<a href="%s" class="logout-link n8prp-button">Log out</a>', wp_logout_url());
     } else {
         $register_page_id = $ultimatemember->permalinks->core['register'];
         if (!empty($register_page_id)) {
             $out .= sprintf('<a href="%s" class="register-link n8prp-button">Register</a>', get_permalink($register_page_id));
         }
         $login_page_id = $ultimatemember->permalinks->core['login'];
         if (!empty($login_page_id)) {
             $out .= sprintf('<a href="%s" class="login-link n8prp-button">Log in</a>', get_permalink($login_page_id));
         }
         //$out .= sprintf('<div id="n8prp-login-form" style="display:none;">%s</div>', do_shortcode('[ultimatemember form_id=1105]') );
         //$out .= '<a href="#TB_inline?width=300&height=550&inlineId=n8prp-login-form" class="thickbox n8prp-button">Log in</a>';
         //$out .= '<script type="text/javascript">jQuery(\'.thickbox\').each(function(index, value){';
         //$out .= 'var w=window.innerWidth*.85;var h=window.innerHeight*.85;if(w>300){w=300;}';
         //$out .= 'var newHref=jQuery(this).attr(\'href\').replace(\'width=300&height=550\', \'width=\'+w+\'&height=\'+h);';
         //$out .= 'jQuery(this).attr(\'href\',newHref);});</script>';
     }
     return $out;
 }
Exemple #15
0
 public function logout_url()
 {
     $app = $this->config->item('nts_app');
     $return_to = isset($GLOBALS['NTS_CONFIG'][$app]['FRONTEND_WEBPAGE']) ? $GLOBALS['NTS_CONFIG'][$app]['FRONTEND_WEBPAGE'] : get_bloginfo('wpurl');
     $to = wp_logout_url($return_to);
     return $to;
 }
Exemple #16
0
function create_dwb_menu()
{
    if (is_super_admin()) {
        return;
    }
    global $wp_admin_bar;
    $current_user = wp_get_current_user();
    $userinfo = $wp_admin_bar->get_node('user-info');
    $userinfo->href = get_permalink(get_id_by_slug("members-dashboard"));
    $avatar = get_avatar($userinfo->ID, 64);
    $userinfo->title = $avatar . $current_user->last_name;
    $array = (array) $userinfo;
    $wp_admin_bar->add_menu($array);
    $logout = $wp_admin_bar->get_node('logout');
    $logout->href = wp_logout_url(get_permalink(get_id_by_slug("members-login")));
    $array = (array) $logout;
    $wp_admin_bar->add_menu($array);
    $sitename = $wp_admin_bar->get_node('site-name');
    $sitename->href = home_url();
    $array = (array) $sitename;
    $wp_admin_bar->add_menu($array);
    $my_account = $wp_admin_bar->get_node('my-account');
    $avatar = get_avatar($userinfo->ID, 28);
    $my_account->title = "Hello, {$current_user->last_name}" . $avatar;
    $array = (array) $my_account;
    $wp_admin_bar->add_menu($array);
    $wp_admin_bar->remove_node('edit-profile');
    $wp_admin_bar->remove_node('wp-logo');
    $wp_admin_bar->remove_node('dashboard');
}
    /**
     * Outputs the content of the widget
     *
     * @param array $args
     * @param array $instance
     */
    public function widget($args, $instance) {

        $title = apply_filters('widget_title', $instance['title']);

        echo $args['before_widget'];
        echo '<div class="event-widget">';

        if (is_user_logged_in()) {
            if (!empty($instance['title'])) {
                echo $args['before_title'] . __('Profile Links') . $args['after_title'];
            }
            $user_ID = get_current_user_id();
            $profile_id = get_user_meta($user_ID, 'uiu_profile', TRUE);
            $profile_link = !empty($profile_id) ? get_permalink($profile_id) : get_dashboard_url($user_ID);
            ?>
            <ul class="menu user-menu">
                <li class="menu-item"><a href="<?php echo $profile_link; ?>">My Profile</a>  </li>               
                <li class="menu-item"><a href="<?php echo wp_logout_url(site_url()); ?>">Logout</a>  </li>

            </ul>
            <?php
        } else {
            if (!empty($instance['title'])) {
                echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
            }
            wp_login_form($args);
        }
        echo $args['after_widget'];
    }
Exemple #18
0
 function start_el(&$output, $item, $depth = 0, $args = array(), $current_object_id = 0)
 {
     if ($item->title == '{logout}') {
         if (!is_user_logged_in()) {
             return;
         } else {
             $item->url = wp_logout_url(home_url());
             $item->title = __('Logout', 'yit');
         }
     }
     global $wp_query;
     $indent = $depth ? str_repeat("\t", $depth) : '';
     $class_names = $value = '';
     $classes = empty($item->classes) ? array() : (array) $item->classes;
     $class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item));
     $class_names = ' class="' . esc_attr($class_names) . '"';
     $output .= $indent . '<li id="menu-item-' . $item->ID . '"' . $value . $class_names . '>';
     if (is_array($args)) {
         $args = (object) $args;
     }
     $attributes = !empty($item->attr_title) ? ' title="' . esc_attr($item->attr_title) . '"' : '';
     $attributes .= !empty($item->target) ? ' target="' . esc_attr($item->target) . '"' : '';
     $attributes .= !empty($item->xfn) ? ' rel="' . esc_attr($item->xfn) . '"' : '';
     $attributes .= !empty($item->url) ? ' href="' . esc_attr($item->url) . '"' : '';
     $item_output = $args->before;
     $item_output .= '<a' . $attributes . '>';
     $item_output .= $args->link_before . apply_filters('the_title', $item->title, $item->ID) . $args->link_after;
     $item_output .= '</a>';
     $item_output .= $args->after;
     $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args);
 }
/**
 * Handle redirects before content is output - hooked into template_redirect so is_page works.
 */
function wc_template_redirect()
{
    global $wp_query, $wp;
    if (!empty($_GET['page_id']) && '' === get_option('permalink_structure') && wc_get_page_id('shop') == $_GET['page_id']) {
        // When default permalinks are enabled, redirect shop page to post type archive url
        wp_safe_redirect(get_post_type_archive_link('product'));
        exit;
    } elseif (is_page(wc_get_page_id('checkout')) && wc_get_page_id('checkout') !== wc_get_page_id('cart') && WC()->cart->is_empty() && empty($wp->query_vars['order-pay']) && !isset($wp->query_vars['order-received'])) {
        // When on the checkout with an empty cart, redirect to cart page
        wc_add_notice(__('Checkout is not available whilst your cart is empty.', 'woocommerce'), 'notice');
        wp_redirect(wc_get_page_permalink('cart'));
        exit;
    } elseif (isset($wp->query_vars['customer-logout'])) {
        // Logout
        wp_redirect(str_replace('&amp;', '&', wp_logout_url(wc_get_page_permalink('myaccount'))));
        exit;
    } elseif (is_search() && is_post_type_archive('product') && apply_filters('woocommerce_redirect_single_search_result', true) && 1 === absint($wp_query->found_posts)) {
        // Redirect to the product page if we have a single product
        $product = wc_get_product($wp_query->post);
        if ($product && $product->is_visible()) {
            wp_safe_redirect(get_permalink($product->get_id()), 302);
            exit;
        }
    } elseif (is_add_payment_method_page()) {
        // Ensure payment gateways are loaded early
        WC()->payment_gateways();
    } elseif (is_checkout()) {
        // Checkout pages handling
        // Buffer the checkout page
        ob_start();
        // Ensure gateways and shipping methods are loaded early
        WC()->payment_gateways();
        WC()->shipping();
    }
}
    function endpoints()
    {
        $params = array_merge(array('wordcampers_internal_api' => '0', 'action' => ''), $_GET);
        if ($params['wordcampers_internal_api'] === '1') {
            header('Content-Type: application/json');
            $data = array();
            if ($params['action'] === 'login_form') {
                $args = array('echo' => true, 'redirect' => home_url('/wp-admin/'), 'form_id' => 'loginform', 'label_username' => __('Username'), 'label_password' => __('Password'), 'label_remember' => __('Remember Me'), 'label_log_in' => __('Log In'), 'id_username' => 'user_login', 'id_password' => 'user_pass', 'id_remember' => 'rememberme', 'id_submit' => 'wp-submit', 'remember' => true, 'value_username' => NULL, 'value_remember' => true);
                ob_start();
                wp_login_form($args);
                $data['login_form'] = ob_get_clean();
            } else {
                if ($params['action'] === 'logout_form') {
                    ob_start();
                    ?>
				<div class="aa_logout">
					Hello,
					<div class="aa_logout_user">
						$user_login, You are already logged in.
					</div>
					<a id="wp-submit" href="<?php 
                    echo wp_logout_url();
                    ?>
" title="Logout">
						Logout
					</a>
				</div>
				<?php 
                    $data['logout_form'] = ob_get_clean();
                }
            }
            echo json_encode($data);
            die;
        }
    }
Exemple #21
0
/**
 * Sets the right href and class attributes for the modal link in menus
 */
function palo_filter_frontend_modal_link_atts($atts, $item, $args)
{
    /**
     * Ony apply to modal login or register
     */
    if (in_array($atts['href'], array('#pa_modal_login', '#pa_modal_register'))) {
        /**
         * Add trigger if not logged in
         */
        if (!is_user_logged_in()) {
            $atts['class'] = assign_if_exists('class', $atts) . ' palo-modal-login-trigger';
        }
        /**
         * Modify links
         */
        if ('#pa_modal_login' == $atts['href']) {
            if (is_user_logged_in()) {
                $atts['href'] = wp_logout_url();
            } else {
                $atts['href'] = wp_login_url();
                $atts['data-palo-modal'] = palo_append_qs(wp_login_url(), 'palo-login=1');
            }
        } else {
            if ('#pa_modal_register' == $atts['href']) {
                $atts['href'] = wp_registration_url();
                $atts['data-palo-modal'] = palo_append_qs(wp_registration_url(), 'palo-login=1');
            }
        }
    }
    return $atts;
}
function seller_profile($atts)
{
    global $wpdb;
    $obj_mp20 = new MP_Form_Handler();
    $obj_mp20->profile_edit_redirection();
    $current_user = wp_get_current_user();
    $table_users = $wpdb->prefix . "users";
    $table_seller = $wpdb->prefix . "mpsellerinfo";
    $myrows = $wpdb->get_results("SELECT u.*,s.* FROM " . $table_users . " u join " . $table_seller . " s on s.user_id=u.ID where u.ID='{$current_user->ID}'");
    $user_rows = $wpdb->get_results("select um.meta_key,um.meta_value from {$wpdb->usermeta} um where um.user_id='{$current_user->ID}'");
    $user_meta = array();
    foreach ($user_rows as $value) {
        $user_meta[$value->meta_key] = $value->meta_value;
    }
    $avatar = $obj_mp20->get_user_avatar($current_user->ID, 'avatar');
    echo '<section id="contentForm">';
    echo '<form method="post"><h1>Profile</h1>';
    echo '<div><img src="' . content_url() . '/uploads/' . $avatar[0]->meta_value . '" width="50" height="50"></div> <br />';
    echo '<div>Username: '******'</div><br />';
    echo '<div>User email: ' . $current_user->user_email . '</div><br />';
    echo '<div>User first name: ' . $current_user->user_firstname . '</div><br />';
    echo '<div>User last name: ' . $current_user->user_lastname . '</div><br />';
    echo '<div>User display name: ' . $current_user->display_name . '</div><br />';
    echo '<div><a class="button" href="' . get_permalink() . '?page=pedit" title="Edit Profile">Edit</a>&nbsp;&nbsp;<a class="button" href="' . wp_logout_url() . '" title="Logout">Logout</a><br /></div></form>';
    echo '</section>';
}
 public function security_check($template)
 {
     global $woocommerce, $current_user;
     //var_dump( Instore_Reports::get_report_data() );
     //make sure we are on console page
     if (is_page(ins_set_instore_page_id())) {
         //load scripts and style
         $this->load_includes();
         //check if user is logged in
         if (is_user_logged_in()) {
             //if instore login set display console
             if (isset($woocommerce->session->instore_login)) {
                 $template = self::load_environment();
             } else {
                 //if user locked out, logout and redirect to wp_login and display error message, otherwise prompt for instore login pin
                 if (!isset($settings['lockout']) || !in_array($current_user->ID, $setting['lockout'])) {
                     $template = self::instore_login();
                 } else {
                     ob_start();
                     add_filter('login_message', 'ins_login_message');
                     wp_redirect(wp_logout_url(get_permalink()));
                 }
             }
             //user not logged in redirect to login page
         } else {
             ob_start();
             wp_redirect(wp_login_url(get_permalink()));
         }
     }
     return $template;
 }
Exemple #24
0
function wpmp_ms_mobile_admin()
{
    $base = get_option('home');
    if (($user = wp_get_current_user()) == null || $user->ID == 0) {
        header("Location: {$base}/wp-login.php?redirect_to=" . urlencode($base) . "%2Fwp-admin%2F");
    }
    $menu = array(__("Overview", 'wpmp') => "/wp-admin/index.php", __("New post", 'wpmp') => "/wp-admin/post-new.php", __("Edit post", 'wpmp') => "/wp-admin/post.php?action=edit", __("Comments", 'wpmp') => "/wp-admin/edit-comments.php", "_" . __("Comment", 'wpmp') => "/wp-admin/comment.php", __("Switcher", 'wpmp') => "/wp-admin/themes.php", __("Settings", 'wpmp') => "/wp-admin/options-general.php");
    if (function_exists('wp_logout_url')) {
        $menu[__("Log out", 'wpmp')] = wp_logout_url();
    } else {
        $menu[__("Log out", 'wpmp')] = "/wp-login.php?action=logout";
    }
    $page = $_SERVER['REQUEST_URI'];
    $function = "";
    foreach ($menu as $link) {
        if (strpos(strtolower($page), strtolower($link)) !== false) {
            $function = substr($link, 10);
            $function = explode(".", $function);
            $function = str_replace("-", "_", $function[0]);
            $function = strtolower($function);
            break;
        }
    }
    if (!function_exists("wpmp_msma_{$function}")) {
        $function = "overview";
    }
    if (!current_user_can('manage_options')) {
        // harsh but fair
        $menu = array();
        $function = "junior";
    }
    wpmp_ms_mobile_top("Admin", $menu);
    call_user_func("wpmp_msma_{$function}", $menu);
    wpmp_ms_mobile_bottom();
}
function cdm_logout_url()
{
    global $wp_query;
    $post_id = $wp_query->post->ID;
    $logout = wp_logout_url(get_post_permalink($post_id));
    $logout = apply_filters('spcdm/links/logout', $logout);
    return $logout;
}
function gt_comment_form($form_options)
{
    // Fields Array
    $fields = array('author' => '<p class="comment-form-author">' . '<input id="author" name="author" type="text" size="30" placeholder="' . __('Your Name (required)', 'velocityslide') . '" />' . '</p>', 'email' => '<p class="comment-form-email">' . '<input id="email" name="email" type="text" size="30" placeholder="' . __('Your Email (will not be published)', 'velocityslide') . '" />' . '</p>', 'url' => '<p class="comment-form-url">' . '<input name="url" size="30" id="url" type="text" placeholder="' . __('Your Website (optional)', 'velocityslide') . '" />' . '</p>');
    // Form Options Array
    $form_options = array('fields' => apply_filters('comment_form_default_fields', $fields), 'comment_field' => '<p class="comment-form-comment">' . '<textarea name="comment" id="comment" aria-required="true" rows="8" cols="45" placeholder="' . __('Please leave your comment...', 'velocityslide') . '"></textarea>' . '</p>', 'must_log_in' => '<p class="must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', 'velocityslide'), wp_login_url(apply_filters('the_permalink', get_permalink()))) . '</p>', 'logged_in_as' => '<p class="logged-in-as">' . sprintf(__('You are currently logged in<a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>', 'velocityslide'), admin_url('profile.php'), isset($user_identity), wp_logout_url(apply_filters('the_permalink', get_permalink()))) . '</p>', 'comment_notes_before' => '', 'comment_notes_after' => '', 'id_form' => 'form-comment', 'id_submit' => 'submit', 'title_reply' => __('Please leave a Comment...', 'velocityslide'), 'title_reply_to' => __('Leave a Reply to %s', 'velocityslide'), 'cancel_reply_link' => __('Cancel reply', 'velocityslide'), 'label_submit' => __('Post Comment', 'velocityslide'));
    return $form_options;
}
Exemple #27
0
function thesis_logout_url()
{
    if (!thesis_wp_version_check()) {
        return get_option('siteurl') . '/wp-login.php?action=logout';
    } else {
        return wp_logout_url(get_permalink());
    }
}
Exemple #28
0
function cfct_get_logout_url($url)
{
    if (function_exists('wp_logout_url')) {
        return wp_logout_url($url);
    } else {
        return get_bloginfo('wpurl') . '/wp-login.php?action=logout';
    }
}
Exemple #29
0
function hui_logout_url()
{
    if (is_home()) {
        return wp_logout_url(home_url());
    } else {
        return wp_logout_url(get_permalink());
    }
}
/**
 * Login form
 */
function pronamic_framework_login_form($args = '')
{
    $args = wp_parse_args($args, array('redirect_to' => ''));
    // Output
    $output = '';
    if (is_user_logged_in()) {
        $user = wp_get_current_user();
        $output .= '<p class="alert">';
        $output .= sprintf(__('You are currently logged in as <a href="%1$s" title="%2$s">%2$s</a>.', 'pronamic_framework'), get_author_posts_url($user->ID), $user->display_name);
        $output .= sprintf('<a href="%s" title="%s">%s</a>', esc_attr(wp_logout_url(home_url())), esc_attr__('Log out of this account', 'pronamic_framework'), esc_attr__('Log out &raquo;', 'pronamic_framework'));
        $output .= '</p>';
    } else {
        // Not logged in
        global $pronamic_framework_error, $pronamic_framework_login_form_i;
        if ($pronamic_framework_login_form_i == null) {
            $pronamic_framework_login_form_i = 1;
        }
        $i = $pronamic_framework_login_form_i++;
        $output .= '<form action="" method="post">';
        $output .= '	<p class="login-form-username">';
        $output .= '		<label for="log-field-' . $i . '">';
        $output .= __('Username', 'pronamic_framework');
        $output .= '		</label>';
        $output .= '		<input id="log-field-' . $i . '" name="log" type="text" class="text-input" value="' . esc_attr(filter_input(INPUT_POST, 'log', FILTER_SANITIZE_STRING)) . '" />';
        $output .= '	</p>';
        $output .= '	<p class="login-form-password">';
        $output .= '		<label for="pwd-field-' . $i . '">';
        $output .= __('Password', 'pronamic_framework');
        $output .= '		</label>';
        $output .= '		<input id="pwd-field-' . $i . '" name="pwd" type="password" class="text-input" value="' . esc_attr(filter_input(INPUT_POST, 'pwd', FILTER_SANITIZE_STRING)) . '" />';
        $output .= '	</p>';
        if (is_wp_error($pronamic_framework_error)) {
            $output .= '<p class="error">';
            if ($message = $pronamic_framework_error->get_error_message()) {
                $output .= $message;
            } else {
                $output .= __('An unknown error has occurred.', 'pronamic_framework');
            }
            $output .= '</p>';
        }
        $output .= '	<p class="login-form-submit">';
        $redirect_to = $args['redirect_to'];
        $value = filter_input(INPUT_GET, 'redirect_to', FILTER_SANITIZE_STRING);
        if (!empty($value)) {
            $redirect_to = $value;
        }
        $output .= '		<input type="hidden" name="redirect_to" value="' . esc_attr($redirect_to) . '" />';
        $output .= '		<input type="hidden" name="action" value="log-in" />';
        $output .= '		<input type="submit" name="submit" class="submit button" value="' . esc_attr__('Log in', 'pronamic_framework') . '" />';
        $output .= '		<input id="rememberme-field-' . $i . '" name="rememberme"  type="checkbox" class="remember-me checkbox" checked="checked" value="forever" />';
        $output .= '		<label for="rememberme-field-' . $i . '">';
        $output .= __('Remember me', 'pronamic_framework');
        $output .= '		</label>';
        $output .= '	</p>';
        $output .= '</form>';
    }
    return $output;
}