@@ -43,7 +43,8 @@ def initialize(info = {})
43
43
] )
44
44
45
45
register_advanced_options ( [
46
- OptInt . new ( 'PostCount' , [ false , 'Number of posts to list' , 100 ] )
46
+ OptInt . new ( 'PostCount' , [ false , 'Number of posts to list' , 100 ] ) ,
47
+ OptBool . new ( 'AutoPublish' , [ false , 'Publish updated posts' , true ] )
47
48
] )
48
49
end
49
50
@@ -115,7 +116,8 @@ def do_update
115
116
res = update_post ( post [ :id ] ,
116
117
title : datastore [ 'POST_TITLE' ] ,
117
118
content : datastore [ 'POST_CONTENT' ] ,
118
- password : datastore [ 'POST_PASSWORD' ]
119
+ password : datastore [ 'POST_PASSWORD' ] ,
120
+ status : datastore [ 'AutoPublish' ] ? 'publish' : nil
119
121
)
120
122
121
123
post_url = full_uri ( wordpress_url_post ( post [ :id ] ) )
@@ -162,6 +164,7 @@ def update_post(id, opts = {})
162
164
payload [ :title ] = opts [ :title ] if opts [ :title ]
163
165
payload [ :content ] = opts [ :content ] if opts [ :content ]
164
166
payload [ :password ] = opts [ :password ] if opts [ :password ]
167
+ payload [ :status ] = opts [ :status ] if opts [ :status ]
165
168
166
169
send_request_cgi ( {
167
170
'method' => 'POST' ,
0 commit comments