Collections functions
General functions
Render functions
Theme permission functions
Resource functions

comments_tags_to_links()

Description

Parse a comment and replace and add links to any user, resource and collection tags

Parameters

ColumnTypeDefaultDescription
$text string The input text e.g. the body of the comment

Return

void

Location

include/comment_functions.php lines 185 to 196

Definition

 
function comments_tags_to_links($text)
    {
    global 
$baseurl_short;
    
$text=preg_replace('/@(\S+)/s''<a href="[BASEURLSHORT]pages/user/user_profile.php?username=$1">@$1</a>'$text);

    
$text=preg_replace('/r([0-9]{1,})/si''<a href="[BASEURLSHORT]?r=$1">r$1</a>'$text); # r12345 to resource link

    
$text=preg_replace('/c([0-9]{1,})/si''<a href="[BASEURLSHORT]?c=$1">c$1</a>'$text); # c12345 to collection link

    
$text str_replace("[BASEURLSHORT]",$baseurl_short,$text); // Replacing this earlier can cause issues
    
return $text;
    }

This article was last updated 24th May 2022 18:35 Europe/London time based on the source file dated 14th April 2022 11:05 Europe/London time.