Forum Discussion

peterlu's avatar
peterlu
Champion
12 years ago

custom user setting problem / issue

<#if !user.anonymous>

profile.user.data = ${settings.name.get("profile.user.data")}

<@liaAddScript>
;(function($) {
	$.post("/restapi/vc/users/self/profiles/name/user.data/set", {value: "my user data Two"}).done(function(data) {
		console.log(data);
		alert("done");
	}).fail(function() {
		alert("error");
	});
})(LITHIUM.jQuery);
</@liaAddScript>

</#if>

 

This code prints out

profile.user.data = my user data ONE

and when I tried to set it to "my user data Two", I got "error code 100 - An unexpected error has occured" in the response. I was logged in as admin, and I was testing it inside studio component editor.

 

I have also tried all these:

$.post("/restapi/vc/users/self/profiles/name/user.data/set", ...

$.post("/restapi/vc/users/self/profiles/name/profile.user.data/set", ...

$.post("/restapi/vc/users/self/settings/name/user.data/set", ...

$.post("/restapi/vc/users/self/settings/name/profile.user.data/set", ...

Also no luck.

 

BTW, lithium team helped us set up this:

[profile]

user.data    :wcu   string  0   64000

 

Thanks.

  • JasonL's avatar
    JasonL
    Lithium Alumni (Retired)

    Hi Peter,

    could it be the &colon?

     

    data &colon;  {			
    						value:"newuserdata"
    					},

     

    • peterlu's avatar
      peterlu
      Champion

      no, &colon; is just the copy and paste error by wysiwyg.

       

      BTW, i have updated the original post.

      • peterlu's avatar
        peterlu
        Champion

        is there any TKB article or guidde on how to set and retrieve custom settings?