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: Shop url rendered double slash when using WPML on vendor registration form. #2291

Conversation

MdAsifHossainNadim
Copy link
Contributor

@MdAsifHossainNadim MdAsifHossainNadim commented Jun 10, 2024

All Submissions:

  • My code follow the WordPress' coding standards
  • My code satisfies feature requirements
  • My code is tested
  • My code passes the PHPCS tests
  • My code has proper inline documentation
  • I've included related pull request(s) (optional)
  • I've included developer documentation (optional)
  • I've added proper labels to this pull request

Changes proposed in this Pull Request:

Related Pull Request(s)

  • Full PR Link

Closes

How to test the changes in this Pull Request:

  • Steps or issue link

Changelog entry

Fix: Shop URL rendered double slash when using WPML on vendor registration.

Detailed Description of the pull request. What was previous behaviour
and what will be changed in this PR.

Before Changes

Go throw the issue details: Link

After Changes

image

Feature Video (optional)

Link of detailed video if this PR is for a feature.

PR Self Review Checklist:

  • Code is not following code style guidelines
  • Bad naming: make sure you would understand your code if you read it a few months from now.
  • KISS: Keep it simple, Sweetie (not stupid!).
  • DRY: Don't Repeat Yourself.
  • Code that is not readable: too many nested 'if's are a bad sign.
  • Performance issues
  • Complicated constructions that need refactoring or comments: code should almost always be self-explanatory.
  • Grammar errors.

FOR PR REVIEWER ONLY:

As a reviewer, your feedback should be focused on the idea, not the person. Seek to understand, be respectful, and focus on constructive dialog.

As a contributor, your responsibility is to learn from suggestions and iterate your pull request should it be needed based on feedback. Seek to collaborate and produce the best possible contribution to the greater whole.

  • Correct — Does the change do what it’s supposed to? ie: code 100% fulfilling the requirements?
  • Secure — Would a nefarious party find some way to exploit this change? ie: everything is sanitized/escaped appropriately for any SQL or XSS injection possibilities?
  • Readable — Will your future self be able to understand this change months down the road?
  • Elegant — Does the change fit aesthetically within the overall style and architecture?

Summary by CodeRabbit

  • New Features

    • Enhanced URL handling in the customer-to-vendor update and seller registration forms for better readability and maintainability.
  • Improvements

    • Improved security by using esc_url for URL concatenation.
    • Enhanced code quality using printf instead of echo for displaying links.

Copy link
Contributor

coderabbitai bot commented Jun 10, 2024

Walkthrough

The changes improve URL handling and output security in two template files by introducing and utilizing $home_url and $custom_store_url variables. Additionally, esc_url is used to sanitize URLs, and printf is applied for regulated display of HTML content, enhancing maintainability and readability.

Changes

Files Change Summary
.../account/update-customer-to-vendor.php Initialized $home_url and $custom_store_url; used esc_url; replaced echo with printf
.../global/seller-registration-form.php Introduced $home_url and $custom_store_url for streamlined URL handling in the shop URL input

Assessment against linked issues

Objective Addressed Explanation
Disabled order editing option when the order status is cancelled or refunded (#59) No visible changes related to this issue.

Poem

In code we tread with care and pride,
URLs secure, no bugs to hide.
Echo replaced, conditions clear,
esc_url ensures no fear.
Our template's now a stronger shield,
With clarity and clean code wield.
코드랩비트, onward we cheer! 🐰✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@MdAsifHossainNadim MdAsifHossainNadim self-assigned this Jun 10, 2024
@MdAsifHossainNadim MdAsifHossainNadim added Needs: Testing This requires further testing Needs: Dev Review It requires a developer review and approval labels Jun 10, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d2a44e3 and 014295f.

Files selected for processing (1)
  • templates/account/update-customer-to-vendor.php (2 hunks)
Files skipped from review due to trivial changes (1)
  • templates/account/update-customer-to-vendor.php

@mrabbani mrabbani added 👍 Dev Review Done Upcoming Release and removed Needs: Dev Review It requires a developer review and approval labels Jun 26, 2024
@shashwatahalder01 shashwatahalder01 added QA In Progress and removed Needs: Testing This requires further testing labels Jul 1, 2024
@shashwatahalder01

This comment was marked as resolved.

@shashwatahalder01

This comment was marked as resolved.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 014295f and 4ab4c78.

Files selected for processing (2)
  • templates/account/update-customer-to-vendor.php (3 hunks)
  • templates/global/seller-registration-form.php (2 hunks)
Additional comments not posted (4)
templates/account/update-customer-to-vendor.php (2)

17-18: LGTM! URL variables initialized correctly.

The $home_url and $custom_store_url variables are initialized appropriately using untrailingslashit( home_url() ) and dokan_get_option( 'custom_store_url', 'dokan_general', 'store' ) respectively.


44-47: LGTM! URLs concatenated securely.

The URLs within the <small> tag are concatenated using esc_url, which is a best practice for security.

templates/global/seller-registration-form.php (2)

8-9: LGTM! URL variables initialized correctly.

The $home_url and $custom_store_url variables are initialized appropriately using untrailingslashit( home_url() ) and dokan_get_option( 'custom_store_url', 'dokan_general', 'store' ) respectively.


35-38: LGTM! URLs concatenated securely.

The URLs within the <small> tag are concatenated using esc_url, which is a best practice for security.

@MdAsifHossainNadim MdAsifHossainNadim added Needs: Testing This requires further testing and removed Type: Bug labels Jul 4, 2024
@MdAsifHossainNadim
Copy link
Contributor Author

@shashwatahalder01 Brother, kindly let me know if any inconsistencies found.

@shashwatahalder01 shashwatahalder01 added QA In Progress QA approved This PR is approved by the QA team and removed Needs: Testing This requires further testing QA In Progress labels Jul 4, 2024
@shohag121 shohag121 merged commit 42c5839 into develop Jul 8, 2024
2 checks passed
@shohag121 shohag121 deleted the fix/vendor-registration-shop-urls-render-double-slash-when-using-wpml branch July 8, 2024 05:20
@Sophie-2e
Copy link

@shashwatahalder01 @MdAsifHossainNadim does not work, please review test here: getdokan/dokan-wpml#59 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

⚠️⚠️ SELLER REGISTRATION FORM > Shop url > Translated forms > double //
5 participants