Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewlimaza committed Nov 16, 2020
2 parents 65a936d + c076f4a commit 774ef0e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
21 changes: 16 additions & 5 deletions pmpro-member-directory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
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.0
Version: 1.1
Author: Paid Memberships Pro
Author URI: https://www.paidmembershipspro.com/
*/
Expand Down Expand Up @@ -89,12 +89,23 @@ function pmpromd_show_extra_profile_fields($user)
add_action( 'edit_user_profile', 'pmpromd_show_extra_profile_fields' );
add_action( 'pmpro_show_user_profile', 'pmpromd_show_extra_profile_fields' );

function pmpromd_save_extra_profile_fields( $user_id )
{
if ( !current_user_can( 'edit_user', $user_id ) )
function pmpromd_save_extra_profile_fields( $user_id ) {

global $pmpro_pages;

if ( !current_user_can( 'edit_user', $user_id ) ) {
return false;
}


if ( is_page( $pmpro_pages['member_profile_edit'] ) ) {
if ( ! isset( $_REQUEST['submit'] ) ) {
return false;
}
}

update_user_meta( $user_id, 'pmpromd_hide_directory', ( isset( $_POST['hide_directory'] ) ? sanitize_text_field( $_POST['hide_directory'] ) : null ) );
$hide_from_dir = isset( $_REQUEST['hide_directory'] ) ? sanitize_text_field( $_REQUEST['hide_directory'] ) : null;
update_user_meta( $user_id, 'pmpromd_hide_directory', $hide_from_dir );
}
add_action( 'personal_options_update', 'pmpromd_save_extra_profile_fields' );
add_action( 'edit_user_profile_update', 'pmpromd_save_extra_profile_fields' );
Expand Down
5 changes: 4 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.5
Stable tag: 1.0
Stable tag: 1.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,9 @@ 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.1 - 2020-11-16 =
* BUG FIX: Fixed issue where saving "hide from directory" wasn't saving on the front-end profile page.
* BUG FIX: Fixed issue where profile page wasn't showing user information (fields) correctly.

= 1.0 - 2020-08-27 =
* BUG FIX/ENHANCEMENT: Moved `pmpro_member_directory_after` outside div container for better styling with Membership Maps.
Expand Down
1 change: 1 addition & 0 deletions templates/profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ function pmpromd_profile_shortcode($atts, $content=null, $code="")
$pu = get_userdata($current_user->ID);

if ( ! empty( $pu ) ) {
$pu->membership_level = pmpro_getMembershipLevelForUser( $pu->ID );
$allmylevels = pmpro_getMembershipLevelsForUser( $pu->ID );
$membership_levels = array();
foreach ( $allmylevels as $curlevel ) {
Expand Down

0 comments on commit 774ef0e

Please sign in to comment.