Page 1 of 3
Submit Button
Posted: Tue Jun 17, 2025 2:50 pm
by WineMan
Can anyone tell me where the code is that when clicking on the Publish posts a new article?
Re: Submit Button
Posted: Wed Jun 18, 2025 7:20 pm
by fraenkiman
Hello WineMan,
in the file
admin.entry.write.tpl in the directory
/admin/panels/entry

- Screenshot 2025-06-18 211700.png (16 KiB) Viewed 27536 times
Best regards
Frank
Re: Submit Button
Posted: Wed Jun 18, 2025 8:42 pm
by WineMan
Thanks...I want to add an include file after the submit button is clicked...Is this where I would place it or should it be placed in the admin.entry.write.php file
Re: Submit Button
Posted: Wed Jun 18, 2025 9:51 pm
by fraenkiman
Depending on what the file to be included does, I would include it in the onsave() function in the admin.entry.write.php file.
What are you planning?
Re: Submit Button
Posted: Wed Jun 18, 2025 10:59 pm
by WineMan
I'm planning on generating an email notification being sent to my subscribers. I know...the rss and atom feeds should do that but that is assuming that they have an rss reader. This way, if they subscribe they will be notified of any new articles and once I figure out how/where, they will also be notified of any comments posted.
Re: Submit Button
Posted: Thu Jun 19, 2025 3:08 pm
by WineMan
I'm perplexed. I placed the include code as suggested and as far as I know, it worked since there are no error messages from my webhost, but it did not work. Does Flatpress generate its own error message and if so, where do I find it?
Re: Submit Button
Posted: Thu Jun 19, 2025 7:25 pm
by fraenkiman
It's starting to get exciting and interesting. The collected e-mail addresses from the input in the widget are collected... In a text file or in the FlatPress configuration file? Do you already have a GDPR-compliant storage option? If possible, the email addresses should not be saved as plain text.
When you click on Save entry, mail() or Postfix is triggered and sends the URL to the created post to all email addresses. Is this already working for you?
Re: Submit Button
Posted: Thu Jun 19, 2025 8:03 pm
by WineMan
Let's see if I can explain the process without confusion. At the moment, the subscribe widget takes the email address of anyone subscribing and writing it to a text file. The include file I am talking about uses the rss feed to add the title of the newly posted article and adds it to another text file and then generates an email to the subscribers notifying them of the new posted article, with a link to the article itself.
The answer to your question is that when I click on Save entry, the text file containing the titles is not updated and the email is not generated This process works if I enter the include file directly into the address bar however. At firs I thought that I did not have the correct path to the include file, but I am almost positive that is not the case.
Re: Submit Button
Posted: Thu Jun 19, 2025 9:11 pm
by fraenkiman
This may be due to the fact that the new entry is saved with onsave(), but not output/read.
You may have to adapt the onsave() and onpreview() function slightly.
Code: Select all
// Additional output of the entry URL
if (!$do_preview && is_numeric($success) && $success > 0) {
$this->outputEntryUrl($success);
}
And create a new function
outputEntryUrl() that outputs the public URL of the entry after saving.
Code: Select all
function onpreview() {
/**
* Outputs the public URL of the entry after saving.
*
* @param int $id The ID of the entry just saved.
*/
protected function outputEntryUrl($id) {
$url = get_permalink($id);
//if ($url) {
//echo '<div class="entry-url">';
//echo 'URL of the entry: <a href="' . esc_url($url) . '">' . esc_html($url) . '</a>';
//echo '</div>';
//}
}
global $lang;
$this->_makePreview($this->_getposteddata());
$this->_getCatsFlags();
add_filter('wp_title', array(
&$this,
'makePageTitle'
), 10, 2);
if ($this->draft) {
add_filter('admin_body_class', array(
&$this,
'draft_class'
));
}
return 0;
}
get_permalink($id); returns the finished URL, which you can then send.
This is not a ready-made solution, just an approach.
Re: Submit Button
Posted: Fri Jun 20, 2025 3:37 pm
by WineMan
Where would I add the include file in the revised admin.entry.write.php file...after the onpreview module?