Function Reference: geodir_claim_content_loader

Summary

This function has not been documented yet.

Source Code

function geodir_claim_content_loader( $content ){

    global $wp_query, $current_user, $plugin_prefix, $wpdb;

    if(isset($_REQUEST['geodir_ptype']) && $_REQUEST['geodir_ptype']=='verify'){

        $content = '';

        if($current_user->ID){

            if(get_option('geodir_claim_auto_approve')=='yes'){

                if(!isset($_REQUEST['rs']) || (isset($_REQUEST['rs']) && $_REQUEST['rs']=='')){

                    $content .= CLAIM_VARIFY_CODE_NOT_EXIST;

                }else{

                    $rand_string = isset($_REQUEST['rs']) ? $_REQUEST['rs'] : '';

                    $approvesql = $wpdb->prepare("select * from ".GEODIR_CLAIM_TABLE." where rand_string=%s",array($rand_string));

                    $approveinfo = $wpdb->get_results($approvesql);

                    if($approveinfo)
                    {
                        $pid = $approveinfo[0]->pid;

                        $post_id = $approveinfo[0]->list_id;

                        $author_id = $approveinfo[0]->user_id;

                        $user_id = $current_user->ID;

                        $status = $approveinfo[0]->status;

                        if($author_id==$user_id)
                        {

                            if($status==1)
                            {
                                $content .= CLAIM_LISTING_ALREADY_VARIFIED;
                            }
                            elseif($status==2)
                            {
                                $content .= CLAIM_LISTING_VERIFICATION_REJECTED;
                            }
                            else
                            {

                                $wpdb->query($wpdb->prepare("update $wpdb->posts set post_author=%d where ID=%d", array($author_id,$post_id)));

                                $wpdb->query($wpdb->prepare("update ".GEODIR_CLAIM_TABLE." set status='1' where pid=%d", array($pid)));

                                geodir_save_post_meta($post_id, 'claimed','1');
								
								/** This action is documented in geodir_claim_functions.php */
								do_action('geodir_claim_request_status_change', $pid, 1, $status);

                                geodir_clientEmail($post_id,$author_id,'claim_approved'); /* email to client */

                                $content .= CLAIM_LISTING_SUCCESS_VERIFIED.' '.$approveinfo[0]->list_title.'';

                            }
                        }
                        else
                        {
                            $content .= CLAIM_VARIFY_CODE_NOT_MATCH;
                        }
                    }
                    else
                    {
                        $content .= CLAIM_VARIFY_CODE_NOT_EXIST;
                    }
                }

            }else{
                $content .= CLAIM_AUTO_VARIFY_DISABLE;
            }

        }else{
            $site_login_url = geodir_login_url();

            $content .= sprintf( CLAIM_LOGIN_REQUIRED, '');
        }


    }

    return $content;
}