FAQ Q214: Can Planyo integrate with the login system used on my website?
The planyo modules/plugins for the following CMSes: joomla, drupal, wordpress, modx have a possibility to use the built-in logging system of these CMSes. This can be optionally switched on in module/plugin settings.
In order to switch on the login integration you must do the following:
- In the planyo backend, go to Advanced integration settings and copy the login integration code to clipboard.
- In the backend of your CMS, go to the settings of the planyo plugin/module and change two options: 1. select the option to integrate with the CMS login and 2. paste the login integration code you copied to the clipboard in the previous step.
When the CMS login is enabled, the reservation form will always display known fields in personal details. You may also use special tags in your templates to take advantage of the login feature: $(is_user_logged_in)
. The first one can be used to conditionally output a different content in case a user is logged in and the second one is a URL of a special page where a logged in client can see and manage all their reservations made in the past. If you want to add a link to this page outside of the planyo templates, you can simply link to the page which contains the planyo plugin with the ?mode=reservation_list
With the login enabled, you can also use another login-related feature, in resource properties you can select the option Only users who are logged in can make reservations
. Doing this will force users to first log into your website and then make reservations.
Instructions for login integration when not using a dedicated planyo plugin
If you're using the PHP integration method, and not one of the dedicated CMS plugins, you still can add an integration with your website's login system using a few lines of PHP code. In order to do this, after pasting the PHP code for the integration, following the instructions in Site settings / Integrate with my website / Advanced / PHP based integration
, you'll need to modify the presented code by adding a few lines. Anywhere BEFORE the planyo-plugin-impl.php file is included (the last line in the code below) enter the following code (in green):
$user_id = ""; // fill with user id or login name
$user_email = ""; // fill with user's email
$user_first_name = ""; // fill with user's first name
$user_last_name = ""; // fill with user's last name
$integration_code = ""; // fill this with the login integration code from the advanced integration settings in the planyo backend
$planyo_login_info = array('first_name'=>$user_first_name, 'last_name'=>$user_last_name, 'email'=>$user_email, 'login_cs'=>sha1($user_email . $integration_code));
You will need to fill out the $user_xxx variables with the values coming from the currently logged-in user.