inherit
168679
0
Nov 18, 2012 17:03:07 GMT -8
Virgil Sovereign
Latet anguis in herba.
686
July 2011
syonidv
|
Post by Virgil Sovereign on Jul 16, 2017 5:29:13 GMT -8
This is a long shot, but just in case: I'm looking to append some options to the "Settings" tab of the "Edit Profile" UI. Is there a library or Proboards API call that does this? ( Peter: Would Yootil do this?) To be brutally specific, I'd like a few Yes/No radio buttons and a dropdown in a style consistent with the existing settings. I'd prefer to use a library if possible to avoid reinventing the wheel. If nothing exists, I'll cobble it together myself. On a related note: Is it possible to attach additional settings to an account (that would be accessible via "Edit Profile") that don't require a user key? If so, what are the limitations of storing per-user data?
|
|
inherit
Official Code Helper
65613
0
1
Oct 22, 2024 1:56:19 GMT -8
Chris
"'Oops' is the sound we make when we improve"
9,018
December 2005
horace
RedBassett's Mini-Profile
|
Post by Chris on Jul 18, 2017 22:12:52 GMT -8
Proboards dictates which fields get a storage slot in the database so adding your own field won't magically add a new slot to the database for storing your custom data. Back in the days we had to piggyback data on officially sanctioned fields in order to save the data online for subsequent retrieval, something along the lines of appending extra data to the spare space left in the personal text field, signature, etc. then retrieving and removing our data whenever the value for that field was rendered on a page. With the advent of V5 we got two official ways to store data remotely: plugin keys and custom profile fields and most plugins I've seen in that situation will employ a user key to save/load data specific to the user. Adding your own fields shouldn't be too hard if you use the clone method to retain the look and feel across various themes. The one concern which I recall coders such as Wormopolis had was the behaviour in blink of abandoning an ajax call when a form submit was initiated if the XHR was sent asynchronously which meant setting an event for saving to your key when the user pushed the save profile button was hit or miss in browsers using that engine. Proboards did however change that fairly recently from a form submit to a pure ajax call (I believe for that reason) thus eliminating that particular headache. There are several endpoints having to deal with saving via ajax from the profile tabs with the only one I've seen in actual use being: proboards.route("update_unified",{user_id:pb.data('page').member.id})
Other endpoints exists for specific tabs but I've yet to come across them in actual use so the required data is unknown but if we assume it is basically the same as the unified then it would simply be the serialized name/value pairs of the form fields (e.g. csrf_token=NunYabIZ&custom_title=%5Bb%5DOfficial+Code+Helper%5B%2Fb%5D&warning_level=0&warning_notes=&posts=7419&account_disabled=0...) but for the specific form rather than an amalgamation of all the various forms proboards.route("update_user_personal",{user_id:proboards.data("profileUserId")}) proboards.route("update_profile_header",{user_id:proboards.data("profileUserId")}) proboards.route("update_user_about",{user_id:proboards.data("profileUserId")}) proboards.route("update_user_social",{user_id:proboards.data("profileUserId")}) proboards.route("update_user_privacy",{user_id:proboards.data("profileUserId")}) proboards.route("update_user_settings",{user_id:proboards.data("profileUserId")}) proboards.route("update_user_admin",{user_id:proboards.data("profileUserId")})
|
|
inherit
168679
0
Nov 18, 2012 17:03:07 GMT -8
Virgil Sovereign
Latet anguis in herba.
686
July 2011
syonidv
|
Post by Virgil Sovereign on Jul 20, 2017 22:14:31 GMT -8
Thanks, Chris . I unfortunately don't have time to figure out whether or not I can piggyback new fields onto the read/write for editing settings. I'm going to use a user key and write to it using a separate event attached to the "Save" button. I'd seen custom profile fields mentioned before but I don't know how to create them or access them. Since I've been all over the plugin build tools, it stands to reason that however custom fields are created, plugins aren't it. I take it they're somehow attached to templates and allow for user-editable $[] variables in those templates? I was holding out hope that somewhere, somehow, somebody had implemented the library calls PBMadeEasyLib.profile.newField( { after : 'display_group', name : 'snow_hate', description : 'Indicate why you hate snow leopards.', type : 'radio', options : [ { name : 'Too Fuzzy', value : '0' }, { name : 'Not Fuzzy Enough', value : '1' } ], defaultValue : '0' } )
and PBMadeEasyLib.profile.getField( 'snow_hate', { defaultValue : '0' } ) thus making modification/access of custom profile settings a magical dream rather than splicing controls into the DOM and piggybacking data onto AJAX calls. But, I can splice and piggyback with the best of 'em.
|
|
inherit
Official Code Helper
65613
0
1
Oct 22, 2024 1:56:19 GMT -8
Chris
"'Oops' is the sound we make when we improve"
9,018
December 2005
horace
RedBassett's Mini-Profile
|
Post by Chris on Jul 21, 2017 6:09:36 GMT -8
That does indeed sound like something the yootil library was created to address so if you still have the time I would wait on Peter 's reply or peruse the library source yourself (I found this: Profile Content Box) but only a container creator you still need to add your own controls the old fashion way
|
|
inherit
2671
0
May 14, 2013 14:40:03 GMT -8
Peter
🐺
10,615
February 2002
peter3
|
Post by Peter on Aug 18, 2017 8:08:43 GMT -8
There is nothing for that unfortunately. The reason why, is that most of what is in Yootil is what I needed myself. Not many use the library, so usually what gets added is what I've needed at some point. Since I've never done a plugin that uses any profile settings pages, then that's likely why there is nothing.
Be nice to have though, feel free to submit some code. Do note though, Yootil is being rewrote completely for v6, but I can refactor anything that does get submitted and add it to v2 and then refactor it again once we know more about v6.
|
|