Jump to content

Client "my Information" Php Question


CraigA

Recommended Posts

Hey devs,

  First, I'd like to apologize as this may seem trivial to a lot of you.  I would list to customize some of the information the client sees when they log in and see the "My Information" area.  I'm editing the "client_main_myinfo.pdt" at the moment.

 

What I would like to do is output one of my custom client fields.  Viewing the database, the client_field_id for this is 5

 

I was wondering what the direct query would be for this?

 

I've tried $this->Html->ifSet($custom_fields); but I'm sure I'm underthinking this and not referencing what I should be.

 

Help is appreciated!

 

Thanks,

Craig

Link to comment
Share on other sites

The $custom_fields variable, assuming it exists in that template, is likely an array of custom fields. If you want to view the contents, view the array:

print_r($custom_fields);

Then use that information to determine what fields to display.

 

But I have a feeling that custom fields aren't available to that template. And if not, you'll need to fetch them from the database by updating the controller ClientMain::setMyInfo(). If you're familiar with php, it should be fairly straight-forward.

 

To fetch client fields, you can invoke Clients::getCustomFields() through the client_main controller:

<?php
$custom_fields = $this->Clients->getCustomFields($this->client->company_id, $this->client->client_group_id, array('show_client' => 1));
?>

If you want the custom field values for the particular client, invoke Clients::getCustomFieldValues():

<?php
$field_values = $this->Clients->getCustomFieldValues($this->client->id);
?>

 

You can also view more about these methods in the source docs.

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...