Pergunta

I am building a website for a charity event and i would like for people to register for this event.

The form should contain name, email and other custom questions. Also I would like a page where to list the persons registered. I was thinking of using the user system + a plugin for listing the user list.

What plugins would you use?

Thanks.

Foi útil?

Solução

Hi solomongaby:

Forms

For the form I would suggestion using GravityForms. It's super easy to use to design and post a form, and here's an example form we made for requests to be a presenter.

GravityForms is $39 per server but if you ask they may be willing to give a charity a free copy?

Registration

I would probably just recommend using EventBrite like we did for our WordPress business conference.

EventBrite is free to use if your event is free and the fees are well worth the lack of headache if you are charging. Using EventBrite (or a similar service) will be much, much easier than trying to implement something in WordPress for a one-time event.

I wrote a shortcode to make display easy (you can put the code in your theme's functions.php file). Here's the prototype usage for the shortcode:

[eventbrite src="{event_url}" width="{width}" height="{height}"]

And this is what the shortcode looked like in use (be sure to substitute your own event URL of course):

[eventbrite src="http://www.eventbrite.com/tickets-external?eid=582216425&ref=etckt" width="620" height="500"]

And finally here's the PHP source code for the short code:

<?php
add_shortcode('eventbrite', 'eventbrite_show_widget');

function eventbrite_show_widget($args) {
  $valid_types = array('ticket-form',);
  $div_style = 'border:1px solid black;color:white;background:red;padding:10px;';
  $default = array(
    'type' => 'ticket-form',
    'url' => '',
    'src' => '',
    'width' => '100%',
    'height' => '500',
  );
  $args = array_merge($default,$args);
  extract($args);
  if (empty($url) && empty($src)) {
    $html =<<<HTML
<div style="$div_style">
<p>The "eventbrite" shortcode much have an attribute of either "<b><i>src</i></b>" or "<b><i>url</i></b>", i.e.:</p>
<ul>
<li>[eventbrite type="ticket-form" <b><i>src</i></b>="http://www.eventbrite.com/tickets-external?eid=582216425&ref=etckt"]</li>
<li>[eventbrite type="ticket-form" <b><i>url</i></b>="http://www.eventbrite.com/tickets-external?eid=582216425&ref=etckt"]</li>
</ul>
</div>
HTML;
  } else if (!empty($url) && !empty($src)) {
    $html =<<<HTML
<div style="$div_style">
You should only the "<b><i>src</i></b>" attribute or the "<b><i>url</i></b>" attribute when using the "eventbrite" shortcode.
</div>
HTML;
  } else if (!in_array($args['type'],$valid_types)) {
    $valid_types = implode('</b></i>"</li><li>"<i><b>',$valid_types);
    $html =<<<HTML
<div style="$div_style">
<p>When using the "eventbrite" shortcode you must specifiy an attribute of "<b><i>type</i></b>" with one of the following valid values:</p>
<ul><li>"<i><b>$valid_types</b></i>"</li></ul>
<p>i.e.:</p>
<ul>
<li>[eventbrite <b><i>type</i></b>="<b><i>ticket-form</i></b>" src="$url$src"]</li>
</ul>
</div>
HTML;
  } else  {
  $html = <<<HTML
<div id="eventbrite">
  <iframe src="$src$url" width="$width" height="$height" allowtransparency="true" scrolling="auto"></iframe>
</div>
HTML;
  }
  return $html;
}

Outras dicas

check out EventExpresso (http://eventespresso.com/) which has both a paid and a free version. That should do everything you need it to.

You can modify the standard WordPresss user registration form to require more data than the usual username + email address.

add_action('register_form','my_show_extra_fields');
add_action('register_post','my_check_fields',10,3);
add_action('user_register','my_register_extra_fields',10,3);

function my_show_extra_fields(){
    ?>
    <style>
    #user_first, #user_last, #hzip {
      background:none repeat scroll 0 0 #FBFBFB;
      border:1px solid #E5E5E5;
      font-size:24px;
      margin-bottom:16px;
      margin-right:6px;
      margin-top:2px;
      padding:3px;
      width:97%;
    }
    </style>
    <p><label>First Name<br/>
      <input id="user_first" type="text" tabindex="20" size="25" value="<?php echo $_POST['first']; ?>" name="first"/>
      </label></p>
    <p><label>Last Name<br/>
      <input id="user_last" type="text" tabindex="20" size="25" value="<?php echo $_POST['last']; ?>" name="last"/>
      </label></p>
    <p><label>Home ZIP Code<br/>
      <input id="hzip" type="text" tabindex="20" size="25" maxlength="10" value="<?php echo $_POST['hzip']; ?>" name="hzip"/>
      </label></p>
    <?php
}

function my_check_fields($login, $email, $errors) {
  global $firstname, $lastname, $hzip;
  if ($_POST['first'] == '') {
    $errors->add('empty_realname', "<strong>ERROR</strong>: Please enter first name");
  } else {
    $firstname = $_POST['first'];
  }
  if ($_POST['last'] == '') {
    $errors->add('empty_realname', "<strong>ERROR</strong>: Please enter last name");
  } else {
    $lastname = $_POST['last'];
  }
  if ($_POST['hzip'] == '') {
    $errors->add('empty_hzip', "<strong>ERROR</strong>: Please enter home ZIP Code");
  } else {
    $hzip = $_POST['hzip'];
  }
}

function my_register_extra_fields($user_id, $password="", $meta=array())  {
  $userdata = array();
  $userdata['ID'] = $user_id;
  $userdata['first_name'] = $_POST['first'];
  $userdata['last_name'] = $_POST['last'];
  wp_update_user($userdata);
  update_usermeta( $user_id, 'hzip', $_POST['hzip'] );
}

add_action( 'show_user_profile', 'my_show_extra_profile_fields' );
add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );

function my_show_extra_profile_fields( $user ) {
  $current_hzip = esc_attr( get_the_author_meta( 'hzip', $user->ID ) );
    ?>
    <h3>Extra profile information</h3>
    <table class="form-table">
      <tr>
        <th><label for="hzip">Home ZIP Code</label></th>
        <td>
          <input type="text" name="hzip" id="hzip" size="10" maxlength="10" value="<?php echo $current_hzip ?>" class="regular-text" />
        </td>
      </tr>
    </table>
    <?php
}

add_action( 'personal_options_update', 'my_save_extra_profile_fields' );
add_action( 'edit_user_profile_update', 'my_save_extra_profile_fields' );

function my_save_extra_profile_fields($user_id) {
  if ( !current_user_can('edit_user', $user_id) ) {
    return false;
  }
  update_usermeta( $user_id, 'hzip', $_POST['hzip'] );
}

Put the above in your functions.php.

A fantastic plugin for displaying customizable lists of user is AmR User Lists

(Edit: Added user registration stuff.)

(Edit 2: Added custom data not normally saved by WordPress.)

Or use BuddyPress, has all this features and more after customizing

Licenciado em: CC-BY-SA com atribuição
Não afiliado a wordpress.stackexchange
scroll top