Moodle is open source lms which allows you to customization and create new functions so that I have written a function for user profile picture that you need to write in course/lib.php file so finally wherever you want to display just call the function.

Here is the my function:

function print_userpic() {
global $USER,$DB,$CFG;
$user_priofile_pic=$DB->get_record(‘files’, array(‘id’ => $USER->picture));
$imagepath=$user_priofile_pic->contextid.”/user/”.$user_priofile_pic->filearea.”/”.$user_priofile_pic->filename;
$userprofile_pix=”/pluginfile.php/”.$imagepath;
return $userprofile_pix;
}

And also written one more function that for retrieving site front page news which is available in the following.

function print_frontpagenews()
{
global $DB;
$sitenews=$DB->get_record(‘course’, array(‘id’ =>1));
echo $sitenews->summary;
}

I hope it is help to you. Please share your thoughts.

5932 Total Views 3 Views Today

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>