An example of step-by-step development
The goal of this component is enabling the admin to pin one or more posts on top of the newsfeed, as requested here:: https://www.opensource-socialnetwork.org/discussion/view/6844
Changelog:
ready to use,
v7.3dev2: fixed wrong merging of extra 'wheres' to get*Posts queries
v7.3dev1: + option to un-/collapse pinned posts contributed by Dominik L.
v7.2dev4: + compatibility fix for Friends-Online component as reported by Dominik L.
v7.2dev3: + 'Pin' menu entries on any wall post
v7.2dev2: + 'Unpin' menu entries on Pinned Post's frontend panel
v7.2dev1: + option to hide/display comments
ready to use, but not recommended
v7.1dev4: + eight selectable background colors + language files
early releases NOT to be used in production environments
v7.1dev3: pinned posts being removed from original location + crash debug
v7.1dev2: pinned posts appear on top of the newsfeed
v7.1dev1: admin backend to save post ids + basic placement on top of newfeed
How to pin one or more posts:
Choose the post you want to pin, open its menu on the right and click 'Pin':
The page reloads and the result will look like this.
(With Greetings and Site Announcement installed, Pinned Posts will care about a meaningful ordering by the way.)
How to unpin one or more pinned posts:
Choose the post you want to unpin, open its menu on the right and click 'Unpin':
Collapsing pinned posts:
Since members may not be too delighted to find the same pinned posts again and again whenever they visit the newsfeed, they may collapse any post they don't want to see anymore...
to just one line ...
Hello!
With the newest PinnedPosts, the "FriendsOnline" is double
Thanks, works good for me! :)
Now, that the basics are working fine it's time to add some more comfort...
So release 7.2dev2 comes with the feature to unpin a pinned post directly in place. Pinned posts may still be removed via Configure->PinnedPosts on the administrator page, but that's no longer mandantory.
Release 7.2 now handles post pinning in a completely different way:
No more superfluous JavaScript, instead Ossn hooks ensure that the insertion code and database queries are only executed when absolutely necessary.
Thank you for your feedback.
It works - yes, but the current implementation is rather questionable. ;)
Because it unconditionally bloats your page's header - and what's worse - causes unnecessary database queries even on pages where pinning is not expected at all.
Excellent component feature. It works great.
Idea:
Pin polls
I found an issue;
Normally comments are collapsed, but when using this component, comments on pinned posts are full length
I'm sorry, but currently I have no time for giving detailed help or larger coding projects.
As a starting point I would clone parts of the Group Invitation component into Pinned Posts in order to get an input field in place, change the 'Invite' button to 'Save' which would call an action to store the post ids. The remaining group 'pin' logic should be adaptable from the already existing code.
Hello again. I want to ask if it is possible for the Pinned Posts component to be modified to a Group Pinned Posts component so that any user who is a group administrator can change the order of posts in the group. I need this because I want to make a music ranking.. and not only that.. it can also be a ranking of images that can be changed by the administrator depending on the number of likes on clips or images.. Is it possible to help me I will do it.. or you can do it.. if you think it will be faster and easier.. I think such a component would be useful..