NB: Make sure you do a back up of your theme, files and database before attempting the tutorials

Formidable Form: Display User's IP
Web Hosting Canada

Last modified : Nov 16 2021

Estimated reading time : 1 minute, 51 seconds - 232 words

This tutorial will show you how to fetch your user’s ID and IP address and display it under the Admin column in the WordPress dashboard.

First off, how to fetch the user’s IP address with the form. In your form, Formidable Form, we will create a hidden form and in its advanced parameters, we will look up a default value which will be the IP address.

Donc concrètement, quand l’utilisateur va poster son formulaire, ça va avoir l’adresse IP en champ caché. When a user will send the form, the hidden form will contain their IP. The next step will be to display it in a column in the WordPress user section.

We will add two new filters manage_users_columns and manage_users_custom_column

function add_column( $column ) {
    $column['userip'] = 'IP utilisateur';
    return $column;
add_filter( 'manage_users_columns', 'add_column' );

/*this will add column value in user list table*/
function add_column_value( $val, $column_name, $user_id ) {
   switch ($column_name) {
        case 'userip' :
	// Remplacer 1094 par l'ID du champ caché de votre formulaire IP Adress
        return FrmProEntriesController::get_field_value_shortcode(array('field_id' => 1094, 'entry' => $entry_id, 'user_id' => $user_id));
    return $val; 
add_filter( 'manage_users_custom_column', 'add_column_value', 10, 3 );

Pour obtenir notre valeur IP de l’utilisateur, nous allons utiliser FrmProEntriesController::get_field_value_shortcode that will allow you to display the Formidable form’s value of the field and inclure an argument is necessary.

In our return Query, we have added the following arguments: field_id, entry, and user_id matching the user’s ID in the results table. This means, for example, to fetch the value matching the ID 1094 of each value each user ID.

NB: Make sure to do a backup of your theme, files and database before proceeding with these tutorials.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>