Function Reference: geodir_post_information_save

Summary

Saves listing data from request variable to database.

Global Values

$wpdb
(object) (required) WordPress Database object.

Default: None
$current_user
(object) (required) Current user object.

Default: None
$post
(object) (required) WordPress Post object.

Default: None

Package

GeoDirectory

Parameters

$post_id
(int) (required) The post ID.

Default: None

Change Log

Since: 1.0.0

Source File

geodir_post_information_save() is located in geodirectory-admin/admin_functions.php [Line: 870]

Source Code

function geodir_post_information_save($post_id, $post) {
    global $wpdb, $current_user;

    if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) {
        return;
    }

    $geodir_posttypes = geodir_get_posttypes();

    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
        return;

    if (!wp_is_post_revision($post_id) && isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)) {
        if (isset($_REQUEST['_status']))
            geodir_change_post_status($post_id, $_REQUEST['_status']);

        if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash'))
            return;

        if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__)))
            return;

        if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__)))
            return;

        geodir_save_listing($_REQUEST);
    }
}