Git Product home page Git Product logo

Comments (4)

agordn52 avatar agordn52 commented on June 19, 2024

Hi @MichaelSowah, the API supports registration with an email, username and password.

WPUserRegisterResponse wpUserRegisterResponse = await WPJsonAPI.instance
      .api((request) => request.wpRegister(
         email: email,
         password: password,
         username: username
      ));

Once they are logged in, you could then call the API to update the user's phone number.
If it's the 'billing phone number' field, you could use the below API method or shippingPhone for the 'shipping phone number'.

WCCustomerUpdatedResponse wcCustomerUpdatedResponse = await WPJsonAPI.instance
        .api((request) => request.wcUpdateCustomerInfo(
            userToken,
            billingPhone: billingPhone
        ));

Re. the role, the API currently doesn't support that.
We can add it to the backlog of things to do, might have a quick turnaround on this for you.

from wp-json-api-flutter.

MichaelSowah avatar MichaelSowah commented on June 19, 2024

Thanks, I would really appreciate that especially the ability to pass the role of the user eg: customer, admin, etc.
At least an optional parameter/field for the dev to pass the user role will be very great for me please as I have different users with different roles creating accounts on my app...how possible is this and what's likely the timeline for adding the role parameter/field?

from wp-json-api-flutter.

agordn52 avatar agordn52 commented on June 19, 2024

Hi @MichaelSowah, v3.1.2 supports the ability to add/remove roles.

Add a new role to a user

WPUserAddRoleResponse wpUserAddRoleResponse = await WPJsonAPI.instance
        .api((request) => request.wpUserAddRole(
            userToken,
            role: "customer" // e.g. customer, subscriber
        ));

Remove role from a user

WPUserRemoveRoleResponse wpUserRemoveRoleResponse = await WPJsonAPI.instance
        .api((request) => request.wpUserRemoveRole(
            userToken,
            role: "customer" // e.g. customer, subscriber
        ));

You'll need to update your WordPress plugin WP JSON API to v3.1.0.

from wp-json-api-flutter.

MichaelSowah avatar MichaelSowah commented on June 19, 2024

great, I updated my plugin

from wp-json-api-flutter.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.