Browse code

add reservation datetime post updated messages.

nita authored on 2014/05/04 02:37:47
Showing 1 changed files
... ...
@@ -219,6 +219,46 @@ function updateReservedContent($post_id)
219 219
     }
220 220
 }
221 221
 
222
+// add update message
223
+add_filter('post_updated_messages','addRcMessage');
224
+function addRcMessage($messages)
225
+{
226
+    global  $post, $post_ID;
227
+    $arrPostTypes = getRcSetting(true);
228
+    $postType = get_post_type($post);
229
+    if(in_array($postType, $arrPostTypes))
230
+    {
231
+        $rcMetas = getRcMetas($post_ID);
232
+        if("1" == $rcMetas['accept'])
233
+        {
234
+            $addMessageDate = repleceRcUpdateMsg(date('Y/m/d H:i',  strtotime($rcMetas['date'])));
235
+            $addMessage = '<br>' . __($addMessageDate, RC_TXT_DOMAIN);
236
+            // published
237
+            $messages[$postType][1] .= $addMessage;
238
+            $messages[$postType][4] .= $addMessage;
239
+            $messages[$postType][6] .= $addMessage;
240
+            // saved
241
+            $messages[$postType][7] .= $addMessage;
242
+            // submited
243
+            $messages[$postType][8] .= $addMessage;
244
+            // scheduled
245
+            $messages[$postType][9] .= $addMessage;
246
+        }
247
+    }
248
+    return $messages;
249
+}
250
+
251
+/**
252
+ * replace add messages in reservation date
253
+ * @param string $s
254
+ * @return string replaced string
255
+ */
256
+function repleceRcUpdateMsg($s) {
257
+    $str = 'registered reservation update content _RC_DATETIME_';
258
+    $res = strtr($str, array('_RC_DATETIME_' => $s));
259
+    return $res;
260
+}
261
+
222 262
 // add reservation info at postlist
223 263
 function manageRucyCols($columns) {
224 264
     $columns['subtitle'] = __("Reservation Update DateTime", RC_TXT_DOMAIN);