In expressionengine with php parse enabled,
if i do the following, it works and i get the username displayed. logged in user is admin. So it echos out admin.
<?php
$x = '{username}';
echo $x;
?>
However if i do the following and use the{username} tag insde mkdir() function, then it doesn’t work. The directory created will have the name {username} instead of admin. Why is this happening.
<?php
$x = '{username}';
mkdir($x);
?>
I’d suggest writing a quick plugin that accepts the logged-in username as a parameter, then does your
mkdir()work within the plugin.There’s more to the plugin, but that’s the guts of it. Then call it like
{exp:make_directory username="{logged_in_username}"}.