By Kevin on Thursday, 12 February 2015
Replies 11
Likes 0
Views 1.3K
Votes 0
When I set the value of a "Text" type Custom Field, I expect that field to display that text so long as the field's "View" tab is set accordingly.

However, when I set a "Text" type Custom Field via the following:

$my->setFieldValue( 'PASS_STYLE', "B3B3B3" );


it sets the value as the following excerpt:

object(SocialFieldValue)#1814 (8) { 
["value"]=> string(6) "B3B3B3"
["raw"]=> string(6) "B3B3B3"
["data"]=> string(6) "B3B3B3" }


but when viewed in the users Profile, I only ever see what was set by the Admin for this fields "Display Text" value.

The attached image and above example illustrates these steps.

I would expect that the value set by "setFieldValue" would then appear when available according to the settings in the "View" tab for that Custom Variable.

Are there other codes that need to be set in order for the new value rather than the default value to be shown?
Hello Eileen,

I would strongly suggest that you create a new field app rather than hacking the existing fields to achieve this. The "text" field for instance, doesn't rely on the user's input and it's getting the text from the params of the custom field.

Hence, regardless of what you are doing, it's only displaying the values that was configured in the field.
·
Sunday, 15 February 2015 15:33
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Eileen,

Sorry for late reply to this,
After you set the value already

$my->setFieldValue( 'PASS_STYLE', "B3B3B3" );

You have to get back the value what you set just now. Try add this :

$my->getFieldValue('PASS_STYLE');

And see how it goes? If still can't, can you provide us with your Joomla backend and FTP access so we can better have a lot?
·
Thursday, 12 February 2015 11:56
·
0 Likes
·
0 Votes
·
0 Comments
·
Thank you Arlex. Yes, I get the correct value returned from getFieldValue() but the end-user does not see this updated value as they will continue to see the "Display Value" that was set by the Admin.

I've attached an image below and have an example setup on a clean sandbox in site details of this note.

Thanks again!
·
Thursday, 12 February 2015 12:41
·
0 Likes
·
0 Votes
·
0 Comments
·
hello Eileen,

Sorry for late reply to this,

I have tried to access in your Joomla backend and FTP account, but i hitting this :

//backend
Warning
Username and password do not match or you do not have an account yet.

//FTP
Response: 530 Login authentication failed
Error: Critical error
Error: Could not connect to server

By the way, I'm still not very sure if "textbox" value you do not want to display on your user profile, you actually can set the default value to 'B3B3B3'. However, you mean the "textbox" value didn't show what you set the value right when you open user profile detail page? Please advise.
·
Thursday, 12 February 2015 23:54
·
0 Likes
·
0 Votes
·
0 Comments
·
Sorry the access information had troubles and your time spent not productive, I now have a big yellow sticky on my monitor "double check access credentials!" I have added the details attached.

I am able to set the textbox to a value via code. I am also able to retrieve that textbox value via code.

Here is my problem and goal with an attached image showing the problems http://www.screencast.com/t/3Z6zStflUXOG:


  1. Problem: the textbox value, as displayed to the end-user in their profile, does not show it's value as I have set it via code. Instead, the texbox, as displayed to the user in their profile, shows what the Admin had set as the default value for that textbox.

  2. Goal: I want to be able to set a default value for a texbox via the Admin back-end that can then be retrieved via code. Today, the default value that is set by the Admin for a textbox is not returned via code. A value will be returned via code only after one of these things happen: i) the value is set by the end-user, or ii) the value is set via code.

  3. As an example, I have added a second textbox. You'll see the value in the profile is Test if I can retrieve this text field value from code. but accessing the value via code I receive these values
    ["value"]=> string(0) "" ["raw"]=> string(0) "" ["data"]=> string(0)


  4. Goal: I want to be able to set the value for a textbox via code that will display for the user in their profile. Today, setting the textbox value via code does not result in that value being displayed for the user when they view their profile.

  5. As an example, you can see this in the first textbox where I set via code the value to This is a test and that value is returned when accessing the field via code. However, when looking at that texbox value in the user profile you still see the fields Default value:

    [{"membership":[{"name":"Silver","background":"B3B3B3","label":"141619"},{"name":"Gold","background":"BA9C00","label":"383000"},{"name":"Platinum","background":"9C9D9E","label":"141619"}]}]


·
Friday, 13 February 2015 00:45
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Eileen,

I'm really apologize that delayed of this reply and keep asking about your login credential

Because it still not work for me .

Can you ensure that you provided with your Joomla backend and FTP login credential is work? So that we can help you check on this quickly

At the same time, can you attach which file are you modifying so that we can at least test in our locally if provided your login credential still get failed.
·
Friday, 13 February 2015 14:43
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi Arlex,

It's snowing like crazy here in New England over the past two weeks --- so maybe the snowplow got my keyboard too

I've attached login credentials again with verification.

Meanwhile, here are the codes you could place in your local /media/com_easysocial/apps/fields/user/joomla_fullname in public function onDisplay after line 528 to see demonstration of the problem:

	require_once( JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/foundry.php' );

// Social user
$my = Foundry::user();

// set Custom Field
$state = $my->setFieldValue( 'PASS_STYLE', "This is a test" );
$testtext = $my->getFieldValue('PASS_STYLE');
print("<br>");
print_r("Text Field");
print("<br>");
print_r("======================");
print("<br>");
var_dump($testtext);

//
// Test to see if we can get the default value
//
$virgintext = $my->getFieldValue('VIRGIN-TEXT');
print("<br>");
print("<br>");
print_r("New Text Field Defaul Value");
print("<br>");
print_r("==========================");
print("<br>");
var_dump($virgintext);



As always, thank you for your professional support.
·
Friday, 13 February 2015 23:10
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Eileen,

The login / password is still not working, http://screen.stackideas.com/2015-02-14_1344.png . I cannot access the front end of your site and this is getting pretty annoying because this thread has been ongoing for quite a while

Anyway looking at the thread above, I really have no idea at all what you are trying to achieve here. Using "setFieldValue" will actually store the data on the database. The "text" field does not rely data from the database because it only reads the text value from what you set at the back end.
·
Saturday, 14 February 2015 13:51
·
0 Likes
·
0 Votes
·
0 Comments
·
what you are trying to achieve


I set Custom Field values, including "text", using ES Developer capabilities. I want users to see these Custom field values when they view their profile. The Boolean field does exactly this. I can set this value in the db and the user then sees the updated value I set when they view their profile. I can also access that same value from code. But, as you describe:

Using "setFieldValue" will actually store the data on the database. The "text" field does not rely data from the database because it only reads the text value from what you set at the back end.


How can I use a Custom profile "text" field so that: 1) I can set/get it's value to/from the db using ES layer 2) and the users will also see this value in their profile?
·
Sunday, 15 February 2015 01:05
·
0 Likes
·
0 Votes
·
0 Comments
·
ok, I understand that it's working as designed and I'm better off creating a new field app.
·
Monday, 16 February 2015 01:28
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Eileen,

Thanks for understanding.
·
Monday, 16 February 2015 11:34
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post