Changeset 1229


Ignore:
Timestamp:
02/23/10 17:16:09 (3 years ago)
Author:
nick_ramsay
Message:

[Branch 1.2] Users 1.3 - Fix for profile refresh bug, mail sent through Email class, instructions added to Account update form, and user tabs hidden from those without permission to see it.

Location:
branches/1.2/content/plugins/users
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2/content/plugins/users/languages/users_language.php

    r1182 r1229  
    6464$lang["users_account_deleted"] = "User Deleted"; 
    6565$lang["users_account_admin_admin"] = "Sorry, only admins can access admin accounts."; 
     66$lang["users_account_username_requirements"] = "At least 4 characters, using only letters, dashes and underscores"; 
     67$lang["users_account_password_requirements"] = "At least 8 characters, using only letters, numbers and these symbols: ! @ * # - _"; 
    6668// Other language is used in content/language_packs/language_default/admin_language 
    6769 
  • branches/1.2/content/plugins/users/libs/UserFunctions.php

    r1202 r1229  
    124124            $headers = "From: " . SITE_EMAIL . "\r\nReply-To: " . SITE_EMAIL . "\r\nX-Priority: 3\r\n"; 
    125125         
    126             mail($to, $subject, $body, $headers); 
     126            $h->email($to, $subject, $body, $headers); 
    127127        } 
    128128         
  • branches/1.2/content/plugins/users/readme.txt

    r1180 r1229  
    1414Changelog 
    1515--------- 
     16v.1.3 2010/02/23 - Nick - Fix for profile refresh bug, mail sent through Email class, instructions added to Account update form. 
    1617v.1.2 2010/02/20 - Nick - Meta tags generated from user details and profile 
    1718v.1.1 2009/12/22 - Nick - Updated for compatibility with Hotaru 1.0 
  • branches/1.2/content/plugins/users/templates/users_account.php

    r980 r1229  
    3838    <table> 
    3939    <tr><td><?php echo $h->lang["users_account_username"]; ?>&nbsp; </td><td><input type='text' size=30 name='username' value='<?php echo $username; ?>' /></td></tr> 
     40    <tr><td colspan='2'><small><?php echo $h->lang["users_account_username_requirements"]; ?></small></td></tr> 
    4041    <tr><td><?php echo $h->lang["users_account_email"]; ?>&nbsp; </td><td><input type='text' size=30 name='email' value='<?php echo $email_check; ?>' /></td></tr> 
    4142    <?php  
     
    8182        <form name='update_form' class='users_form' action='<?php echo BASEURL; ?>index.php' method='post'> 
    8283        <table> 
     84        <tr><td colspan='2'><small><?php echo $h->lang["users_account_password_requirements"]; ?></small></td></tr> 
    8385        <tr><td><?php echo $h->lang["users_account_old_password"]; ?>&nbsp; </td><td><input type='password' size=30 name='password_old' value='<?php echo $password_check_old; ?>' /></td></tr> 
    8486        <tr><td><?php echo $h->lang["users_account_new_password"]; ?>&nbsp; </td><td><input type='password' size=30 name='password_new' value='<?php echo $password_check_new; ?>' /></td></tr> 
  • branches/1.2/content/plugins/users/templates/users_tabs.php

    r1107 r1229  
    2727?> 
    2828 
    29 <ul class='user_tabs'> 
    30  
    31 <li><?php echo $h->lang["users_edit"]; ?>  
    32     <a href='<?php echo $h->url(array('user'=>$username)); ?>'><?php echo $username; ?></a>: 
    33 </li> 
    34  
    3529<?php // show account and profile links to owner or admin access users:  
    3630    if (($h->currentUser->name == $username) || ($h->currentUser->getPermission('can_access_admin') == 'yes')) { ?> 
     31     
     32    <ul class='user_tabs'> 
     33     
     34    <li><?php echo $h->lang["users_edit"]; ?>  
     35        <a href='<?php echo $h->url(array('user'=>$username)); ?>'><?php echo $username; ?></a>: 
     36    </li> 
     37     
    3738    <li><a href='<?php echo $h->url(array('page'=>'account', 'user'=>$username)); ?>'><?php echo $h->lang["users_account"]; ?></a></li> 
    3839    <li><a href='<?php echo $h->url(array('page'=>'edit-profile', 'user'=>$username)); ?>'><?php echo $h->lang["users_profile"]; ?></a></li> 
    3940    <li><a href='<?php echo $h->url(array('page'=>'user-settings', 'user'=>$username)); ?>'><?php echo $h->lang["users_settings"]; ?></a></li> 
    40 <?php } ?> 
    4141 
    42 <?php // show permissions and User Manager links admin access users only:  
    43     if ($h->currentUser->getPermission('can_access_admin') == 'yes') { ?> 
    44     <li><a href='<?php echo $h->url(array('page'=>'permissions', 'user'=>$username)); ?>'><?php echo $h->lang["users_permissions"]; ?></a></li> 
    45  
    46     <?php // show User Manager link only if theplugin is active 
    47         if ($h->isActive('user_manager')) { ?> 
    48         <li><a href="<?php echo BASEURL; ?>admin_index.php?search_value=<?php echo $username; ?>&amp;plugin=user_manager&amp;page=plugin_settings&amp;type=search"><?php echo $h->lang['user_man_link']; ?></a></li> 
     42    <?php // show permissions and User Manager links admin access users only:  
     43        if ($h->currentUser->getPermission('can_access_admin') == 'yes') { ?> 
     44        <li><a href='<?php echo $h->url(array('page'=>'permissions', 'user'=>$username)); ?>'><?php echo $h->lang["users_permissions"]; ?></a></li> 
     45     
     46        <?php // show User Manager link only if theplugin is active 
     47            if ($h->isActive('user_manager')) { ?> 
     48            <li><a href="<?php echo BASEURL; ?>admin_index.php?search_value=<?php echo $username; ?>&amp;plugin=user_manager&amp;page=plugin_settings&amp;type=search"><?php echo $h->lang['user_man_link']; ?></a></li> 
     49        <?php } ?> 
     50         
    4951    <?php } ?> 
    5052     
     53    </ul> 
     54 
    5155<?php } ?> 
    52  
    53 </ul> 
    54  
  • branches/1.2/content/plugins/users/users.php

    r1189 r1229  
    33 * name: Users 
    44 * description: Provides profile, settings and permission pages 
    5  * version: 1.2 
     5 * version: 1.3 
    66 * folder: users 
    77 * type: users 
     
    285285        $h->vars['user']->saveProfileSettingsData($h, $profile, 'user_profile', $h->vars['user']->id); 
    286286         
     287        /*  Problem! The previous profile data is cached and we don't want to disable caching for profiles,  
     288            nor do we want to clear the entire db_cache, so instead, we'll delete the cache file that holds 
     289            the previous profile for this user. */ 
     290        $sql = "SELECT usermeta_value FROM " . DB_PREFIX . "usermeta WHERE usermeta_userid = %d AND usermeta_key = %s"; 
     291        $query = $h->db->prepare($sql, $h->vars['user']->id, 'user_profile'); 
     292        $cache_file = CACHE . 'db_cache/' . md5($query); 
     293        if (file_exists($cache_file)) { 
     294            unlink($cache_file); // delete cache file. 
     295        } 
     296         
    287297        $h->message = $h->lang["users_profile_edit_saved"] . "<br />\n"; 
    288298        $h->message .= "<a href='" . $h->url(array('user'=>$h->vars['user']->name)) . "'>"; 
     
    308318         
    309319        $h->vars['user']->saveProfileSettingsData($h, $settings, 'user_settings', $h->vars['user']->id); 
     320         
     321        /*  Problem! The previous settings data is cached and we don't want to disable caching for settings,  
     322            nor do we want to clear the entire db_cache, so instead, we'll delete the cache file that holds 
     323            the previous settings for this user. */ 
     324        $sql = "SELECT usermeta_value FROM " . DB_PREFIX . "usermeta WHERE usermeta_userid = %d AND usermeta_key = %s"; 
     325        $query = $h->db->prepare($sql, $h->vars['user']->id, 'user_settings'); 
     326        $cache_file = CACHE . 'db_cache/' . md5($query); 
     327        if (file_exists($cache_file)) { 
     328            unlink($cache_file); // delete cache file. 
     329        } 
    310330         
    311331        $h->message = $h->lang["users_settings_saved"] . "<br />\n"; 
Note: See TracChangeset for help on using the changeset viewer.