[FIXED] Threads in Group Forums can't be unstickied

Brettflan

Active Member
This problem is pretty strange. Threads created in Group Discussion forums (thus as far as XF is concerned, threads located in the designated "Group discussions" node, while the Social Groups mod handles their separation/display into different group forums) can be stickied, but cannot be unstickied. After confirming this as a group admin, I then tried to unsticky the thread as a full-fledged Administrator of the entire forums (with full Super Moderator privileges and assignment as Admin of the Social Group in question), and even with that account I cannot unsticky those threads. The Unstick option does nothing.
This is with all methods, whether viewing the thread and choosing the Unstick option in the "..." menu from there, or viewing the thread list and choosing Edit and trying to uncheck the Sticky option for the thread there, or multi-selecting threads and choosing Unstick. Even trying those options when viewing the master node which stores all group discussion threads does not work.

These group discussion threads remain permanently marked as sticky now, with no way even for forum administrators or moderators to fix them.
 
Last edited:
Decided to dig into it to see if I could work out a fix, and I did.

In \src\addons\Truonglv\Groups\XF\Entity\Thread.php, line 204:
Code:
        if ($this->isChanged('sticky') && $this->GroupThread !== null) {
The isChanged('sticky') was returning false for whatever reason when the thread is sticky and the "unstick" option is chosen.
I monitored the variable state for that breakpoint in the code, and compared it to what unstickying a normal (non-group) thread looks like at that breakpoint (along with stickying that same thread), and marked the difference in relevant variables. That clarified it.
So I changed that line to manually compare the pertinent changing variables:
Code:
        if ($this->sticky != $this->sticky_ && $this->GroupThread !== null) {
And it now appears to function properly. I didn't dig further to see why that seems necessary, but it seems to work just fine. All threads sticky and unsticky as expected.
 
Back
Top