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

Unable to have "-" in front of numbers for Permalink #352

Closed
refugeindhamma opened this issue Nov 20, 2023 · 3 comments
Closed

Unable to have "-" in front of numbers for Permalink #352

refugeindhamma opened this issue Nov 20, 2023 · 3 comments
Assignees

Comments

@refugeindhamma
Copy link

Describe the bug
If my Event Name is EME 2024, the slug will become "eme". If I type in "eme-2024" and save/update the event, the slug will revert back to "eme". Only if I put it as "eme2024" will the slug be saved.

Expected behavior
The slug with a "-" in front of numbers should remain after saving/updating.

Version info
PHP version: 8.0
EME version: 2.4.15

@refugeindhamma refugeindhamma changed the title Unable to have "-" in front of number for Permalink Unable to have "-" in front of numbers for Permalink Nov 20, 2023
@liedekef
Copy link
Owner

Based on a quick code review (not tested yet), this only happens because "eme-2024" is already taken as a slug by something else in EME, so EME starts from the beginning (removing "-" and all numbers at the end of a slug and start with just "eme", then "eme-1" etc ...).

@refugeindhamma
Copy link
Author

refugeindhamma commented Nov 20, 2023

I'm using "EME" just as an example. The full title of the event is "Children's Drawing Class 2024". However, EME does not allow my slug to be "childrens-drawing-class-2024". I can only put it as "childrens-drawing-class2024".

I have tried it with various different names with the same result and I'm sure these names do not clash with other posts and events.

Edit: Just to add that this occurred in Recurring Events. I have not tested it for Single events.

@liedekef
Copy link
Owner

In general slugs are made unique by adding '-' followed by a number to it.
For recurrences, the same reasoning exists: recurring events exist of a series of single events and single events can't have the same slug. The first one would have childrens-drawing-class-2024, but the second one would have childrens-drawing-class (removing "-" followed by numbers until the end), the third one childrens-drawing-class-2, etc ...
To avoid such a difference, I remove the "-" and the numbers to begin with (for a recurrent series) and so the events will have as slug childrens-drawing-class, childrens-drawing-class-2, childrens-drawing-class-3, etc ...

However, there was a small glitch when wanting to change the slug for an event that ended with "-" followed by a number (the change was ignored in that case). Now the change will go through (after checking the new slug is unique of course or making it unique by adding a number again). The next version will correct that, but it won't change your "problem".

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

No branches or pull requests

2 participants