Пример #1
0
function ra_ajax_user_popover()
{
    $handle_id = qa_post_text('handle');
    $handle = qa_post_text('handle');
    require_once QA_INCLUDE_DIR . 'qa-db-users.php';
    if (isset($handle)) {
        $userid = qa_handle_to_userid($handle);
        $badges = ra_user_badge($handle);
        if (defined('QA_WORDPRESS_INTEGRATE_PATH')) {
            $userid = qa_handle_to_userid($handle);
            $cover = get_user_meta($userid, 'cover');
            $cover = $cover[0];
        } else {
            $profile = ra_user_profile($handle);
            $cover = @$profile['cover'];
        }
        if (isset($cover)) {
            $image_file = explode('.', $cover);
            $cover = 'style="background:url(' . qa_opt('site_url') . 'images/' . @$image_file[0] . '_s.' . $image_file[1] . ') no-repeat scroll 0 0 / cover;"';
        }
        ?>
		<div id="<?php 
        echo $userid;
        ?>
_popover" class="user-popover">
			<div class="cover" <?php 
        echo @$cover;
        ?>
>
				<div class="avatar pull-left"><?php 
        echo ra_get_avatar($handle, 50);
        ?>
</div>
			</div>
			<div class="bar">		
				<span class="followers-count pull-right icon-star btn btn-warning"><?php 
        echo ra_user_followers_count($handle);
        ?>
</span>
				<h3 class="name"><?php 
        echo ra_name($handle);
        ?>
</h3>				
			</div>
			<div class="extra clearfix">
				<div class="points">
					<?php 
        echo '<span>' . ra_user_points($handle) . '</span>' . _ra_lang('P');
        ?>
				</div>
				<div class="badges">
					<?php 
        echo $badges;
        ?>
				</div>
			</div>
		</div>	
		<?php 
    }
    die;
}
Пример #2
0
    function sc_ra_user_cover()
    {
        if (qw_hook_exist(__FUNCTION__)) {
            $args = func_get_args();
            array_unshift($args, $this);
            return qw_event_hook(__FUNCTION__, $args, NULL);
        }
        if (defined('QA_WORDPRESS_INTEGRATE_PATH')) {
            require_once QA_INCLUDE_DIR . 'qa-app-posts.php';
            $handle = qa_post_userid_to_handle($this->content['raw']['userid']);
            $userid = $this->content['raw']['userid'];
        } else {
            $handle = $this->content['raw']['account']['handle'];
            $userid = $this->content['raw']['account']['userid'];
        }
        $user = ra_user_data($handle);
        $profile = ra_user_profile($handle);
        ob_start();
        ?>
			<div class="user-top clearfix">
				<?php 
        if (qa_get_logged_in_userid() == $userid) {
            ?>
					<a id="upload-cover" class="btn btn-default"><?php 
            ra_lang('Change cover');
            ?>
</a>
				<?php 
        }
        ?>
				<div class="user-bar">
					<div class="avatar pull-left">
						<?php 
        echo ra_get_avatar($handle, 150);
        ?>
					</div>			
				</div>	
				<div class="user-bar-holder">
					<div class="user-stat pull-right">
						<ul>
							<li class="points"><?php 
        echo $user[0]['points'];
        ?>
 <span><?php 
        ra_lang('Points');
        ?>
</span></li>
							<li class="followers"><?php 
        ra_user_followers_count($handle, true);
        ?>
 <span><?php 
        ra_lang('Followers');
        ?>
</span></li>
						</ul>
					</div>
					<div class="user-nag">	
						<div class="user-buttons pull-right">
							<?php 
        $this->favorite();
        if (!defined('QA_WORDPRESS_INTEGRATE_PATH') && qa_opt('allow_private_messages') && qa_get_logged_in_userid() != $this->content['raw']['account']['userid'] && !($this->content['raw']['account']['flags'] & QA_USER_FLAGS_NO_MESSAGES)) {
            echo '<a class="btn btn-primary btn-sm icon-envelope-alt" href="' . qa_path_html('message/' . $handle) . '">' . _ra_lang('Send message') . '</a>';
        }
        ?>
						</div>
						<h3 class="user-name"><?php 
        echo ra_name($handle);
        ?>
</h3>				
					</div>
				</div>
			</div>
		<?php 
        $this->output(ob_get_clean());
    }