Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Moderation Tools

edited April 2008 in Vanilla 1.0 Help
this extension should give the ability to adminstrators to quickly accomplish some basic moderation task, like: split selected comments from a discussion and start a new discussion with them. merge selected comments from a discussion and move them to another discussion. when you ran a forum with lot of members this is a must have....
«134

Comments

  • Options
    That would be nice :) Gonna code it? :D
  • Options
    well I'm not really a good php programmer... but I could code it with the help of the communty.... ;) but I will have to ask a lot of silly question....
  • Options
    Silly questions are our speciality! I'v scrounged up a couple comments on how to do this: http://lussumo.com/community/discussion/2426/#Item_3 http://lussumo.com/community/discussion/1985/#Item_2
  • Options
    edited December 2006
    Thanks WallPhone, for the links.... and yes it's exactly what I've in my head.... 1 set a configuration like "can moderate forum" 2 add a split or merge checkbutton to each comment in the comments grid 3 for the split: in top of the comments.php add a field for the new name of the discussion plus a category menu selector (like when you start a new discussion) and the submit split button. 4 for the merge: just below the split options the merge field where you enter the destination discussion ID and the merge button. 5 I need like a javascript function that checks the all the checkbuttons that it will put in an array. 6 we pass that array to our ajax.php where we make the update to the comment tables and the deletes. well for the moment I'm at point 2 how do I add that checkbox in each comment? or how do I render the function GetBasicCheckBox?? ok :) I managed this... so now step 3....let's see.... lol
  • Options
    edited December 2006
    ok done step 3... now before going to do the 4th step, comes the question how do I make a query with the selected checkbox and assign the action to the submit button.... I'v thought doing that with javascript but then came the problem how do I pass an array with php? it is possible? or maybe I should use dynamic checkboxes and in the onclick action just add to the array checkedBoxes the value of the checked box?
  • Options
    You have any screen shots of how this will look? This is exciting. I'm looking forward to this one.
  • Options
    hey Garvin! no screenshot for the moment as the look is ugly... I'm just focusing in doing the program with php then I will style it more nicely... ;) back to the extension: so I set an array comID[] to each checkbox name I got the menu where I can select the category. I got the field for the new name of the topic. I got the split button. now I'm trying to find when I click the split submit button: 1- a way to check all checked comments and retrieve their comment ids 2- post an empty discussion and retrieve the id of it 3- update vanilla db with a sql query like that `LUM_Comment` set `DiscussionID`='$emptyDiscussionID' where `DiscussionID`='$oldDiscussionID' and `CommentID`='$checkedCommentID' this will be in a for statement for each comment checked. if anyone has advice or hints or just could point me in the good direction... please do it ;)
  • Options
    for 1 you could use Document.getElementsByClassName from the prototype framework. You could easily add to all checkbox the same class name and then call them via this pointer and look at each of them if it's checked
  • Options
    edited January 2007
    thx hutsein I will try that... but actually for point 1 I was wondering if it's not better to do it directly with php with out the need of js..... btw how do I get the last created DiscussionID?
  • Options
    I think the function that creates the discussions gives the DiscussionID back as return value. Else you could use mysql_insert_id()
  • Options

    $s = $this->Context->ObjectFactory->NewContextObject($this->Context, 'sqlBuilder');
    $s->SetMainTable('Discussion','d');
    $s->AddSelect('DiscussionID', 'd');
    $s->AddOrderBy('DiscussionID', 'd', 'desc');
    $s->AddLimit(0, 1);



    whit this you get the last id created....or at least I think....
  • Options
    yes thats a method, but I think it isn't very secure.
    What about the case if a user creates a new discussion in exactly the same moment and then you will get a wrong DicussionID
  • Options
    edited January 2007
    yes I thought about that... so how vanilla does it? to work around that case?? I've been looking in the frameworks and library found the savediscussion function but could not grasp how the function know how it his the last discussion id? or maybe it just write down to the db that's it and my approach is not good....? I should then before get the comments and check wich is the lowest id for put it in firstcomment of discussion and then use the savediscussion function? but probably I will have to write a modified savediscussion function.... thx hutstein, for your support... ;)
  • Options
    Hi!

    Isn't the Id auto_increment, and mysql does all the work?

    Tiggr
  • Options
    Yes, I can confirm that the DiscussionID in the Discussion table is set to auto_increment. Just assign a blank value to it and mySql will take care of incrementing it.
  • Options
    Thx Tiggr and valentinp.... this is something good to know :D ouff... I was seeing the whole thing getting bigger and bigger and I was thinking that I was trying to swallow a bit that I can't swallow.... this simplifies the things....... ehheheh that's why we use DBs isn't it? ;) ok so I can concentrate on just saving the discussion with the checked comments....
  • Options
    but if you use your own sql query you need to take a look at all the UserDiscussionCounter thing, Role Block thing, and so on... I think using the framework would be much more secure
  • Options
    for the Role Block I've set a configuration pref plus I think will check each time if the role have the permission to do the query... but why I should need the UserDiscussionCounter if I just create a new discussion and move some comments in to it, there's no added comment so this will not affect the commentcounter thing... no?
  • Options
    but if you take a look at the SaveDiscussion function you can see all the thing that needs to be considered...
  • Options
    yes I see what you mean.... so many thing to be considered... ;)
This discussion has been closed.