function widget($args, $instance) { extract($args); $title = $instance['wpphpbbu_meta_title']; $ucp_url = get_option('wpphpbbu_url') . 'ucp.php'; $admin_url = \wpphpbbu\Path::get_admin_link(); $mcp_url = \wpphpbbu\Path::get_mcp_link(); $permission_url = \wpphpbbu\Path::get_restore_permissions_link(); if (empty($title)) { $title = " "; } echo $before_widget . $before_title . $title . $after_title; ?> <ul> <?php if (\wpphpbbu\User::is_user_logged_in()) { ?> <li> <a href="<?php bloginfo('home'); ?> /wp-admin/"> <?php echo _e('Blog control panel', 'wpphpbbu'); ?> </a> </li> <li> <a href="<?php echo $ucp_url; ?> "> <?php echo _e('User control panel', 'wpphpbbu'); ?> </a> </li> <?php if (!empty($mcp_url)) { ?> <li> <a href="<?php echo $mcp_url; ?> "> <?php echo _e('Moderator control panel', 'wpphpbbu'); ?> </a> </li> <?php } if (!empty($admin_url)) { ?> <li> <a href="<?php echo $admin_url; ?> "> <?php echo _e('Forum administration', 'wpphpbbu'); ?> </a> </li> <?php } if (!empty($permission_url)) { ?> <li> <a href="<?php echo $permission_url; ?> "> <?php echo _e('Restore permissions', 'wpphpbbu'); ?> </a> </li> <?php } ?> <li> <a href="<?php echo $ucp_url; ?> ?mode=logout&sid=<?php echo \wpphpbbu\Session::get_sessionid(); ?> "> <?php echo _e('Log out', 'wpphpbbu'); ?> </a> </li> <?php } else { ?> <li> <a href="<?php echo $ucp_url; ?> ?mode=sendpassword"> <?php echo _e('I forgot my password', 'wpphpbbu'); ?> </a> </li> <li> <a href="<?php echo $ucp_url; ?> ?mode=resend_act"> <?php echo _e('Resend activation email', 'wpphpbbu'); ?> </a> </li> <li> <a href="<?php echo $ucp_url; ?> ?mode=register"> <?php echo _e('Register new account', 'wpphpbbu'); ?> </a> </li> <?php } ?> <li> <a href="<?php echo $ucp_url; ?> ?mode=delete_cookies"> <?php echo _e('Delete site cookies', 'wpphpbbu'); ?> </a> </li> </ul> <?php echo $after_widget; }
function widget($args, $instance) { global $user, $auth, $phpbb_container; extract($args); $login_title = $instance['wpphpbbu_user_login_title']; $info_title = $instance['wpphpbbu_user_info_title']; $meta_links = $instance['wpphpbbu_user_show_meta']; $user_status = \wpphpbbu\User::is_user_logged_in(); $title = ''; if ($user_status == false) { $title = $login_title; } else { $title = $info_title; } $title = str_replace('{USERNAME}', trim($user->data['username']), $title); $forum_url = $ucp_url = get_option('wpphpbbu_url'); $ucp_url .= 'ucp.php'; echo $before_widget . $before_title . $title . $after_title; if ($user_status == false) { $redirect = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $meta_links = $instance['wpphpbbu_user_show_meta']; ?> <form action="<?php echo $ucp_url; ?> ?mode=login" method="post" class="wp_phpbb_bridge_login" id="login"> <?php if (get_option('wpphpbbu_width', '0') !== '0') { ?> <input type="hidden" name="wpphpbbu_elements_width" id="wpphpbbu_elements_width" value="<?php echo get_option('wpphpbbu_width'); ?> " /> <?php } ?> <label for="username"> <?php echo _e('Username:'******'wpphpbbu'); ?> </label> <br /> <input type="text" name="username" id="wpphpbbu_username" /> <br /> <label for="password"> <?php echo _e('Password:'******'wpphpbbu'); ?> </label> <br /> <input type="password" id="wpphpbbu_password" name="password" /> <br /> <label for="autologin"> <input type="checkbox" name="autologin" id="autologin" /> <?php echo _e('Remember me', 'wpphpbbu'); ?> </label> <br /> <label for="viewonline"> <input type="checkbox" name="viewonline" id="viewonline" /> <?php echo _e('Login as hidden', 'wpphpbbu'); ?> </label> <input type="hidden" name="redirect" value="<?php echo $redirect; ?> " /> <br /> <input type="submit" name="login" id="wpphpbbu_login" value="<?php echo _e('Login', 'wpphpbbu'); ?> " /> <?php if ($meta_links == "yes") { ?> <br /> <a href="<?php echo $ucp_url; ?> ?mode=sendpassword"> <?php echo _e('I forgot my password', 'wpphpbbu'); ?> </a> <br /> <a href="<?php echo $ucp_url; ?> ?mode=register"> <?php echo _e('Register new account', 'wpphpbbu'); ?> </a> <?php } ?> </form> <?php } else { $avatar = \wpphpbbu\User::get_avatar(); $admin_url = \wpphpbbu\Path::get_admin_link(); $mcp_url = \wpphpbbu\Path::get_mcp_link(); $options = get_option('widget_wpb_user'); $meta_links = $instance['wpphpbbu_user_show_meta']; if ($avatar) { ?> <a href="<?php echo $ucp_url; ?> " title="<?php _e('User control panel', 'wpphpbbu'); ?> "> <?php echo $avatar; ?> </a> <?php } ?> <ul id="wp_phpbb_bridge_options"> <li> <?php _e('Total posts', 'wpphpbbu'); ?> : <a href="<?php echo $forum_url; ?> search.php?search_id=egosearch"> <?php echo number_format($user->data['user_posts']); ?> </a> </li> <li> <?php _e("New PM's", 'wpphpbbu'); ?> : <a href="<?php echo $ucp_url; ?> ?i=pm&folder=inbox"> <?php echo number_format($user->data['user_new_privmsg']); ?> </a> </li> <li> <?php _e("Unread PMs", 'wpphpbbu'); ?> : <a href="<?php echo $ucp_url; ?> ?i=pm&folder=inbox"> <?php echo number_format($user->data['user_unread_privmsg']); ?> </a> </li> <?php if ($meta_links == "yes") { if (!empty($admin_url)) { ?> <li> <a href="<?php echo $admin_url; ?> "> <?php _e('Forum administration', 'wpphpbbu'); ?> </a> </li> <?php } } if (\wpphpbbu\User::is_user_logged_in()) { ?> <li> <a href="<?php echo get_option('home'); ?> /wp-admin/"> <?php echo _e('Blog control panel', 'wpphpbbu'); ?> </a> </li> <li> <a href="<?php echo $ucp_url; ?> "> <?php echo _e('User control panel', 'wpphpbbu'); ?> </a> </li> <?php if (!empty($mcp_url)) { ?> <li> <a href="<?php echo $mcp_url; ?> "> <?php echo _e('Moderator control panel', 'wpphpbbu'); ?> </a> </li> <?php } if (!empty($permission_url)) { ?> <li> <a href="<?php echo $permission_url; ?> "> <?php echo _e('Restore permissions', 'wpphpbbu'); ?> </a> </li> <?php } ?> <li> <a href="<?php echo $ucp_url; ?> ?mode=logout&sid=<?php echo \wpphpbbu\Session::get_sessionid(); ?> "> <?php echo _e('Log out', 'wpphpbbu'); ?> </a> </li> <?php } else { ?> <li> <a href="<?php echo $ucp_url; ?> ?mode=sendpassword"> <?php echo _e('I forgot my password', 'wpphpbbu'); ?> </a> </li> <li> <a href="<?php echo $ucp_url; ?> ?mode=resend_act"> <?php echo _e('Resend activation email', 'wpphpbbu'); ?> </a> </li> <li> <a href="<?php echo $ucp_url; ?> ?mode=register"> <?php echo _e('Register new account', 'wpphpbbu'); ?> </a> </li> <?php } ?> </ul> <?php } echo $after_widget; }