Display topic only for his autor and admins

Started by spirulez, July 10, 2005, 11:44:40 AM

Previous topic - Next topic

spirulez

Hi

In my Display.template.php I search a solution to display topics only for his autor and admins. If the reader is not the topic laucher, or don't appart to administrator's team or the thread was not created by an administrator, then the topic must not displayed and show an error message like "You are not able to see this thread, sorry.".

A variable already exist in this file : $context['first_message'].
But it didn't check his ID member. How can I specify a option like that : $context['first_message']['member']['id'] or use $topic['first_post']['member']['id'] we have already in the MessageIndex.php ?

Thanks a lot if you have some time for a help.
Do you undestrand something about SMF's variables? | Vous comprenez quelque chose aux variables sous SMF ?
Some help please? | Un peu d'aide svp ?
Thanks a lot | Merci beaucoup

rhizome

Could you not just use a private forum for your group?

Or maybe the mod for member specific permissions might work in terms of settings for viewing/posting, but just guessing as haven't looked at what could be done with it

spirulez

#2
Sure it must be a private access.

But in fact I want to create a MOD that use SMF like a helpdesk.

So the board should be more a confidential space where members are in fact customers. So it's not really a board to meet someone or flood about the weather (oops just a joke cause I remember the old mine lol). So the topics must be personal and confidential. I have already put the code for displaying the message only to his autor (and the team), so any member can reply a existing thread posted by admins or ask a question by creating another. In this first case, if the message don't appart to the member viewing the thread, he can read only a message error like "This message is not displayed because you are not his autor", and then the thread continue so long to construct and display the rest of the thread till his end.

The must will be now to stop (break) the 'while' that display all the thread, from the start, if the first message is unknown for the reader (not if it's a admin's message or naturally if the reader is admin).

I don't know if a have well explain what I mean.

Thank about your interest, if you should have more informations, no problem (excuse my poor english however ;D)
Do you undestrand something about SMF's variables? | Vous comprenez quelque chose aux variables sous SMF ?
Some help please? | Un peu d'aide svp ?
Thanks a lot | Merci beaucoup

Meriadoc

one variable you might want to look at is $context['started']
this is set to 1 if the user started the thread, otherwise it's ''

i'm not sure i understand what you want though. Do you want anyone to be able to open any thread and not be able to see each post? Wouldn't it make more sense for them to just not be able to see some topics in MessageIndex Probably easier too. the variable $context['topics']['']['first_post']['member']['id'] might be of use.

then of course there are all the variables that come out of the loops that spit out the topics or messages.

I realize I haven't actually told you how to do anything, but I'm not sure exactly what you want, and am just trying to give you a starting point and a couple of variable ideas.
If I know the way home and am walking along it drunkenly, is it any less the right way because I am staggering from side to side? : Leo Tolstoy
Everything I know I learned from Calvin and Hobbes.
And patience is about the most useful thing you could ever have.  That and backups. : [Unknown]
If I choose to send thee, Tuor son of Huor, then believe not that thy one sword is not worth the sending. : Ulmo, Lord of the Waters - Unfinished Tales, by J.R.R. Tolkien

spirulez

@Meriadoc : thank you for your help.

I'll see with more interest what this variable named $context['user']['started'] (found in Display.php after this hopeful line : // Did this user start the topic or not? ;)) can done for my project. I think I have the good one now.

For the second way you spoke, sure I have already use this second variable $context['first_post']['member']['id'] to disable messages that doesn't interest other members.

The problem was naturally the two button : « previous | next » (topic) and the manual increment of the topic in the browser's address bar : if the message number 4 is disallowed by the MessageIndex.template.php, a foxy member could just access by this url :
http://www.the_domaine/forum/index.php?topic=4.0

So, in the Display.template.php, I must test a second time if the topic should or not appear to the user. The same in the calendar.

(houlala, sorry for my english :P)

Thanks a lot for your efficient help that set my on the way, I'll post as soon I have news ;)
Do you undestrand something about SMF's variables? | Vous comprenez quelque chose aux variables sous SMF ?
Some help please? | Un peu d'aide svp ?
Thanks a lot | Merci beaucoup

Meriadoc

Quote from: spirulez on July 21, 2005, 12:44:42 PM
The problem was naturally the two button : « previous | next » (topic) and the manual increment of the topic in the browser's address bar : if the message number 4 is disallowed by the MessageIndex.template.php, a foxy member could just access by this url :
http://www.the_domaine/forum/index.php?topic=4.0

(houlala, sorry for my english :P)
completely forgot about the previous/next buttons, ::)
glad i could help out.

and if you'd like, go ahead and write in French (and English as well if you'd like), if I can't figure it out then Alexandre P can!
i don't think we'd need to shift the thread either.
If I know the way home and am walking along it drunkenly, is it any less the right way because I am staggering from side to side? : Leo Tolstoy
Everything I know I learned from Calvin and Hobbes.
And patience is about the most useful thing you could ever have.  That and backups. : [Unknown]
If I choose to send thee, Tuor son of Huor, then believe not that thy one sword is not worth the sending. : Ulmo, Lord of the Waters - Unfinished Tales, by J.R.R. Tolkien

Ben_S

You also have to think of search, recent posts etc.
Liverpool FC Forum with 14 million+ posts.

rhizome

spirulez, did you have any luck with this.

I think I've ended up posting a similar request
http://www.simplemachines.org/community/index.php?topic=45766.0

Advertisement: