Jump to content

How to get user id in view


Artis

Recommended Posts

Hello,

I'm using my own plugin and I'm not able to get user ID (that is currently login) in view.

Is there easy solution for displaying user ID in view ?

I saw this code in template pdt
 

<?php $this->_("ClientMain.myinfo.client_id", false, $this->Html->_($client->id_code, true));?>

 

But that code is not working in my view.

Link to comment
Share on other sites

1 hour ago, Artis said:

@Paul

I want to get user ID from client. Example 1500, 1501, ...

I tried to login as user and check user ID but I still receive empty string.

This code works in my testing when added to the top of /app/views/client/bootstrap/structure.pdt

<?php echo $this->Html->_($client->id_code, true);  ?>

However, you must LOG IN as the client, it will not work if you are an admin and use the "login as client" feature.

Link to comment
Share on other sites

9 hours ago, Artis said:

@Paul thanks for information. That option is valid for /app/views/client/bootstrap/structure.pdt but I'm using my own plugin and I'm not able to get ID from client (in my plugin) is there documentation link what I can check how to get user ID in view (with my plugin)?

I'm not sure what you'd need to do specifically without bringing in one of our developers, however I'd suggest looking at the "Support Manager" plugin. All the code is open, and Blesta does utilize the Client ID when opening trouble tickets as a client, so looking at that plugin should be helpful.

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