function wpestate_update_menu_bar()
 {
     $user_id = intval($_POST['newuser']);
     if ($user_id != 0 && $user_id != '') {
         $add_link = wpestate_get_dasboard_add_listing();
         $dash_profile = wpestate_get_dashboard_profile_link();
         $dash_favorite = wpestate_get_dashboard_favorites();
         $dash_link = wpestate_get_dashboard_link();
         $dash_searches = wpestate_get_searches_link();
         $logout_url = wp_logout_url();
         $home_url = esc_html(home_url());
         $menu = '<div id="user_menu_open">';
         if ($home_url != $dash_profile) {
             $menu .= '  <a href="' . $dash_profile . '" ><i class="fa fa-cog"></i>' . esc_html__('My Profile', 'wpestate') . '</a>';
         }
         if ($home_url != $dash_link) {
             $menu .= ' <a href="' . $dash_link . '" ><i class="fa fa-map-marker"></i>' . esc_html__('My Properties List', 'wpestate') . '</a>';
         }
         if ($home_url != $add_link) {
             $menu .= '<a href="' . $add_link . '" ><i class="fa fa-plus"></i>' . esc_html__('Add New Property', 'wpestate') . '</a>';
         }
         if ($home_url != $dash_favorite) {
             $menu .= '<a href="' . $dash_favorite . '" class="active_fav"><i class="fa fa-heart"></i>' . esc_html__('Favorites', 'wpestate') . '</a>';
         }
         if ($home_url != $dash_searches) {
             $menu .= '<a href="' . $dash_searches . '" class="active_fav"><i class="fa fa-search"></i>' . esc_html__('Saved Searches', 'wpestate') . '</a>';
         }
         $menu .= '<a href="' . wp_logout_url() . '" title="Logout" class="menulogout"><i class="fa fa-power-off"></i>' . esc_html__('Log Out', 'wpestate') . '</a>';
         $menu .= '</div>';
         $user_small_picture_id = get_the_author_meta('small_custom_picture', $user_id, true);
         if ($user_small_picture_id == '') {
             $user_small_picture = get_template_directory_uri() . '/img/default_user_small.png';
         } else {
             $user_small_picture = wp_get_attachment_image_src($user_small_picture_id, 'wpestate_user_thumb');
         }
         $premenu = '<a class="menu_user_tools dropdown" id="user_menu_trigger" data-toggle="dropdown">
               <i class="fa fa-bars"></i></a>
               <div class="menu_user_picture" style="background-image: url( ' . $user_small_picture . ' );"></div>';
         echo json_encode(array('picture' => $user_small_picture[0], 'menu' => $menu, 'premenu' => $premenu));
     }
     die;
 }
Beispiel #2
0
<?php

global $current_user;
get_currentuserinfo();
$userID = $current_user->ID;
$user_login = $current_user->user_login;
$add_link = wpestate_get_dasboard_add_listing();
$dash_profile = wpestate_get_dashboard_profile_link();
$dash_pack = get_wpestate_packages_link();
$dash_favorite = wpestate_get_dashboard_favorites();
$dash_link = wpestate_get_dashboard_link();
$dash_searches = wpestate_get_searches_link();
$dash_inbox = get_inbox_wpestate_booking();
$dash_invoice = get_invoices_wpestate();
$dash_my_bookings = wpestate_my_booking_link();
$dash_my_reservations = wpestate_my_reservations_link();
$activeprofile = '';
$activeedit = '';
$activedash = '';
$activeadd = '';
$activefav = '';
$activesearch = '';
$activemypack = '';
$activeedit = '';
$activeprice = '';
$activedetails = '';
$activeimages = '';
$activeamm = '';
$activecalendar = '';
$activemybookins = '';
$activemyreservations = '';
    function widget($args, $instance)
    {
        extract($args);
        $display = '';
        global $post;
        print $before_widget;
        $facebook_status = esc_html(get_option('wp_estate_facebook_login', ''));
        $google_status = esc_html(get_option('wp_estate_google_login', ''));
        $yahoo_status = esc_html(get_option('wp_estate_yahoo_login', ''));
        $mess = '';
        $display .= '
                <div class="login_sidebar">
                    <h3 class="widget-title-sidebar"  id="login-div-title">' . esc_html__('Login', 'wpestate') . '</h3>
                    <div class="login_form" id="login-div">
                        <div class="loginalert" id="login_message_area_wd" >' . $mess . '</div>
                            
                        <input type="text" class="form-control" name="log" id="login_user_wd" placeholder="' . esc_html__('Username', 'wpestate') . '"/>
                        <input type="password" class="form-control" name="pwd" id="login_pwd_wd" placeholder="' . esc_html__('Password', 'wpestate') . '"/>                       
                        <input type="hidden" name="loginpop" id="loginpop_wd" value="0">
                        ' . wp_nonce_field('login_ajax_nonce', 'security-login', false, false) . '   

                       
                        <button class="wpb_button  wpb_btn-info  wpb_regularsize   wpestate_vc_button  vc_button" id="wp-login-but-wd" >' . esc_html__('Login', 'wpestate') . '</button>
                        
                        <div class="navigation_links">
                            <a href="#" id="widget_register_sw">' . esc_html__("Don't have an account?", 'wpestate') . '</a> | 
                            <a href="#" id="forgot_pass_widget">' . esc_html__('Forgot Password?', 'wpestate') . '</a>
                        </div>
                        
                        <div class="login-links">
                         ';
        if ($facebook_status == 'yes') {
            $display .= '<div id="facebooklogin_wd" data-social="facebook"><i class="fa fa-facebook"></i>' . esc_html__('Login with Facebook', 'wpestate') . '</div>';
        }
        if ($google_status == 'yes') {
            $display .= '<div id="googlelogin_wd" data-social="google"><i class="fa fa-google"></i>' . esc_html__('Login with Google', 'wpestate') . '</div>';
        }
        if ($yahoo_status == 'yes') {
            $display .= '<div id="yahoologin_wd" data-social="yahoo"><i class="fa fa-yahoo"></i>' . esc_html__('Login with Yahoo', 'wpestate') . '</div>';
        }
        $display .= '</div>
                          
                    </div>
                
              <h3 class="widget-title-sidebar"  id="register-div-title">' . esc_html__('Register', 'wpestate') . '</h3>
                <div class="login_form" id="register-div">
                    <div class="loginalert" id="register_message_area_wd" ></div>
                    <input type="text" name="user_login_register" id="user_login_register_wd" class="form-control" placeholder="' . esc_html__('Username', 'wpestate') . '"/>
                    <input type="text" name="user_email_register" id="user_email_register_wd" class="form-control" placeholder="' . esc_html__('Email', 'wpestate') . '"  />
                    <input type="checkbox" name="terms" id="user_terms_register_wd"><label id="user_terms_register_wd_label" for="user_terms_register_wd">' . esc_html__('I agree with ', 'wpestate') . '<a href="' . wpestate_get_terms_links() . '" target="_blank" id="user_terms_register_topbar_link">' . esc_html__('terms & conditions', 'wpestate') . '</a> </label>
          
                    <p id="reg_passmail">' . esc_html__('A password will be e-mailed to you', 'wpestate') . '</p>
                    ' . wp_nonce_field('register_ajax_nonce', 'security-register', false, false) . '   
                    <button class="wpb_button  wpb_btn-info  wpb_regularsize  wpestate_vc_button  vc_button" id="wp-submit-register_wd">' . esc_html__('Register', 'wpestate') . '</button>

                    <div class="login-links">
                        <a href="#" id="widget_login_sw">' . esc_html__('Back to Login', 'wpestate') . '</a>                       
                    </div>   
                 </div>
                </div>
                <h3 class="widget-title-sidebar"  id="forgot-div-title_shortcode">' . esc_html__('Reset Password', 'wpestate') . '</h3>
                <div class="login_form" id="forgot-pass-div_shortcode">
                    <div class="loginalert" id="forgot_pass_area_shortcode_wd"></div>
                    <div class="loginrow">
                            <input type="text" class="form-control" name="forgot_email" id="forgot_email_shortcode" placeholder="' . esc_html__('Enter Your Email Address', 'wpestate') . '" size="20" />
                    </div>
                    ' . wp_nonce_field('login_ajax_nonce_forgot_wd', 'security-login-forgot_wd', true) . '  
                    <input type="hidden" id="postid" value="0">    
                    <button class="wpb_btn-info wpb_regularsize wpestate_vc_button  vc_button" id="wp-forgot-but_shortcode" name="forgot" >' . esc_html__('Reset Password', 'wpestate') . '</button>
                    <div class="login-links shortlog">
                    <a href="#" id="return_login_shortcode">' . esc_html__('Return to Login', 'wpestate') . '</a>
                    </div>
                </div>
            ';
        global $current_user;
        get_currentuserinfo();
        $userID = $current_user->ID;
        $user_login = $current_user->user_login;
        $user_email = get_the_author_meta('user_email', $userID);
        $activeprofile = $activedash = $activeadd = $activefav = '';
        $add_link = wpestate_get_dasboard_add_listing();
        $dash_profile = wpestate_get_dashboard_profile_link();
        $dash_link = wpestate_get_dashboard_link();
        $dash_favorite = wpestate_get_dashboard_favorites();
        $dash_searches = wpestate_get_searches_link();
        $dash_reservation = wpestate_get_my_reservation_link();
        $dash_bookings = wpestate_get_my_bookings_link();
        $dash_inbox = get_inbox_wpestate_booking();
        $dash_invoices = get_invoices_wpestate();
        $home_url = esc_html(home_url());
        $logged_display = '
                    <h3 class="widget-title-sidebar" >' . esc_html__('Hello ', 'wpestate') . ' ' . $user_login . '  </h3>
                    
                    <ul class="wd_user_menu">';
        if ($home_url != $dash_profile) {
            $logged_display .= '<li> <a href="' . $dash_profile . '"  class="' . $activeprofile . '"><i class="fa fa-cogs"></i>  ' . esc_html__('My Profile', 'wpestate') . '</a> </li>';
        }
        if ($home_url != $dash_link) {
            $logged_display .= ' <li> <a href="' . $dash_link . '"     class="' . $activedash . '"><i class="fa fa-map-marker"></i>' . esc_html__('My Properties', 'wpestate') . '</a> </li>';
        }
        if ($home_url != $add_link) {
            $logged_display .= ' <li> <a href="' . $add_link . '"      class="' . $activeadd . '"><i class="fa fa-plus"></i>' . esc_html__('Add New Property', 'wpestate') . '</a> </li>';
        }
        if ($home_url != $dash_favorite) {
            $logged_display .= ' <li> <a href="' . $dash_favorite . '" class="' . $activefav . '"><i class="fa fa-heart"></i>' . esc_html__('Favorites', 'wpestate') . '</a> </li>';
        }
        if ($home_url != $dash_reservation) {
            $logged_display .= ' <li> <a href="' . $dash_reservation . '" class="' . $activefav . '"><i class="fa fa-folder-open"></i>' . esc_html__('Reservations', 'wpestate') . '</a> </li>';
        }
        if ($home_url != $dash_bookings) {
            $logged_display .= ' <li> <a href="' . $dash_bookings . '" class="' . $activefav . '"><i class="fa fa-folder-open-o"></i>' . esc_html__('Bookings', 'wpestate') . '</a> </li>';
        }
        if ($home_url != $dash_inbox) {
            $logged_display .= ' <li> <a href="' . $dash_inbox . '" class="' . $activefav . '"><i class="fa fa-inbox"></i>' . esc_html__('Inbox', 'wpestate') . '</a> </li>';
        }
        if ($home_url != $dash_favorite) {
            $logged_display .= ' <li> <a href="' . $dash_invoices . '" class="' . $activefav . '"><i class="fa  fa-file-o"></i>' . esc_html__('Invoices', 'wpestate') . '</a> </li>';
        }
        $logged_display .= ' <li> <a href="' . wp_logout_url() . '" title="Logout"><i class="fa fa-power-off"></i>' . esc_html__('Log Out', 'wpestate') . '</a> </li>   
                    </ul>
                ';
        if (is_user_logged_in()) {
            print $logged_display;
        } else {
            print $display;
        }
        print $after_widget;
    }