Jump to content

Using The Current User's Data While Provisioning Service Through Module


tszilassi

Recommended Posts

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?

 

Link to comment
Share on other sites

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 by LukesUbuntu
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...