Changeset 888

Show
Ignore:
Timestamp:
01/29/07 16:44:49 (2 years ago)
Author:
ben
Message:

You can now lock down community creation to be linked to a user flag of your choice.

Files:

Legend:

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

    r836 r888  
    121121 
    122122    $CFG->rsspostsmaxage = 0; 
     123 
     124// Set this to 'admin' to only allow administrators to create new communities. 
     125// You can set this to other user flags if you're told to by a plugin. 
     126 
     127    $CFG->community_create_flag = ""; 
    123128 
    124129// 
  • devel/lib/setup.php

    r834 r888  
    6868if (empty($CFG->disable_publiccomments)) { 
    6969    $CFG->disable_publiccomments = false; 
     70} 
     71 
     72if (empty($CFG->community_create_flag)) { 
     73    $CFG->community_create_flag = ""; 
    7074} 
    7175 
  • devel/mod/community/lib.php

    r782 r888  
    66    global $PAGE; 
    77    global $CFG; 
     8    global $USER; 
    89 
    910    $page_owner = $profile_id; 
     
    5253                                       'html' => a_href("{$CFG->wwwroot}_communities/?owner=$page_owner" , 
    5354                                                          __gettext("Communities")));  
    54                              
     55            if ($CFG->community_create_flag == "" || user_flag_get($CFG->community_create_flag, $USER->ident)) { 
    5556            $PAGE->menu_sub[] = array( 'name' => 'community:owned', 
    5657                                       'html' => a_href("{$CFG->wwwroot}_communities/owned.php?owner=$page_owner" , 
    5758                                                          __gettext("Owned Communities"))); 
    58  
     59            } 
    5960        } 
    6061         
  • devel/units/communities/communities_actions.php

    r659 r888  
    1616        $comm_name = optional_param('comm_name'); 
    1717        $comm_username = optional_param('comm_username'); 
    18         if (logged_on && !empty($comm_name) && !empty($comm_username)) { 
     18        if (logged_on && !empty($comm_name) && !empty($comm_username) && 
     19            ($CFG->community_create_flag == "" || user_flag_get($CFG->community_create_flag, $USER->ident))) { 
    1920            if (!preg_match("/^[A-Za-z0-9]{3,12}$/",$comm_username)) { 
    2021                $messages[] = __gettext("Error! The community username must contain letters and numbers only, cannot be blank, and must be between 3 and 12 characters in length."); 
  • devel/units/communities/communities_create.php

    r659 r888  
    1010    } 
    1111 
    12     global $page_owner
     12    global $page_owner, $CFG, $USER
    1313     
    14     if (logged_on && $page_owner == $_SESSION['userid']) { 
     14    if (logged_on && $page_owner == $_SESSION['userid'] && 
     15        ($CFG->community_create_flag == "" || user_flag_get($CFG->community_create_flag, $USER->ident))) { 
    1516     
    1617    $header = __gettext("Create a new community"); // gettext variable