Changeset 253

Show
Ignore:
Timestamp:
03/07/08 19:30:30 (9 months ago)
Author:
kevin
Message:

Added support for form module and fixed some PHP notices

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • regext/README.txt

    r236 r253  
    5757etc. 
    5858 
     59*Integration with form module* 
     60 
     61To take the title and description for the join and registration forms from those 
     62defined using the form module, as well as the registration form response text, define: 
     63 
     64define('INVITE_USE_FORM_MODULE',true); 
     65 
     66in invite_config.php 
     67 
     68See the form module README for more information. 
     69 
    5970*Moderated registration* 
    6071 
  • regext/invite_actions.php

    r222 r253  
    192192                 } else {                      
    193193                    regext_setup_user($u,$owner,'',false,$displaypassword); 
    194                     $_SESSION['messages'][] = __gettext("Your account was created! You can now log in using the username and password you supplied. "); 
    195                     if (INVITE_MAIL_CLEAR_PASSWORD) { 
    196                         $_SESSION['messages'][] = __gettext("You have been sent an email containing these details for reference purposes.");    
     194                    if (defined("INVITE_USE_FORM_MODULE") && INVITE_USE_FORM_MODULE  
     195                        && $reg_response = get_field('forms','response_text','name','registration')) { 
     196                        $_SESSION['messages'][] = $reg_response; 
     197                    } else { 
     198                        $_SESSION['messages'][] = __gettext("Your account was created! You can now log in using the username and password you supplied. "); 
     199                        if (INVITE_MAIL_CLEAR_PASSWORD) { 
     200                            $_SESSION['messages'][] = __gettext("You have been sent an email containing these details for reference purposes.");    
     201                        } 
    197202                    } 
    198203                 } 
  • regext/invite_join.php

    r222 r253  
    11<?php 
    22 
    3 global $CFG, $metatags
     3global $CFG, $metatags, $title
    44// Join 
    55 
    66require_once($CFG->dirroot.'mod/profile/profile.config.php'); 
    7 $problem_fields = $_SESSION['problem_fields']; 
    8 unset($_SESSION['problem_fields']); 
     7 
     8if ($_SESSION['problem_fields']) { 
     9    $problem_fields = $_SESSION['problem_fields']; 
     10    unset($_SESSION['problem_fields']); 
     11
    912 
    1013$profiledetails = optional_param('profiledetails'); 
     
    4649            $username = preg_replace("/[^A-Za-z]/","",$username); 
    4750        } 
    48  
    49     if(array_key_exists("invite:join:welcome",$function)){ 
     51         
     52    if (defined("INVITE_USE_FORM_MODULE") && INVITE_USE_FORM_MODULE && $reg_description = get_field('forms','description','name','registration')) { 
     53        $run_result .= $reg_description; 
     54        $title = get_field('forms','title','name','registration'); 
     55    } else if(array_key_exists("invite:join:welcome",$function)){ 
    5056      $run_result.=run("invite:join:welcome"); 
    5157    } 
     
    9096         
    9197        foreach($data['profile:details'] as $field) { 
    92                 if (!is_array($field) && $field->registration) { 
     98                if (!is_array($field) && isset($field->registration) && $field->registration) { 
    9399                        if (empty($field->user_type) || $field->user_type == '' || $field->user_type == 'person') { 
    94100                                $registration_fields[] = $field; 
     
    138144                    $ftype = "text"; 
    139145                } 
    140                 $column1 = display_input_field(array("profiledetails[" . $fname . "]",$value->value,$ftype,$fname,@$value->ident,$page_owner)); 
     146                $column1 = display_input_field(array("profiledetails[" . $fname . "]",$value->value,$ftype,$fname,@$value->ident,page_owner())); 
    141147                 
    142148                $run_result .= templates_draw(array( 
  • regext/lib.php

    r222 r253  
    1010        $function['invite:init'] = array($CFG->dirroot . "mod/invite/lib/invite_config.php",$CFG->dirroot . "mod/regext/invite_actions.php"); 
    1111        $function['invite:join'] = array($CFG->dirroot . "mod/regext/invite_join.php"); 
     12        $function['invite:register:welcome'] = array($CFG->dirroot . "mod/regext/invite_register_welcome.php"); 
    1213} 
    1314