Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
765 views
in Plugins by

I cannot see any possibility how to get the link to the recent question (answer/comment) from the filter module.

I tried $question['postid'] but this gives me an undefined index.

Is there any way I can get the link to Q/A/C or at least the postid?

2 Answers

+1 vote
by
selected by
 
Best answer
Unless you're editing an existing post, the filter module is called before the post is created, so it does not yet have a postid. If you want to do something after the post is created, I recommend trying an event module.
by
Oh wow! So here I was wrong :S. I thought filter is to update the content in post not pre. :(
by
thanks for letting me know so quickly :o)
enjoy the evening http://www.youtube.com/watch?v=2RQYQ8v4LEA
by
FYI: If an answer is posted, use function filter_answer() which has $question. Then you can use $question['postid'] to access the question, i.e. the parent of the answer.
0 votes
by
I believe filter module is for filtering the stored data and another which is not an event or action. So I think you can update or filter the data rather than sorting.

This is something similar to Wordpress add_filter () This is what I know. So I don't think so this will work to get recent question. But if not then please update my knowledge I would appreciate.

What exactly you are trying to get? May be possible with different approach!
by
Thanks for your answer. I am filtering formatting and other stuff. Furthermore I implemented if i get mentioned in the post with "@echteinfachtv" it sends me an notification email. Problem is that I would like to have a link there, not only the text. I needed to search for the post each time...

see also http://www.question2answer.org/qa/25686/who-is-interested-in-%40user-mentioning-notification-system
by
So you want to link @mention to the question/answer/comment? Or to the user profile? Sorry just confused because usually @mention linked to the user profile or somewhere.
by
Linking to the Q/A/C where the mention is. The user profile is not necessary, that would be easy ;)

But to make it clear, when @echteinfachtv appears in text, the filter module is sending an email with this text to my email address. Then in this mail, I'd like to have a link that points to the post.
...