inherit
97216
0
Nov 26, 2024 13:53:14 GMT -8
Bennett 🚀
Formerly iPokemon.
3,622
January 2007
catattack
iPokemon's Mini-Profile
|
Post by Bennett 🚀 on Jul 11, 2013 10:30:52 GMT -8
I'm confused as to what exactly the question is? I can see moneyubbc keys as a guest. It's not accessible; I get an undefined return after using proboards.plugin.key('moneyubbc').get(); It only works as the admin account (admin username, not the group). I tried promoting another account of mine, still didn't work for me when staff.
|
|
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 Jul 11, 2013 10:55:41 GMT -8
["moneyubbc", 1, "{\"admin\":500,\"shadowlark2\":633,\"allisonross\":500,\"xenia\":500,\"hunter01\":500,\"zane\":500,\"aurelio\":500,\"ayame\":500}"]
all data is being stored in the superuser key for account 1.
if account 1 doesnt appear on the page (in the form of a link or something) then I dont think the key values are initialized.
|
|
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 Jul 11, 2013 11:07:08 GMT -8
Yeah, like I said, I can see the data for that key as a guest. I'm not familiar with the structure of your data for this particular plugin, but it seems like (as Wormo pointed out) you're not correctly assigning data to users.
Edit: As a sidenote, I checked the database, and the permissions are set correctly to be visible/accessible by everyone.
|
|
inherit
97216
0
Nov 26, 2024 13:53:14 GMT -8
Bennett 🚀
Formerly iPokemon.
3,622
January 2007
catattack
iPokemon's Mini-Profile
|
Post by Bennett 🚀 on Jul 11, 2013 11:08:19 GMT -8
Oh. So super user keys correspond to the user viewing the page? I thought it was a global key, meaning it was viewable by everyone!
So then how am I to combat that?
|
|
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 Jul 11, 2013 11:17:24 GMT -8
not the viewer, but a reference to a member must already exist on the page for a .get() to work. otherwise it would have to list key data for every single member of the forum on every page load.
|
|
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 Jul 11, 2013 11:19:00 GMT -8
It is global in that any user (with the proper permissions) can get/set a super key. However, we don't load all the values for a particular super key on every page load. Instead, we load the values for those users whose data is loaded for the page currently being viewed. This drastically cuts down the amount of data we could theoretically need to load on every page view when a super key is in use. I don't know much of anything about your specific plugin, but the general idea is to assign the data relevant to a particular user to a key that corresponds to that user. So, from your example, the key data that is returned with .get(1) would be the data describing the admin user, while the key data returned with .get(16) would refer to the data describing 'shadowlark2'.
|
|
inherit
97216
0
Nov 26, 2024 13:53:14 GMT -8
Bennett 🚀
Formerly iPokemon.
3,622
January 2007
catattack
iPokemon's Mini-Profile
|
Post by Bennett 🚀 on Jul 11, 2013 11:23:00 GMT -8
It is global in that any user (with the proper permissions) can get/set a super key. However, we don't load all the values for a particular super key on every page load. Instead, we load the values for those users whose data is loaded for the page currently being viewed. This drastically cuts down the amount of data we could theoretically need to load on every page view when a super key is in use. I don't know much of anything about your specific plugin, but the general idea is to assign the data relevant to a particular user to a key that corresponds to that user. So, from your example, the key data that is returned with .get(1) would be the data describing the admin user, while the key data returned with .get(16) would refer to the data describing 'shadowlark2'. So then how should I store something so that everyone can access it, no matter if their data is loaded? Just use .get(1) for everything? and .set(1) as well?
|
|
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 Jul 11, 2013 11:28:02 GMT -8
That's what you're currently doing, and will only work as long as the admin account is loaded on the page somewhere. What data is it you're trying to make available?
|
|
inherit
97216
0
Nov 26, 2024 13:53:14 GMT -8
Bennett 🚀
Formerly iPokemon.
3,622
January 2007
catattack
iPokemon's Mini-Profile
|
Post by Bennett 🚀 on Jul 11, 2013 11:31:03 GMT -8
That's what you're currently doing, and will only work as long as the admin account is loaded on the page somewhere. What data is it you're trying to make available? The data of the key 'moneyubbc'; it's for a custom money plugin I made (obviously). So I could save each of the user's data in the global key with .set(id). Too bad I can't convert from username to ID.. would make the ubbc portion of it a lot easier to figure out so my staff don't have to track around for the user they're modding's ID. I could make it available in their mini profile I suppose. Thanks for the help.
|
|
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 Jul 11, 2013 13:34:29 GMT -8
I understand it's that data, but what is that data supposed to represent? When and how is that data supposed to be updated? In almost every case, you don't need to keep track of a user's username, you can just use their ID to track the data, and display it in the appropriate place using the ID.
I can't be more specific than that without knowing what data you're trying to store, and how it's both used and updated.
|
|
inherit
97216
0
Nov 26, 2024 13:53:14 GMT -8
Bennett 🚀
Formerly iPokemon.
3,622
January 2007
catattack
iPokemon's Mini-Profile
|
Post by Bennett 🚀 on Jul 11, 2013 13:39:44 GMT -8
Here's an example situation:
A person wins a battle, they receive money. Their account is added on using ubbc ([money add/subtract="amount" uid="(\d+)" reason="optional"]); this data is stored per post. If there are multiple, it's put into an array and stringified and saved in the post_key. Now, if the post hasn't been parsed and saved already, it will add on to/subtract from the moneyubbc value of that user.
So, per thread, I'm requesting each of the mini-profile related data in the moneyubbc key and displaying it. It's saved in a variable so I can edit it without having to call it every time; this variable data is then used to display the mini-profile data because then I can use it to update that text when the UBBC is used.
|
|
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 Jul 11, 2013 14:42:51 GMT -8
What's the UID for?
I'm going to make the following assumptions: - You want specific members (staff, most likely) to be the only ones adding/removing money from a user's 'account' - You want the optional reason for gain/loss to be displayed on the post where the action occurred - You want a user's 'balance' to display somewhere standard (profile page or mini-profile, most likely)
I'd go about this in the following way:
if (we're on a page with posts (thread, search results, recent posts, etc.)) { foreach (post on page) { display_record(post_id); if(current_user is allowed to handle money) { insert button with click handler that calls get_dialog(post.creator.id, post.id) } } }
function display_record(post_id) { $('#post-' + post_id).append(html to display the data from plugin_post_key.get(post_id)) }
function get_dialog(user_id, post_id) { create new proboards.dialog add text field for amount to add/remove add textarea for reason add ok/cancel buttons on_ok_press { // These get the old value, change it, and set it again oldValue = plugin_user_key.get(user_id); plugin_user_key.set(user_id, (oldValue + newValue));
// This sets the data for the post to display plugin_post_key.set(post_id, { amount: $500, reason: 'Just Because' }
// This displays the post's record so we don't have to refresh display_record(post_id); }
on_cancel_press { close dialog } }
Granted, that's just some spit-balled psuedo-code, but I think it achieves what you're looking for. As an added benefit, no more typing in weird psuedo-html, it's all handled with dialogs, which also provides room for error-handling and such. This code would need to be modified slightly if money is modified for a particular user or post more than once per page load (e.g., make all the dialogs set variables rather than keys, and then provide a save button to save the total changes to a key somewhere, probably with an onbeforeunload call to make sure that the moderators don't accidentally forget to save their work). The setting of the post key would similarly be complicated slightly, but pushing items onto an array is a simple enough modification.
|
|
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 Jul 11, 2013 15:09:15 GMT -8
is there any documentation on proboards.dialog ?
|
|
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 Jul 11, 2013 15:22:38 GMT -8
I don't believe so, but I'm pretty sure it's mostly a straightforward implementation of api.jqueryui.com/dialog/. I dug up a quick example: proboards.dialog('dialog_id', { html : "Dialog Content", title : "Dialog Title", height : 700, width : 700, resizable : false, buttons : [{ text: button, click: function() {} }] });
|
|
inherit
2671
0
May 14, 2013 14:40:03 GMT -8
Peter
🐺
10,615
February 2002
peter3
|
Post by Peter on Jul 11, 2013 15:42:09 GMT -8
|
|