Jump to content

Create a public profile page


Recommended Posts

Hello,

I would need to do when registering a public_id to be created randomly (16 characters) that leads to the creation of a public profile page for accounts that are as follows mydomain .com / p / id_public

I have this code but Where should i put this code and how to make the public profile page with the url mondomaine.fr/p/id_public which displays the name and first name of the account in question that has the correct public_id

    public function hookActionSubmitAccountBefore($params) {
    $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
    $charactersLength = strlen($characters);
    $randomString = '';
    for ($i = 0; $i < $length; $i++)
    {
        $randomString .= $characters[rand(0, $charactersLength - 1)];
    }
    Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'tablecustom (id_customer, key_random) VALUES ('.(int)$params['id_customer'].',"'.pSQL($randomString).'")');
}

Thanks

Link to comment
Share on other sites

The clean solution is by a module using a front controller, you can check the new documentation about the modules here: https://devdocs.prestashop.com/1.7/modules/

And here the reference to include front controllers: https://devdocs.prestashop.com/1.7/modules/concepts/controllers/front-controllers/

You can use also as reference many native modules using front controllers.

 

Regards!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...