- fix wrong user id in account block

This commit is contained in:
ashubawork
2023-04-27 12:51:57 +03:00
parent bcadcfc7bd
commit 5c40cf7b08
4 changed files with 48 additions and 32 deletions
+12
View File
@@ -626,6 +626,9 @@ if ( ! class_exists( 'um\core\Account' ) ) {
$this->init_displayed_fields( $fields, $id );
foreach ( $fields as $key => $data ) {
if ( 1 === (int) $shortcode_args['widget'] ) {
$data['widget'] = 1;
}
$output .= UM()->fields()->edit_field( $key, $data );
}
break;
@@ -666,6 +669,9 @@ if ( ! class_exists( 'um\core\Account' ) ) {
$this->init_displayed_fields( $fields, $id );
foreach ( $fields as $key => $data ) {
if ( 1 === (int) $shortcode_args['widget'] ) {
$data['widget'] = 1;
}
$output .= UM()->fields()->edit_field( $key, $data );
}
@@ -720,6 +726,9 @@ if ( ! class_exists( 'um\core\Account' ) ) {
$this->init_displayed_fields( $fields, $id );
foreach ( $fields as $key => $data ) {
if ( 1 === (int) $shortcode_args['widget'] ) {
$data['widget'] = 1;
}
$output .= UM()->fields()->edit_field( $key, $data );
}
@@ -758,6 +767,9 @@ if ( ! class_exists( 'um\core\Account' ) ) {
$this->init_displayed_fields( $fields, $id );
foreach ( $fields as $key => $data ) {
if ( 1 === (int) $shortcode_args['widget'] ) {
$data['widget'] = 1;
}
$output .= UM()->fields()->edit_field( $key, $data );
}
+1 -1
View File
@@ -139,7 +139,7 @@ if ( ! class_exists( 'um\core\Blocks' ) ) {
public function um_account_render( $atts ) {
$shortcode = '[ultimatemember_account';
$shortcode = '[ultimatemember_account widget="1"';
if ( isset( $atts['tab'] ) && 'all' !== $atts['tab'] ) {
$shortcode .= ' tab="' . $atts['tab'] . '"';
+5 -1
View File
@@ -2076,7 +2076,11 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
function edit_field( $key, $data, $rule = false, $args = array() ) {
global $_um_profile_id;
$output = '';
if ( 1 === (int) $data['widget'] ) {
$_um_profile_id = get_current_user_id();
}
$output = '';
$disabled = '';
if ( empty( $_um_profile_id ) ) {
$_um_profile_id = um_user( 'ID' );
+30 -30
View File
@@ -593,20 +593,20 @@ function um_after_account_privacy( $args ) {
<div class="um-clear"></div>
</div>
<?php $completed = $wpdb->get_row(
"SELECT ID
FROM $wpdb->posts
WHERE post_author = $user_id AND
post_type = 'user_request' AND
post_name = 'export_personal_data' AND
post_status = 'request-completed'
ORDER BY ID DESC
"SELECT ID
FROM $wpdb->posts
WHERE post_author = $user_id AND
post_type = 'user_request' AND
post_name = 'export_personal_data' AND
post_status = 'request-completed'
ORDER BY ID DESC
LIMIT 1",
ARRAY_A );
if ( ! empty( $completed ) ) {
$exports_url = wp_privacy_exports_url();
echo '<p>' . esc_html__( 'You could download your previous data:', 'ultimate-member' ) . '</p>';
echo '<a href="'.esc_attr( $exports_url . get_post_meta( $completed['ID'], '_export_file_name', true ) ) . '">' . esc_html__( 'Download Personal Data', 'ultimate-member' ) . '</a>';
echo '<p>' . esc_html__( 'You could send a new request for an export of personal your data.', 'ultimate-member' ) . '</p>';
@@ -614,13 +614,13 @@ function um_after_account_privacy( $args ) {
}
$pending = $wpdb->get_row(
"SELECT ID, post_status
FROM $wpdb->posts
WHERE post_author = $user_id AND
post_type = 'user_request' AND
post_name = 'export_personal_data' AND
post_status != 'request-completed'
ORDER BY ID DESC
"SELECT ID, post_status
FROM $wpdb->posts
WHERE post_author = $user_id AND
post_type = 'user_request' AND
post_name = 'export_personal_data' AND
post_status != 'request-completed'
ORDER BY ID DESC
LIMIT 1",
ARRAY_A );
@@ -670,13 +670,13 @@ function um_after_account_privacy( $args ) {
</div>
<?php $completed = $wpdb->get_row(
"SELECT ID
FROM $wpdb->posts
WHERE post_author = $user_id AND
post_type = 'user_request' AND
post_name = 'remove_personal_data' AND
post_status = 'request-completed'
ORDER BY ID DESC
"SELECT ID
FROM $wpdb->posts
WHERE post_author = $user_id AND
post_type = 'user_request' AND
post_name = 'remove_personal_data' AND
post_status = 'request-completed'
ORDER BY ID DESC
LIMIT 1",
ARRAY_A );
@@ -688,13 +688,13 @@ function um_after_account_privacy( $args ) {
}
$pending = $wpdb->get_row(
"SELECT ID, post_status
FROM $wpdb->posts
WHERE post_author = $user_id AND
post_type = 'user_request' AND
post_name = 'remove_personal_data' AND
post_status != 'request-completed'
ORDER BY ID DESC
"SELECT ID, post_status
FROM $wpdb->posts
WHERE post_author = $user_id AND
post_type = 'user_request' AND
post_name = 'remove_personal_data' AND
post_status != 'request-completed'
ORDER BY ID DESC
LIMIT 1",
ARRAY_A );