Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test functions

check_order_by_in_table_joins()

Description

If a "fieldX" order_by is used, check it's a valid value.
Where the value is invalid, the default 'resourceid' will be used instead.

Parameters

ColumnTypeDefaultDescription
string { $order_by:
0
5
get_resource_table_joins
Order string by string e.g. field8

Return

string Order by string if valid else default 'resourceid'

Location

include/search_functions.php lines 3060 to 3069

Definition

 
function check_order_by_in_table_joins($order_by): string
{
    if (
substr($order_by05) == "field" && !in_array(substr($order_by5), get_resource_table_joins())) {
        global 
$userref;
        
debug("Userref $userref requested invalid order_by $order_by - using default: resourceid - check config and user preferences.");
        return 
'resourceid';
    }

    return 
$order_by;
}

This article was last updated 26th October 2025 19:05 Europe/London time based on the source file dated 24th October 2025 09:15 Europe/London time.