Changeset 979

Show
Ignore:
Timestamp:
02/17/07 16:34:41 (2 years ago)
Author:
sven
Message:

hide public comments user option if they're globally disabled

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • devel/units/users/userdetails_edit.php

    r751 r979  
    11<?php 
    22 
    3     global $page_owner, $CFG; 
    4      
    5     if (user_type($page_owner) == 'person' && run("permissions:check",array("userdetails:change", $page_owner))) { 
    6      
    7         $info = get_record('users','ident',$page_owner); 
    8         $name = htmlspecialchars(stripslashes($info->name), ENT_COMPAT, 'utf-8'); 
    9         $email = htmlspecialchars(stripslashes($info->email), ENT_COMPAT, 'utf-8'); 
     3global $page_owner, $CFG; 
     4 
     5if (user_type($page_owner) == 'person' && run("permissions:check",array("userdetails:change", $page_owner))) { 
     6     
     7    $info = get_record('users','ident',$page_owner); 
     8    $name = htmlspecialchars(stripslashes($info->name), ENT_COMPAT, 'utf-8'); 
     9    $email = htmlspecialchars(stripslashes($info->email), ENT_COMPAT, 'utf-8'); 
    1010     
    1111    $changeName = __gettext("Change your full name:"); // gettext variable 
     
    3434    $emailRules = __gettext("This will not be displayed to other users; you can choose to make an email address available via the profile screen."); // gettext variable 
    3535    $body .= <<< END 
    36              
     36     
    3737    <h2> 
    3838        $emailAddress 
     
    5151        ); 
    5252 
    53         $friendAddress = __gettext("Friendship moderation:"); // gettext variable 
    54         $friendRules = __gettext("This allows you to choose who can list you as a friend."); // gettext variable 
    55         $body .= <<< END 
    56                  
     53    $friendAddress = __gettext("Friendship moderation:"); // gettext variable 
     54    $friendRules = __gettext("This allows you to choose who can list you as a friend."); // gettext variable 
     55    $body .= <<< END 
     56         
    5757        <h2> 
    5858            $friendAddress 
     
    6464END; 
    6565 
    66         $friendlevel = "<select name=\"moderation\">"; 
    67         $friendlevel .= "<option value=\"no\" "; 
    68         if ($info->moderation == "no") { 
    69             $friendlevel .= "selected=\"selected\""; 
    70        
    71         $friendlevel .= ">" . __gettext("No moderation: anyone can list you as a friend. (Recommended)") . "</option>"; 
    72         $friendlevel .= "<option value=\"yes\" "; 
    73         if ($info->moderation == "yes") { 
    74             $friendlevel .= "selected=\"selected\""; 
    75        
    76         $friendlevel .= ">" . __gettext("Moderation: friendships must be approved by you.") . "</option>"; 
    77         $friendlevel .= "<option value=\"priv\" "; 
    78         if ($info->moderation == "priv") { 
    79             $friendlevel .= "selected=\"selected\""; 
    80        
    81         $friendlevel .= ">" . __gettext("Private: nobody can list you as a friend.") . "</option>"; 
    82         $friendlevel .= "</select>"; 
    83      
    84         $body .= templates_draw(array( 
     66    $friendlevel = "<select name=\"moderation\">"; 
     67    $friendlevel .= "<option value=\"no\" "; 
     68    if ($info->moderation == "no") { 
     69        $friendlevel .= "selected=\"selected\""; 
     70   
     71    $friendlevel .= ">" . __gettext("No moderation: anyone can list you as a friend. (Recommended)") . "</option>"; 
     72    $friendlevel .= "<option value=\"yes\" "; 
     73    if ($info->moderation == "yes") { 
     74        $friendlevel .= "selected=\"selected\""; 
     75   
     76    $friendlevel .= ">" . __gettext("Moderation: friendships must be approved by you.") . "</option>"; 
     77    $friendlevel .= "<option value=\"priv\" "; 
     78    if ($info->moderation == "priv") { 
     79        $friendlevel .= "selected=\"selected\""; 
     80   
     81    $friendlevel .= ">" . __gettext("Private: nobody can list you as a friend.") . "</option>"; 
     82    $friendlevel .= "</select>"; 
     83     
     84    $body .= templates_draw(array( 
    8585            'context' => 'databox', 
    8686            'name' => __gettext("Friendship moderation"), 
     
    8888            ) 
    8989            ); 
    90          
     90     
     91    if (!$CFG->disable_publiccomments) { 
    9192        $emailReplies = __gettext("Make comments public"); 
    9293        $emailRules = __gettext("Set this to 'yes' if you would like anyone to be able to comment on your resources (by default only logged-in users can). Note that this may make you vulnerable to spam."); 
     
    101102END; 
    102103 
    103     if (!$CFG->disable_publiccomments) { 
    104104        $publiccomments = user_flag_get("publiccomments",$page_owner); 
    105105        if ($publiccomments) { 
     
    119119        } 
    120120    } 
    121          
     121     
    122122    $emailReplies = __gettext("Receive email notifications"); 
    123         $emailRules = __gettext("Set this to 'yes' if you would like to receive email copies of any messages you receive. This includes blog comments, notifications when people add you as a friend and more. You can always view these online as part of your recent activity page."); 
    124          
    125         $body .= <<< END 
     123    $emailRules = __gettext("Set this to 'yes' if you would like to receive email copies of any messages you receive. This includes blog comments, notifications when people add you as a friend and more. You can always view these online as part of your recent activity page."); 
     124     
     125    $body .= <<< END 
    126126         
    127127        <h2>$emailReplies</h2> 
     
    148148        ); 
    149149    } 
    150          
     150     
    151151    $password = __gettext("Change your password:"); // gettext variable 
    152152    $passwordRules = __gettext("Leave this blank if you're happy to leave your password as it is."); // gettext variable 
    153153    $body .= <<< END 
    154          
     154     
    155155    <h2> 
    156156        $password 
     
    177177     
    178178    // Allow plug-ins to add stuff ... 
    179         $body .= run("userdetails:edit:details"); 
    180  
    181         $id = $page_owner; 
    182  
    183         $save = __gettext("Save"); 
    184          
    185         $body .= <<< END 
    186          
     179    $body .= run("userdetails:edit:details"); 
     180 
     181    $id = $page_owner; 
     182 
     183    $save = __gettext("Save"); 
     184     
     185    $body .= <<< END 
     186     
    187187    <p align="center"> 
    188188        <input type="hidden" name="action" value="userdetails:update" /> 
     
    190190        <input type="hidden" name="profile_id" value="$page_owner" /> 
    191191END; 
    192         if (context == "admin") { 
    193             $body .= '<input type="hidden" name="context" value="admin" />'; 
    194        
    195         $body .= <<< END 
     192    if (context == "admin") { 
     193        $body .= '<input type="hidden" name="context" value="admin" />'; 
     194   
     195    $body .= <<< END 
    196196        <input type="submit" value="$save" /> 
    197197    </p> 
     
    202202 
    203203    $run_result .= $body; 
    204    
     204
    205205 
    206206?>