Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🪓 fix: Prevented store URL generation for staff managers on admin dashboard #2505

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions includes/Admin/UserProfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public function add_meta_fields( $user ) {
<a href="#" class="dokan-banner-drag button button-primary"><?php esc_html_e( 'Upload banner', 'dokan-lite' ); ?></a>
<p class="description">
<?php
echo sprintf(
printf(
/* translators: %1$s: banner width, %2$s: banner height in integers */
esc_attr__( 'Upload a banner for your store. Banner size is (%1$sx%2$s) pixels.', 'dokan-lite' ),
esc_attr( $banner_width ),
Expand All @@ -134,13 +134,15 @@ public function add_meta_fields( $user ) {
</td>
</tr>

<tr>
<th><?php esc_html_e( 'Store URL', 'dokan-lite' ); ?></th>
<td>
<input type="text" name="dokan_store_url" data-vendor="<?php echo esc_attr( $user->ID ); ?>" class="regular-text" id="seller-url" value="<?php echo esc_attr( $user->data->user_nicename ); ?>"><strong id="url-alart-mgs"></strong>
<p><small><?php echo esc_url( home_url() . '/' . dokan_get_option( 'custom_store_url', 'dokan_general', 'store' ) ); ?>/<strong id="url-alart"><?php echo esc_attr( $user->data->user_nicename ); ?></strong></small></p>
</td>
</tr>
<?php if ( ! user_can( $user, 'vendor_staff' ) ) : ?>
<tr>
<th><?php esc_html_e( 'Store URL', 'dokan-lite' ); ?></th>
<td>
<input type="text" name="dokan_store_url" data-vendor="<?php echo esc_attr( $user->ID ); ?>" class="regular-text" id="seller-url" value="<?php echo esc_attr( $user->data->user_nicename ); ?>"><strong id="url-alart-mgs"></strong>
<p><small><?php echo esc_url( home_url() . '/' . dokan_get_option( 'custom_store_url', 'dokan_general', 'store' ) ); ?>/<strong id="url-alart"><?php echo esc_attr( $user->data->user_nicename ); ?></strong></small></p>
</td>
</tr>
<?php endif; ?>
Comment on lines +137 to +145
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls remove the if condition and generate the url for vendor using dokan_get_current_user_id()

$vendor =  new WP_User( dokan_get_current_user_id() );

Now use $vendor instead of $user to generate the URL.


<tr>
<th><?php esc_html_e( 'Address 1', 'dokan-lite' ); ?></th>
Expand Down
Loading