Automatically generate permalinks

2 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: June 11, 2019   (RSS)

By gversion - June 5, 2019

Hello,

I have a front-end form for users to create listings. This works fine however the permalink for the listing is not generated automatically when the listing is created. I have to manually run the "Permalinks > Update Tables" script. See attached.

Is it possible to have the permalinks generate automatically when the user creates their listing? Any assistance would be greatly appreciated.

Thank you,

Greg

Attachments:

permalink-manual.png 66K

By daniel - June 11, 2019

Hi Greg,

By default the auto-populate functionality only works on CMSB admin pages, so on front-end user pages, you'll need to add some code to create and save the permalink. Luckily you can use the permalink_generate() function to create it based on your auto-populate rules. Here's its usage:

<?php
 $permalinkText = permalink_generate($_REQUEST, $permalinkPrefix);
?>

$permalinkPrefix is optional; if you do not use a prefix for your permalinks you can omit it. You can then save $permalinkText as the permalink field for the user's new listing.

Let me know if you have any questions!

Thanks,

Daniel
Technical Lead
interactivetools.com