Submit Button

This is the right place to report general bugs, make suggestions or ask for help.
User avatar
WineMan
Posts: 127
Joined: Tue Sep 01, 2020 5:03 pm

Submit Button

Post by WineMan » Tue Jun 17, 2025 2:50 pm

Can anyone tell me where the code is that when clicking on the Publish posts a new article?

User avatar
fraenkiman
Posts: 368
Joined: Thu Feb 03, 2022 7:25 pm
Location: Berlin, Germany
Contact:

Re: Submit Button

Post by fraenkiman » Wed Jun 18, 2025 7:20 pm

Hello WineMan,

in the file admin.entry.write.tpl in the directory /admin/panels/entry
Screenshot 2025-06-18 211700.png
Screenshot 2025-06-18 211700.png (16 KiB) Viewed 25903 times
Best regards
Frank
:pencil: You are strong in PHP and Java Script? :point_right: Then help us to improve FlatPress. :point_left:

:exploding_head: Looking for ideas, templates, examples and answers to frequently asked questions?
:bulb: You'll find it here.

My :de: FlatPress-Blog: https://frank-web.dedyn.io

User avatar
WineMan
Posts: 127
Joined: Tue Sep 01, 2020 5:03 pm

Re: Submit Button

Post by WineMan » Wed Jun 18, 2025 8:42 pm

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

User avatar
fraenkiman
Posts: 368
Joined: Thu Feb 03, 2022 7:25 pm
Location: Berlin, Germany
Contact:

Re: Submit Button

Post by fraenkiman » Wed Jun 18, 2025 9:51 pm

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?
:pencil: You are strong in PHP and Java Script? :point_right: Then help us to improve FlatPress. :point_left:

:exploding_head: Looking for ideas, templates, examples and answers to frequently asked questions?
:bulb: You'll find it here.

My :de: FlatPress-Blog: https://frank-web.dedyn.io

User avatar
WineMan
Posts: 127
Joined: Tue Sep 01, 2020 5:03 pm

Re: Submit Button

Post by WineMan » Wed Jun 18, 2025 10:59 pm

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.

User avatar
WineMan
Posts: 127
Joined: Tue Sep 01, 2020 5:03 pm

Re: Submit Button

Post by WineMan » Thu Jun 19, 2025 3:08 pm

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?

User avatar
fraenkiman
Posts: 368
Joined: Thu Feb 03, 2022 7:25 pm
Location: Berlin, Germany
Contact:

Re: Submit Button

Post by fraenkiman » Thu Jun 19, 2025 7:25 pm

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?
:pencil: You are strong in PHP and Java Script? :point_right: Then help us to improve FlatPress. :point_left:

:exploding_head: Looking for ideas, templates, examples and answers to frequently asked questions?
:bulb: You'll find it here.

My :de: FlatPress-Blog: https://frank-web.dedyn.io

User avatar
WineMan
Posts: 127
Joined: Tue Sep 01, 2020 5:03 pm

Re: Submit Button

Post by WineMan » Thu Jun 19, 2025 8:03 pm

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.

User avatar
fraenkiman
Posts: 368
Joined: Thu Feb 03, 2022 7:25 pm
Location: Berlin, Germany
Contact:

Re: Submit Button

Post by fraenkiman » Thu Jun 19, 2025 9:11 pm

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.
Attachments
admin.entry.write.zip
(1.96 KiB) Downloaded 818 times
:pencil: You are strong in PHP and Java Script? :point_right: Then help us to improve FlatPress. :point_left:

:exploding_head: Looking for ideas, templates, examples and answers to frequently asked questions?
:bulb: You'll find it here.

My :de: FlatPress-Blog: https://frank-web.dedyn.io

User avatar
WineMan
Posts: 127
Joined: Tue Sep 01, 2020 5:03 pm

Re: Submit Button

Post by WineMan » Fri Jun 20, 2025 3:37 pm

Where would I add the include file in the revised admin.entry.write.php file...after the onpreview module?

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests