Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete client #305

Open
giulianoviale opened this issue Apr 4, 2022 · 22 comments
Open

Delete client #305

giulianoviale opened this issue Apr 4, 2022 · 22 comments

Comments

@giulianoviale
Copy link

Hello! im having trouble when I want to delete a client .. when i wanna make a query to search for the user with an email string parameter to know if the user exist it doesnt work , any advise?

@navjot50
Copy link
Contributor

navjot50 commented Apr 4, 2022

Could you post the code snippet you have tried? Also, at this point it is not clear from your wording what are you actually trying to acheive.

@giulianoviale
Copy link
Author

snippet
I want to know if this is possible, searching with .Search passing the string of the email, knowing this I can get the ID for the parameter of the .Users.Delete() method

@navjot50
Copy link
Contributor

navjot50 commented Apr 4, 2022

Does it throw any exception?

@giulianoviale
Copy link
Author

None

@giulianoviale
Copy link
Author

you understand what i wanna accomplish? maybe i can express myself better

@navjot50
Copy link
Contributor

navjot50 commented Apr 5, 2022

There should be no problem if you pass the email in the Search of UsersQueryBuilder. However, the Wordpress REST api only returns the users which have created at least one post, page or category (or so to say any kind of content in Wordpress). If the user you are searching for hasn't created anything in Wordpress, then it will not be returned in the result.

@giulianoviale
Copy link
Author

image
im trying that , it retrieves all mi clients but doesnt give the their emails , i have something like 2769 users and only retrieve 10 with the email propertie
image

@giulianoviale
Copy link
Author

Can you lead me to some example of the use of the Search in the query builder?

@navjot50
Copy link
Contributor

navjot50 commented Apr 6, 2022

The result of UsersQueryBuilder is paginated by default. It gives 10 results for one request. You can set the Page and PerPage properties of UsersQueryBuilder to loop through and retrieve all users. Max value for PerPage is 100. So, one query can return at max 100 users.

@giulianoviale
Copy link
Author

Please give me more information of the Search sentence and how to do it

@navjot50
Copy link
Contributor

navjot50 commented Apr 6, 2022

You can have a look at the REST api reference from Wordpress: https://developer.wordpress.org/rest-api/

My general advice would be to first try the query builder. If you get a specific exception and problem then it would be easier to help you.

@giulianoviale
Copy link
Author

image

I dont have any exception or problem, i just wanna retrieve and save all the users from the query that i´ve build, i dont know how to make a for each of the 10 pages that retrieve me 100 users each one, if you can help me with that it would be all that i need at the moment

@navjot50
Copy link
Contributor

navjot50 commented Apr 6, 2022

Use a for loop and increment the Page property for each iteration of for loop.

Have a look here: #297 (comment)

@giulianoviale
Copy link
Author

Thank you, i´ll be updating you from this

@giulianoviale
Copy link
Author

image
JWT Authentication for WP REST API is configured correctly, when i want to do the .RequestJWToken method it throws me that error, on line 35

@navjot50
Copy link
Contributor

navjot50 commented Apr 6, 2022

Try generating JWT token using Postman. If it doesn’t generate token there, then the JWT plugin is not configured properly.

@giulianoviale
Copy link
Author

Try generating JWT token using Postman. If it doesn’t generate token there, then the JWT plugin is not configured properly.

i´ve installed the plugin jwt and configured the wp_config.php file , im gonna try to do what you´ve told me

@giulianoviale
Copy link
Author

Try generating JWT token using Postman. If it doesn’t generate token there, then the JWT plugin is not configured properly.

i´ve installed the plugin jwt and configured the wp_config.php file , im gonna try to do what you´ve told me

image
it works

@navjot50
Copy link
Contributor

navjot50 commented Apr 7, 2022

So, atleast the plugin is configured correctly. You must remove the image as it has your credentials. I would suggest you to check the base url that you are passing to the wordpress client on construction. Maybe it’s wrong and you are getting errors for that.

@giulianoviale
Copy link
Author

"You must remove the image as it has your credentials." i dont undestand that
the url that im passing is this one: https://portal21uat.hrfactors.online/wp-json

@giulianoviale
Copy link
Author

"You must remove the image as it has your credentials." i dont undestand that
the url that im passing is this one: https://portal21uat.hrfactors.online/wp-json

Any news about this issue? i think that the url works fine but i cant do the conection, how can i notice if the url works or not?

@giulianoviale
Copy link
Author

I´ve check everything(including the wordpresspcl source code) and found nothing wrong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants