Erics News Feed Filter component feedback

Arsalan Shah Posted in Component Development 8 months ago

@Eric

https://github.com/compie67/OSSN-Newfeed-filter

Just wondering what is use of this function as OssnWall already have

  • getFriendsPosts() + friends posts only
  • getPublicPosts() which shows everyone posts + friends post

Example this component https://www.opensource-socialnetwork.org/component/view/5673/home-page-posts

You can simply edit siteactivty siteactivity.php into your component and based on user selection you can show the posts types.

I believe your function will break the actual functionality of the methods (getPublicPosts , getAllPosts, getFriendsPosts)

Also never head such a hook in OSSN before ossn_add_hook('action', 'user/settings/save', .......)

Instead of using such a code why don't you simply use OssnUser object to save cutstom option?

$user = $params['user'];
$user->data->newsfeedorder_preference = $input;
$user->save()

And get it by $user->newsfeedorder_preference

Instead of the lengthily annotation code.

Replies
Dutch Eric redegeld Replied 8 months ago

Thanks a lot for your sharp and constructive feedback. kudos
I'm really learning a lot from thi.
OSSN invites experimentation, which makes it fun to explore and try different things. But it's even better when someone points out: hey, there's a cleaner and more OSSN-native way to do this.

This module was exactly one of those "figuring-it-out" cases I got it working, but it quickly became a mix of older annotation logic and non-standard hooks. Your tip about using $user->data and simply overriding siteactivity.php really brings clarity. That feels like the missing puzzle piece.

I’ll think i after test the redcrest module implement your tip much appreciated!

Eric