1

I am new to plugin development for Wordpress but not new to software development.

This question is to get an idea of the "best practice" style for the following question.

I need to make a form only available to registered users, who ideally have a username that is a specific numbers-only is that they already would have. Ideally, the user would register with this id as their username, their email, name etc. After logging in, they would have access to a form that would be created by a plugin. When they submit the form, it would add data to a custom table created by the plugin. I've seen a lot of resources for managing tables in Wordpress, so that's not an issue.

Is there a members plugin that has an API that would allow me to track their id (username) when they submit the form? Should I use the default user capability? What would be the best practice for this situation?

Thanks

0

only available to registered users

If the users are logged in, there have a username and ID to identifier. WordPress have functions to get this data, easy to use. You get as as example the user datas via wp_get_current_user() and only the ID of the logged in user via get_current_user_id(). The documentation of the functions is inside the codex, there have a lot of documentations about this topic, also examples.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.