Can anyone provide some hints, clues or point to a plugin to modifies discussion and comment body.
I am new to MVC and have tried to study the docs available, so have patience. If you can provide any hints, so I can learn how to do things properly, I would be very appreciative.
Currently I have modified the helper_functions so that it parses selected words from the body of a comment or discussion and modifies some words and does a database lookup.
What I would like to do is change it to a plug-in. Can someone possibly set me on my way with some answers to a few questions.
1 - What hook or hooks would I use to select out the body of the message, use my functions to parse and modify what I need to, and then throw the processed information into the displayed message. I am not looking to modify the data stored permanently in the vanilla database, just to modify what appears on the screen on the fly for each discussion that is clicked on and viewed.
2 - Are there any plug-ins that do something similar, that I can get some tips from.
Other stumbling blocks -
3- Another issue I have is I modified the other helper functions file that lists the discussions and modified that to display the current time of messages that are less than a few hours old in a different color,(since we use reply-to messages are embedded in other than time order), is there a hook I can use to get the time and test and process and through my new style in.
3 - Final Question - Any suggestions on how to store current unread message count prior to a user clicking a message and displaying unread messages in a different color after the user clicks on the discussion to read.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Answers
look at the signatures plugin, also look at formatters. It just want to do a little bit of post parsing, then you don't have to worry about formatters, if you are essentially creating a full blown creating formatter, then take a look at one of those plugins.
grep is your friend.
O wow, thank you for these very interesting questions.
Can we store this thread in the developers category please?
There was an error rendering this rich post.
Not sure what you mean UnderDog. Did I post this in the wrong category? I assumed developer category was for the developers of vanilla. If you tell me how to move it to a different category I will.
Thanks for the clues X00 for question 1. Any ideas or hints on question 2 and 3.
particularly on storing the unread comment count in a variable (and where) prior to firing of the discussion which changes unread comment to zero. (possibly an example)
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
What I mean is that your questions are so interesting that it deserves a discussion from developers perspective
You didn't put it in the wrong category, I just thought of moving it to the developers category so it will keep a ... higher level of posts and suggestions...
Let's keep it here for now and see how the thread will develop.
There was an error rendering this rich post.
Look in the helper_function are
FireEvent
s those are hooks. Hint you are probably goign to want to display that with other 'Meta'. try an visualise with the view code what represent what when rendering. You can also use the eventi plugin to help orwell with the plugin class you can store value between sequential hooks, in a class variable.
Of course I could do it for you, but think you will learn better by discovery. Don't be scared.
grep is your friend.
x00 thanks for the tips. I got some good ideas from the filterstar plugin. I do have one problem that I am not sure if I am going about it the correct way. Keep in mind OOP, MVC, and vanilla are new to me.
I can get the discussion body to change, but I am unsure how to modify the additional comments bodies to parse out. Here is modified and simplified sample of my code that theoretically reads the message body, selects specified matches and converts them to a link with a title. My actual code uses a callback function that reads a database but this should provide an idea of what I am trying to implement
my sample snippet of highlight plugin code.
e.g. the body of the message
this is XXXXX and ZZZZ
then if you hover over XXXXX the title "Testing" pops up.
if you hover over ZZZZ the title "Testing" pops up.
Problem subsequent comments don't convert .
TIA, if you want to continue pursuing with help or ideas to a beginner .
also: I don't know if I should click answered if I have more questions.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
solved problem 1.
Thank goodness for the eventi plugin.
replace lines 9-14 above with lines below to make it work properly for all comments
within discussion.
public function DiscussionController_AfterCommentFormat_Handler(&$Sender)
{
$Object = $Sender->EventArguments['Object'];
$this->DoReplacement($Object->FormatBody);
}
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.