Creator Name

  • Antonello Mancuso
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
8 years 10 months ago #86972 by Antonello Mancuso
Creator Name was created by Antonello Mancuso
In my developing website I have two kinds of users: normal people and Entities.
I disabled Joomla 'lastname' field because I want that Entities write into Name field their Company Name.
I added also a custom field 'lastname' that it is used only from physical people.
Now... what happens?
When I enable into EB Options "Show Event Creator" into Event Details, it shows just the field Name, so I see:
- for Entities:
Author: Company Name (<-- OK, that's right)
-for simple people instead:
Author: Name (without lastname, because I disabled it!).
So I would like to override the template to show:
<td class="eb-event-property-value">
<a href="<?php echo JRoute::_('index.php?option=com_eventbooking&view=search&created_by=' . $event->created_by . '&Itemid=' . $Itemid); ?>"><?php echo $event->creator_name; $user->lastname; ?></a>
where lastname is my custom lastname field.
How to do this?

Eng. Antonello Mancuso

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

More
8 years 10 months ago - 8 years 10 months ago #86985 by James Riley
Replied by James Riley on topic Creator Name
Tuan might have a quicker, more direct answer, but the way I would check if $user contains the value that I want is to insert the following into my development code:
Code:
<pre><?php print_r($user); ?></pre>
(assuming that $user is a valid variable array!!) and look for the variable within that block of output.
You could always put a call into the DB to look-up the record by user-id (I'm not great with mySQL commands though).

James Riley .: EventBooking user since 2014 ::: JoomDonation user since 2016 :.
.: grfx & web design / IT / AV @ St. Therese Institute of Faith and Mission, Bruno, SK, Canada :.
Last edit: 8 years 10 months ago by James Riley.

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

More
8 years 10 months ago #86995 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Creator Name
Hi Antonello

I am not sure where do you define lastname field, so I could not give you the answer. The easiest way would be submitting a support ticket sending me super admin account of the site and the link to the page

I will look at your setup and guide you with correct code (or I will modify it directly for you)

Regards,

Tuan

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

  • Antonello Mancuso
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
8 years 10 months ago #86999 by Antonello Mancuso
Replied by Antonello Mancuso on topic Creator Name

Tuan Pham Ngoc wrote: I am not sure where do you define lastname field, so I could not give you the answer.
Tuan

I created the new custom field with Easy Profile extension. Then I used your EB Easy Profile plugin to join last_name field with my custom field my_custom_lastname.
Consider that I need to make an override of event detail, events default and events timeline layouts (I already modified them as you know), so I can use all arrays and variables available in that three *.php files.
Obviously I can always search into my database (using phpMyAdmin) in which table Easy Profiles stores custom fields and then put into my overrided layout a call to the database, as James Riley suggested.
But I want to make this as my last chance....
Thanks Tuan and sorry for the higher number of tickets I'm submitting :laugh: :silly: :silly: :blush:
Maybe, when I'll be payd, I'll consider to make some donation to you... AhahhaH ;)

Eng. Antonello Mancuso

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

More
8 years 10 months ago #87001 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Creator Name
I don't know how Easy Profile works. As James suggested, you can try to print_r($user) object to see whether it contains the data you need

Otherwise, you will have to query database directly (or ask Easy Profile developer how to get custom field data of certain fields)

Tuan

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

More
8 years 10 months ago #87002 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Creator Name
Luckily, not many customers need so many customization like you, otherwise, I would have to stop working on new features of EB and just spend time on support :D

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

  • Antonello Mancuso
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
8 years 10 months ago #87006 by Antonello Mancuso
Replied by Antonello Mancuso on topic Creator Name

Tuan Pham Ngoc wrote: Luckily, not many customers need so many customization like you, otherwise, I would have to stop working on new features of EB and just spend time on support :D


Maybe other customers uses the extension as it is because they wouldn't be able to customize itself, or maybe they are everybody expert programmers so that they can do alone whatever they need.
I'm in the situation where:
- I'm not a programmer (I simply like to do this stuff, even if it's not my first job. And that's why I gathered this job, probably together with the fact that my Client don't want to spend too much money hiring a full software house to solve its problem!);
- my Client has a difficult (or particular... it depends on which side you watch it) situation to manage, so that the extension must work in another way.

Keeping back to my question... I'll let you know after some trials.

Eng. Antonello Mancuso

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

More
8 years 10 months ago #87007 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Creator Name
Hi Antonello

It was just just for fun (see the emotion :D I wrote), I didn't mean to be serious about it

Any way, just try and you should be able to find the solution for it. Maybe you would have to query the data in the database directly or Easy Profile has an easy way to access that data but I don't know about it. When I wrote the plugin to integrate Easy Profile with my extension, I also had to query the database directly

Tuan
The following user(s) said Thank You: Antonello Mancuso

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

  • Antonello Mancuso
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
8 years 10 months ago #87012 by Antonello Mancuso
Replied by Antonello Mancuso on topic Creator Name
That's what I done.
Retrieved author of an event with standard JUser command:
Code:
$author= JFactory::getUser($item->created_by); //get info about author of the event $author_id=$author->get('id'); // get author id
Then I feed $author_id to JSNHelper class (as explained here ):
Code:
print_r(JsnHelper::getUser("$author_id")->get('custom_lastname')); //this print the value of the custom field
Using print_r, I get the right value plotted.
Instead, if I try to save this value into a variable, i.e.:
Code:
$surname=JsnHelper::getUser("$author_id";)->get('custom_lastname'); //retrieve custom last_name field
doesn't work!!
print_r($surname) or var_dump($surname) give me NULL output!
I'm getting crazy!! What is wrong here??!! :( :(

Eng. Antonello Mancuso

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

  • Antonello Mancuso
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
8 years 10 months ago #87013 by Antonello Mancuso
Replied by Antonello Mancuso on topic Creator Name

Tuan Pham Ngoc wrote: Hi Antonello,
It was just just for fun (see the emotion :D I wrote), I didn't mean to be serious about it
Tuan


Don't worry ;) !!! I'm fine with that :laugh: :laugh: :laugh:

Eng. Antonello Mancuso

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

Moderators: Tuan Pham Ngoc