Skip to:
Content
Pages
Categories
Search
Top
Bottom

Creating TOS hurdles

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

  • modemlooper
    Moderator

    @modemlooper

    The second choice, I think, is your easiest option.


    Boris
    Participant

    @travel-junkie

    Or use something like this:

    /**
    * Add custom userdata from register.php
    */
    function tj_add_to_signup( $usermeta )
    {
    $usermeta['accept_tos'] = $_POST['accept_tos'];

    return $usermeta;
    }
    add_filter( 'bp_signup_usermeta', 'tj_add_to_signup' );

    /**
    * Update usermeta with custom registration data
    */
    function tj_user_activate_fields( $user )
    {
    update_usermeta( $user['user_id'], 'accept_tos', $user['meta']['accept_tos'] );

    return $user;
    }
    add_filter( 'bp_core_activate_account', 'tj_user_activate_fields' );

    /**
    * Perform checks for custom registration data
    */
    function tj_check_additional_signup()
    {
    global $bp;

    if( $_POST['accept_tos'] != 'agreed' )
    $bp->signup->errors['accept_tos'] = __( 'Please make sure to read our Terms of Service and then check this box!', 'traveljunkie' );
    }
    add_action( 'bp_signup_validate', 'tj_check_additional_signup' );

    /**
    * Add newsletter and TOS to register page
    */
    function tj_add_to_registration()
    {
    ?>
    <div id="tos" class="register-section">
    <?php do_action( 'bp_accept_tos_errors' ) ?>
    <label><input type="checkbox" name="accept_tos" id="accept_tos" value="agreed" /> <?php _e( 'Check this box to accept our <a href="/terms-of-service" target="_blank">Terms Of Service</a> (required)', 'traveljunkie' ) ?></label>
    </div>
    <?php
    }
    add_action( 'bp_before_registration_submit_buttons', 'tj_add_to_registration' );

    You’d have to adjust the links and some other stuff slightly, though. Put this in your (child-)themes functions.php file. I use the above for all kinds of stuff, like newsletter signup. You could add the quiz stuff then with a bit of jQuery.


    mrjarbenne
    Participant

    @mrjarbenne

    That’s beautiful. Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Creating TOS hurdles’ is closed to new replies.
Skip to toolbar