Skip to:
Content
Pages
Categories
Search
Top
Bottom

how should i process form data with the skeleton plugin for an edit screen


  • firetag
    Participant

    @firetag

    I have been working on this plugin and I need to have an edit screen to edit some data on the database… Basically I am not sure how to pass the form data with the skeleton plugin structure… Which file directly handles this kind of data and where should I write my function for it? I know my access to the db should be in the classes file. Where should I call that function in the classes file? I saw a few other plugins that created a whole new php file called bp-[plugin_name]-screens. Is this where I should directly call the mutator in the classes file that I created?..if so how do let the form know thats where the data has to be sent?

    also a quick off topic question….what is the function name for adding a new subnav item in the settings menu?

Viewing 6 replies - 1 through 6 (of 6 total)

  • shaisimchi
    Participant

    @shaisimchi

    Hi,

    With the skeleton plugin what I did was create the DB access stuff (the basic create, some inserts etc) in the classes file.

    then most of my functions are in the templatetags file (some also access/insert/update the db).

    the form is in the main plugin php file (resides under wp-content/plugins) and it calls all the necessary files.

    when you post the data in the form and then call a specific function to do the processing you can access the form variables using $_POST (that is in case you use post in your form).

    If you need more help or having specific questions let me know. I am not a big expert but I got several plugins created using the skeleton and if its working…dont touch it :-)

    Shai


    firetag
    Participant

    @firetag

    Ok thanks a lot man! I defiantly understand the structure a lot better, but I have a few more questions after that… What file exactly is the form suppose to be under?

    …the way I was trying to set it up was put it in the templates folder then create a file with the default theme code plus the form code in the same file. Once the user hits the submit button can I just collect that $_POST data anywhere in my plugin?


    shaisimchi
    Participant

    @shaisimchi

    ok i’ll try to explain what i did.

    when you install the plugin in its original form is it called bp-example so i will stick to that naming convention.

    under wp-content/plugins you have the folder called bp-example with all the files in it (class, templatetags etc).

    under wp-content/plugins you also have a file called bp-example.php

    (if you put these two in place you can activate the bp-example plugin without making any changes).

    anyways, I created my form inside bp-example.php

    my form started with something like that:

    <form id=”form1″ name=”form1″ action=”<?php bp_example_do_something() ?>” method=”post”>

    rest of form is here etc

    later i have the submit button to submit the form etc.

    once you submit the form it calls the function in the action. this function is in bp-example-temlatetags.php that is in the bp-example folder.

    inside this function you can use the $_POST and do whatever you want with your POST variables.

    hope this helps.

    Thanks,

    Shai


    ElectricOwl
    Participant

    @electricowl

    I think you might have helped me out there too.

    It isn’t at all clear how to deal with form data, it would make a great tutorial.

    Thanks.


    firetag
    Participant

    @firetag

    Well everyone has been very helpful, but I am still very confused on how this system works and since I have had no time to experiment I’ve decided to just keep this thread alive. So my last question is: Can I just handle form data anywhere within the plugin or is it in a certain class that this has to be done? … I think I am also going to try to directly ask the plugin developers maybe they would be able to better explain it…


    shaisimchi
    Participant

    @shaisimchi

    Please let me know what you are trying to achieve and I will try to help if I can understand :-)

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘how should i process form data with the skeleton plugin for an edit screen’ is closed to new replies.
Skip to toolbar