Changeset 527 for trunk/xpressme_integration_kit
- Timestamp:
- Mar 9, 2010, 8:30:49 AM (15 years ago)
- Location:
- trunk/xpressme_integration_kit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/xpressme_integration_kit/wp-content/plugins/xpressme/include/custom_functions.php
r524 r527 1 1 <?php 2 function xpress_user_access_level(){ 3 global $current_user; 4 5 $level = @$current_user->user_level; 6 $role = @$current_user->roles[0]; 7 switch ($role){ 8 case 'administrator': 9 $role_level = 10; 10 break; 11 case 'editor': 12 $role_level = 7; 13 break; 14 case 'author': 15 $role_level = 2; 16 break; 17 case 'contributor': 18 $role_level = 1; 19 break; 20 default: 21 $role_level = 0; 22 } 23 24 if ($level > $role_level){ 25 return $level; 26 } else { 27 return $role_level; 28 } 29 } 30 31 32 2 33 function xpress_is_contributor() 3 34 { 4 35 global $current_user; 5 36 get_currentuserinfo(); 6 if ( $current_user->user_level> 3)37 if (xpress_user_access_level() > 3) 7 38 return true; 8 39 else … … 21 52 if (defined('MULTISITE')) return MULTISITE; 22 53 return $xoops_config->multiblog; 54 } 55 56 function xpress_is_multiblog_root() { 57 global $blog_id; 58 if (defined('MULTISITE') && MULTISITE && $blog_id == 1){ 59 return true; 60 } else { 61 return false; 62 } 23 63 } 24 64 … … 143 183 extract( $r ); 144 184 145 $output = @$current_user->user_level;185 $output = xpress_user_access_level(); 146 186 if ($echo) 147 187 echo $output; -
trunk/xpressme_integration_kit/xoops_version.php
r522 r527 20 20 } 21 21 22 if (!function_exists('mod_access_level')){ 23 function mod_access_level(){ 24 global $current_user; 25 26 $level = @$current_user->user_level; 27 $role = @$current_user->roles[0]; 28 switch ($role){ 29 case 'administrator': 30 $role_level = 10; 31 break; 32 case 'editor': 33 $role_level = 7; 34 break; 35 case 'author': 36 $role_level = 2; 37 break; 38 case 'contributor': 39 $role_level = 1; 40 break; 41 default: 42 $role_level = 0; 43 } 44 45 if ($level > $role_level){ 46 return $level; 47 } else { 48 return $role_level; 49 } 50 } 51 } 52 22 53 $mydirpath = dirname(__FILE__); 23 54 $mydirname = basename($mydirpath); … … 71 102 */ 72 103 73 104 74 105 // Search 75 106 $modversion['hasSearch'] = 1 ; … … 94 125 if(is_object($GLOBALS["xoopsUser"])){ 95 126 global $current_user , $xoops_config; 96 if ( @$current_user->user_level> 0) {127 if (mod_access_level() > 0) { 97 128 $modversion['sub'][1]['name'] = constant( '_MI_XP2_MENU_POST_NEW'); 98 129 if (wp_version_compare($wp_version, '>=','2.1')) … … 105 136 $modversion['sub'][3]['url'] = $add_url . "wp-admin/"; 106 137 } 107 if ( @$current_user->user_level> 9) {138 if (mod_access_level() > 9) { 108 139 $modversion['sub'][4]['name'] = constant( '_MI_XP2_MENU_XPRESS'); 109 140 $modversion['sub'][4]['url'] = $add_url . "wp-admin/admin.php?page=xpressme" . DIRECTORY_SEPARATOR . "xpressme.php";
Note: See TracChangeset
for help on using the changeset viewer.