• Resolved Shwet

    (@sasha1)


    Hi, I want to add an extra checkbox and extra textbox field in registration form. But i am using free version of the plugin.
    So can you please guide me how can i set these two fields in my front end registration page?.
    I want to integrate the registration page with the constant contact plugin is this possible?
    And is there any chances of using Simple Local Avatar with the profile edit page on front end?
    Your reply will be precious…

    https://www.ads-software.com/extend/plugins/profile-builder/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Contributor barinagabriel

    (@barinagabriel)

    Hello sasha1,

    PB has a filter in place, which lets you add extra content, for example on the register page. This is extraRegistrationField and using a function, you can return a string representing the code for a textarea and checkbox (in your case). All you need to do (you can use the same filter) is to handle the saving part ( $_POST ).

    If you need help with this further, let me know!

    Gabriel

    Thread Starter Shwet

    (@sasha1)

    barinagabriel thank you for your precious time for replying.
    I have tried some.but failed to get the desired result.
    So can you suggest me the hook to get this?
    Any help would be appreciated.

    Plugin Contributor barinagabriel

    (@barinagabriel)

    add_filter('extraRegistrationField', 'my_extra_function');
    
    function my_extra_function(){
    
    //if the following condition doesn't work to save data, you can move it outside of the function
    if ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == 'adduser'){
    
       //use this condition to save the sent data; in this case $_POST['extraInput']
    }
    
    $myExtraContent = '<p class="extraInput"><label for="extraInput">Your custom extra input</label><input class="text-input" name="extraInput" type="text" id="extraInput"/></p><!-- .form-extraInput -->';'
    
    return $myExtraContent;
    }
    Thread Starter Shwet

    (@sasha1)

    barinagabriel thank you so much….
    super fast reply…

    Thread Starter Shwet

    (@sasha1)

    @barinagabriel..
    unfortunately what you provided did not worked…what i used is..

    add_filter('extraRegistrationField', 'my_extra_function');
    
    function my_extra_function(){
    
    //if the following condition doesn't work to save data, you can move it outside of the function
    if ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == 'adduser'){
    
       //use this condition to save the sent data; in this case $_POST['extraInput']
    }
    
    $myExtraContent = '<p class="extraInput"><label for="extraInput">County</label><input class="text-input" name="extraInput" type="text" id="extraInput"/></p>';
    do_action('register_form');
    
    return $myExtraContent;
    }

    where i am doing wrong?????
    That did not saved entry in the database…

    Plugin Contributor barinagabriel

    (@barinagabriel)

    @sasha1

    if the only issue is that it is not saving the inserted data, then move the if condition out of the function;

    one thing you can do, is do a var_dump($_POST); outside of the function, and see if you pressed the register button, does it contain some data? If not, you need to find a way to delay it, maybe add it in a function which is hooked on the “footer” hook (head might be too soon maybe).

    Gabriel

    Hello, I am a total amateur in programing, but I would appreciate a checkbox in my Profile Builder.
    Something like the user will check that he is 15 years or older and he will register as a subscriber15+ for example…
    I already created new role for users and hidden some content for younger users, but didn’t realize they can’t assign to those roles by themselves ??

    Could someone please tell me what to add where or give an advice how to create this chechbox function?
    Thanks very much!

    Plugin Author Cristian Antohe

    (@sareiodata)

    Hi,

    You can either have a look at the code Gabriel posted and use it to create a checkbox, OR you can have a look at Profile Builder Hobbyist that allows you to create extra fields: https://www.cozmoslabs.com/wordpress-profile-builder/

    OK thanks! Didn’t know about this Hobbyist so I will take a look ??

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Extra field adding in profile builder’ is closed to new replies.