Collections functions
General functions
Node functions
Render functions
Theme permission functions
User functions
Resource functions

can_edit_tile()

Description

Check if current user can edit dash tile. Users shouldn't be able to edit tiles that they can't view and only dash admins should be able to edit shared tiles.

Parameters

ColumnTypeDefaultDescription
$tileref int
$audience int 0 for tile available to one user, 1 for all users. Typically obtained from get_tile()
$user int Ref of the user editing the tile.
$usertile int Ref of the tile being edited. Typically obtained from get_tile()

Return

bool Will return true if editing is allowed else will return false.

Location

include/dash_functions.php lines 2177 to 2191

Definition

 
function can_edit_tile(int $tilerefint $audienceint $user)
    {
    if (
$audience === 0)
        {
        
// User is trying to edit a tile visible to only them.
        
$result ps_query("SELECT ref, user, dash_tile, order_by FROM user_dash_tile WHERE dash_tile = ? AND user = ?", ['i'$tileref'i'$user]);
        return isset(
$result[0]);
        }
    else
        {
        
// Tile is available to all users so editable only to dash admin users.
        // This includes tiles available to a specified group.
        
return checkPermission_dashadmin();
        }
    }

This article was last updated 27th April 2024 12:35 Europe/London time based on the source file dated 25th April 2024 16:15 Europe/London time.