The MU forums have moved to WordPress.org

Agree to terms of service on sign-up? (15 posts)

  1. BernieSteakouse
    Member
    Posted 17 years ago #

    Hello,

    I've seen a few conversations on this subject already, but none seem to either offer a solution or be up to date.

    I'm working on a blog hosting service, and I don't really want to allow sign ups until people must agree to the TOS before signing up, as they do on Wordpress.com (http://wordpress.com/signup/)

    Is there a hack/plugin/some code that people have used to do this, as it seems foolish to allow people to sign up without confirming they've read and agreed your TOS, however casual they may be?

    Thank you!

  2. Ovidiu
    Member
    Posted 17 years ago #

    try this:

    <p>
    <input id="signupblog" type="radio" name="signup_for" value="blog" checked="checked" />
    <label for="signupblog"><?php _e('Gimme a blog!') ?></label>
    <br />
    <input id="signupuser" type="radio" name="signup_for" value="user" />
    <label for="signupuser"><?php _e('Just a username, please.') ?></label>
    <br />
    <input id="ToS"  type="checkbox" name="ToS" value="ToS" onclick= "if (this.checked)
    doit(); else undoit();" />
    <label for="ToS">I have read the <a href="http://zice.ro/imprint/tos/">ToS</a> and
    agree to them</label>
    </p>
    <script type="text/javascript">
    function doit()
    {
    document.getElementById("submit").disabled=false; }
    function undoit()
    {
    document.getElementById("submit").disabled=true; }
    document.getElementById("ToS").checked=false;
    </script>
    </td>
    </tr>
    <tr>
    <th scope="row"  valign="top">&nbsp;</th>
    <td><input id="submit" type="submit" name="submit" class="submit" value="<?php
    _e('Next &raquo;') ?>" DISABLED/></td>
    </tr>
    </table>
    </form>
    <?php
    
    }
    
    function validate_user_signup() {
            $result = validate_user_form();
            extract($result);

    this is the relevant part of wp-signup.php - added a javascript and a checkbox, give it a test as this should work...

  3. BernieSteakouse
    Member
    Posted 17 years ago #

    Thank you, that seems to be just about perfect.

    :)

  4. stgoos
    Member
    Posted 17 years ago #

    Hi, I included this one in my wp-signup.php form which already had the 'create a blog option' only available for logged-in-site-admin's ;)

    Just replace the whole <form>-section with:

    
    <form name="setupform" id="setupform" method="post" action="wp-signup.php">
    <input type="hidden" name="stage" value="validate-user-signup">
    <?php do_action( "signup_hidden_fields" ); ?>
    <table border="0" width="100%" cellpadding="9">
    <?php show_user_form($user_name, $user_email, $errors); ?>
    <th scope="row"  valign="top">�</th>
    <td>
    
    <?php
    if( is_user_logged_in() == true and is_site_admin() == true ) { ?>
    <input id="signupblog" type="radio" name="signup_for" value="blog" checked="checked" />
    <label for="signupblog"><?php _e('Gimme a blog!') ?></label>
    
    <input id="signupuser" type="radio" name="signup_for" value="user" />
    <label for="signupuser"><?php _e('Just a username, please.') ?></label>
    <?php } else { ?>
    <input id="signupuser" type="hidden" name="signup_for" value="user" />
    <input id="ToS"  type="checkbox" name="ToS" value="ToS" onclick="if (this.checked) doit(); else undoit();" />
    <label for="ToS">I have read the '<a href="<?php echo $domain; ?>/imprint/tos/">ToS</a>' and agree to them</label>
    <script type="text/javascript">
    function doit()
    {
    document.getElementById("submit").disabled=false; }
    function undoit()
    {
    document.getElementById("submit").disabled=true; }
    document.getElementById("ToS").checked=false;
    </script>
    <?php
    }
    ?>
    
    </td>
    </tr>
    <tr>
    <th scope="row"  valign="top">�</th>
    <td><input id="submit" type="submit" name="submit" class="submit" value="<?php _e('Next �') ?>"<?php echo ( (is_user_logged_in() == true and is_site_admin() == true) ? "" : " disabled"); ?> /></td>
    </tr>
    </table>
    </form>
    
  5. emgersh
    Member
    Posted 17 years ago #

    Is there any email confirmation that the terms were checked? Do you get a record in any way?

  6. tohave
    Member
    Posted 17 years ago #

    Hi, I tried first one, could not make it work! used second one, works perfectly with 2 question arised in my mind:
    1- How can I remove those squares appear next to the box in sign-up form?
    2- Does it prevent automatic registrations completely?

    cheers

  7. emgersh
    Member
    Posted 17 years ago #

    Well, the checkbox for TOS appears but an account is created regardless of whether or not it's actually checked and there's no confirmation that it was checked. Any ideas on that?

  8. redbox
    Member
    Posted 17 years ago #

    I took the lazy route.

    By clicking the Signup button below, you agree that you have read and agree to the Terms of Service. (terms are linked)

    So if they sign up, then they agree by default.

  9. drmike
    Member
    Posted 17 years ago #

    Pretty much...

  10. usermrpapa
    Member
    Posted 17 years ago #

    The solution posted by Ovidiu does indeed work... what I have seen folks miss is the addition of DISABLED to the submit input statement...

    this works by the next button being disabled until the tos checkbox is selected at which time the next button becomes visible.

  11. worldblogosphere
    Member
    Posted 15 years ago #

    Hi,

    I have put in Ovidiu's code.

    At first I got an "UNEXPECTED $END" error. Which i have found happanes a lot if you miss a } in there somewhere. I couldn't figure out where to put it, so I tried right at the end of the code snippet Ovidiu supplied. That error went away and the page opens and show all that it is supposed.
    Problem is it shows a bit extra. After the Submit button is this text which comes out of the next function in the coding.

    'is your new username
    But, before you can start using your new username, you must activate it.

    Check your inbox at and click the link given.

    If you do not activate your username within two days, you will have to sign up again.'

    Here is the actual code that is in my page right now from the top of Ovidui's snippet to just after. Any ideas how to fix it? You can see the actual page at http://www.worldblogosphere.com/wp-signup.php if it would help to see the problem.

    Thanks,
    Gene

    '<p>
    <input id="signupblog" type="radio" name="signup_for" value="blog" checked="checked" />
    <label for="signupblog"><?php _e('Gimme a blog!') ?></label>

    <input id="signupuser" type="radio" name="signup_for" value="user" />
    <label for="signupuser"><?php _e('Just a username, please.') ?></label>

    <input id="ToS" type="checkbox" name="ToS" value="ToS" onclick= "if (this.checked)
    doit(); else undoit();" />
    <label for="ToS">I have read the ToS and
    agree to them</label>
    </p>
    <script type="text/javascript">
    function doit()
    {
    document.getElementById("submit").disabled=false; }
    function undoit()
    {
    document.getElementById("submit").disabled=true; }
    document.getElementById("ToS").checked=false;
    </script>
    </td>
    </tr>
    <tr>
    <th scope="row" valign="top"> </th>
    <td><input id="submit" type="submit" name="submit" class="submit" value="<?php
    _e('Next »') ?>" DISABLED/></td>
    </tr>
    </table>
    </form>
    <?php

    }

    function validate_user_signup() {
    $result = validate_user_form();
    extract($result);

    } //THIS IS THE CURLY BRACKET I ADDED

    if ( $errors->get_error_code() ) {
    signup_user($user_name, $user_email, $errors);
    return false;
    }

    if ( 'blog' == $_POST['signup_for'] ) {
    signup_blog($user_name, $user_email);
    return false;
    }

    wpmu_signup_user($user_name, $user_email, apply_filters( "add_signup_meta", array() ) );

    confirm_user_signup($user_name, $user_email);
    return true;
    }

    function confirm_user_signup($user_name, $user_email) {
    ?>
    <h2><?php printf(__('%s is your new username'), $user_name) ?></h2>
    <p><?php _e('But, before you can start using your new username, you must activate it.') ?></p>
    <p><?php printf(__('Check your inbox at %1$s and click the link given.'), $user_email) ?></p>
    <p><?php _e('If you do not activate your username within two days, you will have to sign up again.'); ?></p>
    <?php
    do_action('signup_finished');
    }

    function signup_blog($user_name = '', $user_email = '', $blogname = '', $blog_title = '', $errors = '') {
    if ( !is_wp_error($errors) )
    $errors = new WP_Error();'

  12. Ovidiu
    Member
    Posted 15 years ago #

    to be honest that's quite an old hack, and I lack the patience to look through the code.
    besides its a hack you need to apply every time you update your wpmu.

    try this plugin: http://ozblog.com.au/2008/09/20/wordpress-terms-of-use-plugin/

  13. VentureMaker
    Member
    Posted 15 years ago #

    Also you can use a simple plugin from here: http://premium.wpmudev.org/project/terms-of-service

  14. Ovidiu
    Member
    Posted 15 years ago #

    $50 for TOS plugin??? you must be kidding!

    @ Venturemaker: hehehe, you know that's the usual answer when suggesting a premium plugin :-)

  15. VentureMaker
    Member
    Posted 15 years ago #

    LOL :)

About this Topic

  • Started 17 years ago by BernieSteakouse
  • Latest reply from VentureMaker