Skip to:
Content
Pages
Categories
Search
Top
Bottom

Creating TOS hurdles

  • Avatar of mrjarbenne
    mrjarbenne
    Participant

    @mrjarbenne

    Wondering if there is a plugin for this, or for advice on how easily it might be put into play. After users activate their accounts, and work through entering all of the required Profile fields, I want to take them through a series of (five or six) statements/terms of service, that would appear in sequence before the user is able to move forward.

    A bit of background. I’m using BP in an elementary school, and I’m getting ready to invite some other schools into the fray, so I won’t be in the classroom to direct appropriate use, and I’m tired of the garbage that new users spew on the activity stream before they take a moment to recognize the mood/climate of the network. I want them to do a bit of a “quiz” to ensure that they understand what is expected on the site. Remember that these are 9 and 10 year olds, so to kick and ban doesn’t provide that “teachable moment” I’m looking for.

    Is there a way to do this, or should I just add required Profile Fields, then use the BP Profile Privacy plugin to set these fields as only available to be viewed by the admin.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Avatar of @modemlooper
    @modemlooper
    Moderator

    @modemlooper

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

    Avatar of Travel-Junkie
    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.

    Avatar of mrjarbenne
    mrjarbenne
    Participant

    @mrjarbenne

    That’s beautiful. Thanks.

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

You must be logged in to reply to this topic.