Changeset 504

Show
Ignore:
Timestamp:
08/15/06 20:09:50 (2 years ago)
Author:
ben
Message:

For testing or resource management purposes, admins can now cap the number of users in their installation.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • devel/config-dist.php

    r492 r504  
    4242 
    4343    $CFG->publicinvite = true; 
     44 
     45// Set this to a positive number to cap the number of users in your 
     46// installation, for example if you're testing and only have a certain number 
     47// of resources available to you. 
     48 
     49    $CFG->maxusers = 0; 
    4450 
    4551// Set this to 1 to enable a walled garden - i.e., if you're not logged in, 
  • devel/lib/displaylib.php

    r457 r504  
    173173 
    174174    global $page_owner; 
     175     
     176    global $CFG; 
    175177         
    176178    // If this is someone else's portfolio, display the user's icon 
     
    183185        $body = '<form action="'.url.'login/index.php" method="post">'; 
    184186 
    185         if (public_reg == true) { 
     187        if (public_reg == true && ($CFG->maxusers == 0 || (count_users('person') < $CFG->maxusers))) { 
    186188            $reg_link = '<a href="' . url . '_invite/register.php">'. gettext("Register") .'</a> |'; 
    187189        } else { 
  • devel/mod/friend/lib.php

    r499 r504  
    4747                                                              gettext("Access controls"))); 
    4848 
    49                 if ($CFG->publicinvite == true) { 
     49                if ($CFG->publicinvite == true && ($CFG->maxusers == 0 || (count_users('person') < $CFG->maxusers))) { 
    5050                    $PAGE->menu_sub[] = array( 'name' => 'friend:invite', 
    5151                                               'html' => a_href( "{$CFG->wwwroot}_invite/", 
  • devel/sanitychecks.php

    r483 r504  
    3838    if (!isset($CFG->emailfilter)) { 
    3939        $CFG->emailfilter = ""; 
     40    } 
     41    if (!isset($CFG->maxusers)) { 
     42        $CFG->maxusers = 0; 
    4043    } 
    4144    if (!isset($CFG->walledgarden)) { 
  • devel/units/display/function_log_on_pane.php

    r473 r504  
    1313        $body .= '<form action="'.url.'login/index.php" method="post">'; 
    1414 
    15         if (public_reg == true) { 
     15        if (public_reg == true && ($CFG->maxusers == 0 || (count_users('person') < $CFG->maxusers))) { 
    1616            $reg_link = '<a href="' . url . '_invite/register.php">'. gettext("Register") .'</a> |'; 
    1717        } else { 
  • devel/units/invite/invite_actions.php

    r481 r504  
    1919         $invite->email = trim(optional_param('invite_email')); 
    2020         if (!empty($invite->name) && !empty($invite->email)) { 
    21              if (logged_on || $CFG->publicinvite == true) { 
     21             if (logged_on || ($CFG->publicinvite == true)) { 
     22                 if (($CFG->maxusers == 0 || (count_users('person') < $CFG->maxusers))) { 
    2223                 if (validate_email(stripslashes($invite->email))) { 
    2324                     $strippedname = stripslashes($invite->name); // for the message text. 
     
    6061                 } 
    6162             } else { 
     63                 $messages[] = gettext("Error: This community has reached its maximum number of users."); 
     64             } 
     65             } else { 
     66                 $messages[] = gettext("Invitation failed: you are not logged in."); 
     67             } 
     68         } else { 
    6269                 $messages[] = gettext("Invitation failed: you must specify both a name and an email address."); 
    63              } 
    6470         } 
    6571         break; 
     
    7379         $password2 = trim(optional_param('join_password2')); 
    7480         if (isset($name) && isset($code)) { 
     81             if (($CFG->maxusers == 0 || (count_users('person') < $CFG->maxusers))) { 
     82                 $messages[] = gettext("Unfortunately this community has reached its account limit and you are unable to join at this time."); 
     83             } 
    7584             if (empty($over13)) { 
    7685                 $messages[] = gettext("You must indicate that you are at least 13 years old to join.");