wpdb Object
(
[show_errors] =>
[suppress_errors] =>
[last_error] =>
[num_queries] => 20
[num_rows] => 2
[rows_affected] => 0
[insert_id] => 0
[last_query] => SELECT
nam.id,
nam.first_name,
nam.last_name,
nam.email,
nam.location,
nam.picture,
nam.profile_url,
nam.industry,
nam.created,
pos.location as loc_work,
pos.title as profession,
com.name as com_name,
com.industry as com_inds
from
users_signin nam,
users_positions pos,
users_company com
WHERE nam.oauth_provider = 'linkedin'
AND nam.id = pos.users_id
AND pos.company_id = com.id
limit 0, 20
<b>[last_result] => Array
(</b>
[0] => stdClass Object
(
[id] => 1
[first_name] => Хабиб
[last_name] => Макгрэгович
[email] => dvoeglazov.ilya@yandex.ru
[location] => United States
[picture] => https://media.licdn.com/dms/image/C4D03AQF7xeYVfWVd0Q/profile-displayphoto-shrink_100_100/0?e=1544054400&v=beta&t=bCAj7ixxdIj7Mmk2pH1iIdTGUK7VZLPKcBXxEK5Grts
[profile_url] => http://www.linkedin.com/in/%D1%85%D0%B0%D0%B1%D0%B8%D0%B1-%D0%BC%D0%B0%D0%BA%D0%B3%D1%80%D1%8D%D0%B3%D0%BE%D0%B2%D0%B8%D1%87-9b57a412b
[industry] => Information Technology and Services
[created] => 2018-10-04 23:13:00
[loc_work] => Saint Petersburg, Russian Federation
[profession] => Frontend Engineer
[com_name] => Paladin Engineering
[com_inds] => Информационные технологии и услуги
)
[1] => stdClass Object
(
[id] => 1
[first_name] => Хабиб
[last_name] => Макгрэгович
[email] => dvoeglazov.ilya@yandex.ru
[location] => United States
[picture] => https://media.licdn.com/dms/image/C4D03AQF7xeYVfWVd0Q/profile-displayphoto-shrink_100_100/0?e=1544054400&v=beta&t=bCAj7ixxdIj7Mmk2pH1iIdTGUK7VZLPKcBXxEK5Grts
[profile_url] => http://www.linkedin.com/in/%D1%85%D0%B0%D0%B1%D0%B8%D0%B1-%D0%BC%D0%B0%D0%BA%D0%B3%D1%80%D1%8D%D0%B3%D0%BE%D0%B2%D0%B8%D1%87-9b57a412b
[industry] => Information Technology and Services
[created] => 2018-10-04 23:13:00
[loc_work] =>
[profession] => Капитан команды
[com_name] => Яндекс Терра
[com_inds] => Нефтяная и энергетическая промышленность
)
)
<?php
function wp_schools_list() {
global $wpdb;
$table_name = "users_signin";
$table_positions = 'users_positions';
$table_company = 'users_company';
$pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 1;
$limit = 20; // number of rows in page
$offset = ( $pagenum - 1 ) * $limit;
$total = $wpdb->get_var( "select count(*) as total from $table_name WHERE oauth_provider = 'linkedin'" );
$num_of_pages = ceil( $total / $limit );
$rows = $wpdb->get_results(
"SELECT
nam.id,
nam.first_name,
nam.last_name,
nam.email,
nam.location,
nam.picture,
nam.profile_url,
nam.industry,
nam.created,
pos.location as loc_work,
pos.title as profession,
com.name as com_name,
com.industry as com_inds
from
$table_name nam,
$table_positions pos,
$table_company com
WHERE nam.oauth_provider = 'linkedin'
AND nam.id = pos.users_id
AND pos.company_id = com.id
limit $offset, $limit"
);
$rowcount = $wpdb->num_rows;
echo "<pre>";
print_r($rows);
?>
<!-- <link type="text/css" href="<?php #echo WP_PLUGIN_URL; ?>mywp/sinetiks-schools/style-admin.css" rel="stylesheet" /> -->
<div class="wrap abs">
<table class='wp-list-table widefat fixed striped posts'>
<tr>
<th class="manage-column ss-list-width">#</th>
<th class="manage-column ss-list-width">Full Name</th>
<th class="manage-column ss-list-width">Email</th>
<th class="manage-column ss-list-width">Location</th>
<th class="manage-column ss-list-width">Picture</th>
<th class="manage-column ss-list-width">Industry</th>
<th class="manage-column ss-list-width">location_work</th>
<th class="manage-column ss-list-width">Profession</th>
<th class="manage-column ss-list-width">Company name</th>
<th class="manage-column ss-list-width">Company industry</th>
<th class="manage-column ss-list-width">Created</th>
</tr>
<?php
if($rowcount>0){
$i = $offset;
foreach ($rows as $row) { $i++; ?>
<tr>
<td class="manage-column ss-list-width"><?php echo $i; ?></td>
<td class="manage-column ss-list-width">
<a target="_blank" href="<?php echo $row->profile_url; ?>">
<?php echo $row->first_name . ' '. $row->last_name; ?>
</a>
</td>
<td class="manage-column ss-list-width"><?php echo $row->email; ?></td>
<td class="manage-column ss-list-width"><?php echo $row->location; ?></td>
<td class="manage-column ss-list-width">
<a target="_blank" href="<?php echo $row->profile_url; ?>">
<img src="<?php echo $row->picture; ?>" alt="">
</a>
</td>
<td class="manage-column ss-list-width"><?php echo $row->industry; ?></td>
<td class="manage-column ss-list-width"><?php echo $row->loc_work; ?></td>
<td class="manage-column ss-list-width"><?php echo $row->profession; ?></td>
<td class="manage-column ss-list-width"><?php echo $row->com_name; ?></td>
<td class="manage-column ss-list-width"><?php echo $row->com_inds; ?></td>
<td class="manage-column ss-list-width"><?php echo $row->created; ?></td>
</tr>
<?php } }else{
echo "<tr><td cols=an='5'>No records found</td></tr>";
} ?>
</table>
</div>
<?php
$page_links = paginate_links( array(
'base' => add_query_arg( 'pagenum', '%#%' ),
'format' => '',
'prev_text' => __( '«', 'text-domain' ),
'next_text' => __( '»', 'text-domain' ),
'total' => $num_of_pages,
'current' => $pagenum
) );
if ( $page_links ) {
echo '<div class="tablenav" style="width: 99%;"><div class="tablenav-pages" style="margin: 1em 0">' . $page_links . '</div></div>';
}
}
wp_schools_list();