Closed ansonphong closed 10 years ago
Phong, i couldn't test this using your edit post page http://localhost/wordpress/search/#/edit-post i get errors related to tiny mce?
however, i created another test page [get latest commit for both postworld and theme]
sample here:
postworld.controller('pwTestController',
function pwTestController($scope, $location, $log, $attrs, $timeout, pwData) {
// Initialize
$scope.pwTestPost = function() {
var post_data = {
'post_title' : 'hello content',
'post_content' :'sdsfdsfds',
'post_status' : 'publish',
'post_author' : 1,
'post_category' : [8,39 ],
'post_class':'test',
'post_format' :'ggggggg',
'link_url':'sssssss',
'external_image' : 'fgdfgdfgdf',
};
pwData.pw_save_post( post_data ).then(
// Success
function(response) {
//alert( "RESPONSE : " + response.data );
$log.info('pwData.pw_save_post : saved post id: ', response.data);
},
// Failure
function(response) {
//alert('error');
}
);
};
$scope.pwTestPost();
}
);
http://localhost/wordpress/search/#/test-post we can save the post without a problem, even with the add_record_to_post_meta($post_ID); uncommented.. can you get us more details about the difference between our example above and yours? maybe some different post_data that we can try?
It may be working because I commented out that line in the latest commit.
If you go inside of postworld_points.php
in pw_insert_post
and un-comment out this line add_record_to_post_meta($post_ID);
, is it still working?
phong
I just tried now and it produces this :
Error : {"0":"<","1":"d","2":"i","3":"v","4":" ","5":"i","6":"d","7":"=","8":"'","9":"e","10":"r","11":"r","12":"o","13":"r","14":"'","15":">","16":"\n","17":"\t","18":"\t","19":"\t","20":"<","21":"p","22":" ","23":"c","24":"l","25":"a","26":"s","27":"s","28":"=","29":"'","30":"w","31":"p","32":"d","33":"b","34":"e","35":"r","36":"r","37":"o","38":"r","39":"'","40":">","41":"<","42":"s","43":"t","44":"r","45":"o","46":"n","47":"g","48":">","49":"W","50":"o","51":"r","52":"d","53":"P","54":"r","55":"e","56":"s","57":"s","58":" ","59":"d","60":"a","61":"t","62":"a","63":"b","64":"a","65":"s","66":"e","67":" ","68":"e","69":"r","70":"r","71":"o","72":"r","73":":","74":"<","75":"/","76":"s","77":"t","78":"r","79":"o","80":"n","81":"g","82":">","83":" ","84":"[","85":"C","86":"o","87":"l","88":"u","89":"m","90":"n","91":" ","92":"c","93":"o","94":"u","95":"n","96":"t","97":" ","98":"d","99":"o","100":"e","101":"s","102":"n","103":"&","104":"#","105":"0","106":"3","107":"9","108":";","109":"t","110":" ","111":"m","112":"a","113":"t","114":"c","115":"h","116":" ","117":"v","118":"a","119":"l","120":"u","121":"e","122":" ","123":"c","124":"o","125":"u","126":"n","127":"t","128":" ","129":"a","130":"t","131":" ","132":"r","133":"o","134":"w","135":" ","136":"1","137":"]","138":"<","139":"b","140":"r","141":" ","142":"/","143":">","144":"\n","145":"\t","146":"\t","147":"\t","148":"<","149":"c","150":"o","151":"d","152":"e","153":">","154":"i","155":"n","156":"s","157":"e","158":"r","1...:"e","186":"t","187":"a","188":" ","189":"v","190":"a","191":"l","192":"u","193":"e","194":"s","195":"(","196":"1","197":"7","198":"2","199":"7","200":"0","201":"4","202":",","203":"&","204":"#","205":"0","206":"3","207":"9","208":";","209":"p","210":"o","211":"s","212":"t","213":"_","214":"c","215":"l","216":"a","217":"s","218":"s","219":"&","220":"#","221":"0","222":"3","223":"9","224":";","225":",","226":"&","227":"#","228":"0","229":"3","230":"9","231":";","232":"s","233":"t","234":"a","235":"n","236":"d","237":"a","238":"r","239":"d","240":"&","241":"#","242":"0","243":"3","244":"9","245":";","246":",","247":"&","248":"#","249":"0","250":"3","251":"9","252":";","253":"&","254":"#","255":"0","256":"3","257":"9","258":";","259":",","260":"0","261":",","262":"0","263":",","264":"0","265":")","266":"<","267":"/","268":"c","269":"o","270":"d","271":"e","272":">","273":"<","274":"/","275":"p","276":">","277":"\n","278":"\t","279":"\t","280":"\t","281":"<","282":"/","283":"d","284":"i","285":"v","286":">","287":"{","288":"\"","289":"v","290":"e","291":"r","292":"s","293":"i","294":"o","295":"n","296":"\"","297":":","298":"\"","299":"0","300":".","301":"1","302":"\"","303":",","304":"\"","305":"s","306":"t","307":"a","308":"t","309":"u","310":"s","311":"\"","312":":","313":"2","314":"0","315":"0","316":",","317":"\"","318":"d","319":"a","320":"t","321":"a","322":"\"","323":":","324":"1","325":"7","326":"2","327":"7","328":"0","329":"4","330":"}","$promise":{},"$resolved":true}
The error disappears immediately when removing this line add_record_to_post_meta($post_ID);
from pw_insert_post()
in postworld_posts.php
I will look more into it...
When I run add_record_to_post_meta() on it's own on a valid post_id, it returns this :
WordPress database error: [Column count doesn't match value count at row 1]
insert into wp_postworld_post_meta values(172704,'post_class','standard','',0,0,0)
null
The error seems to originate in the function add_record_to_post_meta()
I may be running on an old database model - I will update now and report back.
OK - confirmed, the issue was I was running on an old database structure, with a post_author column in wp_postworld_post_meta
.
Hi Haidy, I found an issue which appears while I'm saving to a post using
pw_insert_post()
viapw_save_post()
via AJAX. I've only been able to get the error in the JS environment.I pinpointed it to this line in
pw_insert_post()
insidepostworld_posts.php
, since the errors disappear when I remove this line :add_record_to_post_meta($post_ID);
This refers to a function in
postworld_points.php
The error is serialized as follows, but you can read between the numbers, it says something like : Wordpress DB Error - something about column count not matching.
The origin of the error is in
add_record_to_post_meta($post_ID);
function inside :postworld_points.php
Any ideas what's causing this? This only just became an issue since one of the last commits in the last 24 hours.