• Richard

    (@richardashby)


    I love this plugin, but the best bit is the API which is really easy to use:

    $subs = Ninja_Forms()->subs()->get( $args );
    $field_number = 2; // look this up from your own install
    foreach ( $subs as $sub ) {
        echo $sub->get_field( $field_number ) . "<br />";
    }

    Excellent work, thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • hi, richard can i get the api for save the data and the email for subscription ?? thanks.

    Thread Starter Richard

    (@richardashby)

    Use that exact code but replace the field IDs with the ones relating to your own project. You’ll need to debug the output to find out but that’s easy enough. Good luck!

    hi richard thanks for your reply ?? but i am still not understand what to do ,this code is used for fetch the data but i want to save the data but how ? I will show you our code what i am doing :
    i am using under the rest api plugin this is my url:

    URL:
    ‘/posts/newsletters’ => array(
    array( array( $this, ‘newsletters’ ), WP_JSON_Server::CREATABLE | WP_JSON_Server::ACCEPT_JSON ),
    ),

    FUNCTION :
    public function newsletters(){
    $newsletter = new Ninja_Forms();
    $response = new WP_JSON_Response();
    $data1 = array();
    $data[‘ninja_forms_field_1’] = $_POST[‘name’];
    $data[‘ninja_forms_field_2′] = $_POST[’email’];
    $data[‘ninja_forms_field_3’] = $_POST[‘message’];
    $name=$data[‘ninja_forms_field_1’];
    $email=$data[‘ninja_forms_field_2’];
    $message=$data[‘ninja_forms_field_3’];

    print($message);
    print($email);
    print($name);

    it will show all the rest my mail , name and message but how i save into the database can you please give some idea or code to save this data . thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Awesome and brilliant API’ is closed to new replies.