Pinned Posts Download 7.2dev3

5.0
German Michael Zülsdorff 11 months ago

Pinned Posts

An example of step-by-step development


ready to use,
release 7.2dev3: + 'Pin' menu entries on any wall post
release 7.2dev2: + 'Unpin' menu entries on Pinned Post's frontend panel
release 7.2dev1: + option to hide/display comments

ready to use, but not recommended
release 7.1dev4: + 8 selectable background colors + language files

early releases NOT to be used in production environments
release 7.1dev3: pinned posts being removed from original location + crash debug
release 7.1dev2: pinned posts appear on top of the newsfeed
release 7.1dev1: admin backend to save post ids + basic placement on top of newfeed

The idea of this component is to pin one or more selected posts on top of the newsfeeds as requested here:
https://www.opensource-socialnetwork.org/discussion/view/6844


How to pin one or more posts:
Choose the post you want to pin, open its menu on the right and click 'Pin':


enter image description here


The page reloads and the result will look like this.
(With Greetings and Site Announcement installed, Pinned Post will care about a meaningful ordering by the way.)


enter image description here


How to unpin one or more pinned posts:
Choose the post you to unpin, open its menu on the right and click 'Unpin':


enter image description here

Comments
German Dominik L Replied 7 days ago

Thanks, works good for me! :)

German Michael Zülsdorff Replied 1 week ago

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.


enter image description here

German Michael Zülsdorff Replied 2 weeks ago

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.

German Michael Zülsdorff Replied 2 weeks ago

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.

bm Helen Trott Replied 4 weeks ago

Excellent component feature. It works great.

German Dominik L Replied 1 month ago

Idea:

Pin polls

German Dominik L Replied 4 months ago

I found an issue;

Normally comments are collapsed, but when using this component, comments on pinned posts are full length

German Michael Zülsdorff Replied 5 months ago

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.

Bulgarian Georgi Shindarov Replied 5 months ago

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..

enter image description here

German Michael Zülsdorff Replied 10 months ago

Oops, I thought it would be obvious when I wrote that I intentionally changed Arsalan's line of valid code

$return['order_by'] = 'o.guid ASC';

to this invalid line

$return['order_by'] = 'CRASH_ME!';

in order to force some debug output....

Okay, it was not. Then, what can we do?

1) Revert back to Arsalan's original code. But that would change the sort order in general. And that's not what you wanted.
2) Leave Arsalan's line in place but reverse the ordering in a valid way like

$return['order_by'] = 'o.guid DESC';

which wouldn't hurt but doesn't make too much sense because the default ordering is already DESCENDING
3) simply remove the invalid line :)

Component

Developer: Michael
License GPL v2
Type: Site admin
Requires Ossn Version : 7.1
Latest Version: 7.2dev3
Last Updated 6 days ago
Repository Url View Repository

Versions