Beispiel #1
0
 function showLoginForm()
 {
     $this->piereg_ssl_template_redirect();
     global $errors, $pagenow;
     $option = get_option('pie_register_2');
     if (is_user_logged_in() && $option['redirect_user'] == 1) {
         $this->afterLoginPage();
         return "";
     } else {
         include_once "login_form.php";
         $output = pieOutputLoginForm();
         return $output;
     }
 }
Beispiel #2
0
 public function widget($args, $instance)
 {
     $option = get_option('pie_register_2');
     global $errors;
     echo $args['before_widget'];
     $before_title = apply_filters('widget_title', $instance['before_title']);
     $after_title = apply_filters('widget_title', $instance['after_title']);
     if (!is_user_logged_in()) {
         if (!empty($before_title)) {
             echo $args['before_title'] . $before_title . $args['after_title'];
         }
         include_once "login_form.php";
         $output = pieOutputLoginForm(true);
         echo $output;
     } else {
         global $current_user;
         get_currentuserinfo();
         //$current_user = wp_get_current_user();
         if (!empty($after_title)) {
             echo $args['before_title'] . $after_title . $args['after_title'];
         }
         $profile_pic_array = get_user_meta($current_user->ID);
         foreach ($profile_pic_array as $key => $val) {
             if (strpos($key, 'profile_pic') !== false) {
                 $profile_pic = trim($val[0]);
             }
         }
         /*if(!preg_match('/(http|https):\/\/(www\.)?[\w-_\.]+\.[a-zA-Z]+\/((([\w-_\/]+)\/)?[\w-_\.]+\.(png|gif|jpg|jpeg|xpng|bmp))/',$profile_pic)){
         			$profile_pic = plugin_dir_url(__FILE__).'images/userImage.png';
         		}*/
         $profile_pic = apply_filters("piereg_profile_image_url", $profile_pic, $current_user);
         echo '<div class="logged-In">';
         $profile_link = get_permalink($option['alternate_profilepage']);
         $user_avater = get_avatar(get_current_user_id(), 75);
         $profile_avatar = !empty($profile_pic) ? '<img src="' . $profile_pic . '" style="max-width:75px;max-height:75px;"/>' : $user_avater;
         //$profile_image_html = '<a href="'.$profile_link.'"><img src="'.$profile_pic.'" style="max-width:75px;max-height:75px;"/></a>';
         $profile_image_html = '<a href="' . $profile_link . '">' . $profile_avatar . '</a>';
         echo apply_filters('pie_profile_image_frontend_widget', $profile_image_html, $profile_link, $profile_pic);
         ////////////////////////////
         $first_name = get_user_meta($current_user->ID, "first_name", true);
         $last_name = get_user_meta($current_user->ID, "last_name", true);
         if (!empty($first_name) && !empty($last_name)) {
             $profile_text = $first_name . "&nbsp;" . $last_name;
         } elseif (!empty($current_user->display_name)) {
             $profile_text = $current_user->display_name;
         } else {
             $profile_text = $current_user->user_login;
         }
         $profile_text_html = '<a href="' . $profile_link . '">' . $profile_text . '</a>';
         echo '';
         echo '<div class="member_div"><h4>';
         echo apply_filters('pie_profile_username_frontend_widget', $profile_text_html, $profile_link, $profile_text);
         echo '</h4>';
         echo '<a href="' . wp_logout_url() . '" class="logout-link" title="Logout">' . __("Logout", "piereg") . '</a></div></div>';
     }
     echo $args['after_widget'];
 }