I have this button (shown below)
$link_host = new moodle_url('https://live.tgcampus.com/develop/custom/', array('ClientID' => $tg_license,'RoomName' => $tg_room,'Rec' => $cm->name,'Host' => $USER->username, 'SessionKey' => $livesessiondetails->tg_sessionkey, 'duration'=>$duration )); echo html_writer::link($link_host, get_string('host_session', 'tgwhiteboard'), ['class' => 'btn btn-primary', 'target' => '_blank']);
But now what I want to do is, This button is redirecting on the given url all the time till button is visible.
I want to make it conditional as, If endDateTime is less than currentDateTime then it should not redirect on the given link. Instead of that it should display a message like, in pop-up or error message (Your session is completed, Please refresh the page). Or If we can then, when this is condition as endDateTime is less than currentDateTime then it will display a message on button click and refresh the page automatically