user_bar();
    } else {
        user_reset_form();
    }
    die;
}
if (isset($_POST['tt_get_user_register_form'])) {
    if (is_user_logged_in()) {
        user_bar();
    } else {
        user_register_form();
    }
    die;
}
if (isset($_POST['tt_get_current_user_gravatar'])) {
    tt_get_user_avatar();
    die;
}
//User Bar
class TT_User_bar extends WP_Widget
{
    function __construct()
    {
        $params = array('discription' => 'Themeton User Bar Description', 'name' => 'Themeton User Bar');
        parent::__construct('tt_user_bar', 'TT_User_bar', $params);
    }
    public function form($instance)
    {
        extract($instance);
        ?>
        <p>
    function user_bar($is_widget = false)
    {
        //    tt_social_message('user_name_exists');
        global $data;
        ?>
        <div class="user-bar <?php 
        echo $is_widget ? 'user-widget clearfix' : '';
        ?>
"><?php 
        if (is_user_logged_in()) {
            $log_out_url = isset($data['logout_redirect_page']) && $data['logout_redirect_page'] != 'no' && $data['logout_redirect_page'] != '' ? get_permalink($data['logout_redirect_page']) : home_url();
            $current_user = wp_get_current_user();
            $user_id = $current_user->ID;
            $user_login = $current_user->user_login;
            ?>
                <div class="user-online pull-right">
                    <a href="<?php 
            echo get_author_posts_url($user_id);
            ?>
" class="tt-author2">
                        <div class="author-avatar">
            <?php 
            tt_get_user_avatar();
            ?>
                        </div>
                        <div class="author-content">
                            <span class="user-name"><?php 
            echo $user_login;
            ?>
</span><b class="caret"></b>
                            <span class="user-caps"><?php 
            echo key($current_user->caps);
            ?>
</span>
                        </div>
                    </a>
                    <ul class="user-bar-dropdown clearfix <?php 
            echo $is_widget ? '' : 'dropdown-menu';
            ?>
">
                        <li><a href="<?php 
            echo get_author_posts_url(get_current_user_id());
            ?>
" class="user-my-profile"><i class="icon-user"></i><?php 
            _e('My profile', 'themeton');
            ?>
</a></li>
                        <?php 
            if (isset($data['profile_options_page']) && $data['profile_options_page'] !== 'no' && $data['profile_options_page'] !== '') {
                ?>
                            <li><a href="<?php 
                echo get_permalink($data['profile_options_page']);
                ?>
" class="user-my-settings"><i class="icon-wrench"></i><?php 
                _e('My settings', 'themeton');
                ?>
</a></li>
                        <?php 
            }
            ?>
                        <?php 
            if (isset($data['frontend_editor_page']) && $data['frontend_editor_page'] !== 'no' && $data['frontend_editor_page'] !== '') {
                ?>
                            <li><a href="<?php 
                echo get_permalink($data['frontend_editor_page']);
                ?>
" class="user-add-post"><i class="icon-pencil"></i><?php 
                _e('Add Post', 'themeton');
                ?>
</a></li>
            <?php 
            }
            ?>
            <?php 
            if (isset($data['draft_page']) && $data['draft_page'] != 'no' && $data['draft_page'] != '') {
                ?>
                            <li><a href="<?php 
                echo get_permalink($data['draft_page']);
                ?>
" class="user-draft-posts"><i class="icon-star"></i><?php 
                _e('My drafts', 'themeton');
                ?>
</a></li>
                <?php 
            }
            ?>
            <?php 
            if (isset($data['favorite_page']) && $data['favorite_page'] != 'no' && $data['favorite_page'] != '') {
                ?>
                            <li><a href="<?php 
                echo get_permalink($data['favorite_page']);
                ?>
" class="user-favorite-posts"><i class="icon-star"></i><?php 
                _e('Favorite posts', 'themeton');
                ?>
</a></li>
                <?php 
            }
            ?>
                        <li class="divider"></li>
                        <li><a href="<?php 
            echo wp_logout_url($log_out_url);
            ?>
" class="user-log-out"><i class="icon-remove-sign"></i><?php 
            _e('Log out', 'themeton');
            ?>
</a></li>
                    </ul>
                </div><?php 
        } else {
            ?>
                <div class="user-offline">
                    <div class="user-join">
            <?php 
            _e('Not a Member?', 'themeton');
            ?>
                        <a href="#">
                        <?php 
            _e('Join Now', 'themeton');
            ?>
                        </a>
                    </div>
                    <div class="user-login-buton pull-right"><?php 
            if (isset($data['fb_connect']) && $data['fb_connect'] && isset($data['fb_app_id']) && !empty($data['fb_app_id']) && isset($data['fb_app_secret']) && !empty($data['fb_app_secret'])) {
                global $facebook;
                ?>
<a href="<?php 
                echo $facebook->getLoginUrl(array('scope' => 'email'));
                ?>
" class="fb"><img alt="Login with facebook" src="<?php 
                echo get_template_directory_uri();
                ?>
/images/facebook-login.png" /></a><?php 
            }
            if (isset($data['tw_connect']) && $data['tw_connect'] && isset($data['tw_consumer_key']) && !empty($data['tw_consumer_key']) && isset($data['tw_consumer_secret']) && !empty($data['tw_consumer_secret'])) {
                echo '<a href="' . home_url() . '?tt_tw_redirect=true" class="tw"><img alt="Login with twitter" src="' . get_template_directory_uri() . '/images/twitter-login.png"/></a>';
            }
            if (!$is_widget) {
                ?>
                            <a href="#" class="btn wp dropdown-toggle"><?php 
                _e('Sign In', 'themeton');
                ?>
</a><?php 
            }
            ?>
                        <div class="user-form-container <?php 
            echo $is_widget ? '' : 'dropdown-menu';
            ?>
">
                <?php 
            user_login_form();
            ?>
                        </div>
                    </div>
                </div><?php 
        }
        ?>
        </div><?php 
    }
global $blogConf, $isFavoritePage;
if ($blogConf['hide_author']) {
    ?>
    <div class="item-author clearfix">
        <div class="panel-outer"><?php 
    //$post_author_id=get_query_var('author');
    if ($isFavoritePage) {
        $current_user = wp_get_current_user();
        $post_author_id = $current_user->ID;
        tt_get_user_avatar(false, '70');
        echo '<h3><a href="' . get_author_posts_url($post_author_id) . '" title="Posts by admin">';
        echo $current_user->display_name;
        echo "</a></h3>";
    } else {
        $post_author_id = $post->post_author;
        tt_get_user_avatar(get_userdata($post_author_id), '70');
        echo "<h3>";
        if (is_author()) {
            the_author();
        } else {
            the_author_posts_link();
        }
        echo "</h3>";
    }
    ?>
            
            <p><?php 
    $description = get_the_author_meta('description', $post_author_id);
    if ($description != '') {
        echo $description;
    } else {
예제 #4
0
     get_template_part('post', 'content');
 }
 ?>
         </div>
         <?php 
 $author = false;
 if ($author) {
     ?>
             <div class="item-author-content clearfix"><?php 
     $user_info = get_userdata($post->post_author);
     $user_id = $user_info->ID;
     $user_login = $user_info->user_login;
     ?>
                 <div class="author-avatar">
                     <?php 
     echo tt_get_user_avatar($user_info);
     ?>
                 </div>
                 <div class="author-content">
                     <span class="author-name"><?php 
     _e('Author: ', 'themeton');
     ?>
             <?php 
     if (is_author()) {
         the_author();
     } else {
         the_author_posts_link();
     }
     ?>
                     </span>
                     <span class="published-date"><?php