id,$atts) == 1) { return $content; } else { return ""; } } function ums_permission($atts) { extract(shortcode_atts(array(),$atts)); global $wpdb; $current_user = wp_get_current_user(); if (usm_HasAccess($current_user->id,$atts) == 0) { die("You do not have access to this page"); } } function usm_HasAccess($id,$atts) { global $wpdb; $current_user = wp_get_current_user(); $foundmatch = 0; foreach ($atts as $element) { $splitIt = strrpos($element,":"); $length = strlen($element); $partA = substr($element,0,$splitIt); $partB = substr($element,$splitIt,$length-$splitIt); if (strlen($partA)==0) { $partA = $partB; $partB= "usm_xxxxx"; } $myquery = "SELECT * FROM wp_usermeta where user_id = ".$id." and meta_key = '".$partA."'"; $myrows = $wpdb->get_results( $myquery ); if (count($myrows) > 0) { if ($partB == "usm_xxxxx" ) { $foundmatch=1; } else { $partB = substr($partB,1,strlen($partB)); foreach ($myrows as $myrow) { if ($myrow->meta_value == $partB ) { $foundmatch = 1; } } } } } $retValue = false; if ($foundmatch == 1){$retValue = true;} return $retValue; } function mtw_print_r($myArray) { //echo "
"; //print_r($myArray); //echo ""; } /* function my_plugin_options() { echo '