Please include [USER_ID] tag in next release

  • noel adams
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 months 3 days ago #141996 by noel adams
Hi Tuan,
Could you please include the code to allow the [USER_ID] in SQL custom fields in the next release. You released a version of sql.php held in administrator/components/com_eventbooking/libraries/rad/form/field that had this tag but the latest version overwrote it.
Thank you,
Noel Adams

Please Log in or Create an account to join the conversation.

More
3 months 2 weeks ago #145944 by OTWD
LIKEWISE -
SELECT `email` AS value,`email` AS text FROM `nipd_eb_registrants` WHERE `user_id` = "3371" AND `event_id` = "2027" ;
WORKS

BUT

SELECT `email` AS value,`email` AS text FROM `nipd_eb_registrants` WHERE `user_id` = [USER_ID] AND `event_id` = "2027" ;
DOESN'T

Success consists of going from failure to failure without loss of enthusiasm.

Please Log in or Create an account to join the conversation.

More
3 months 2 weeks ago #145981 by Joshua Goldberg
Replied by Joshua Goldberg on topic Please include [USER_ID] tag in next release
Tuan,

I badly need this one.

Thanks!

Please Log in or Create an account to join the conversation.

More
3 months 2 weeks ago #145988 by Joshua Goldberg
Replied by Joshua Goldberg on topic Please include [USER_ID] tag in next release
Hey Noel, 

I figured out how to fix it if you need it quickly while you wait for Tuan to implement it:

In administrator/components/com_eventbooking/libraries/rad/form/field.php
after:

 protected $eventId = null;

add: 

        protected $user = null;




Then down below that (same file) in this block:

 public function __construct($row, $value = null)
        {
                $this->name        = $row->name;
                $this->title       = $row->title;
                $this->description = $row->description;
                $this->row         = $row;
                $this->value       = $value;


add the following line:

 $this->user = Factory::getUser()->id;

last but not least, after this line in administrator/components/com_eventbooking/libraries/rad/form/field/sql.php :

 $this->query = str_replace('[EVENT_ID]', (int) $this->eventId, $this->query);


add this line:

$this->query = str_replace('[USER_ID]', (int) $this->user, $this->query);


I hope this helps!

Please Log in or Create an account to join the conversation.

More
3 months 2 weeks ago #145989 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Please include [USER_ID] tag in next release
Hello

As I said before, this will only work for user who registered in the frontend of your site. In case admin editing a registration record for example, that user id will be ID of the admin users and you would get wrong result

Tuan

Please Log in or Create an account to join the conversation.

More
3 months 2 weeks ago #145990 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Please include [USER_ID] tag in next release
Please get this file, unzip it, then upload the received file to administrator/components/com_eventbooking/libraries/rad/form/field folder and check the result. It should work as expected

Regards,

Tuan
Attachments:

Please Log in or Create an account to join the conversation.

  • noel adams
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 months 2 weeks ago #145991 by noel adams
Replied by noel adams on topic Please include [USER_ID] tag in next release
Thanks Joshua,
I already had the code to implement [USER_ID] thank you. The reason I placed the post on wishlist was to avoid the need to redo it everytime I updated Event Booking.
Cheers,
Noel.

Please Log in or Create an account to join the conversation.

More
3 months 2 weeks ago #145995 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Please include [USER_ID] tag in next release
Just for information, if the above modified file works OK for you, I will be happy to include the change in the package so that you don't have to re-upload the file each time you update to new version of Events Booking

Regards,

Tuan

Please Log in or Create an account to join the conversation.

More
1 month 2 weeks ago - 1 month 2 weeks ago #147223 by Manfred Lilge
Replied by Manfred Lilge on topic Please include [USER_ID] tag in next release
Solution does not work me.

A very simple SQL field "SELECT "1" AS value, [USER_ID] AS text" always returns "0" for the user_id.

I'm on EB v3.17.2 and Joomla v4.
Last edit: 1 month 2 weeks ago by Manfred Lilge.

Please Log in or Create an account to join the conversation.

More
1 month 2 weeks ago #147224 by Manfred Lilge
Replied by Manfred Lilge on topic Please include [USER_ID] tag in next release
However, this files does the job.
joomdonation.com/forum/events-booking-ge...r-fields.html#117585

Would be great to have this solution added to the regular releases, if not done yet.

Please Log in or Create an account to join the conversation.

Moderators: Tuan Pham Ngoc