inherit
162752
0
Nov 7, 2024 3:58:23 GMT -8
Pebble
Where it all does or doesn't happen!
1,437
January 2011
pebbleleague
|
Post by Pebble on Nov 29, 2013 9:08:11 GMT -8
Hi Everyone, I've written a plugin for someone and they are constantly getting this error in a pb alert : Link to a thread with an image of the error : link I did see this error once on their forum, but I now can't reproduce it Hence having to link to their post for the screen shot. I've tried the plugin on different forums of my own using Admin, staff, normal members & guest , but still can't get the error. The key is user(private) The code accessing the key is : $( ".newlike" ).click(function() { var postid = $(this).closest('tr.item.post').attr('id'); var testval = pb.plugin.key('likedposts').get(); if ( $.inArray( postid, testval ) == -1 && proboards.data('user').name != "Guest"){ if (typeof testval == "undefined"){ pb.plugin.key('likedposts').set({ value: [postid] }); } else { pb.plugin.key('likedposts').push({ value: postid }); }; $(this).closest('.content').find('a.likes-button').click(); }; $(this).hide(); $(this).next().show().css('display', 'inline-block'); }) and the full plugin is here : linkAnd a link to a new forum with only this plugin enabled : linkThanks for any advice / help. Cheers, Pebble.
|
|
inherit
162752
0
Nov 7, 2024 3:58:23 GMT -8
Pebble
Where it all does or doesn't happen!
1,437
January 2011
pebbleleague
|
Post by Pebble on Nov 29, 2013 14:00:06 GMT -8
I re-wrote the plugin and waiting to hear back from the user. I still have no idea why a user couldn't write to a user key but.... Hopefully it wont be a problem with the new plugin. Crosses fingers.
|
|
inherit
The Dream Crusher (Ret.)
164921
0
Apr 1, 2014 11:00:25 GMT -8
Tim Camara
Teach a man to fish, etc., etc.
1,721
March 2011
tcamara
|
Post by Tim Camara on Dec 2, 2013 9:24:29 GMT -8
The way that code snippet looks, the set/push functions will attempt to infer the correct object_id (in this case, user_id). I would verify that the object_id being used is correct, or even just set it explicitly. You can override the error function to set/push to give you more feedback about the values that are being passed in.
|
|
inherit
162752
0
Nov 7, 2024 3:58:23 GMT -8
Pebble
Where it all does or doesn't happen!
1,437
January 2011
pebbleleague
|
Post by Pebble on Dec 3, 2013 9:57:56 GMT -8
Thanks Tim. I re-wrote the plugin using a different method which is working fine. Next time I'm using a key I'll give the method posted above another bash and see what it comes up with.
|
|
inherit
162752
0
Nov 7, 2024 3:58:23 GMT -8
Pebble
Where it all does or doesn't happen!
1,437
January 2011
pebbleleague
|
Post by Pebble on Dec 6, 2013 9:33:51 GMT -8
Hi Tim, This error seems to have reared its ugly head again. Unfortunately I can't replicate it to see what is happening. The user getting the error ( others have used it and not getting the error ) is using FF25, which I've tried and not getting the error myself. Link to the error report post : link
After the first report of this, I changed pb.plugin.key('postliked').set({value: keydatalike})
To pb.plugin.key('postliked').set({option: proboards.data('user').id, value: keydatalike})
And it still continues. I have a test site here : link if you want to go and investigate and play about with. There's nothing there that is important. I'm sort of at a loss now that I can't replicate the error. Thanks for any help , Pebble.
|
|
inherit
The Dream Crusher (Ret.)
164921
0
Apr 1, 2014 11:00:25 GMT -8
Tim Camara
Teach a man to fish, etc., etc.
1,721
March 2011
tcamara
|
Post by Tim Camara on Dec 6, 2013 10:46:15 GMT -8
I don't see that specific code in that plugin on that forum, but just by looking at it, it should be this:
pb.plugin.key('postliked').set({object_id: proboards.data('user').id, value: keydatalike}); If that doesn't work, I'd add in something like this to get more feedback from that user:
pb.plugin.key('postliked').set({object_id: proboards.data('user').id, value: keydatalike, error: function(status) { // print debug info here }});
|
|
inherit
162752
0
Nov 7, 2024 3:58:23 GMT -8
Pebble
Where it all does or doesn't happen!
1,437
January 2011
pebbleleague
|
Post by Pebble on Dec 6, 2013 12:39:11 GMT -8
Thanks Tim for the above (one of those days where I do everything wrong and blame everyone/everything else!) I was able to finally replicate this error 32 in FF25 (not happening in other browsers for some reason) and after investigating more it just seems that it wasn't setting the user id , and once I added in the (correct) object_id the error went away. (and would have been 10 minutes sooner if I'd added it to both parts of the code where it sets the key ( as I said , one of those days.) So, for now it's working in GC, FF and IE. Hopefully I wont be back to this thread for help! thanks again. Pebble. EDIT: As an aside, it may be worth adding that you can set the user id to user keys in the key guide. I didn't know this as it just states that it will know what id to use.
|
|
inherit
162752
0
Nov 7, 2024 3:58:23 GMT -8
Pebble
Where it all does or doesn't happen!
1,437
January 2011
pebbleleague
|
Post by Pebble on Dec 22, 2013 21:43:45 GMT -8
Hi Tim Camara, Sorry , me again! I'm still getting this error 32 and I'm at a loss as to what is causing it. The code has a load of console.logs in there and the plugin is commented. I just created a new forum : pebbleplugins3.proboards.com/thread/1/welcome-new-forumAnd this is the only plugin on there. From my other forum, I seem to have found that admin & staff can write to the user(private) key but not a normal member. ( I was testing previously with an admin account and a test account that was a global mod, which is why I was having trouble reproducing the error ) On the new site, straight away the admin account worked without a problem, and then the 'normal' member threw up the error. Any help would be much appreciated. ( and if anyone else is reading... If you want to create an account and confirm, that'd be great! ) This is from the source code: Normal member :
proboards.plugin.keys.init(["likeddata",1]);proboards.plugin.keys.init_permissions(["likeddata",{2:[1,1]}]);
Admin :
proboards.plugin.keys.init(["likeddata",1]);proboards.plugin.keys.init_permissions(["likeddata",{1:[1,1]}]);proboards.plugin.keys.init_values(["likeddata", 1, ["2"]]);
Staff member :
proboards.plugin.keys.init(["likeddata",1]);proboards.plugin.keys.init_permissions(["likeddata",{3:[1,1]}]);proboards.plugin.keys.init_values(["likeddata", 3, ["2"]]);
Cheers. Pebble. Edit: I have a horrible feeling that someone is going to say " have you set the permissions" somewhere I've never looked!
|
|
inherit
King Oligochaete
126470
0
Feb 24, 2021 12:23:15 GMT -8
Wormopolis
Stop rating plugins with 1 star that dont deserve it.
20,002
June 2008
tbserialkillers
Wormo's Mini-Profile
|
Post by Wormopolis on Dec 22, 2013 23:13:36 GMT -8
I was attempting to do this with a plugin as well and from what I gathered, being able to set anything to a private user key is a bug in the first place otherwise its only a read away from being a super key.
I could be wrong though..
|
|
inherit
162752
0
Nov 7, 2024 3:58:23 GMT -8
Pebble
Where it all does or doesn't happen!
1,437
January 2011
pebbleleague
|
Post by Pebble on Dec 23, 2013 5:16:19 GMT -8
But a user (non-staff) should be able to set/push ro their own user key, shouldn't they?
this is the code part for the key set/push :
/* test if like clicked + or - and set key */
$( document ).ajaxComplete(function( event, xhr, settings ) {
if ( settings.url == "/post/like" ){
window.console.log("liked button clicked");
var postall = settings.data.split("&");
var postid = postall[0].substring(8);
if ( $('#post-'+postid).find('div.message span').hasClass( "liketest" )){
var keydata = pb.plugin.key('likeddata').get();
var obj = jQuery.parseJSON(xhr.responseText);
if (obj.liked == "1") {
if (typeof keydata == "undefined"){
window.console.log("user id = " + proboards.data('user').id);
pb.plugin.key('likeddata').set({object_id: proboards.data('user').id, value:[ postid ]});
} else {
pb.plugin.key('likeddata').push({object_id: proboards.data('user').id, value: postid});
};
window.console.log("keydata = " + keydata);
$('#post-' + postid).find('.newlike').hide();
$('#post-' + postid).find('.likecontent').show();
window.console.log("LIKED!");
} else {
if (typeof keydata != "undefined"){
keydata = $.grep(keydata, function( n, i ) {
return ( n !== postid );
});
pb.plugin.key('likeddata').set({object_id: proboards.data('user').id, value: keydata});
window.console.log("keydata = " + keydata);
window.console.log("UN - LIKED!");
$('#post-' + postid).find('.newlike').show();
$('#post-' + postid).find('.likecontent').hide();
}
}
}
}
})
|
|
inherit
King Oligochaete
126470
0
Feb 24, 2021 12:23:15 GMT -8
Wormopolis
Stop rating plugins with 1 star that dont deserve it.
20,002
June 2008
tbserialkillers
Wormo's Mini-Profile
|
Post by Wormopolis on Dec 23, 2013 7:46:07 GMT -8
to their OWN, yes, but I was able to push to others successfully UNTIL it came to regular users vs staff.
try this:
pb.plugin.key('likeddata').set({object_id: proboards.data('user').id, value:[ postid ]});
|
|
inherit
162752
0
Nov 7, 2024 3:58:23 GMT -8
Pebble
Where it all does or doesn't happen!
1,437
January 2011
pebbleleague
|
Post by Pebble on Dec 23, 2013 7:49:54 GMT -8
to their OWN, yes, but I was able to push to others successfully UNTIL it came to regular users vs staff. try this: pb.plugin.key('likeddata').set({object_id: proboards.data('user').id, value:[ postid ]}); Cheers , I'll try it later. Another of my 'stupid' moments. For some reason I keep putting option instead of object_id (for about the 3rd time.... ) Still the same error comes up for the non staff user although the user id is correct. Maybe a normal user can't write an array??? Now I'm just clutching at straws!
|
|
inherit
The Dream Crusher (Ret.)
164921
0
Apr 1, 2014 11:00:25 GMT -8
Tim Camara
Teach a man to fish, etc., etc.
1,721
March 2011
tcamara
|
Post by Tim Camara on Dec 23, 2013 9:23:18 GMT -8
Normal users can write the same kinds of data that staff users can. Wormopolis is right in that being able to write to another user's private key is a bug, and relying on that functionality would be a mistake, since it'll eventually get fixed, breaking anything that relies on it. I'm afraid I don't have time today to look into your specific issue Pebble, but I'd recommend ensuring that the data you're sending is exactly what you think you're sending. Check the network tab of your firebug/inspector thing, make sure the information matches what you're putting in.
|
|
inherit
King Oligochaete
126470
0
Feb 24, 2021 12:23:15 GMT -8
Wormopolis
Stop rating plugins with 1 star that dont deserve it.
20,002
June 2008
tbserialkillers
Wormo's Mini-Profile
|
Post by Wormopolis on Dec 23, 2013 12:55:16 GMT -8
did you try emptying all your key data and trying from scratch? isnt the error 32 when it tries to push to a key that isnt an array type?
|
|
inherit
The Dream Crusher (Ret.)
164921
0
Apr 1, 2014 11:00:25 GMT -8
Tim Camara
Teach a man to fish, etc., etc.
1,721
March 2011
tcamara
|
Post by Tim Camara on Dec 23, 2013 13:15:27 GMT -8
32 is a permissions error, 64 is the invalid data error that you're thinking of.
|
|