Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
-FP Posted October 1, 2015 Posted October 1, 2015 I want to let users who can't see hidden posts know that there was a post that has been hidden. So at the end of the postContainer template I added this: {{if $comment->hidden() AND $comment->canUnhide()}} This message has been hidden. {{endif}} To me as an user with permission to view and unhide hidden content, that simply shows "This message has been hidden." after the hidden message. So then I tried this line: {{if $comment->hidden() AND !$comment->canUnhide()}} This message has been hidden. {{endif}} Obviously I no longer see the message after the hidden post. But it doesn't show up for users who can't unhide/view hidden messages, and that's what I need. How can I work around this? The if statement? Work in another template?
Adlago Posted October 1, 2015 Posted October 1, 2015 I would try this: - Create new members group - Add this group Staff/Moderators - Edit Staff/This new group ->Content - YES only 'Can view all hidden content?' - and permissions you decide. - Add to postContainer only the first code. (or second if I misunderstood)
-FP Posted October 1, 2015 Author Posted October 1, 2015 Hey, the issue is that I don't want them to see the content of the message. I only want to notify that there was a message that has been hidden.
Adlago Posted October 1, 2015 Posted October 1, 2015 You said: 'To me as an user with permission to view and unhide hidden content, that simply shows "This message has been hidden." after the hidden message. ' This new group should see this message.
-FP Posted October 1, 2015 Author Posted October 1, 2015 Ah yeah the first part was just a functionality test. Then I modified it to make it work for people who can't see hidden messages, but it doesn't. So basically, I want people who can't see hidden messages, to see "This message has been hidden." instead of nothing. If I do what you suggested, they will see normal post block with the actual message and the modified style to show that it's hidden, and I don't want that.
Adlago Posted October 1, 2015 Posted October 1, 2015 If your code first condition to perform Staff team, then create this new group and its members for this condition
-FP Posted October 1, 2015 Author Posted October 1, 2015 Yes, the issue is that if I do that, they will see the normal post block with the post itself, and I don't want that, I only want to show that the message was hidden. Right now nothing is shown to people who can't see hidden messages.
Adlago Posted October 1, 2015 Posted October 1, 2015 I think this is the only option that easily experiment
Tom S. Posted October 1, 2015 Posted October 1, 2015 Do you know what canUnhide() returns? If it is just true or false then maybe try using syntax canUnhide() == false
-FP Posted October 1, 2015 Author Posted October 1, 2015 I added this to the topic template: In the foreach that calls the postContainer template, after that call, I added 2 if statements. The first one in purpose to test that I, as an user with an account that can unhide stuff, can see the notification of hidden message. Yes I see it below the hidden message: So, the second if statement, should show the notification message for users that can't unhide posts. But it doesn't. I suspect because to begin with hidden comments do not even get into $comment if you don't have the permission to view/unhide them, so the hidden() stuff doesn't work.
-FP Posted October 2, 2015 Author Posted October 2, 2015 Baaaaaaaaah been trying to do this for hours. I definitely think hidden messages do not get in $comments if the user doesn't have permission to view them. I guess I would have to modify some php file to get everything in $comments, and then also modify the topic template to only call postContainer for hidden messages if the user can see them, if not just show the custom message. But not willing to mess with that.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.