--- userpoints_role.module	2008-02-15 18:18:00.000000000 -0800
+++ userpoints_roleNew.module	2008-02-15 18:17:46.000000000 -0800
@@ -163,4 +163,28 @@ function _userpoints_load_role_points() 
     }
   }
   return $role_points;
-}
\ No newline at end of file
+}
+
+
+/**
+ * Public function to return the name of the highest
+ * role a user has reached.
+ *
+ * @param $userpoints
+ *	current points for user
+ *
+ * @return 
+ *	name of their role
+ *
+ */
+function userpoints_user_highest_role($userpoints){
+	$role_points = _userpoints_load_role_points();
+	$roles_within = array();
+	foreach($role_points as $role_point) {
+		//put all the roles user is within into an array.
+		if ($userpoints > $role_point['points']){
+			$roles_within[ $role_point['points'] ] = $role_point['name'];
+		}
+  }
+	echo max($roles_within);
+}
