Skip Navigation

[Resolved] displaying users on a map

This support ticket is created 4 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 5 replies, has 2 voices.

Last updated by Shane 4 years, 3 months ago.

Assisted by: Shane.

Author
Posts
#1741317

my theme uses register_form for its registration page.
i havecreated toolset User Field Group with address
how do i add this field to the reg form , i cant find any documentation on this . i need the reg form to be displayed. stored and later displayed on a map using views .

do i need a function in function.php to accomplish this or can it all be done within toolset

thanks in advance

#1742279

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Martin,

Thank you for getting in touch.

The form that you are using to regis, was this form generated with Toolset? Or was it generated by the theme.

If it is created by toolset then you can just Go to Toolset -> User Forms and edit your user form then just drag the field from the custom fields section of the form then save the form.

If it is generated by your theme then I would recommend that you consult your theme author for a guide on to do this.

Thanks,
Shane

#1745383

nothing is ever simple with toolset...... i have reached out they are going to send me something but it will need the toolset custome field adding to the function...

#1745439

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Martin,

I must apologize for not being better able to assist. Why not re-create the registration form using our Forms plugin so that it would be much easier to add the fields that you need.

will need the toolset custome field adding to the function...

Can you provide a bit of clarity on this one for me ?

Thanks,
Shane

#1753045

hey shane i found a document for this over on my theme site , i did a little work on it and have now got this in my functions.php

this adds a simple name field to registration form , stores to the database displays on the profile , can be edited etc etc , so it works perfect, i need to replace the simple name box to my toolset custom user field(address) . which is user-address.
reg for as it stands is here
hidden link

custom field for user-address is here (this field already shows in the edit profile page funnily enough so its really only needs adding on the front end reg form and storing to database on registration)

hidden link (same user and pass as previously supplied , if needed please set me a privte reply)

the code in my functions is

/******* martin/userfields ************/

// display the custom fields
function at_custom_fields() {
?>
<fieldset class="at_fieldset">
<legend><?php _e('trainer adress', 'appthemes'); ?></legend>
<p>
<label for="at_name"><?php _e('adress', 'appthemes'); ?></label><br/>
<input class="text" type="text" name="at_name" id="at_name" value=<?php if (isset($_POST['at_name'])) echo esc_attr($_POST['at_name']); ?>>
</p>
</fieldset>

<style type="text/css">
.at_fieldset { border: 1px solid #ccc; padding: 10px; border-radius: 5px; }
.at_referral_note { font-size: 12px; color: #ccc; }
.at_number { width: 100px }
</style>
<?php
}

// display the custom fields on registration form
add_action( 'register_form', 'at_custom_fields' );

// register the extra fields as user metadata
function at_register_custom_fields( $user_id, $password = "", $meta = array() ) {

// custom fields
$fields = array(
'at_name',
);
// cleans and updates the custom fields
foreach ( $fields as $field ) {
$value = stripslashes( trim( $_POST[$field] ) ) ;
if ( ! empty( $value ) ) {
update_user_meta( $user_id, $field, $value );
}
}

}

// save the custom fields to the database as soon as the user is registered on the database
add_action( 'user_register', 'at_register_custom_fields' );

// display custom fields/values on the backend or frontend
function at_custom_fields_display( $user ) {
$user_id = $user->ID;
?>
<?php if ( is_admin() ) { ?>
<!-- // show the backend HTML -->
<h3><?php _e('Additional Information', 'appthemes'); ?></h3>

<table class="form-table">
<tr>
<th><label for="at_name"><?php _e('adress', 'appthemes'); ?></label></th>
<td>
<input class="text" type="text" name="at_name" id="at_name" value="<?php echo get_user_meta( $user_id, 'at_name', true ) ; ?>">
</td>
</tr>

</table>

<?php } else { ?>

<!-- // show the frontend HTML -->
<fieldset>
<legend><?php _e('trainer adress', 'appthemes'); ?></legend>
<p>
<label for="at_name"><?php _e('address', 'appthemes'); ?></label>
<input class="text" type="text" name="at_name" id="at_name" value="<?php echo get_user_meta( $user_id, 'at_name', true ) ; ?>">
</p>
</fieldset>

<?php } ?>
<?php
}

// display the custom fields on the user profile page (frontend and admin)
add_action( 'show_user_profile', 'at_custom_fields_display' ); // frontend
add_action( 'edit_user_profile', 'at_custom_fields_display' ); // backend

// updates custom fields
function at_custom_fields_update( $user_id ) {

if ( !current_user_can( 'edit_user', $user_id ) )
return false;

// updatable fields
$fields = array(
'at_name',
);

foreach ( $fields as $field ) {
$value = stripslashes( trim( $_POST[$field] ) ) ;
if ( ! empty( $value ) ) {
update_user_meta( $user_id, $field, $value );
}
}

}

// additional fields update
add_action( 'edit_user_profile_update', 'at_custom_fields_update' );
add_action( 'personal_options_update', 'at_custom_fields_update' );

many many thanks

#1753875

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Martin,

Our Address field is actually quite complex. Based on what I see here the most you can do is to just add a single line field and give it the slug of our Types address field so that you can actually add the address to the database.

You won't be able to have the map load on the form where the user enters the address. In order to have this you will definitely need to recreate your user form using our Forms plugin.

Unless your theme's form provides some form of functionality that you absolutely require then I recommend that you remake your form in Toolset a it can become easier to manage especially if you're going to add custom user fields.

Thanks,
Shane