创建注册表和发送帖子

时间:2015-05-07 作者:Scott Wolter

我想做一些额外的字段,这将显示在用户发送的帖子稍后自定义注册页面。

我只需要:

制作手动注册页面

我需要的注册项目名称家庭用户名电子邮件位置单选按钮选择用户帐户类型(卖家-买家)可以发送(电话号码-bbm pin-我们的聊天代码-网站链接-价格-上传地图)选择帐户类型(免费-特优)

现在我弄糊涂的是怎么做!:-)我不知道该怎么开始。如果有人能帮我填写这份表格,我将不胜感激。

谢谢

1 个回复
SO网友:Scott Wolter

更新:

将表单调用到前端:

<?php
if (!is_user_logged_in()) {
 get_template_part(\'header\', \'form\');
} else {
    get_template_part(\'header\', \'panel\');
} ?>
header-form.php 内容:

<div class="alert alert-dismissible fade in" role="alert">
      <button type="button" class="close" data-dismiss="alert" aria-label="Close" data-toggle="tooltip" data-placement="top" title="Close"><span aria-hidden="true">&times;</span></button>


  <div role="tabpanel">

  <!-- Nav tabs -->
  <ul class="nav nav-tabs" role="tablist">
    <li role="presentation" class="active"><a href="#login" aria-controls="home" role="tab" data-toggle="tab"><i class="glyphicon glyphicon-log-in"></i> Login</a></li>
    <li role="presentation"><a href="#register" aria-controls="profile" role="tab" data-toggle="tab">Register</a></li>
    <li role="presentation"><a href="#password" aria-controls="messages" role="tab" data-toggle="tab">Lost Password?</a></li>
  </ul>

  <!-- Tab panes -->
  <div class="tab-content">

    <div role="tabpanel" class="tab-pane active" id="login">
        <h3><?php _e(\'Have an account?\', \'landers\'); ?></h3>
        <p><?php _e(\'Log in or sign up! It&rsquo;s fast &amp; <em>free!</em>\', \'landers\'); ?></p>

        <form class="form-horizontal" method="post" action="<?php bloginfo(\'url\') ?>/wp-login.php">
                  <div class="form-group">
                    <input type="text" class="form-control" name="log" value="<?php echo esc_attr(stripslashes($user_login)); ?>" size="20" id="user_login" tabindex="11" placeholder="<?php _e(\'Username\', \'landers\'); ?>" />
                  </div>

                  <div class="form-group">
                   <label class="sr-only" for="user_pass"><?php _e(\'Password\', \'landers\'); ?>: </label>
                   <input type="password" class="form-control" name="pwd" value="" size="20" id="user_pass" tabindex="12" placeholder="Password" />
                  </div>


                 <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                      <div class="checkbox">
                        <label>
                          <input type="checkbox"name="rememberme" value="forever" checked="checked" id="rememberme" tabindex="13" /> Remember me
                        </label>
                      </div>
                    </div>
                  </div>

                 <div class="form-group">
                      <?php do_action(\'login_form\'); ?>
                      <input type="submit" class="btn btn-default" name="user-submit" value="<?php _e(\'Login\', \'landers\'); ?>" tabindex="14" class="user-submit" />
                        <input type="hidden" name="redirect_to" value="<?php echo $_SERVER[\'REQUEST_URI\']; ?>" />
                        <input type="hidden" name="user-cookie" value="1" />
                </div>
                </form>
    </div>

    <div role="tabpanel" class="tab-pane" id="register">
        <h3><?php _e(\'Register for this site!\', \'landers\'); ?></h3>
            <p><?php _e(\'Sign up now for the good stuff.\', \'landers\'); ?></p>
            <form method="post" action="<?php echo site_url(\'wp-login.php?action=register\', \'login_post\') ?>" class="wp-user-form">
                <div class="form-group">
                    <input class="form-control" type="text" name="user_login" value="<?php echo esc_attr(stripslashes($user_login)); ?>" size="20" id="user_login" tabindex="101" placeholder="<?php _e(\'Username\', \'landers\'); ?>" />
                </div>
                <div class="form-group">
                    <input class="form-control" type="text" name="user_email" value="<?php echo esc_attr(stripslashes($user_email)); ?>" size="25" id="user_email" tabindex="102" placeholder="<?php _e(\'Your Email\', \'landers\'); ?>" />
                </div>
                <div class="form-group">
                    <?php do_action(\'register_form\'); ?>
                    <input class="btn btn-default" type="submit" name="user-submit" value="<?php _e(\'Sign up!\', \'landers\'); ?>" class="user-submit" tabindex="103" />
                    <?php $register = $_GET[\'register\']; if($register == true) { echo \'<p><?php _e("Check your email for the password!", "landers"); ?></p>\'; } ?>
                    <input type="hidden" name="redirect_to" value="<?php echo $_SERVER[\'REQUEST_URI\']; ?>?register=true" />
                    <input type="hidden" name="user-cookie" value="1" />
                </div>
            </form>
    </div>


    <div role="tabpanel" class="tab-pane" id="password">
         <h3><?php _e(\'Lose something?\', \'landers\'); ?></h3>
         <span id="helpBlock" class="help-block"><?php _e(\'Enter your username or email to reset your password.\', \'landers\'); ?></span>
            <form method="post" action="<?php echo site_url(\'wp-login.php?action=lostpassword\', \'login_post\') ?>" class="wp-user-form">
                <div class="username">
                    <input type="text" class="form-control" placeholder="<?php _e(\'Username or Email\', \'landers\'); ?>" name="user_login" value="" size="20" id="user_login" tabindex="1001" />
                </div>
                <div class="login_fields">
                    <?php do_action(\'login_form\', \'resetpass\'); ?>
                    <input type="submit" name="user-submit" value="<?php _e(\'Reset my password\', \'landers\'); ?>" class="btn btn-primary user-submit" tabindex="1002" />
                    <?php $reset = $_GET[\'reset\']; if($reset == true) { echo \'<p><?php _e("A message will be sent to your email address.", "landers"); ?></p>\'; } ?>
                    <input type="hidden" name="redirect_to" value="<?php echo $_SERVER[\'REQUEST_URI\']; ?>?reset=true" />
                    <input type="hidden" name="user-cookie" value="1" />
                </div>
            </form>
    </div>

  </div>

</div>


</div><!-- end alert-->
header-panel.php 内容:

<div class="alert alert-warning alert-dismissible fade in" role="alert">
      <button type="button" class="close" data-dismiss="alert" aria-label="Close"  data-toggle="tooltip" data-placement="top" title="Close"><span aria-hidden="true">&times;</span></button>


<div class="row">

        <div class="col-lg-6">

            <div class="row">

                <div class="col-md-6">
                    <h3><?php $current_user = wp_get_current_user(); echo \'<i class="glyphicon glyphicon-user"></i> Welcome, \' . $current_user->user_login . "\\n"; ?></h3>
                    <?php global $userdata; get_currentuserinfo(); echo get_avatar($userdata->ID, 60); ?>
                </div>

                <div class="col-md-6">
                    <p><i class="glyphicon glyphicon-log-in"></i> You&rsquo;re logged in as <strong><?php echo $current_user->display_name ?></strong></p>
                    <p>
                        <a class="btn btn-danger btn-sm" href="<?php echo wp_logout_url(\'index.php\'); ?>"><i class="glyphicon glyphicon-log-out"></i> Log out</a>
                        <?php if (current_user_can(\'manage_options\')) { 
                            echo \'<a class="btn btn-info btn-sm" href="\' . admin_url() . \'"><i class="glyphicon glyphicon-dashboard"></i> \' . __(\'Admin\') . \'</a>\';
echo \'&shy;\';
                            echo \'<a class="btn btn-primary btn-sm" href="\' . admin_url() . \'profile.php"><i class="glyphicon glyphicon-list"></i> \' . __(\'Profile\') . \'</a>\';
    echo \'&shy;\';
                            echo \'<a class="btn btn-success btn-sm" href="\' . admin_url() . \'post-new.php"><i class="glyphicon glyphicon-pencil"></i> \' . __(\'Send Ad\') . \'</a>\';
                            } else { 
                             } ?>

                    </p>
                </div>

            </div>

        </div>

        <div class="col-lg-6">
            <?php global $current_user;
                  get_currentuserinfo();
                    echo \'<div class="table-responsive">\';
                    echo \'<table class="table table-bordered">\';
                    echo \'<tbody>\';

                    echo \'<tr>\';             
                    echo \'<td>\';
                                  echo \'Username: \';
                                  echo \'</td>\';
                    echo \'<td>\';
                                  echo \'\'. $current_user->user_login . "\\n";
                                  echo \'</td>\';
                    echo \'</tr>\';

                    echo \'<tr>\';             
                    echo \'<td>\';
                                  echo \'Your email: \';
                                  echo \'</td>\';
                    echo \'<td>\';
                                  echo \'\' . $current_user->user_email . "\\n";
                                  echo \'</td>\';
                    echo \'</tr>\';

                    echo \'<tr>\';
                    echo \'<td>\';
                                  echo \'Your first name: \';
                                  echo \'</td>\';
                    echo \'<td>\';
                                  echo \'\'  . $current_user->user_firstname . "\\n";
                                  echo \'</td>\';
                    echo \'</tr>\';

                    echo \'<tr>\';
                    echo \'<td>\';
                                  echo \'Your last name: \';
                                  echo \'</td>\';
                    echo \'<td>\';
                                  echo \'\' . $current_user->user_lastname . "\\n";
                                  echo \'</td>\';
                    echo \'</tr>\';

                    echo \'<tr>\';
                    echo \'<td>\';
                                  echo \'Your display name: \';
                                  echo \'</td>\';
                    echo \'<td>\';
                                  echo \'\' . $current_user->display_name . "\\n";
                                  echo \'</td>\';
                    echo \'</tr>\';

                    echo \'<tr>\';
                    echo \'<td>\';
                                  echo \'Your ID: \';
                                  echo \'</td>\';
                    echo \'<td>\';
                                  echo \'\' . $current_user->ID . "\\n";
                                  echo \'</td>\';
                    echo \'</tr>\';

                    echo \'</tbody>\';
                    echo \'</table>\';
                    echo \'</div>\';
            ?>
        </div>

</div>

</div><!--end of alert-->
直到我做了这么多。现在,我需要在注册表中添加一些字段,并授予发布帖子的访问权限(在接受之前,暂挂不会变为live)。

结束

相关推荐

My posts show 2 comment forms

我们有一个Wordpress网站,lifering.org, 在戈达迪主持。我们最近升级了虚拟服务器的Linux操作系统,这涉及到从备份重建站点。现在,我们的单篇帖子显示了两个评论回复表单。我相信我们之前每个帖子只有一个评论回复表。我不知道这是怎么发生的-我自己做了备份-或者如何修复它。