graphql mutation in wpgraphql

 mutation MyMutation {

  registerUser(

    input: {username: "abacus", email: "abacus@gmail.com", password: "abacus123", firstName: "abacusjames", lastName: "nito"}

  ) {

    user {

      auth {

        authToken

        refreshToken

        authTokenExpiration

        refreshTokenExpiration

      }

      id

      email

      roles {

        nodes {

          name

        }

      }

    }

  }

}



===========================================

contact form 7 submission with rate limiter ===> 



add_action('rest_api_init', function () {

    register_rest_route('wp/v2', '/cf7/submit', array(

        'methods'  => 'POST',

        'callback' => 'mcbot_cf7_rest_submit',

        'permission_callback' => '__return_true',

        'args' => array(

            'form_id' => array(

                'required' => true,

                'type'     => 'integer',

                'description' => 'Contact Form 7 form ID'

            ),

            'name' => array(

                'required' => true,

                'type'     => 'string',

                'description' => 'Sender name'

            ),

            'email' => array(

                'required' => true,

                'type'     => 'string',

                'description' => 'Sender email'

            ),

            'phone' => array(

                'required' => false,

                'type'     => 'string',

                'description' => 'Phone number'

            ),

            'message' => array(

                'required' => false,

                'type'     => 'string',

                'description' => 'Message content'

            ),

        )

    ));

});



function mcbot_cf7_rest_submit(WP_REST_Request $request)

{

    $form_id = $request->get_param('form_id');

    $contact_form = WPCF7_ContactForm::get_instance($form_id);


    if (!$contact_form) {

        return new WP_REST_Response([

            'status'  => 'error',

            'message' => 'Invalid form ID'

        ], 404);

    }


    // Extract only allowed params

    $allowed = [

        'name',

        'email',

        'phone',

        'message'

    ];


    $data = [];


    foreach ($allowed as $field) {

        if ($request->get_param($field)) {

            $data[$field] = sanitize_text_field($request->get_param($field));

        }

    }


    // Inject into $_POST to simulate CF7 submission

    foreach ($data as $key => $val) {

        $_POST[$key] = $val;

    }


    $result = $contact_form->submit();


    return new WP_REST_Response([

        'status' => $result['status'],

        'message' => $result['message'],

        'invalid_fields' => $result['invalid_fields'] ?? []

    ], 200);

}



====> https://wordpress.org/plugins/cf7-database/




zip link: https://drive.google.com/file/d/1mXyA3MKQKw5oD5W3AnxvZJd25nShtf_P/view?usp=sharing


Welcome to SPACTEX GLOBAL LLP – Trusted Exporter to the World 
Need quality agro products with good export services? You are in the right place. We are distributing high-quality food and farm products across the globe with high emphasis on quality, freshness, and speed of delivery.
Who We Are
We are a reputed export house that delivers agricultural products of high quality to the international markets. We deal directly with farmers, mills, and certified suppliers to maintain quality.
We follow high benchmarks of cleanliness, packaging, and worldwide trade guidelines. We are committed to creating long-term business connections, established on belief, straightforwardness and esteem.
Our Products
We provide a variety of premium agro products which are procured from high-quality farms and processing plants.
Onions
Farm-fresh Red, Pink, and White Onions with striking flavour and long rack life.
Packed in solid export-grade sacks so that it remains fresh amid transit.
Rice 
Long-grain, fragrant, and high-quality basmati and regular rice.
Washed, sorted, and stuffed agreeing to worldwide nourishment security standards.
Groundnuts
An assortment of fresh, delicious, and high-grade Groundnuts in Strong, Java, and Red-Skin flavors.
Hygienically stuffed and quality-tested to guarantee freshness.
Castor Oil
100% pure and naturally extracted Castor Oil for cosmetic, pharmaceutical, and industrial use.
Refined with care to maintain purity and effectiveness.
Chillies
Premium Dry Red Chillies with rich color, aroma, and high level of heat.
Several types are available to meet local taste patterns.
Why Choose Us?
Premium farm-fresh products
International packaging and hygiene.
Quick delivery and logistics.
Competitive export pricing
Open and professional communication.
We do not only ship goods, but we also offer confidence with each order.
Our Export Reach
Currently we are distributing to large markets in the Middle East and Asian countries such as: UAE, Saudi Arabia, Qatar, Oman, Bahrain, Kuwait, Singapore, Bangladesh, Malaysia, Sri Lanka, and Indonesia.
Let’s Grow Together
In need of a dependable merchant of quality cultivated items? Get in touch with us for estimating, product details, or bulk orders. We are concerned about your business development. We are prepared to provide excellence to your market. 
Let’s connect and create success beyond borders.






https://1drv.ms/u/c/0fbf6d71489eaa3a/IQCmccrHqyHrSZybvhNj6p4rAUMs4uK-Pl3d1QtAw2BjmLo?e=ngM2GA




Popular posts from this blog

MCSL 216 MCA NEW Practical ~ common questions suggestions

jitsi

dev chaeatsheet