By Richard on Thursday, 20 March 2014
Posted in General Issues
Replies 12
Likes 0
Views 623
Votes 0
I apologize for all the questions regarding custom fields (it's just a very large aspect of the site I'm working on).

What I'd like to know, if possible, is how to add a custom field before the stream pulls the username.

So for example, the stream currently shows this:

random_user just logged in to the site. — 34 minutes ago

What I'd like it to show is:

CUSTOM_FIELD (random_user) has just logged in to the site. — 34 minutes ago

Thanks again for all the help and support so far, and the great product.
Hi,

Currently it is not possible. The only way currently that this is possible is to hardcode the content of the stream into the users app.
·
Thursday, 20 March 2014 17:11
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Jason,

I'm ok with modifying the code to do it, I'm just not sure where to look or what I should modify. I would love to learn though.

Thanks!
·
Thursday, 20 March 2014 17:13
·
0 Likes
·
0 Votes
·
0 Comments
·
Any other thoughts on this?
·
Friday, 21 March 2014 03:59
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Richard,

You might be able to achieve what you want by overriding a few language constants.

The text you see in the example you gave --> Random_user "just logged in" The "just logged in" part is mentioned in the language files. You can basically override this to whatever you want.
If you want to do this go to the backend --> extensions --> language manager --> overrides
There you can search for the constant you need and override it with the text you want.

I know it's maybe not exactly what you're looking for, but it could help.
I guess it's a rather fixed text you want to add? if it's a changing text based on the user than my suggestion is not possible.

Regards,
Danny
·
Friday, 21 March 2014 06:58
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Danny,

What I'd like to do is add a custom field before the username.

Say for example my site is a community for tradespeople, so in front of their username I would like a custom field that says what their trade is (eg. Mechanic, Carpenter, Plumber, etc)

So on the stream it would display as: "Mechanic (username) has just logged into the site", or "Carpenter (username) has just logged into the site"

Like I mentioned previously, I'm not opposed at modifying whatever needs to be modified for it to display like this.
·
Friday, 21 March 2014 07:29
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Richard,

I think you can achieve this if you customize the file /administrator/components/com_easysocial/includes/user/user.php . Take a look at the method getName


public function getName( $useFormat = '' )
{
$config = Foundry::config();
$name = $this->username;

if( $useFormat )
{
if( $useFormat == 'realname' )
$name = JString::ucfirst( $this->name );
}
else
{
if( $config->get( 'users.displayName' ) == 'realname' )
$name = JString::ucfirst( $this->name );
}

// This is where the magic happens.
// Replace CUSTOM_KEY_FOR_FIELDS with your respective custom field.
$name = $this->getFieldData('CUSTOM_KEY_FOR_FIELDS') . ' ' . $name;

return $name;
}


Though, you need to keep in mind that making the change here will make every other place that has the user's name would contain these prefixes.
·
Friday, 21 March 2014 11:01
·
0 Likes
·
0 Votes
·
0 Comments
·
That's EXACTLY what I was looking for, thank you so much Mark!
·
Friday, 21 March 2014 12:20
·
0 Likes
·
0 Votes
·
0 Comments
·
You are most welcome Richard Do take note that whenever you upgrade EasySocial, this would be overwritten too
·
Friday, 21 March 2014 12:36
·
0 Likes
·
0 Votes
·
0 Comments
·
Yep - I have copies of all the files I've modified, so I'll be able to replace them afterwards. It's too bad you can't make an administrator template override. Unless you can and I haven't read anything on it
·
Friday, 21 March 2014 15:58
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Richard,

I don't think it really makes sense to actually override a core php file because this is like the "main engine" of EasySocial and most likely it gets modified every version lol.
·
Friday, 21 March 2014 17:23
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Mark,

Yea, I was thinking about that, too. I looked around a bit more and was able to modify some of the stream files inside the /themes/wireframe/stream directory to have the stream display the information I wanted to, so I restored the core file back to default and created a template override for theme files. Starting to get the hang of how everything works haha.

On a side note, after upgrading to 1.2.2 there are .bak files of the theme folders, are these safe to remove?
·
Saturday, 22 March 2014 03:57
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for updating Richard Hope you are loving EasySocial (I know there's a little learning curve but it's still new and there's lots of room of improvements)

By the way, if you use EasySocial please do post a review for it at http://extensions.joomla.org/extensions/clients-a-communities/communities/25616 . This would greatly motivate me and the team

Thank you in advance!
·
Saturday, 22 March 2014 14:58
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post