How do you make the Profile icon clickable?

Allon Prooit Posted in Beginning Developers 7 years ago

Clickable Profile Icon?
This would be a nice addition to the the UI I think. Can you make it clickable like the text it's next to? Should be relatively easy to code. I'm more of a designer and a novice coder but have faired well this past year with the Premium OSSN 5.0 with excellent growth. Any help is surely appreciated!
See it here... 3NCIRCLE N37WORK

Replies
gb TalkToAi Online Replied 7 years ago

Looks nice and modern.

us Allon Prooit Replied 7 years ago

Ha ha! Figured this one out too!
Inside of the OssnWall component...
OssnWall/plugins/default/wall/templates/wall/user/item.php

Line 29 is
<div class="meta">
<img class="user-img" src="<?php echo $params['user']->iconURL()->small; ?>" />

Change it to this...
<div class="meta">
<a href="<?php echo $params['user']->profileURL(); ?>">
<img class="user-img" src="<?php echo $params['user']->iconURL()->small; ?>" /></a>

and voila! All the wall post profile icons will now take you to the users profiles!!!

us Allon Prooit Replied 7 years ago

Now on to the next challenge!How to make the post icon clickable?

us Bryce alvord Replied 7 years ago

That is certainly one way to go about it but believe me, when a version update happens you will kick yourself for making source code changes on core components or core files because they will all go bye bye. The path you took is definitely better in terms of if it were going to be merged into source code in upcoming versions but the way I suggested will make it a long lasting change that will work for you using the homefreelancer css/js component. I would just hate to have you go through losing changes, same with your cool theme changes. Please just for your own sake get your current setup created as a personal theme (don't share it of it's based on premium) so that you don't lose your hard work on a version upgrade.

us Allon Prooit Replied 7 years ago

Actually figured it out just a moment ago...
Inside of the OssnProfile component
OssnProfile/plugins/default/profile/newsfeed/info.php

Line 15 is
<div class="newseed-uinfo">
<img src="<?php echo ossn_loggedin_user()->iconURL()->small; ?>"/>

Change it to this
<div class="newseed-uinfo"><a href="<?php echo ossn_loggedin_user()->profileURL(); ?>"><img src="<?php echo ossn_loggedin_user()->iconURL()->small; ?>"/></a>

and voila! The profile icon is now clickable!!!

us Bryce alvord Replied 7 years ago

That color scheme is seriously freaking awesome, I'm jealous. Why have you not created a dark theme for us my friend, you obviously have the eye for it! I couldn't design something ugly on a good day!

Regarding your question, the right way to do this is to add the homelancer css/js component, this will allow you to add custom js to the head of every page you load. Then add a simple onclick event listener with the function taking you to the user url for your given user. That's all pseudo code but I can actually write something for you if that's what you need when I get home, just let me know.

Bryce