PluginProbe
UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP / 1.0.18
UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP v1.0.18
1.2.73 1.2.72 1.2.71 1.2.70 1.2.69 1.2.68 1.2.67 1.2.66 1.2.65 1.2.64 1.2.63 trunk 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.20 1.0.21 1.0.22 All 173 releases
userswp / widgets / login.php

login.php in UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP 1.0.18, at widgets/login.php

97 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 add_action('widgets_init', 'uwp_init_login_widget');
4
5 function uwp_init_login_widget() {
6
7 register_widget("UWP_Login_Widget");
8
9 }
10
11 class UWP_Login_Widget extends WP_Super_Duper {
12
13 public function __construct() {
14
15 $options = array(
16 'textdomain' => 'userswp',
17 'block-icon' => 'admin-site',
18 'block-category'=> 'widgets',
19 'block-keywords'=> "['userswp','login']",
20 'class_name' => __CLASS__,
21 'base_id' => 'uwp_login',
22 'name' => __('UWP > Login','userswp'),
23 'widget_ops' => array(
24 'classname' => 'uwp-login-class',
25 'description' => esc_html__('Displays login form or current logged in user.','userswp'),
26 ),
27 'arguments' => array(
28 'title' => array(
29 'title' => __( 'Login widget title', 'userswp' ),
30 'desc' => __( 'Enter login widget title', 'userswp' ),
31 'type' => 'text',
32 'desc_tip' => true,
33 'default' => '',
34 'advanced' => false
35 ),
36 )
37
38 );
39
40 parent::__construct( $options );
41 }
42
43 public function output( $args = array(), $widget_args = array(), $content = '' ) {
44
45 ob_start();
46
47 echo '<div class="uwp_widgets uwp_widget_login">';
48
49 if(is_user_logged_in()) {
50
51 global $current_user;
52
53 $template = new UsersWP_Templates();
54
55 $logout_url = $template->uwp_logout_url();
56
57 echo '<div class="uwp-login-widget user-loggedin">';
58
59 echo '<p>'.__( 'Logged in as ', 'userswp' );
60
61 echo '<a href="'. apply_filters('uwp_profile_link', get_author_posts_url($current_user->ID), $current_user->ID).'">' . get_avatar( $current_user->ID, 35 ). '<strong>'. apply_filters('uwp_profile_display_name', $current_user->display_name).'</strong></a>';
62
63 echo '<span>';
64
65 printf(__( '<a href="%1$s">Log out</a>', 'userswp'), esc_url( $logout_url ));
66
67 echo '</span>';
68
69 echo '</p>';
70
71 echo '</div>';
72
73 } else {
74
75 $temp_obj = new UsersWP_Templates();
76 $template = $temp_obj->uwp_locate_template('login');
77
78 echo '<div class="uwp_page">';
79
80 if ($template) {
81 include($template);
82 }
83
84 echo '</div>';
85
86 }
87
88 echo '</div>';
89
90 $output = ob_get_contents();
91
92 ob_end_clean();
93
94 return trim($output);
95
96 }
97 }