Please upgrade here. These earlier versions are no longer being updated and have security issues.

New to Vanilla and I would like to know how to do few things.Please Help!

How to include custom fields in registration?
I would like to add a data to one of my table from a database whenever an user creates a discussion or comments on a discussion. how to do this?
Thanks in advance :)

Tagged:

Comments

  • peregrineperegrine MVP
    edited August 2015

    @anithaiyer: said "New to Vanilla"

    I guess I can safely say "Welcome new member" without ducking :)

    How to include custom fields in registration?

    profile extender plugin.

    I would like to add a data to one of my table from a database whenever an user creates a discussion or comments on a discussion. how to do this?

    kind of a detailed question.

    you would need to write a custom plugin. There is an example plugin and some documentation regarding writing plugins in the official documentation. The Documentation link at top of page in this forum would be a good place to start looking regarding plugin development.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

    mtschirsanithaiyer
  • Thanks for answering :)
    Can't I insert a simple code in between the post discussion module's php code to attain this? Is it necessary to write a plugin?

  • peregrineperegrine MVP
    edited August 2015

    anithaiyer said: Is it necessary to write a plugin?

    the prevailing school of thought, is not to change the core. It makes it a nightmare when you try to do upgrades. Some people have chosen to take this path only to realize, it seemed simpler at the time, but caused headaches later.

    Addons are the way to go. If you can do something triggering off of an event instead of overriding views, etc. You will be better off in my opinion.

    In some cases some people have written themes and plugins that override views, etc and never have recovered or have been capable of updating (either time constraint or savoir-faire) for the current version. It becomes hasta manana. (which never seems to come).

    You said you want to write to a table after Discussion save or comment save,

    Download a few plugins and research them.

    look at triggering off of events

    e.g.

    public function PostController_AfterCommentSave_Handler($Sender, $Args) {

    and or
    public function PostController_AfterDiscussionSave_Handler($Sender, $Args) {

    then look at how to use the vanilla way to write to a table.

    take a look at models and the structure function in various plugins.

    In summary, you will be happier once you get the knack of plugins, and then you can write community plugins to gain wealth and fame. (maybe only fame :) ).

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

    mtschirsanithaiyer
  • mtschirsmtschirs ✭✭✭
    edited August 2015

    You can modify the relevant parts of the code directly, but in doing so you create your own Vanilla software branch that is incompatible to the official releases. Future updates will revert all your modifications if you don't take great care while merging changes.

    A plugin is much simpler, just create a handler for the relevant events ( 'AfterDiscussionSave' and 'AfterCommentSave').

    Edit: Peregrine was faster :unamused:

    -

    peregrineanithaiyer
  • peregrineperegrine MVP
    edited August 2015

    mtschirs said Edit: Peregrine was faster

    ah, but yours was concise and to the point.

    sometimes concision is better celerity. I prefer the brevity over verboseness but can't help myself.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

    anithaiyer
  • peregrineperegrine MVP
    edited August 2015

    @mtschirs

    you alluded to desiring the yak-shaver badge ( I would advise against, it can be hazardous to your health e.g. twitching, nervous tics, etc. ).

    I, on the other hand have been striving for this erstwhile badge, ever elusive, and totally exclusive.

    http://vanillaforums.org/badge/lightning

    Lightning Reflexes

    Commenting on a new discussion within 60 seconds takes superhuman skills.

    1 person has earned this badge.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

    anithaiyer
  • mtschirsmtschirs ✭✭✭
    edited August 2015

    @peregrine :fearful: ...please don't write a peregrine-auto-reply bot for this forum :glasses:

    -

    peregrineanithaiyer
  • Thanks a lot people for taking time to help :awesome: !! Will look into the code this weekend and try creating a plugin :smiley:
    one last doubt :tongue: Is it possible to have a custom homepage other than discussion?

  • peregrineperegrine MVP
    edited August 2015

    Is it possible to have a custom homepage other than discussion?

    yes. google search (vanilla search engine only lists 10 items)

    https://www.google.com/search?q=site:vanillaforums.org+custom+hom+page

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

    anithaiyer
  • and also can I create a large number of categories and discussions in an automated manner without clicking , typing and creating?

  • if you designed it yourself and knew every nuance of the permissions table and category table. otherwise no.

    there are some performance tradeoffs and category limitations with a large number of categories in dashboard.

    you can probably find those via google with site:vanillafourms.org.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

    anithaiyer
  • I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

    anithaiyer
  • I would like to show table layout for desktops and modern layout for mobiles. Is it possible?

  • peregrineperegrine MVP
    edited August 2015

    @anithaiyer said: I would like to show table layout for desktops and modern layout for mobiles. Is it possible?

    you could write a plugin

    this should work...

    public function Gdn_Dispatcher_AfterControllerCreate_Handler($Sender) {
      // change mobile layout to modern if mobile is detected.
      if (IsMobile()) {
       SaveToConfig('Vanilla.Discussions.Layout','modern', array('Save' => FALSE));
       }
    }
    

    there may be other ways as well.

    probably best to start a new discussion with an appropriate title for each new question after this, please

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

    Bleistivtanithaiyerhgtonight
  • Haha sure :tongue:
    btw you're the best :proud:

  • @peregrine said:
    Download a few plugins and research them.

    look at triggering off of events
    e.g.
    public function PostController_AfterCommentSave_Handler($Sender, $Args) {
    and or
    public function PostController_AfterDiscussionSave_Handler($Sender, $Args) {
    then look at how to use the vanilla way to write to a table.
    take a look at models and the structure function in various plugins.

    I need to write a profile extender data to a table with discussion topics as fields(if new discussion is created it should be added to this table too).
    Can you tip me some exact code to use? or which specific plugin to look for? :anguished:

  • peregrineperegrine MVP
    edited August 2015

    Can you tip me some exact code to use?

    I would start here:

    http://docs.vanillaforums.com/developers/framework/database/

    flagging, tagging, discussion polls write to tables to name a few of many, many plugins that write to database.

    http://vanillaforums.org/discussion/comment/206536/

    http://vanillaforums.org/discussion/comment/187306/#Comment_187306

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

    hgtonight
Sign In or Register to comment.