Filter user-provided URLs?
-
I have a music website that allows users to enter their own URLs for bands and locations in Events Manager.
It is currently set up so that a user must enter the “https://” along with their link. For example, here’s the EM code to display a Location’s website link:
{has_latt_location_website} <p><a href="#_LATT{Location Website}"><strong>View Website</strong></a></p> {/has_latt_location_website}
However, many people ignore the instructions and don’t include the “https://”, rendering the link useless. I can change the code above so that it inserts the “https://”, but then I have the opposite problem with people who DO enter it.
I know that a Sanitize URL option exists, but I don’t think it would work for this problem.
Ideally, I’d like to be able to include the “https://” in my posting code above, then filter it from any inputted urls on the front-end. Any advice on how I could do that in a function?
- The topic ‘Filter user-provided URLs?’ is closed to new replies.