Collections functions
Encryption functions
General functions
Render functions
Theme permission functions
Video 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 112 to 122

Definition

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

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

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

    
return $text;
    }

This article was last updated 14th May 2021 23:05 Europe/London time based on the source file dated 1st March 2021 16:05 Europe/London time.