tszilassi Posted January 3, 2015 Report Posted January 3, 2015 Hi all, I'm developing a Blesta module for a web control panel (cPanel alternative). When adding a new service I set the required Configurable options which are needed for provisioning the user account on the web control panel. These fields are: - Domain - Username - Password - Email - First Name - Last Name (These fields are required for creating new user through the control panel's API). My question is: Is there a way to omit: Email, First Name & Last Name fields from this form? When the User registers or logs in and orders the service, these datas should be available. There should be no need to enter the email and name twice. (I know the control panel allows multiple users with same email, so there is no issue) So is it possible to obtain the user's email, first and last name in the addService() function? Quote
LukesUbuntu Posted January 3, 2015 Report Posted January 3, 2015 (edited) From when they are logged in you could get the clients info , something like this in your addService Loader::loadModels($this,array("Clients")); #update checked the client model and you can do something like this obviously some checking of client_id etc... $client = $this->Clients->get($vars['client_id'],false);$email = $client->email;$first_name = $client->first_name;$last_name = $client->last_name; //you may need to add something to check when addService is run from admin panel so your not passing the admin id im not sure check it out code is well documented its awesome.... Anyway there maybe a better way of grabbing the clients details i haven't tested this as ive only just started doing modules for blesta last week so don't quote me on it but it is one way.... Edited January 4, 2015 by LukesUbuntu tszilassi 1 Quote
tszilassi Posted January 3, 2015 Author Report Posted January 3, 2015 Thank you, very useful info. Would be glad to hear opinions of the seasoned Blesta developers, especially about the admin's user ID when adding services through the admin backend. Quote
Tyson Posted January 5, 2015 Report Posted January 5, 2015 What LukesUbuntu mentioned should suffice for fetching client data in case you want to omit or prepopulate field data. There is no difference between adding the service as an admin or a client, so an admin ID shouldn't be relevant. LukesUbuntu 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.