Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sevasram
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
krishna chandran
sevasram
Commits
f4e3720b
Commit
f4e3720b
authored
May 13, 2020
by
Arun Raj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mail configured for a new entry in featured content
parent
bdce90b6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
1 deletions
+53
-1
wp-content/themes/landscop/functions.php
+53
-1
No files found.
wp-content/themes/landscop/functions.php
View file @
f4e3720b
...
@@ -432,7 +432,7 @@ function func($post_id)
...
@@ -432,7 +432,7 @@ function func($post_id)
function
wpdocs_run_on_publish_only
(
$new_status
,
$old_status
,
$post
)
{
/*
function wpdocs_run_on_publish_only( $new_status, $old_status, $post ) {
if ( 'publish' === $new_status && 'publish' !== $old_status )
if ( 'publish' === $new_status && 'publish' !== $old_status )
{
{
$category_detail=get_the_category($post->ID);//$post->ID
$category_detail=get_the_category($post->ID);//$post->ID
...
@@ -459,6 +459,58 @@ function wpdocs_run_on_publish_only( $new_status, $old_status, $post ) {
...
@@ -459,6 +459,58 @@ function wpdocs_run_on_publish_only( $new_status, $old_status, $post ) {
}
}
}
}
add_action( 'transition_post_status', 'wpdocs_run_on_publish_only', 10, 3 );*/
function
wpdocs_run_on_publish_only
(
$new_status
,
$old_status
,
$post
){
global
$wpdb
;
$customers
=
$wpdb
->
get_results
(
"SELECT * FROM wp_newsletter"
);
if
(
'publish'
===
$new_status
&&
'publish'
!==
$old_status
)
{
$category_detail
=
get_the_category
(
$post
->
ID
);
//$post->ID
$data
=
array
(
"message"
=>
$post
->
post_content
,
"title"
=>
$post
->
post_title
);
foreach
(
$category_detail
as
$cd
)
{
if
(
$cd
->
slug
==
'news'
)
{
$curl
=
curl_init
(
'http://52.55.205.218:5555/notification/sendnotificationtoall'
);
curl_setopt
(
$curl
,
CURLOPT_POST
,
true
);
curl_setopt
(
$curl
,
CURLOPT_POSTFIELDS
,
http_build_query
(
$data
)
);
curl_setopt
(
$curl
,
CURLOPT_RETURNTRANSFER
,
true
);
$response
=
curl_exec
(
$curl
);
curl_close
(
$curl
);
}
}
foreach
(
$customers
as
$customer
){
$email
=
$customer
->
email
;
$cat
=
get_the_term_list
(
$post
->
ID
,
'wpfcas-category'
);
$cat
=
strip_tags
(
$cat
);
//echo $cat;exit;
if
((
$cat
==
"Guruvachanam"
)
||
(
$cat
==
"Guruvaakku"
)
||
(
$cat
==
"Guruvarul"
))
{
$body
=
sprintf
(
'Hey there is a new entry in %s!
See <%s>'
,
$cat
,
get_home_url
()
);
wp_mail
(
$email
,
'New entry!'
,
$body
);
}
}
}
}
add_action
(
'transition_post_status'
,
'wpdocs_run_on_publish_only'
,
10
,
3
);
add_action
(
'transition_post_status'
,
'wpdocs_run_on_publish_only'
,
10
,
3
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment