Wordpress - plugin "Služba"

Místo pro dotazy a rady ohledně programovacích jazyků (C++, C#, PHP, ASP, Javascript, VBS..) a tvorby webových stránek

Moderátor: Mods_senior

Odpovědět
Hyko
Level 1.5
Level 1.5
Příspěvky: 140
Registrován: 24 bře 2014 20:46

Wordpress - plugin "Služba"

Příspěvek od Hyko »

Dobrý den,
potřebuji poradit jak udělat na webu, který běží na Wordpressu, aby se zadaným lidem odeslal mail např. dva dny před začátkem služby.
Potřebuji zřejmě nějaký plugin, který bude umět, když zadám lidi na službu v určitý den např. v pátek aby jim byl třeba ve středu odeslán automaticky mail, že mají službu.
Poradíte mi někdo, který použít?
Děkuji.
Uživatelský avatar
LuCaCZ
Level 3.5
Level 3.5
Příspěvky: 929
Registrován: 21 bře 2011 00:02

Re: Wordpress - plugin "Služba"

Příspěvek od LuCaCZ »

V rychlosti jsem našel tohle: https://cs.wordpress.org/plugins/email-reminder/ ale je skoro 3 roky neaktualizovaný.
Pak https://wordpress.org/plugins/task-scheduler/
...zkusit hledat "email reminder / sheduler"
Hyko
Level 1.5
Level 1.5
Příspěvky: 140
Registrován: 24 bře 2014 20:46

Re: Wordpress - plugin "Služba"

Příspěvek od Hyko »

LuCaCZ píše:V rychlosti jsem našel tohle: https://cs.wordpress.org/plugins/email-reminder/ ale je skoro 3 roky neaktualizovaný.
Pak https://wordpress.org/plugins/task-scheduler/
...zkusit hledat "email reminder / sheduler"
Děkuji to je přesně ono, zadat čas a email komu poslat upozornění [Email-reminder], akorát bych potřeboval poradit jak mám odstranit značky html, který se v emailu pošlou, vlastní text vím jak upravit ale kde odstranit <p>, <strong> atd. děkuji za rady

Kód: Vybrat vše

<p>This message is a reminder created on Friday, February 2, 2018</p>
<p><strong>[/b]REMINDER:[b]</strong><br />
Reminder</p><br />
<p>This reminder was sent using <a href="http://pogidude.com/email-reminder/">Email Reminder plugin</a> by <a href="http://pogidude.com/about/">Pogidude
Web Studio</a></p>
Hyko
Level 1.5
Level 1.5
Příspěvky: 140
Registrován: 24 bře 2014 20:46

Re: Wordpress - plugin "Služba"

Příspěvek od Hyko »

Asi jsem našel kód kde se vytváří tělo mailu, mohl by mi někdo poradit jak to upravit, aby se do těla mailu nevkládaly ty značky jak jsem psal víše a nebo jak upravit aby ten mail byl jako html stránka.
děkuji


Kód: Vybrat vše

<?php

class PDER{

	/**
	 * Get Ereminders
	 *
	 * Selects all 'ereminders' custom post types from the 'posts' table whose 'post_date' is less than $date and 'post_status' = draft returns rows as a numerically indexed array of objects. Uses $wpdb->get_results() function to fetch the results from the database.
	 *
	 * @param string $date date in YYYY-MM-DD H:i:s format. Defaults to current local time
	 * @param string $status draft|publish. corresponds to scheduled and sent reminders respectively
	 * @return array numerically indexed array of row objects
	 */
	public function get_ereminders( $date = '', $status = 'draft' ) {
		global $wpdb;
		
		if( $date == '' ){
			$date = current_time( 'mysql',0 );
		}
		
		if( $status == 'sent' ) 
			$status = 'publish';
		elseif( $status == 'scheduled' ) 
			$status = 'draft';
		
		$ereminders = $wpdb->get_results( $wpdb->prepare("
			SELECT *
			FROM {$wpdb->posts}
			WHERE post_date < %s
				AND post_type = 'ereminder'
				AND post_status = %s
			ORDER BY post_date ASC
		", $date, $status) );
		
		return $ereminders;
	}//get_ereminders
	
	/**
	 * Send Ereminders
	 */
	public static function send_ereminders(){

		
    
    
    
    
		//credits
	$credits = sprintf(__('This reminder was sent using <a href="%s">Email Reminder plugin</a> by <a href="%s">Pogidude
Web Studio</a>', 'email-reminder'), 'http://pogidude.com/email-reminder/', 'http://pogidude.com/about/');
		
		//get ereminders
		$pd = new PDER;
		$ereminders = $pd->get_ereminders();
		
	foreach( $ereminders as $ereminder ){
		
			$subject = __('[Reminder] ', 'email-reminder') . $ereminder->post_title;
			$to = $ereminder->post_excerpt;
			
			//use the email of the user who scheduled the reminder
			$author = get_userdata( $ereminder->post_author );
			$author_email = $author->user_email;

			$headers = 	__('From: Email Reminder', 'email-reminder') . "<{$author_email}>\r\n" . "Content-Type:
			text/html;\r\n";
			
			$creation_date = date( 'l, F j, Y', strtotime( $ereminder->post_date ) );
			$message = "<p>" . sprintf(__('This message is a reminder created on %s', 'email-reminder'),
					$creation_date) .
			           "</p>\n";
			$message .= '<p><strong>' . __('REMINDER:', 'email-reminder') . "</strong><br />\n";
			$message .= $ereminder->post_content . "</p><br />\n";
			$message .= "<p>{$credits}</p>";
			
			$email_result = wp_mail( $to, $subject, $message, $headers );
			//$email_result = wp_mail( 'ryannmicua@gmail.com', 'Test Reminder', 'message', 'From: Email Reminder <ryannmicua@gmail.com>' );
			
			
			if( $email_result ){//wp_mail() processed the request successfully
				//set post to 'publish' or delete the post
				$args = array( 'ID' => $ereminder->ID, 'post_status' => 'publish', 'post_date' => $ereminder->post_date, 'post_date_gmt' => $ereminder->post_date_gmt, 'post_modified' => current_time('mysql',0), 'post_modified_gmt' => current_time('mysql',1) );
				
				wp_update_post( $args );
				//wp_delete_post( $ereminder->ID );
			}
			
		}
	}
	
}
Uživatelský avatar
CZechBoY
Master Level 9.5
Master Level 9.5
Příspěvky: 8813
Registrován: 20 srp 2008 14:02
Bydliště: Brno
Kontaktovat uživatele:

Re: Wordpress - plugin "Služba"

Příspěvek od CZechBoY »

Co pouzit google kalendar?
PHP, Nette, MySQL, C#, TypeScript, Python
IntelliJ Idea, Docker, Opera browser, Linux Mint
iPhone XS
Raspberry PI 3 (KODI, Raspbian)
XBox One S, PS 4, nVidia GeForce NOW
Odpovědět
  • Podobná témata
    Odpovědi
    Zobrazení
    Poslední příspěvek

Zpět na „Programování a tvorba webu“