Michael Zülsdorff
2 years ago
Sound crazy? Yes, actually this is just a showcase for aspiring Ossn developers of how to extend the profile page to display a member's age and gender in response to Dominik's post https://www.opensource-socialnetwork.org/discussion/view/6431/can-someone-help-me-edit-the-profile-and-search-of-ossn
Okay, so: Where is the code we need to alter? The way to find it is thoroughly documented in https://www.opensource-socialnetwork.org/wiki/view/1137/how-to-find-something-a-word-pattern-in-the-source-code
This time we do a right-click->inspect on the profile page just below the member name and get something like
![enter image description here][ATTACHMENT:7008]
And since Dominik wants to add (18) after the class 'user-fullname' it makes sense to use this pattern for searching. On a Linux command-line you would execute a
grep -Rn 'class="user-fullname"' .
which gives
./components/OssnProfile/plugins/default/profile/pages/profile.php:77
That is: We need to edit line #77 of profile.php?
NO - remember: https://www.opensource-socialnetwork.org/wiki/view/704/should-i-modify-core-files
In fact, we can leave profile.php completely untouched and add our extras by means of the Ossn function
ossn_extend_view('file_to_extend', 'by_file_with_extensions');
And right that's where 1.0dev1 of this component starts ...
Have fun!
[ATTACHMENT:7008]: https://www.opensource-socialnetwork.org/photoattachment/7008/18m-1-1.jpg
Michael Zülsdorff
Replied 2 years ago
Hmm yes, not really comfortable admittedly...
That's why release 1.0dev2 is making us of
if (ossn_isAdminLoggedin()) {
ossn_register_callback('ossn', 'init', 'eighteenmale_init');
}
This way the component only gets initialized if the administrator is logged in and we can prevent regular members from getting strange results while the component is still ongoing development.
Dominik L
Replied 2 years ago
Need to setup a test environment, thank you