0

i don't know this topic might covered else where. but i am trying to find step by step simply tutorial. to make a plugin where i can add a new page to site. and in that page i put some form. and only registered user can access that.

i managed to make plugin at admin side. but not able to find the tutorial to make a form at front end of website. for registered user only.

please give me some link for it.

my core issues are

  1. how can i display custom coded php form in only one page in front end.
  2. how can i make that page ristricted for registered user only.
  3. how can i customize the login/registration form to add custom fields without using any plugin.

Thanks in advance.

1
  • Thank you Bainternet, it was really great answer straight for the question to the solution. with appropriate example links. it helped me a lot to make confirm, that the solution i am thinking is right.
    – user7299
    Jul 25, 2011 at 6:12

3 Answers 3

2

how can i display custom coded php form in only one page in front end?

The best way to go would be to create a custom page template then create a page inside WordPress admin and select your newly created template for that page.

how can i make that page ristricted for registered user only?

Normally I would go with my plugin User Specific Content but since you are looking for a solution without a plugin then you can use the is_user_logged_in() function in your custom template page to check if the user is logged in or not.

how can i customize the login/registration form to add custom fields without using any plugin?

take a look at this nice tutorial

2

For a custom form without plugin. you can make use of existing hooks in wordpress like template_redirect.This hook get called before re-directing to the new page. you can refer to an in-depth article here

html form

<div class="employee">
<input type="hidden" name="show_msg">

<form name="customer_details" method="POST" required="required" class="input-hidden">
Your Name: <input type="text" id="name" name="customer_name">
Your Email: <input type="text" id="email" name="customer_email">
Company: <input type="text" id="company" name="company">
Sex: <input type="radio" name="customer_sex" value="male">Male <input type="radio" name="customer_sex" value="female">Female
<textarea id="post" name="experience" placeholder="Write something.." style="height:400px;width:100%"></textarea>
<input type="submit" value="Submit">
<!--?php wp_nonce_field( 'wpshout-frontend-post','form-submit' ); ?-->
</form></div>

PHP Function

function wpshout_frontend_post() {
    wpshout_save_post_if_submitted();
}
add_action('template_redirect','wpshout_frontend_post', 2);
-1

Adding a shortcode for your form is also an option: http://codex.wordpress.org/Shortcode_API

1
  • Not really addresses the question in hand
    – Bainternet
    Jul 22, 2011 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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