More Restricted URL for vendor

This topic contains 24 replies, has 3 voices, and was last updated by WCfM Forum WCfM Forum 5 days, 23 hours ago.

  • Author
    Posts
  • #35760 Reply

    mustafa

    Hi,

    We want to limit the vendor “Store Name” in the URL To have only Latin characters with no space and only _ allowed. For example, like Instagram usernames.
    https://example.com/vendors/%5Byour_store%5D

    Can that be done?

    Thanks

  • #35779 Reply
    WCfM Forum
    WCfM Forum
    Keymaster

    HI,

    Do you want to apply this rule for store name or store url?

    Thank You

  • #35792 Reply

    mustafa

    It should be for Store URL

  • #35872 Reply
    WCfM Forum
    WCfM Forum
    Keymaster

    Ok, we are looking into this.
    “_” is not an issue, but restricting Latin characters is difficult.

    I will update you on this.

    Thank You

  • #35886 Reply

    mustafa

    Hi,

    Thanks for your feedback. Please, keep us updated as this feature is a must for our site.

  • #35902 Reply
    WCfM Forum
    WCfM Forum
    Keymaster

    Yeah sure!

  • #36627 Reply

    mustafamsy
    Participant

    Hi,

    Any update on this?

  • #36881 Reply
    WCfM Forum
    WCfM Forum
    Keymaster

    We are looking for a solution for this, will update you soon.

    As i already mentioned you before – “Latin characters is difficult.”
    If you asked me English character then it will be very easy.

    Thank You

  • #36912 Reply

    Mustafa

    Only English is fine.

  • #36994 Reply

    mustafamsy
    Participant

    Can you also restrict changes? I mean disallow vendor to change their URL once set.

    Thanks

  • #37000 Reply
    WCfM Forum
    WCfM Forum
    Keymaster

    HI,

    Kindly add this code to your site –

    add_action( 'end_wcfm_membership_registration_form', function() {
    	?>
    	<script>
    	jQuery(document).ready(function($) {
    		$('#store_name').on('keydown', function( event ) {
    			var key = event.keyCode;
    			return ((key >= 65 && key <= 90) || key == 8 || key == 189 || key == 9 || key == 32);
    		});
    	});
    	</script>
    	<?php
    });
    add_filter( 'wcfm_is_allow_store_name', '__return_false' );

    This will restrict store name to only characters and “_”.
    Also vendors will not able to edit store name and slug later.

    Thank You

  • #37009 Reply

    mustafamsy
    Participant

    Where should I add that code. I’ve added to child-theme function.php file but still no change.

  • #37010 Reply
    WCfM Forum
    WCfM Forum
    Keymaster

    HI,

    You have added this at right file, still show me screenshot for this.

    Between, what change you are expecting?

    Trying to register as a new vendor and you will see limitation at “Store Name” field.
    Also check at Vendor’s setting page – Store Name and Store Slug setting option no more available.

    Thank You

  • #37061 Reply

    mustafamsy
    Participant

    Hi,

    I tested and it works for English but I can still type in Arabic characters for (store slug) which I don’t want to allow.

    The changes I am expecting is:
    1) I don’t want to restrict vendors from adding whatever they want for “Store Names”.
    2) I just want to restrict “Store Slugs”.

    Thanks for your support.

  • #37062 Reply
    WCfM Forum
    WCfM Forum
    Keymaster

    HI,

    OK, then you have to wait till WCFM Membership next update.

    I will update you as new version will be there.

    Thank You

  • #37948 Reply

    mustafamsy
    Participant

    Hi,

    Please, make sure that you add this feature also during upgrade process of vendor account.

    Thank you

  • #38096 Reply
    WCfM Forum
    WCfM Forum
    Keymaster

    Hi,

    What do you mean by “during upgrade process of vendor account”?

    Thank You

  • #38280 Reply

    mustafamsy
    Participant

    Hi,

    When vendors change their membership, the form to change their Store Slug is also there.

    Regards

  • #38984 Reply

    mustafamsy
    Participant

    Any update on this?

  • #38986 Reply
    WCfM Forum
    WCfM Forum
    Keymaster

    Hi,

    WCFM Membership new update not yet released, I will give you support code after that.

    Thank You

  • #39176 Reply
    WCfM Forum
    WCfM Forum
    Keymaster

    Hi,

    Hope you have already updated latest WCFM and WCFM Membership, now please use this code for the purpose ->

    add_filter( 'wcfm_generated_store_slug', function( $store_slug ) {
    	$store_slug = preg_replace("/[^a-z0-9-]/", "", $store_slug);
    	return $store_slug;
    });

    Thank You

  • #39184 Reply

    mustafamsy
    Participant

    Hi,

    It work for English. But what if user tries enter Arabic character?

    I want to restrict English character only.

  • #39187 Reply
    WCfM Forum
    WCfM Forum
    Keymaster

    Hi,

    It will only allow these characters -> a-z0-9-

    if Arabic inserted then those will be removed from slug.

    Thank You

  • #39190 Reply

    mustafamsy
    Participant

    I checked, they are not removed. You can try this for example: عربي

  • #39194 Reply
    WCfM Forum
    WCfM Forum
    Keymaster

    Hi,

    It’s converted to alphanumeric -> https://ibb.co/4KDpR5R

    Between, do you have removed this code?

    ,

    Kindly add this code to your site –

    add_action( 'end_wcfm_membership_registration_form', function() {
    	?>
    	<script>
    	jQuery(document).ready(function($) {
    		$('#store_name').on('keydown', function( event ) {
    			var key = event.keyCode;
    			return ((key >= 65 && key <= 90) || key == 8 || key == 189 || key == 9 || key == 32);
    		});
    	});
    	</script>
    	<?php
    });

    If it’s there then how you can add other characters there?

    Thank You

Reply To: More Restricted URL for vendor
Your information: