Support

  1. giorgi-bulia
  2. General
  3. Tuesday, November 23 2021, 03:08 PM
I need to create url in my custom module. in the end of the url I need to add id, first name and last name of user who is viewing this page. I am using components anywere from Regular labs in this module so [% %] are tags for this plugin.
inside this tags is my url.

[%https://mysite.com/<;?php $user=JsnHelper::getUser($user_id); echo $user; ?>-<?php $user=JsnHelper::getUser(); echo $user->firstname; ?>-<?php $user=JsnHelper::getUser(); echo $user->lastname; ?>%]


this code creates this url

[%https://mysite.com/JsnUser-გიორგი-ბულია%]

So firstname and lastname are correct but user ID is not provided. What am I doing wrong?
giorgi-bulia Accepted Answer
In first post I accidentally wrote <;?php but in my module I have correct code without ;
  1. more than a month ago
  2. General
  3. # 1
admin Accepted Answer
Admin
Hi,
sorry for late reply.

If you want to get infos of the current logged in user then you can use the function JsnHelper::getUser() without any userid.
  1. more than a month ago
  2. General
  3. # 2
giorgi-bulia Accepted Answer
Task was changed by little but problem stays active.
I have code below this is responsible to display records of user with ID 164, but as you can see I have added ID of user manually into code. So it displays for everyone records from this user.
But I want to add variable on line 6 where is written 164 which will display ID of user who is viewing this module, so he will see own records and not users with ID 164.


if($params->get('view_what', 'all') == 'author')
{
$query = $db->getQuery(TRUE);
$query->select('id');
$query->from('#__js_res_record');
$query->where('user_id = 164');
$query->where('published = 1');
$query->where('hidden = 0');
$query->where('section_id = ' . $params->get('section_id'));
$db->setQuery($query);
$ids = $db->loadColumn();
if(empty($ids))
{
return;
}
$params->set('view_what', 'all');
}
  1. more than a month ago
  2. General
  3. # 3
giorgi-bulia Accepted Answer
I was able to solve this problem.
  1. more than a month ago
  2. General
  3. # 4
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Request Support

Support is currently Online

Support Availability

Working days: Monday to Friday. The support staff is not available on weekends; in the most of cases tickets will not be answered during that time.

Reply time: Depending on the complexity of your support issue it's usually between a few minutes and 24 hours for paid members and about one week for free members. When we expect longer delays we will notify you.

Guidelines

Before you post: read the documentation and search the forums for an answer to your question.

When you post: include Site Details if you request a support (you can use the form below the reply in Site Details tab).

Auto Solved Question: If after a week the author of the post does not reply to a request by moderator, the question will be marked as resolved.

Language: only English

Search Users

Easy Profile® is not affiliated with or endorsed by Open Source Matters or the Joomla Project. Joomla is Free Software released under the GNU/GPL License.