Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Plugin Name: Custom Fields Registration - RCP
- Plugin URL: http://wordpress.org/extend/plugins/custom-fields-registration-rcp/
- Description: Adds a simple custom fields to the Restrict Content Pro registration form made by DannIkhim for AAFW !
- Version: 1.0.0
- Author: Dann Ikhim
- Author URI: http://webinkdesign.ro
- Contributors: Dann Ikhim
- License: GPL2
- Text Domain: custom-fields-registration
- */
- // displays the custom fields to registration form
- function wid_add_custom_fields() {
- ?>
- <p>
- <label for="rcp_location"><?php _e('Your City, State', 'rcp'); ?></label>
- <input name="rcp_location" id="rcp_location" type="text"/>
- </p>
- <p>
- <label for="rcp_address"><?php _e('Address', 'rcp'); ?></label>
- <input name="rcp_address" id="rcp_address" type="text"/>
- </p>
- <p>
- <label for="rcp_zip"><?php _e('Zip', 'rcp'); ?></label>
- <input name="rcp_zip" id="rcp_address" type="text"/>
- </p>
- <p>
- <label for="rcp_phone"><?php _e('Phone no', 'rcp'); ?></label>
- <input name="rcp_phone" id="rcp_phone" type="text"/>
- </p>
- <?php
- }
- add_action('rcp_after_password_registration_field', 'wid_add_custom_fields');
- function wid_save_custom_fields($posted, $user_id) {
- if($posted['rcp_location']) {
- update_user_meta($user_id, 'rcp_location', $posted['rcp_location']);
- }
- if($posted['rcp_address']) {
- update_user_meta($user_id, 'rcp_address', $posted['rcp_address']);
- }
- if($posted['rcp_zip']) {
- update_user_meta($user_id, 'rcp_zip', $posted['rcp_zip']);
- }
- if($posted['rcp_phone']) {
- update_user_meta($user_id, 'rcp_phone', $posted['rcp_phone']);
- }
- }
- add_action('rcp_form_processing', 'wid_save_custom_fields', 10, 2);
- function wid_add_table_header_footer() {
- ?>
- <th class="rcp-location-col"><?php _e('Location', 'rcp'); ?></th>
- <th class="rcp-address-col"><?php _e('Street', 'rcp'); ?></th>
- <th class="rcp-zip-col"><?php _e('Zip', 'rcp'); ?></th>
- <th class="rcp-phone-col"><?php _e('Phone', 'rcp'); ?></th>
- <?php
- }
- add_action('rcp_members_page_table_header', 'wid_add_table_header_footer');
- add_action('rcp_members_page_table_footer', 'wid_add_table_header_footer');
- function wid_add_row($user_id) {
- ?>
- <td><?php echo get_user_meta($user_id, 'rcp_location', true); ?></td>
- <td><?php echo get_user_meta($user_id, 'rcp_address', true); ?></td>
- <td><?php echo get_user_meta($user_id, 'rcp_zip', true); ?></td>
- <td><?php echo get_user_meta($user_id, 'rcp_phone', true); ?></td>
- <?php
- }
- add_action('rcp_members_page_table_column', 'wid_add_row');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement