diff options
author | friendica <info@friendica.com> | 2013-11-24 23:15:07 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2013-11-24 23:15:07 -0800 |
commit | 2b47d36a11cd7203c26c50c6cd504726c2cd9b39 (patch) | |
tree | 5a5d52e89f5b0fecbe7041c966182150b848a200 /util | |
parent | c63a18a2506778fff37c3e82881e90e24ce545a8 (diff) | |
download | volse-hubzilla-2b47d36a11cd7203c26c50c6cd504726c2cd9b39.tar.gz volse-hubzilla-2b47d36a11cd7203c26c50c6cd504726c2cd9b39.tar.bz2 volse-hubzilla-2b47d36a11cd7203c26c50c6cd504726c2cd9b39.zip |
wordpress publish hook was called before the meta storage hook so the plugin would only work on edited posts. This may be a wordpress version issue because you'd think somebody would've noticed it before.
Diffstat (limited to 'util')
-rw-r--r-- | util/wp/post_to_red/post_to_red.php | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/util/wp/post_to_red/post_to_red.php b/util/wp/post_to_red/post_to_red.php index 095884007..47af7789b 100644 --- a/util/wp/post_to_red/post_to_red.php +++ b/util/wp/post_to_red/post_to_red.php @@ -55,12 +55,19 @@ function post_to_red_get_password() { } function post_to_red_post($post_id) { - + $post = get_post($post_id); + if (isset($_POST['post_to_red'])) { + update_post_meta($post_id, 'post_to_red', 1); + } else { + update_post_meta($post_id, 'post_to_red', 0); + } + + // if meta has been set if (get_post_meta($post_id, "post_to_red", true) == 1) { - + $user_name = post_to_red_get_acct_name(); $password = post_to_red_get_password(); $seed_location = post_to_red_get_seed_location(); @@ -80,7 +87,7 @@ function post_to_red_post($post_id) { $message_namespace = 'wordpress'; - $message_id = $site_url() . '/' . $post_id; + $message_id = site_url() . '/' . $post_id; $message = $post->post_title . "<br /><br />" . $message; @@ -148,6 +155,7 @@ EOF; } function post_to_red_post_checkbox() { + add_meta_box( 'post_to_red_meta_box_id', 'Cross Post to Red Matrix', @@ -170,8 +178,9 @@ function post_to_red_post_field_data($post_id) { return; // security check -// if (!wp_verify_nonce( $_POST['post_to_red_nonce'], plugin_basename( __FILE__ ))) -// return; + if((! array_key_exists('post_to_red_nonce', $_POST)) + || (!wp_verify_nonce( $_POST['post_to_red_nonce'], plugin_basename( __FILE__ )))) + return; // now store data in custom fields based on checkboxes selected if (isset($_POST['post_to_red'])) { |