Guest User

Untitled

a guest
Sep 14th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.40 KB | None | 0 0
  1. <?php
  2. /**
  3. * In your active theme create the folder `/paid-memberships-pro/pmpro-member-directory/` and save the code from this gist in a file called `directory.php`.
  4. * This shortcode will display the members list and additional content based on the defined attributes.
  5. */
  6. function pmpromd_shortcode( $atts, $content = null, $code = '' ) {
  7. // $atts ::= array of attributes
  8. // $content ::= text within enclosing form of shortcode element
  9. // $code ::= the shortcode found, when == callback name
  10. // examples: [pmpro_member_directory show_avatar="false" show_email="false" levels="1,2"]
  11. extract(
  12. shortcode_atts(
  13. array(
  14. 'avatar_size' => '128',
  15. 'fields' => null,
  16. 'layout' => 'div',
  17. 'level' => null,
  18. 'levels' => null,
  19. 'limit' => null,
  20. 'link' => null,
  21. 'order_by' => 'u.display_name',
  22. 'order' => 'ASC',
  23. 'show_avatar' => null,
  24. 'show_email' => null,
  25. 'show_level' => null,
  26. 'show_search' => null,
  27. 'show_startdate' => null,
  28. ), $atts, 'pmpro_member_directory'
  29. )
  30. );
  31.  
  32. global $wpdb, $post, $pmpro_pages, $pmprorh_registration_fields;
  33.  
  34. // some page vars
  35. if ( ! empty( $pmpro_pages['directory'] ) ) {
  36. $directory_url = get_permalink( $pmpro_pages['directory'] );
  37. }
  38. if ( ! empty( $pmpro_pages['profile'] ) ) {
  39. $profile_url = get_permalink( $pmpro_pages['profile'] );
  40. }
  41.  
  42. // turn 0's into falses
  43. if ( $link === '0' || $link === 'false' || $link === 'no' ) {
  44. $link = false;
  45. } else {
  46. $link = true;
  47. }
  48.  
  49. // did they use level instead of levels?
  50. if ( empty( $levels ) && ! empty( $level ) ) {
  51. $levels = $level;
  52. }
  53.  
  54. if ( $show_avatar === '0' || $show_avatar === 'false' || $show_avatar === 'no' ) {
  55. $show_avatar = false;
  56. } else {
  57. $show_avatar = true;
  58. }
  59.  
  60. if ( $show_email === '0' || $show_email === 'false' || $show_email === 'no' ) {
  61. $show_email = false;
  62. } else {
  63. $show_email = true;
  64. }
  65.  
  66. if ( $show_level === '0' || $show_level === 'false' || $show_level === 'no' ) {
  67. $show_level = false;
  68. } else {
  69. $show_level = true;
  70. }
  71.  
  72. if ( $show_search === '0' || $show_search === 'false' || $show_search === 'no' ) {
  73. $show_search = false;
  74. } else {
  75. $show_search = true;
  76. }
  77.  
  78. if ( $show_startdate === '0' || $show_startdate === 'false' || $show_startdate === 'no' ) {
  79. $show_startdate = false;
  80. } else {
  81. $show_startdate = true;
  82. }
  83.  
  84. if ( isset( $_REQUEST['ps'] ) ) {
  85. $s = $_REQUEST['ps'];
  86. } else {
  87. $s = '';
  88. }
  89.  
  90. if ( isset( $_REQUEST['pn'] ) ) {
  91. $pn = intval( $_REQUEST['pn'] );
  92. } else {
  93. $pn = 1;
  94. }
  95.  
  96. if ( isset( $_REQUEST['limit'] ) ) {
  97. $limit = intval( $_REQUEST['limit'] );
  98. } elseif ( empty( $limit ) ) {
  99. $limit = 15;
  100. }
  101.  
  102. $end = $pn * $limit;
  103. $start = $end - $limit;
  104.  
  105. if ( $s ) {
  106. $sqlQuery = "SELECT SQL_CALC_FOUND_ROWS u.ID, u.user_login, u.user_email, u.user_nicename, u.display_name, UNIX_TIMESTAMP(u.user_registered) as joindate, mu.membership_id, mu.initial_payment, mu.billing_amount, mu.cycle_period, mu.cycle_number, mu.billing_limit, mu.trial_amount, mu.trial_limit, UNIX_TIMESTAMP(mu.startdate) as startdate, UNIX_TIMESTAMP(mu.enddate) as enddate, m.name as membership, umf.meta_value as first_name, uml.meta_value as last_name FROM $wpdb->users u LEFT JOIN $wpdb->usermeta umh ON umh.meta_key = 'pmpromd_hide_directory' AND u.ID = umh.user_id LEFT JOIN $wpdb->usermeta umf ON umf.meta_key = 'first_name' AND u.ID = umf.user_id LEFT JOIN $wpdb->usermeta uml ON uml.meta_key = 'last_name' AND u.ID = uml.user_id LEFT JOIN $wpdb->usermeta um ON u.ID = um.user_id LEFT JOIN $wpdb->pmpro_memberships_users mu ON u.ID = mu.user_id LEFT JOIN $wpdb->pmpro_membership_levels m ON mu.membership_id = m.id WHERE mu.status = 'active' AND (umh.meta_value IS NULL OR umh.meta_value <> '1') AND mu.membership_id > 0 AND ";
  107.  
  108. $sqlQuery .= "(u.user_login LIKE '%" . esc_sql( $s ) . "%' OR u.user_email LIKE '%" . esc_sql( $s ) . "%' OR u.display_name LIKE '%" . esc_sql( $s ) . "%' OR um.meta_value LIKE '%" . esc_sql( $s ) . "%') ";
  109.  
  110. if ( $levels ) {
  111. $sqlQuery .= ' AND mu.membership_id IN(' . esc_sql( $levels ) . ') ';
  112. }
  113.  
  114. $sqlQuery .= 'GROUP BY u.ID ORDER BY ' . esc_sql( $order_by ) . ' ' . $order;
  115. } else {
  116. $sqlQuery = "SELECT SQL_CALC_FOUND_ROWS u.ID, u.user_login, u.user_email, u.user_nicename, u.display_name, UNIX_TIMESTAMP(u.user_registered) as joindate, mu.membership_id, mu.initial_payment, mu.billing_amount, mu.cycle_period, mu.cycle_number, mu.billing_limit, mu.trial_amount, mu.trial_limit, UNIX_TIMESTAMP(mu.startdate) as startdate, UNIX_TIMESTAMP(mu.enddate) as enddate, m.name as membership, umf.meta_value as first_name, uml.meta_value as last_name FROM $wpdb->users u LEFT JOIN $wpdb->usermeta umh ON umh.meta_key = 'pmpromd_hide_directory' AND u.ID = umh.user_id LEFT JOIN $wpdb->usermeta umf ON umf.meta_key = 'first_name' AND u.ID = umf.user_id LEFT JOIN $wpdb->usermeta uml ON uml.meta_key = 'last_name' AND u.ID = uml.user_id LEFT JOIN $wpdb->pmpro_memberships_users mu ON u.ID = mu.user_id LEFT JOIN $wpdb->pmpro_membership_levels m ON mu.membership_id = m.id";
  117. $sqlQuery .= " WHERE mu.status = 'active' AND (umh.meta_value IS NULL OR umh.meta_value <> '1') AND mu.membership_id > 0 ";
  118. if ( $levels ) {
  119. $sqlQuery .= ' AND mu.membership_id IN(' . esc_sql( $levels ) . ') ';
  120. }
  121. $sqlQuery .= 'ORDER BY ' . esc_sql( $order_by ) . ' ' . esc_sql( $order );
  122. }
  123.  
  124. $sqlQuery .= " LIMIT $start, $limit";
  125.  
  126. $sqlQuery = apply_filters( 'pmpro_member_directory_sql', $sqlQuery, $levels, $s, $pn, $limit, $start, $end, $order_by, $order );
  127.  
  128. $theusers = $wpdb->get_results( $sqlQuery );
  129. $totalrows = $wpdb->get_var( 'SELECT FOUND_ROWS() as found_rows' );
  130.  
  131. // update end to match totalrows if total rows is small
  132. if ( $totalrows < $end ) {
  133. $end = $totalrows;
  134. }
  135.  
  136. $layout_cols = preg_replace( '/[^0-9]/', '', $layout );
  137. if ( ! empty( $layout_cols ) ) {
  138. $theusers_chunks = array_chunk( $theusers, $layout_cols );
  139. } else {
  140. $theusers_chunks = array_chunk( $theusers, 1 );
  141. }
  142.  
  143. ob_start();
  144.  
  145. ?>
  146. <?php
  147. if ( ! empty( $show_search ) ) {
  148. echo '<h4 style="color:tomato;">' . __FILE__ . ' Line ' . __LINE__ . '</h4>';
  149.  
  150. ?>
  151. <form role="search" class="pmpro_member_directory_search search-form">
  152. <label>
  153. <span class="screen-reader-text"><?php _e( 'Search for:', 'pmpromd' ); ?></span>
  154. <input type="search" class="search-field" placeholder="<?php _e( 'Search Members', 'pmpromd' ); ?>" name="ps" value="
  155. <?php
  156. if ( ! empty( $_REQUEST['ps'] ) ) {
  157. echo esc_attr( $_REQUEST['ps'] );}
  158. ?>
  159. " title="<?php _e( 'Search Members', 'pmpromd' ); ?>" />
  160. <input type="hidden" name="limit" value="<?php echo esc_attr( $limit ); ?>" />
  161. </label>
  162. <input type="submit" class="search-submit" value="<?php _e( 'Search Members', 'pmpromd' ); ?>">
  163. </form>
  164. <style type="text/css">
  165. #katherine-filter {
  166. float: right;
  167. margin-right: 1rem;
  168. }
  169. </style>
  170. <select id="katherine-filter">
  171. <option>Sample HTML only</option>
  172. <option>PHP needed to</option>
  173. <option>Query and Sort</option>
  174. <option>Results from Below</option>
  175. </select>
  176. <?php } ?>
  177. <h3 id="pmpro_member_directory_subheading">
  178. <?php if ( ! empty( $s ) ) { ?>
  179. <?php printf( __( 'Profiles Within <em>%s</em>.', 'pmpromd' ), ucwords( esc_html( $s ) ) ); ?><br>
  180. <?php } else { ?>
  181. <?php _e( 'Viewing All Profiles', 'pmpromd' ); ?>
  182. <?php } ?><br>
  183. <?php if ( $totalrows > 0 ) { ?>
  184. <small class="muted">
  185. (
  186. <?php
  187. if ( $totalrows == 1 ) {
  188. printf( __( 'Showing 1 Result', 'pmpromd' ), $start + 1, $end, $totalrows );
  189. } else {
  190. printf( __( 'Showing %1$s-%2$s of %3$s Results', 'pmpromd' ), $start + 1, $end, $totalrows );
  191. }
  192. ?>
  193. )
  194. </small>
  195. <?php } ?>
  196. </h3>
  197. <?php
  198. if ( ! empty( $theusers ) ) {
  199. if ( ! empty( $fields ) ) {
  200. $fields_array = explode( ';', $fields );
  201. if ( ! empty( $fields_array ) ) {
  202. for ( $i = 0; $i < count( $fields_array ); $i++ ) {
  203. $fields_array[ $i ] = explode( ',', trim( $fields_array[ $i ] ) );
  204. }
  205. }
  206. } else {
  207. $fields_array = false;
  208. }
  209.  
  210. // Get Register Helper field options
  211. $rh_fields = array();
  212. if ( ! empty( $pmprorh_registration_fields ) ) {
  213. foreach ( $pmprorh_registration_fields as $location ) {
  214. foreach ( $location as $field ) {
  215. if ( ! empty( $field->options ) ) {
  216. $rh_fields[ $field->name ] = $field->options;
  217. }
  218. }
  219. }
  220. }
  221. ?>
  222. <div class="pmpro_member_directory">
  223. <hr class="clear" />
  224. <?php
  225. if ( $layout == 'table' ) {
  226. ?>
  227. <table width="100%" cellpadding="0" cellspacing="0" border="0">
  228. <thead>
  229. <?php if ( ! empty( $show_avatar ) ) { ?>
  230. <th class="pmpro_member_directory_avatar">
  231. <?php _e( 'Avatar', 'pmpromd' ); ?>
  232. </th>
  233. <?php } ?>
  234. <th class="pmpro_member_directory_display-name">
  235. <?php _e( 'Member', 'pmpromd' ); ?>
  236. </th>
  237. <?php if ( ! empty( $show_email ) ) { ?>
  238. <th class="pmpro_member_directory_email">
  239. <?php _e( 'Email Address', 'pmpromd' ); ?>
  240. </th>
  241. <?php } ?>
  242. <?php if ( ! empty( $fields_array ) ) { ?>
  243. <th class="pmpro_member_directory_additional">
  244. <?php _e( 'More Information', 'pmpromd' ); ?>
  245. </th>
  246. <?php } ?>
  247. <?php if ( ! empty( $show_level ) ) { ?>
  248. <th class="pmpro_member_directory_level">
  249. <?php _e( 'Level', 'pmpromd' ); ?>
  250. </th>
  251. <?php } ?>
  252. <?php if ( ! empty( $show_startdate ) ) { ?>
  253. <th class="pmpro_member_directory_date">
  254. <?php _e( 'Start Date', 'pmpromd' ); ?>
  255. </th>
  256. <?php } ?>
  257. <?php if ( ! empty( $link ) && ! empty( $profile_url ) ) { ?>
  258. <th class="pmpro_member_directory_link">&nbsp;</th>
  259. <?php } ?>
  260. </thead>
  261. <tbody>
  262. <?php
  263. $count = 0;
  264. foreach ( $theusers as $auser ) {
  265. $auser = get_userdata( $auser->ID );
  266. $auser->membership_level = pmpro_getMembershipLevelForUser( $auser->ID );
  267. $count++;
  268. ?>
  269. <tr id="pmpro_member_directory_row-<?php echo $auser->ID; ?>" class="pmpro_member_directory_row
  270. <?php
  271. if ( ! empty( $link ) && ! empty( $profile_url ) ) {
  272. echo ' pmpro_member_directory_linked'; }
  273. ?>
  274. ">
  275. <?php if ( ! empty( $show_avatar ) ) { ?>
  276. <td class="pmpro_member_directory_avatar">
  277. <?php if ( ! empty( $link ) && ! empty( $profile_url ) ) { ?>
  278. <a href="<?php echo add_query_arg( 'pu', $auser->user_nicename, $profile_url ); ?>"><?php echo get_avatar( $auser->ID, $avatar_size ); ?></a>
  279. <?php } else { ?>
  280. <?php echo get_avatar( $auser->ID, $avatar_size ); ?>
  281. <?php } ?>
  282. </td>
  283. <?php } ?>
  284. <td>
  285. <h3 class="pmpro_member_directory_display-name">
  286. <?php if ( ! empty( $link ) && ! empty( $profile_url ) ) { ?>
  287. <a href="<?php echo add_query_arg( 'pu', $auser->user_nicename, $profile_url ); ?>"><?php echo $auser->display_name; ?></a>
  288. <?php } else { ?>
  289. <?php echo $auser->display_name; ?>
  290. <?php } ?>
  291. </h3>
  292. </td>
  293. <?php if ( ! empty( $show_email ) ) { ?>
  294. <td class="pmpro_member_directory_email">
  295. <?php echo $auser->user_email; ?>
  296. </td>
  297. <?php } ?>
  298. <?php
  299. if ( ! empty( $fields_array ) ) {
  300. ?>
  301. <td class="pmpro_member_directory_additional">
  302. <?php
  303. foreach ( $fields_array as $field ) {
  304. if ( WP_DEBUG ) {
  305. error_log( 'Content of field data: ' . print_r( $field, true ) );
  306. }
  307.  
  308. $meta_field = $auser->{$field[1]};
  309. if ( ! empty( $meta_field ) ) {
  310. ?>
  311. <p class="pmpro_member_directory_<?php echo $field[1]; ?>">
  312. <?php
  313. if ( is_array( $meta_field ) && ! empty( $meta_field['filename'] ) ) {
  314. // this is a file field
  315. ?>
  316. <strong><?php echo $field[0]; ?></strong>
  317. <?php echo pmpromd_display_file_field( $meta_field ); ?>
  318. <?php
  319. } elseif ( is_array( $meta_field ) ) {
  320. // this is a general array, check for Register Helper options first
  321. if ( ! empty( $rh_fields[ $field[1] ] ) ) {
  322. foreach ( $meta_field as $key => $value ) {
  323. $meta_field[ $key ] = $rh_fields[ $field[1] ][ $value ];
  324. }
  325. }
  326. ?>
  327. <strong><?php echo $field[0]; ?></strong>
  328. <?php echo implode( ', ', $meta_field ); ?>
  329. <?php
  330. } else {
  331. if ( $field[1] == 'user_url' ) {
  332. ?>
  333. <a href="<?php echo esc_url( $meta_field ); ?>" target="_blank"><?php echo $field[0]; ?></a>
  334. <?php
  335. } else {
  336. ?>
  337. <strong><?php echo $field[0]; ?></strong>
  338. <?php
  339. $meta_field_embed = wp_oembed_get( $meta_field );
  340. if ( ! empty( $meta_field_embed ) ) {
  341. echo $meta_field_embed;
  342. } else {
  343. echo make_clickable( $meta_field );
  344. }
  345. ?>
  346. <?php
  347. }
  348. }
  349. ?>
  350. </p>
  351. <?php
  352. }
  353. }
  354. ?>
  355. </td>
  356. <?php
  357. }
  358. ?>
  359. <?php if ( ! empty( $show_level ) ) { ?>
  360. <td class="pmpro_member_directory_level">
  361. <?php echo $auser->membership_level->name; ?>
  362. </td>
  363. <?php } ?>
  364. <?php if ( ! empty( $show_startdate ) ) { ?>
  365. <td class="pmpro_member_directory_date">
  366. <?php echo date( get_option( 'date_format' ), $auser->membership_level->startdate ); ?>
  367. </td>
  368. <?php } ?>
  369. <?php if ( ! empty( $link ) && ! empty( $profile_url ) ) { ?>
  370. <td class="pmpro_member_directory_link">
  371. <a href="<?php echo add_query_arg( 'pu', $auser->user_nicename, $profile_url ); ?>"><?php _e( 'View Profile', 'pmpromd' ); ?></a>
  372. </td>
  373. <?php } ?>
  374. </tr>
  375. <?php
  376. }
  377. ?>
  378. </tbody>
  379. </table>
  380. <?php
  381. } else {
  382. $count = 0;
  383. foreach ( $theusers_chunks as $row ) :
  384. ?>
  385. <div class="row">
  386. <?php
  387. foreach ( $row as $auser ) {
  388. $count++;
  389. $auser = get_userdata( $auser->ID );
  390. $auser->membership_level = pmpro_getMembershipLevelForUser( $auser->ID );
  391. ?>
  392. <div class="medium-
  393. <?php
  394. if ( $layout == '2col' ) {
  395. $avatar_align = 'alignright';
  396. echo '6 ';
  397. } elseif ( $layout == '3col' ) {
  398. $avatar_align = 'aligncenter';
  399. echo '4 text-center ';
  400. } elseif ( $layout == '4col' ) {
  401. $avatar_align = 'aligncenter';
  402. echo '3 text-center ';
  403. } else {
  404. $avatar_align = 'alignright';
  405. echo '12 ';
  406. }
  407. if ( $count == $end ) {
  408. echo 'end ';
  409. }
  410. ?>
  411. columns">
  412. <div id="pmpro_member-<?php echo $auser->ID; ?>">
  413. <?php if ( ! empty( $show_avatar ) ) { ?>
  414. <div class="pmpro_member_directory_avatar">
  415. <?php if ( ! empty( $link ) && ! empty( $profile_url ) ) { ?>
  416. <a class="<?php echo $avatar_align; ?>" href="<?php echo add_query_arg( 'pu', $auser->user_nicename, $profile_url ); ?>"><?php echo get_avatar( $auser->ID, $avatar_size, null, $auser->display_name ); ?></a>
  417. <?php } else { ?>
  418. <span class="<?php echo $avatar_align; ?>"><?php echo get_avatar( $auser->ID, $avatar_size, null, $auser->display_name ); ?></span>
  419. <?php } ?>
  420. </div>
  421. <?php } ?>
  422. <h3 class="pmpro_member_directory_display-name">
  423. <?php if ( ! empty( $link ) && ! empty( $profile_url ) ) { ?>
  424. <a href="<?php echo add_query_arg( 'pu', $auser->user_nicename, $profile_url ); ?>"><?php echo $auser->display_name; ?></a>
  425. <?php } else { ?>
  426. <?php echo $auser->display_name; ?>
  427. <?php } ?>
  428. </h3>
  429. <?php if ( ! empty( $show_email ) ) { ?>
  430. <p class="pmpro_member_directory_email">
  431. <strong><?php _e( 'Email Address', 'pmpromd' ); ?></strong>
  432. <?php echo $auser->user_email; ?>
  433. </p>
  434. <?php } ?>
  435. <?php if ( ! empty( $show_level ) ) { ?>
  436. <p class="pmpro_member_directory_level">
  437. <strong><?php _e( 'Level', 'pmpromd' ); ?></strong>
  438. <?php echo $auser->membership_level->name; ?>
  439. </p>
  440. <?php } ?>
  441. <?php if ( ! empty( $show_startdate ) ) { ?>
  442. <p class="pmpro_member_directory_date">
  443. <strong><?php _e( 'Start Date', 'pmpromd' ); ?></strong>
  444. <?php echo date( get_option( 'date_format' ), $auser->membership_level->startdate ); ?>
  445. </p>
  446. <?php } ?>
  447. <?php
  448. if ( ! empty( $fields_array ) ) {
  449. foreach ( $fields_array as $field ) {
  450. $meta_field = $auser->{$field[1]};
  451. if ( ! empty( $meta_field ) ) {
  452. ?>
  453. <p class="pmpro_member_directory_<?php echo $field[1]; ?>">
  454. <?php
  455. if ( is_array( $meta_field ) && ! empty( $meta_field['filename'] ) ) {
  456. // this is a file field
  457. ?>
  458. <strong><?php echo $field[0]; ?></strong>
  459. <?php echo pmpromd_display_file_field( $meta_field ); ?>
  460. <?php
  461. } elseif ( is_array( $meta_field ) ) {
  462. // this is a general array, check for Register Helper options first
  463. if ( ! empty( $rh_fields[ $field[1] ] ) ) {
  464. foreach ( $meta_field as $key => $value ) {
  465. $meta_field[ $key ] = $rh_fields[ $field[1] ][ $value ];
  466. }
  467. }
  468. ?>
  469. <strong><?php echo $field[0]; ?></strong>
  470. <?php echo implode( ', ', $meta_field ); ?>
  471. <?php
  472. } elseif ( $field[1] == 'user_url' ) {
  473. ?>
  474. <a href="<?php echo $auser->{$field[1]}; ?>" target="_blank"><?php echo $field[0]; ?></a>
  475. <?php
  476. } else {
  477. ?>
  478. <strong><?php echo $field[0]; ?>:</strong>
  479. <?php echo make_clickable( $auser->{$field[1]} ); ?>
  480. <?php
  481. }
  482. ?>
  483. </p>
  484. <?php
  485. }
  486. }
  487. }
  488. ?>
  489. <?php if ( ! empty( $link ) && ! empty( $profile_url ) ) { ?>
  490. <p class="pmpro_member_directory_link">
  491. <a class="more-link" href="<?php echo add_query_arg( 'pu', $auser->user_nicename, $profile_url ); ?>"><?php _e( 'View Profile', 'pmpromd' ); ?></a>
  492. </p>
  493. <?php } ?>
  494. </div> <!-- end pmpro_addon_package-->
  495. </div>
  496. <?php
  497. }
  498. ?>
  499. </div> <!-- end row -->
  500. <hr />
  501. <?php
  502. endforeach;
  503. }
  504. ?>
  505. </div> <!-- end pmpro_member_directory -->
  506. <?php
  507. } else {
  508. ?>
  509. <p class="pmpro_member_directory_message pmpro_message pmpro_error">
  510. <?php _e( 'No matching profiles found', 'pmpromd' ); ?>
  511. <?php
  512. if ( $s ) {
  513. printf( __( 'within <em>%s</em>.', 'pmpromd' ), ucwords( esc_html( $s ) ) );
  514. if ( ! empty( $directory_url ) ) {
  515. ?>
  516. <a class="more-link" href="<?php echo $directory_url; ?>"><?php _e( 'View All Members', 'pmpromd' ); ?></a>
  517. <?php
  518. }
  519. } else {
  520. echo '.';
  521. }
  522. ?>
  523. </p>
  524. <?php
  525. }
  526.  
  527. // prev/next
  528. ?>
  529. <div class="pmpro_pagination">
  530. <?php
  531. // prev
  532. if ( $pn > 1 ) {
  533. ?>
  534. <span class="pmpro_prev"><a href="
  535. <?php
  536. echo esc_url(
  537. add_query_arg(
  538. array(
  539. 'ps' => $s,
  540. 'pn' => $pn - 1,
  541. 'limit' => $limit,
  542. ), get_permalink( $post->ID )
  543. )
  544. );
  545. ?>
  546. ">&laquo; <?php _e( 'Previous', 'pmpromd' ); ?></a></span>
  547. <?php
  548. }
  549. // next
  550. if ( $totalrows > $end ) {
  551. ?>
  552. <span class="pmpro_next"><a href="
  553. <?php
  554. echo esc_url(
  555. add_query_arg(
  556. array(
  557. 'ps' => $s,
  558. 'pn' => $pn + 1,
  559. 'limit' => $limit,
  560. ), get_permalink( $post->ID )
  561. )
  562. );
  563. ?>
  564. "><?php _e( 'Next', 'pmpromd' ); ?> &raquo;</a></span>
  565. <?php
  566. }
  567. ?>
  568. </div>
  569. <?php
  570. $temp_content = ob_get_contents();
  571. ob_end_clean();
  572. return $temp_content;
  573. }
  574. add_shortcode( 'pmpro_member_directory', 'pmpromd_shortcode' );
Add Comment
Please, Sign In to add comment