Skip to:
Content
Pages
Categories
Search
Top
Bottom

registration validation


  • AR2015
    Participant

    @ar2015

    hi,

    i am trying to find how (if) BP is doing validation
    using BP 2.1.1

    on buddypress plugin\bp-templates\bp-legacy\css\buddypress.css

    there is section 3.5 forms

    for example here are a few lines:

    #buddypress .standard-form input[type=text],
    #buddypress .standard-form input[type=text],
    #buddypress .standard-form input[type=color],
    #buddypress .standard-form input[type=date],

    this seems to coincide with wp-content\themes\test_theme\buddypress\register.php
    the action bp_signup_username_errors

    <!– here is an an example of the action hook for username validation –>
    <label for=”signup_username”><?php _e( ‘Username’, ‘buddypress’ ); ?> <?php _e( ‘*’, ‘buddypress’ ); ?></label>
    <?php do_action( ‘bp_signup_username_errors’ ); ?>
    <input type=”text” name=”signup_username” id=”signup_username” value=”<?php bp_signup_username_value(); ?>” />
    <p class=”description”>Usernames must be all one word.</p>

    so my question is, buddypress seems to have validation for username, password, and email address. there will be a red error message box popping up when the data isn’t in the correct format.

    where is this functionality passed, and how can i build on it to include other fields like Xprofile fields and WP user profile fields?

    _________________________________________
    for example:

    ‘describe yourself in 25 words or less’

    while this isn’t on the register page, its on where/how would i hook into this field with an action.. and can i use the same function page as the above validation.. just copy and modify the syntax to include the requirements for the data (25 words or less, no urls, etc)

    thanks in advance

Viewing 4 replies - 1 through 4 (of 4 total)

  • AR2015
    Participant

    @ar2015

    also, there is a

    buddypress\buddypress plugin\bp-templates\bp-legacy\js\password-verify.js

    that seems to effect only the password? is this a separate validation script from the others?


    Henry Wright
    Moderator

    @henrywright

    i am trying to find how (if) BP is doing validation
    using BP 2.1.1

    Hi @ar2015

    Leaving validation to chance isn’t something that BuddyPress does, so you can be sure that it will strive to validate everything that’s necessary. For example, the user’s username and email address are validated by bp_core_validate_user_signup() and the blog URL and title are validated in bp_core_validate_blog_signup()

    Hope this helps point you in the right direction.


    ottolini
    Participant

    @ottolini

    I was able to implement validation, creating a hook on bp_signup_pre_validate, with something like that:

    
    function myplugin_bp_signup_pre_validate() {
      global $bp;
    
      if (!myvalidationfunction($_POST['field_XX'])) {
        $bp->signup->errors['field_XX'] = 'My validation error message';
      }
    }
    
    add_action ('bp_signup_pre_validate', 'myplugin_bp_signup_pre_validate', 20);
    

    Obviously you have to use the correct number for the field(s) you want to validate instead of “XX”: look at the code of the page to identify the correct name of your XProfile field(s).


    Security
    Participant

    @shivam-kumar

    Hi @ar2015
    Actually i wrote a post on this few days back may be you would like to have a look

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘registration validation’ is closed to new replies.
Skip to toolbar