/** This is rendered widget content */ public function widget($args, $instance) { // if social login is disabled, return if (!the_champ_social_login_enabled()) { return; } extract($args); if ($instance['hide_for_logged_in'] == 1 && is_user_logged_in()) { return; } echo $before_widget; if (!empty($instance['title']) && !is_user_logged_in()) { $title = apply_filters('widget_title', $instance['title']); echo $before_title . $title . $after_title; } if (!empty($instance['before_widget_content'])) { echo '<div>' . $instance['before_widget_content'] . '</div>'; } if (!is_user_logged_in()) { echo the_champ_login_button(true); } else { global $theChampLoginOptions, $user_ID; $userInfo = get_userdata($user_ID); echo "<div style='height:80px;width:180px'><div style='width:63px;float:left;'>"; if (($userAvatar = get_user_meta($user_ID, 'thechamp_avatar', true)) !== false && strlen(trim($userAvatar)) > 0) { echo '<img alt="Social Avatar" src="' . $userAvatar . '" height = "60" width = "60" title="' . $userInfo->user_login . '" style="border:2px solid #e7e7e7;"/>'; } else { echo @get_avatar($user_ID, 60, $default, $alt); } echo "</div><div style='float:left; margin-left:10px'>"; echo str_replace('-', ' ', $userInfo->user_login); do_action('the_champ_login_widget_hook', $userInfo->user_login); echo '<br/><a href="' . wp_logout_url(home_url()) . '">' . __('Log Out', 'Super-Socializer') . '</a></div></div>'; } echo '<div style="clear:both"></div>'; if (!empty($instance['after_widget_content'])) { echo '<div>' . $instance['after_widget_content'] . '</div>'; } echo $after_widget; }
/** * Shortcode for Social Login. */ function the_champ_login_shortcode($params) { if (the_champ_social_login_enabled()) { extract(shortcode_atts(array('style' => '', 'title' => ''), $params)); $html = '<div '; // style if ($style != "") { if (strpos($style, 'float') === false) { $style = 'float: left;' . $style; } $html .= 'style="' . $style . '"'; } $html .= '>'; if (!is_user_logged_in() && $title != '') { $html .= '<div style="font-weight:bold">' . ucfirst($title) . '</div>'; } $html .= the_champ_login_button(true); $html .= '</div><div style="clear:both"></div>'; return $html; } }
/** * Shortcode for Social Login. */ function the_champ_login_shortcode($params) { if (the_champ_social_login_enabled()) { extract(shortcode_atts(array('style' => ''), $params)); $html = '<div '; // style if ($style != "") { if (strpos($style, 'float') === false) { $style = 'float: left;' . $style; } $html .= 'style="' . $style . '"'; } $html .= '>'; $html .= the_champ_login_button(true); $html .= '</div><div style="clear:both"></div>'; return $html; } }