j7-dev/wp-refine-plugin

Need examples to work with plugin

foxpcteam opened this issue ยท 2 comments

Hi,
First, thank you for this plugin!

Can you please provide some examples of how to work with this plugin?

  1. i want to create some page in admin or in front that users with specific role can access this page.
    If user not login. Page will show login form. if user login and don't have the right role he will see message "access denied"

  2. same for Capabilities. How to work with: user "can edit", "can delete" etc...

  3. example of how to work with custom post types

  4. example of how to work direct with wp db

Thanks

@foxpcteam Welcome ๐Ÿ˜

Sorry for not noticing this issue.๐Ÿ™

Actually, this plugin is still in development.

Recently, I'm working on v2, still in processing, check here

And it would be like:

image

There are some issue need to deal with the dataProvicer.

v2 might be completed on 2024/06, but it depends on my workload.

To answer your question

  1. i want to create some page in admin or in front that users with specific role can access this page.
    If user not login. Page will show login form. if user login and don't have the right role he will see message "access denied"

To solve this problem, you need to custom wp rest API and check user role in backend.
With usefulteam/jwt-auth integrated, you can use get_current_user_id() to get user_id who send the request.

  1. same for Capabilities. How to work with: user "can edit", "can delete" etc...

Same as above, the key is, "how to identify user who send request".

  1. example of how to work with custom post types

There's an example by default, please check here

  1. example of how to work direct with wp db

You can't access db directly from Front end browser.
If you really want to do that, you might concern integrate with wp-graphQL

This is a plugin integrate with WordPress + Vite + React + refine.dev

If you are seeking WordPress + Vite + React template plugin, ๐Ÿ‘‰ check this