Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewlimaza committed Apr 7, 2022
2 parents bbf8893 + 89581d6 commit 35f3c64
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
19 changes: 11 additions & 8 deletions pmpro-member-directory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
Plugin Name: Paid Memberships Pro - Member Directory Add On
Plugin URI: https://www.paidmembershipspro.com/add-ons/member-directory/
Description: Adds a customizable Member Directory and Member Profiles to your membership site.
Version: 1.2
Version: 1.2.1
Author: Paid Memberships Pro
Author URI: https://www.paidmembershipspro.com/
Text Domain: pmpro-member-directory
Domain Path: /languages
*/

define( 'PMPRO_MEMBER_DIRECTORY_VERSION', '1.2' );
define( 'PMPRO_MEMBER_DIRECTORY_VERSION', '1.2.1' );

global $pmpromd_options;

Expand Down Expand Up @@ -269,7 +269,7 @@ function pmpromd_get_user_by_identifier( $value ) {

$user_identifier = pmpromd_user_identifier();

return get_user_by( $user_identifier, $value );
return get_user_by( $user_identifier, sanitize_text_field( $value ) );

}

Expand All @@ -279,17 +279,20 @@ function pmpromd_get_user_by_identifier( $value ) {
* @since 1.2.0
*
*/
function pmpromd_get_user(){
function pmpromd_get_user( $user_id = false ){

global $wp_query;
global $wp_query, $current_user;

if( !empty( $wp_query->get( 'pu' ) ) ){
if ( $user_id ) {
//We're specifying which user we want to display
$pu = get_user_by( 'id', intval( $user_id ) );
} elseif ( ! empty( $wp_query->get( 'pu' ) ) ) {
//Using the new permalinks /profile/user
$pu = pmpromd_get_user_by_identifier( $wp_query->get( 'pu' ) );
} elseif( !empty( $_REQUEST['pu'] ) ) {
} elseif ( ! empty( $_REQUEST['pu'] ) ) {
//Using old url structure /profile/?pu=user
$pu = pmpromd_get_user_by_identifier( $_REQUEST['pu'] );
} elseif( !empty( $current_user->ID ) ) {
} elseif ( ! empty( $current_user->ID ) ) {
$pu = $current_user;
} else {
$pu = false;
Expand Down
7 changes: 6 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: strangerstudios
Tags: pmpro, paid memberships pro, members, directory
Requires at least: 4.0
Tested up to: 5.9
Stable tag: 1.2
Stable tag: 1.2.1

Add a robust Member Directory and Profiles to Your Membership Site - with attributes to customize the display.

Expand Down Expand Up @@ -97,6 +97,11 @@ Please post it in the issues section of GitHub and we'll fix it as soon as we ca
Please visit our premium support site at http://www.paidmembershipspro.com for more documentation and our support forums.

== Changelog ==
= 1.2.1 - 2022-04-07 =
* ENHANCEMENT: Added small sanitization check for query parameter values.
* BUG FIX: Fixed issue where passing "user_id" attribute in shortcode was returning empty results.
* BUG FIX: Removed debug code that was causing minor output issues.

= 1.2 - 2022-03-31 =
* ENHANCEMENT: General improvements to localization and translatable strings.
* ENHANCEMENT: Improvement to profile pretty permalinks structure that's more SEO friendly (e.g. membership-account/profile/admin/). Automatically flush permalinks when needed in admin area.
Expand Down
3 changes: 1 addition & 2 deletions templates/profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,7 @@ function pmpromd_profile_shortcode($atts, $content=null, $code="")
elseif(empty($limit))
$limit = 15;


$pu = pmpromd_get_user();
$pu = pmpromd_get_user( $user_id );

if ( ! empty( $pu ) ) {
$pu->membership_level = pmpro_getMembershipLevelForUser( $pu->ID );
Expand Down

0 comments on commit 35f3c64

Please sign in to comment.