2011-08-09 2 views

답변

3

나는 플러그인을 사용하지 않는 것이 더 쉽다고 생각합니다. functions.php에 몇 줄을 추가하면 작업을 완료 할 수 있습니다. 나는 당신이 첫 페이지에 가입하는 사용자를 얻으려고한다고 가정합니다. 이 코드에서 뭔가를 얻을 수 있는지 확인하십시오.

<?php 
/** 
* Template Name: Register Page 
* 
*/ 

/* Load registration file. */ 
require_once(ABSPATH . WPINC . '/registration.php'); 

/* Check if users can register. */ 
$registration = get_option('users_can_register'); 

/* If user registered, input info. */ 
if ('POST' == $_SERVER['REQUEST_METHOD'] && !empty($_POST['action']) && $_POST['action'] == 'adduser') { 
    $user_pass = wp_generate_password(); 
    $userdata = array(
     'user_pass' => $user_pass, 
     'user_login' => esc_attr($_POST['user_name']), 
     'first_name' => esc_attr($_POST['first_name']), 
     'last_name' => esc_attr($_POST['last_name']), 
     'nickname' => esc_attr($_POST['nickname']), 
     'user_email' => esc_attr($_POST['email']), 
     'user_url' => esc_attr($_POST['website']), 
     'aim' => esc_attr($_POST['aim']), 
     'yim' => esc_attr($_POST['yim']), 
     'jabber' => esc_attr($_POST['jabber']), 
     'description' => esc_attr($_POST['description']), 
     'role' => get_option('default_role'), 
    ); 

    if (!$userdata['user_login']) 
     $error = __('A username is required for registration.', 'frontendprofile'); 
    elseif (username_exists($userdata['user_login'])) 
     $error = __('Sorry, that username already exists!', 'frontendprofile'); 

    elseif (!is_email($userdata['user_email'], true)) 
     $error = __('You must enter a valid email address.', 'frontendprofile'); 
    elseif (email_exists($userdata['user_email'])) 
     $error = __('Sorry, that email address is already used!', 'frontendprofile'); 

    else{ 
     $new_user = wp_insert_user($userdata); 
     wp_new_user_notification($new_user, $user_pass); 

     update_usermeta($new_user, 'twitter', esc_attr($_POST['twitter'] )); 
     update_usermeta($new_user, 'birth', esc_attr($_POST['birth'] )); 
     update_usermeta($new_user, 'hobbies',   $_POST['hobbies'] ); 
     update_usermeta($new_user, 'agree', esc_attr($_POST['agree'] )); 
    } 

} 



    // calling the header.php 
    get_header(); 

    // action hook for placing content above #container 
    //thematic_abovecontainer(); 

?> 

<div style="width:970px; height:32px; margin-bottom:10px; clear:both;"><img src="<?php bloginfo('template_url');?>/images/allNarutal_organicTea.png" title="All Natural, Organic Rooibos Tea" > </div> 


    <div id="products_page"> 
     <div id="registration"> 

      <?php 

      // calling the widget area 'page-top' 

      the_post(); 

      ?> 

      <div id="post-<?php the_ID(); ?>"> 

       <?php 

       // creating the post header 
       // thematic_postheader(); 

       ?> 

       <div class="entry-content"> 

        <?php 

        the_content(); 

        wp_link_pages("\t\t\t\t\t<div class='page-link'>".__('Pages: ', 'thematic'), "</div>\n", 'number'); 

        edit_post_link(__('Edit', 'thematic'),'<span class="edit-link">','</span>') ?> 

       </div> 
      </div><!-- .post --> 

<!-- REGISTER FORM STARTS HERE --> 

     <?php if (is_user_logged_in() && !current_user_can('create_users')) : ?> 

      <p class="log-in-out alert"> 
      <?php printf(__('You are logged in as <a href="%1$s" title="%2$s">%2$s</a>. You don\'t need another account.', 'frontendprofile'), get_author_posts_url($curauth->ID), $user_identity); ?> <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="<?php _e('Log out of this account', 'frontendprofile'); ?>"><?php _e('Logout &raquo;', 'frontendprofile'); ?></a> 
      </p><!-- .log-in-out .alert --> 

     <?php elseif ($new_user) : ?> 

      <p class="alert"> 
      <?php 
       if (current_user_can('create_users')) 
        printf(__('A user account for %1$s has been created.', 'frontendprofile'), $_POST['user-name']); 
       else 
        printf(__('Thank you for registering, %1$s.', 'frontendprofile'), $_POST['user-name']); 
        printf(__('<br/>Please check your email address. That\'s where you\'ll recieve your login password.<br/> (It might go into your spam folder)', 'frontendprofile')); 
      ?> 
      </p><!-- .alert --> 

     <?php else : ?> 

      <?php if ($error) : ?> 
       <p class="error"> 
        <?php echo $error; ?> 
       </p><!-- .error --> 
      <?php endif; ?> 

      <?php if (current_user_can('create_users') && $registration) : ?> 
       <p class="alert"> 
        <?php _e('Users can register themselves or you can manually create users here.', 'frontendprofile'); ?> 
       </p><!-- .alert --> 
      <?php elseif (current_user_can('create_users')) : ?> 
       <p class="alert"> 
        <?php _e('Users cannot currently register themselves, but you can manually create users here.', 'frontendprofile'); ?> 
       </p><!-- .alert --> 
      <?php endif; ?> 

      <?php if ($registration || current_user_can('create_users')) : ?> 

      <form method="post" id="adduser" class="user-forms" action="http://<?php echo $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; ?>"> 


       <strong>Name</strong> 

       <p class="form-username"> 
        <label for="user_name"><?php _e('Username (required)', 'frontendprofile'); ?></label> 
        <input class="text-input" name="user_name" type="text" id="user_name" value="<?php if ($error) echo wp_specialchars($_POST['user_name'], 1); ?>" /> 
       </p><!-- .form-username --> 

       <p class="first_name"> 
        <label for="first_name"><?php _e('First Name', 'frontendprofile'); ?></label> 
        <input class="text-input" name="first_name" type="text" id="first_name" value="<?php if ($error) echo wp_specialchars($_POST['first_name'], 1); ?>" /> 
       </p><!-- .first_name --> 

       <p class="last_name"> 
        <label for="last_name"><?php _e('Last Name', 'frontendprofile'); ?></label> 
        <input class="text-input" name="last_name" type="text" id="last_name" value="<?php if ($error) echo wp_specialchars($_POST['last_name'], 1); ?>" /> 
       </p><!-- .last_name --> 

       <p class="nickname"> 
        <label for="nickname"><?php _e('Nickname', 'frontendprofile'); ?></label> 
        <input class="text-input" name="nickname" type="text" id="nickname" value="<?php if ($error) echo wp_specialchars($_POST['nickname'], 1); ?>" /> 
       </p><!-- .nickname --> 

       <strong>Contact Info</strong> 

       <p class="form-email"> 
        <label for="email"><?php _e('E-mail (required)', 'frontendprofile'); ?></label> 
        <input class="text-input" name="email" type="text" id="email" value="<?php if ($error) echo wp_specialchars($_POST['email'], 1); ?>" /> 
       </p><!-- .form-email --> 

       <p class="form-website"> 
        <label for="website"><?php _e('Website', 'frontendprofile'); ?></label> 
        <input class="text-input" name="website" type="text" id="website" value="<?php if ($error) echo wp_specialchars($_POST['website'], 1); ?>" /> 
       </p><!-- .form-website --> 

       <p class="form-aim"> 
        <label for="aim"><?php _e('AIM', 'frontendprofile'); ?></label> 
        <input class="text-input" name="aim" type="text" id="aim" value="<?php if ($error) echo wp_specialchars($_POST['aim'], 1); ?>" /> 
       </p><!-- .form-aim --> 

       <p class="form-yim"> 
        <label for="yim"><?php _e('Yahoo IM', 'frontendprofile'); ?></label> 
        <input class="text-input" name="yim" type="text" id="yim" value="<?php if ($error) echo wp_specialchars($_POST['yim'], 1); ?>" /> 
       </p><!-- .form-yim --> 

       <p class="form-jabber"> 
        <label for="jabber"><?php _e('Jabber/Google Talk', 'frontendprofile'); ?></label> 
        <input class="text-input" name="jabber" type="text" id="jabber" value="<?php if ($error) echo wp_specialchars($_POST['jabber'], 1); ?>" /> 
       </p><!-- .form-jabber --> 

       <strong>About Yourself</strong> 

       <p class="form-description"> 
        <label for="description"><?php _e('Biographical Info', 'frontendprofile'); ?></label> 
        <textarea class="text-input" name="description" id="description" rows="5" cols="30"><?php if ($error) echo wp_specialchars($_POST['description'], 1); ?></textarea> 
       </p><!-- .form-description --> 



       <p class="form-submit"> 
        <?php echo $referer; ?> 
        <input name="adduser" type="submit" id="addusersub" class="submit button" value="<?php if (current_user_can('create_users')) _e('Add User', 'frontendprofile'); else _e('Register', 'frontendprofile'); ?>" /> 
        <?php wp_nonce_field('add-user') ?> 
        <input name="action" type="hidden" id="action" value="adduser" /> 
       </p><!-- .form-submit --> 

      </form><!-- #adduser --> 

      <?php endif; ?> 

     <?php endif; ?> 

<!-- REGISTER FORM ENDS HERE --> 



     </div><!-- #content --> 
    </div><!-- #container --> 

<?php 

    // action hook for placing content below #container 
    // thematic_belowcontainer(); 

    // calling the standard sidebar 
    // thematic_sidebar(); 

    // calling footer.php 
    get_footer(); 
+0

에서 다운로드하시는 것이 더 나을 것입니다. 주제별 다운로드 – Benjamin

+0

좋은 한 번 감사합니다 :) – Satch3000

+0

안녕하세요. :) – Benjamin

0

BuddyPress 사용을 고려하십시오. 당신이 모든 힘을 필요로하는지 확신하지 못한다.

관련 문제