Hi, I am adding some custom elements to profile.index.php, and I need to show the username.
This is possible in userinfo.php with
<?php echo $user->getDisplayName(); ?>
but when I try that in profile.index.php it breaks the page.
How can I display the name?
Thanks and Happy Holidays!
Hi Marija,
I think you are just not getting the user object yet. Have a look at this page is has a lot of examples and explains some of the different methods available.
documentation.jomsocial.com/wiki/JomSocial_User_Object
I hope this helps
Paul, unfortunately that did not clear the issue.
Placing
$cuser = CFactory::getUser();
$data = $cuser->getDisplayName();
echo $data;
in profile.index.php returns the username of the logged in user. I need to show the username of the person who's profile is being viewed.
The purpose of this, is to add simple heading saying "Username's Wall"
Hi Marija,
Please you use this :
$cuser = CFactory::getUser();
echo $cuser->username;
May I know in which page position do you want to show it? I will give you the full code
Your screenshoot is not coming from Jomsocial code, I am sure its coming from 3rd party app... your backend is not working so I can test it..
well, you should add the userid paramater on creating Cuser Object :
$cuser = CFactory::getUser(USERID);
echo $cuser->username;
Dimas, that does not help at all and I am getting a little tired from your approach and effort. Now, this is the last time I am asking kindly, as it has been over two weeks since I first asked a simple question.
I will not explain the question again, as you can just scroll up and see.
The screenshot is coming from JomSocial, and shame on you for not recognizing it. I have just modified the layout of the profile page. You do not need the backend at all, as I have mentioned in the previous post, I am editing in /templates/socialize/html/com_community/profile.index.php, line 88
FTP is provided in the first post, and it is working, the site is under the /nomad subfolder.
I will find the patience to wait out for one more of your replies, make it worth.
Hi Marija,
With all respect, i see this screenshoot
www.jomsocial.com/media/kunena/attachmen...36415/Untitled12.png
is NOT coming from Jomsocial, and we dont have "reviewed" text/stream by default on profile.index.php page.. so thats why i want to know where you get this? so I need the backend access..
thank you for your patient
note : if you have limited skill on PHP, it will hard to understand what I said on here
www.jomsocial.com/forum/profile-universa...ile-index-php#114710
Dimas, that is not all respectful.
First of all, JomSocial is marketed as EXTENDABLE, so I have extended it with jReviews. The WALL streams are PURELY from JomSocial, the fact that you are confused by the 'reviewed' word is quite embarrassing for a team of the JomSocial development!
I CLEARLY understand what you said, but, once again, it displays the username of the person LOGED IN. Now, do you understand me?
Please be kind and assign this to someone who is not as as lost in their job as you are.
Apologies for being rude, but you do need to try harder.
OK let me clarify this, on last code you didnt provide the userid of your viewed user, I will give you the detail code, please try this :
$cuser = CFactory::getUser($userid);
echo $cuser->username;
// or you can use
echo $cuser->getDisplayName();
->set('userid',$user->id)
->fetch('profile.index');
Hi, Marija.
Code provide by Dimas works but maybe you'll find this one a bit more simple. Just paste this code wherever you want to display user name in profile.index.php:
$cuser = CFactory::getUser(JRequest::getCmd(userid));
echo $cuser->name;
Michal, thank you - I can confirm that is correct.
I apologize for my rudeness towards your employee, I know I was not asking something that counts as 'support', but it is a very needed line of code, I was expecting him to know it from the top of his head, but what frustrated me more is that he did not test or try to understand the issue.
Never mind, I appreciate your contribution, have a lovely day!