Example #1
0
    function widget($args, $instance)
    {
        if (empty($instance['style'])) {
            $instance['style'] = RPX_BUTTONS_STYLE_SMALL;
        }
        $user_data = rpx_user_data();
        if ($instance['hide'] != 'true' || ($user_data == false || empty($user_data->rpx_provider))) {
            extract($args);
            $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
            echo $before_widget;
            if (!empty($title)) {
                echo $before_title . $title . $after_title;
            }
            if ($user_data != false && !empty($user_data->rpx_provider)) {
                global $rpx_http_vars;
                $rpx_user_icon = rpx_user_provider_icon();
                $avatar = '';
                if (!empty($user_data->rpx_photo)) {
                    $avatar = '<img class="rpx_sidebar_avatar" src="' . $user_data->rpx_photo . '">';
                } else {
                    $avatar = '<div class="rpx_sidebar_avatar">&nbsp;</div>';
                }
                ?>
<div class="rpx_user_icon">
  <?php 
                echo $avatar;
                echo $rpx_user_icon;
                ?>
</div>
  <a href="<?php 
                echo wp_logout_url($rpx_http_vars['redirect_to']);
                ?>
" title="Logout">Log out</a>
  <?php 
            } elseif ($user_data != false && empty($user_data->rpx_provider)) {
                $instance['prompt'] = RPX_CONNECT_PROMPT;
                echo rpx_buttons($instance['style'], $instance['prompt']);
            } else {
                $instance['prompt'] = RPX_LOGIN_PROMPT;
                echo rpx_buttons($instance['style'], $instance['prompt']);
            }
            echo $after_widget;
        }
    }
Example #2
0
 function rpx_user_profile()
 {
     if (function_exists('rpx_init')) {
         $user_data = rpx_user_data();
         if (!empty($user_data->rpx_provider)) {
             $provider = htmlentities($user_data->rpx_provider);
             $text .= "<h3>Currently connected to {$provider}</h3>";
             $removable = get_option(RPX_REMOVABLE_OPTION);
             if ($removable == 'true') {
                 $text .= "<p>You can remove all {$provider} data and disconnect your account from {$provider} by clicking <a href=\"?action=" . RPX_REMOVE_ACTION . "\">remove</a>.\n                    <br><strong>Be certain before you click \"remove\" and set a password for this account so you can use it without social sign in.</strong></p>";
             }
         } else {
             $text = rpx_buttons(RPX_BUTTONS_STYLE_LARGE, RPX_CONNECT_PROMPT);
         }
         $ret = $text;
         return $ret;
     }
 }