Question

I'm using php code in my moodle frontpage.php.

<?php echo get_string('usergreeting', 'theme_ui_1', $USER->firstname .' '. $USER->lastname); ?> 

I want to link only user name with profile.php page, please help me.

Was it helpful?

Solution

Something like this?

$url = new moodle_url('/user/profile.php', array('id'=>$USER->id);
$link = html_writer::link($url, $USER->firstname .' '. $USER->lastname);
echo get_string('usergreeting', 'theme_ui_1', $link);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top