baidubuqin

Data-Managers

  • As far as I can see, it is not possible to get the datamanagers to accept fields other then those defined in $validfields.
    Many hacks add stuff to the tables handled by the datamanagers, like in Forum Manager.

    Is there any way to add fields without having to always edit the class_dm_xxx.php file?
    Maybe a method add_valid_field() or smth. in the baseclass could be introduced.

    If not I think this somewhat defeats the goal of the plugins system.


  • Did not notice that, thanks for the tip :)


  • I must have been blind.
    Forget the question :)


  • That is a great tip, now I can update plugins :)


  • Adding new validation methods would be the more challenging bit as you can't add methods at run-time. I'd have to recommend using the lambda function support that's already in there to either put validation code in directly or execute an external validation method.

    For the latter, you should probably do:

    function validate_data($obj, &$data)
    {
    // modify data, return as appropriate, etc
    }


    And in the lambda function part:
    return validate_data($this, $data);


  • Great, didn't know i can use the hooks for that. I do now :p


  • Use the hook in the consturctor to add fields.


  • exacly what i was saying on vB.org. I converted my hack, and i had to edit the $validfields array in class_dm_forum.php. And the admincp/forum.php file. Most to all my hacks would need to edit the $validfields array. :(







  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about Data-Managers , Please add it free.
    edit