예제 #1
0
    function wp_ulike_comments_um_profile_content($args)
    {
        global $wp_ulike_class, $ultimatemember;
        $args = array("user_id" => um_profile_id(), "col" => 'comment_id', "table" => 'ulike_comments', "limit" => 10);
        $user_logs = $wp_ulike_class->get_current_user_likes($args);
        if ($user_logs != null) {
            echo '<div class="um-profile-note"><span>' . __('Recent Comments Liked', 'alimir') . '</span></div>';
            foreach ($user_logs as $user_log) {
                $comment = get_comment(stripslashes($user_log->comment_id));
                $get_date = $user_log->date_time;
                echo '<div class="um-item">';
                echo '<div class="um-item-link">
						  <i class="um-icon-ios-chatboxes"></i>
						  <a href="' . get_comment_link($comment->comment_ID) . '">' . $comment->comment_content . '</a>
						  <em style="font-size:.7em;padding:0 10px;"><span class="um-faicon-quote-left"></span> ' . $comment->comment_author . ' <span class="um-faicon-quote-right"></span></em>
						  </div>';
                echo '<div class="um-item-meta">
						  <span>' . wp_ulike_date_i18n($get_date) . '</span>
						  <span class="badge"><i class="um-faicon-thumbs-o-up"></i> ' . get_comment_meta($comment->comment_ID, '_commentliked', true) . '</span>
						  </div>';
                echo '</div>';
            }
        } else {
            echo '<div style="display: block;" class="um-profile-note"><i class="um-faicon-frown-o"></i><span>' . __('This user has not made any likes.', 'alimir') . '</span></div>';
        }
    }
예제 #2
0
파일: logs.php 프로젝트: hyperweb2/wp-ulike
/**
 * Create WP ULike bbPress Logs page with separate pagination
 *
 * @author       	Alimir	 	
 * @since           2.2
 * @return			String
 */
function wp_ulike_bbpress_likes_logs()
{
    global $wpdb;
    $alternate = true;
    $items = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "ulike_forums");
    if ($items > 0) {
        $p = new pagination();
        $p->items($items);
        $p->limit(wp_ulike_logs_return_per_page());
        // Limit entries per page
        $p->target("admin.php?page=wp-ulike-bbpress-logs");
        $p->calculate();
        // Calculates what to show
        $p->parameterName('page_number');
        $p->adjacents(1);
        //No. of page away from the current page
        if (!isset($_GET['page_number'])) {
            $p->page = 1;
        } else {
            $p->page = $_GET['page_number'];
        }
        //Query for limit page_number
        $limit = "LIMIT " . ($p->page - 1) * $p->limit . ", " . $p->limit;
        $get_ulike_logs = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "ulike_forums ORDER BY id DESC " . $limit . "");
        ?>
	<div class="wrap">
		<h2><?php 
        _e('WP ULike Logs', 'alimir');
        ?>
</h2>
		<h3><?php 
        _e('Topics Likes Logs', 'alimir');
        ?>
</h3>
		<div class="tablenav">
			<div class='tablenav-pages'>
				<span class="displaying-num"><?php 
        echo $items . ' ' . __('Logs', 'alimir');
        ?>
</span>
				<?php 
        echo $p->show();
        // Echo out the list of paging.
        ?>
			</div>
		</div>
		<table class="widefat">
			<thead>
				<tr>
					<th width="2%"><?php 
        _e('ID', 'alimir');
        ?>
</th>
					<th width="10%"><?php 
        _e('Username', 'alimir');
        ?>
</th>
					<th><?php 
        _e('Status', 'alimir');
        ?>
</th>
					<th width="6%"><?php 
        _e('Topic ID', 'alimir');
        ?>
</th>
					<th><?php 
        _e('Topic Title', 'alimir');
        ?>
</th>
					<th width="20%"><?php 
        _e('Date / Time', 'alimir');
        ?>
</th>
					<th><?php 
        _e('IP', 'alimir');
        ?>
</th>
					<th><?php 
        _e('Actions', 'alimir');
        ?>
</th>
				</tr>
			</thead>
			<tbody class="wp_ulike_logs">
				<?php 
        foreach ($get_ulike_logs as $get_ulike_log) {
            ?>
				<tr <?php 
            if ($alternate == true) {
                echo 'class="alternate"';
            }
            ?>
>
				<td>
				<?php 
            echo $get_ulike_log->id;
            ?>
				</td>
				<td>
				<?php 
            $user_info = get_userdata($get_ulike_log->user_id);
            if ($user_info) {
                echo get_avatar($user_info->user_email, 16, '', 'avatar') . '<em> @' . $user_info->user_login . '</em>';
            } else {
                echo '<em> #' . __('Guest User', 'alimir') . '</em>';
            }
            ?>
				</td>
				<td>
				<?php 
            $get_the_status = $get_ulike_log->status;
            if ($get_the_status == 'like') {
                echo '<img src="' . plugin_dir_url(__FILE__) . '/classes/img/like.png" alt="like" width="24"/>';
            } else {
                echo '<img src="' . plugin_dir_url(__FILE__) . '/classes/img/unlike.png" alt="unlike" width="24"/>';
            }
            ?>
				</td>
				<td>
				<?php 
            echo $get_ulike_log->topic_id;
            ?>
				</td>
				<td>
				<?php 
            echo '<a href="' . get_permalink($get_ulike_log->topic_id) . '" title="' . get_the_title($get_ulike_log->topic_id) . '">' . get_the_title($get_ulike_log->topic_id) . '</a>';
            ?>
 
				</td>
				<td>
				<?php 
            echo wp_ulike_date_i18n($get_ulike_log->date_time);
            ?>
 
				</td>
				<td>
				<?php 
            echo $get_ulike_log->ip;
            ?>
 
				</td>
				<td>
				<button class="wp_ulike_delete button" type="button" data-id="<?php 
            echo $get_ulike_log->id;
            ?>
" data-table="ulike_forums"><i class="dashicons dashicons-trash"></i></button> 
				</td>
				<?php 
            $alternate = !$alternate;
        }
        ?>
				</tr>
			</tbody>
		</table>
		<div class="tablenav">
			<div class='tablenav-pages'>
				<span class="displaying-num"><?php 
        echo $items . ' ' . __('Logs', 'alimir');
        ?>
</span>
				<?php 
        echo $p->show();
        // Echo out the list of paging.
        ?>
			</div>
		</div>
	</div>
		
	<?php 
    } else {
        echo "<div class='error'><p>" . __('<strong>ERROR:</strong> No Record Found. (This problem is created because you don\'t have any data on this table)', 'alimir') . "</p></div>";
    }
}