Userpoints: Showing points block only to users with a minimum threshold

A support question came up where someone is running a site that has the userpoints module on it, and wanted to show certain blocks, only if the user has a certain number of points.

Here is the code to do this:

For the block(s) you want to show/hide, select the option that says:

Show if the following PHP code returns TRUE (PHP-mode, experts only).

Then enter the following code snippet:

<?php

global $user;

$ret = FALSE;

if ($user->uid) {
$points = userpoints_get_current_points($user->uid);
if ($points >= 400) {
$ret = TRUE;
}
}

return $ret;
?>

This will only show the block if the user has 400 points or more.

Contents: