Jump to content

Recommended Posts

Posted

I have the "simple contact form" module. And it creates a log in Setup->logs (simplecontactform-log) for every sent email from the form. I want to output the logs in the front end? I also displaying the every email in the front end so i also want the specific log be attached to it. Is that possible? Please help..

Posted

Well its hard to understand that page for a beginner when there is no real examples.

This is the closest i got.

$scf = $modules->get('SimpleContactForm');

$wire = $log->getLogs($scf);

foreach($wire as $hejda){
  echo $hejda . "<br>";
}

And it outputs

Array

Array

Array

Array

Array

Array

Posted

But how do i get specific log? Lets say you are on a page that outputting the form message (front end). I only want that specific message attached to the page. Same date for example.

$myLogs = $log->getLines("simplecontactform-log");
    foreach ($myLogs as $logs) {
    echo $logs . "<br><br><br>";
}

 

Posted

Yes i saw that but as a said before i´m a beginner at PHP.. Can you give me some hint/example.. i´m struggling here ? /Thanks

Posted

I can give you a simple example how to use the options array. 

In this example you would get all log entries for your log file that have been stored today. 

$entries = $log->getEntries("simplecontactform-log", ["dateFrom" => "2022-06-14 00:00", "dateTo" => "2022-06-14 23:59:59"]);
foreach($entries as $entry){
	//get log entry text, you can also get date, user and url
	$text = $entry["text"];
}

 

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...