Username on OSSNWall

Druskus ZoneNations Posted in Technical Support 9 months ago

I wanted to ask if it was possible to put the username next to the item what are you thinking? I tried entering %s in the language file, but I get no results. Can you guys help me out?

Replies
Italian Druskus ZoneNations Replied 8 months ago

After applying the patch, I noticed that the profile board and group board did not show the username but only %s. To complete this pèost and maybe it might come in handy for someone else the same string:
<textarea placeholder="<?php echo ossnprint('wall:post:container', [ossnloggedin_user()->username]); ?>" name="post"></textarea>

should also be changed in the following paths:
components/OssnWall/plugins/default/forms/OssnWall/group/container.php line 20
e
components/OssnWall/plugins/default/forms/OssnWall/user/container.php line 26

Italian Druskus ZoneNations Replied 8 months ago

now it is clear to me, I had not made the changes to the language file. Thank you

German Michael Zülsdorff Replied 8 months ago

For a better understanding I'd recommend to study https://www.opensource-socialnetwork.org/wiki/view/2132/how-to-translate-ossn

You wanted to ADD the username to the textarea container.
That's why you ADDED %s to the language file like

'wall:post:container' => "What's on your mind, %s?",

Thus, in order to pass the username to %s, the former

ossn_print('wall:post:container');

needs to be extended like

ossn_print('wall:post:container', [ossnloggedin_user()->username]); 

That is, all you have to do is ADD just one more parameter to the ossn_print() function while the complete <textarea>...</textarea> block has to remain the same of course.

Italian Druskus ZoneNations Replied 8 months ago

in the posted patch is missing </textarea>
the version that should be correct is:
<textarea placeholder="<?php echo ossnprint('wall:post:container', [ossnloggedin_user()->username]); ?>" name="post"></textarea>
Otherwise, an error is received.
Username does not appear after post

Italian Druskus ZoneNations Replied 9 months ago

Thank you both for the response!

German Michael Zülsdorff Replied 9 months ago

Perhaps a little reminder on the documentation makes sense, in this case
https://www.opensource-socialnetwork.org/wiki/view/704/should-i-modify-core-files

Italian Druskus ZoneNations Replied 9 months ago

oh ok thank you very much, I was based on the greeter component and thought it was the same thing, my mistake and you very kind to provide support. One question, in case of upgrade, will this code I enter be overwritten or will it remain constant?

Indonesian Arsalan Shah Replied 9 months ago

%s doesn't represent username but anything.

Here you need to change

https://github.com/opensource-socialnetwork/opensource-socialnetwork/blob/master/components/OssnWall/plugins/default/forms/OssnWall/home/container.php#L30

and changing the other line to

<textarea placeholder="<?php echo ossn_print('wall:post:container', [ossn_loggedin_user()->username]); ?>" name="post">

Fixed issue Thanks to Michael for finding it out :) it was missing closing bracket ]