function lhg_create_mainboard_post_ajax()
{
    global $lhg_price_db;
    require_once WP_PLUGIN_DIR . '/lhg-hardware-profile-manager/templates/scan.php';
    $sid = $_REQUEST['session'];
    $title = $_REQUEST['title'];
    #error_log("SID: $sid - Title: $title");
    # execute standard actions for status change:
    #lhg_db_update_status( $sid, $status, $uid );
    $postid = lhg_create_mainboard_article($title, $sid, "");
    $newurl = "/wp-admin/post.php?post=" . $postid . "&action=edit&scansid=" . $sid;
    #error_log("Created article: $postid");
    $response = new WP_Ajax_Response();
    $response->add(array('data' => 'success', 'supplemental' => array('postid' => $postid, 'newurl' => $newurl)));
    $response->send();
    die;
}
Пример #2
0
 #print '<div id="mbname">Identified name: '.$clean_mb_name."<span id='details-mb' class='details-link'></span></div>";
 if ($show_public_profile != 1) {
     print '<div id="hidden-details-mb">Full identifier: ' . $mb_name . '</div>';
 }
 $mb_usercomment = lhg_get_mb_usercomment($sid);
 $url_mb = lhg_get_mb_url($sid);
 $buttontype = "green";
 $buttontext = $txt_submit;
 #"Submit";
 if ($mb_usercomment != "") {
     $buttontype = "light";
 }
 if ($mb_usercomment != "") {
     $buttontext = "Update";
 }
 $newPostID_mb = lhg_create_mainboard_article($mb_name, $sid);
 // creating rating stars
 ob_start();
 $returnval .= the_ratings("div", $newPostID_mb);
 $out1 = ob_get_contents();
 ob_end_clean();
 if (!strpos($out1, "onmouseout") > 0) {
     $out1 = "already rated";
 }
 $out1 = str_replace("(No Ratings Yet)", "", $out1);
 # only scanning person should be allowed to rate here!
 if ($show_public_profile != 1) {
     $article_created = '<span class="rating-mb"><nobr>' . $out1 . '</nobr></span>';
 }
 if ($show_public_profile != 1) {
     echo ' <form action="?" method="post" class="mb-usercomment">