inherit
173855
0
Apr 23, 2024 9:59:44 GMT -8
Texas
I check in every once in a while...
869
November 2011
petermaggio
|
Post by Texas on Nov 1, 2014 19:57:51 GMT -8
Hey, I'm (sort of) back. I have a little spare time and I'm itching to do something, so I'm doing a little developing with the intention of sticking around for a while. (although less active as I used to be)
Anyway, this is more of an informational post then anything else, I just came across something that I had been looking for in the past and I thought I'd share.
Whilst developing my Gold Shop plugin, I always wished I could figure out what users you could write data to, as you can only do it if they are linked to on the page. Yes, you can check if a user has data if you know there id, and thereby know they are on the page, but what if they don't have data? Then you are reduced to checking if a user has data every time you want to do anything with it, and that gets repetitive and confusing. You could also just loop through all "user-links" and create a list that way, but it's not very efficient.
So, upon my return to the ProBoards community, I tried to find a solution, and I have. I was viewing the source, when I noticed the "key permissions". This is an object which contains a list of users who are on the page (meaning they have been linked to and so you can give them data) and whether the current user can read and write to their key. This lead me to proboards.plugin.key.permissions, which returns an object containing previously mentioned permissions. By using Object.keys() you can then get an array of all users who a.
If any of you have any better way, or have anything to add, feel free to do so.
Note: This only works if you are using a super user key
|
|
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 Nov 2, 2014 14:56:13 GMT -8
it was changed so you could write to a key of a user not on the page. I made a feature request for that a while back. keep in mind though that unless its an array stored in the key, you will overwrite whatever is in there. but if its an array, you can use key.push to add stuff to it.
|
|
inherit
namaste
197894
0
Nov 15, 2013 13:06:18 GMT -8
Jaguar
Fear does not stop death. It stops life.
7,151
August 2013
sugilite
|
Post by Jaguar on Nov 2, 2014 15:00:43 GMT -8
Welcome [sort of] back Texas
|
|
inherit
173855
0
Apr 23, 2024 9:59:44 GMT -8
Texas
I check in every once in a while...
869
November 2011
petermaggio
|
Post by Texas on Nov 2, 2014 17:20:30 GMT -8
it was changed so you could write to a key of a user not on the page. I made a feature request for that a while back. keep in mind though that unless its an array stored in the key, you will overwrite whatever is in there. but if its an array, you can use key.push to add stuff to it. Oh, haha, well that makes things a lot more simple. It's still nice to know who is on the page though since it is more likely that you will be writing to their data if you're doing things correctly.
|
|
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 Nov 2, 2014 17:27:25 GMT -8
"correctly" is relative to the purpose. I had a purpose to write to off screen keys.
|
|
inherit
173855
0
Apr 23, 2024 9:59:44 GMT -8
Texas
I check in every once in a while...
869
November 2011
petermaggio
|
Post by Texas on Nov 2, 2014 17:42:42 GMT -8
Wormopolis, yeah, I actually have need of it too, I didn't really mean "correctly", there's no "correct" way to program, there are for sure ways to "incorrectly" program, but "correct" is only relative to the users imagination and the tools he has follow his imagination.
|
|