Ning Developer Network

I followed the Adding Visibility Options to Your Member Profile Pages tutorial exactly but
submitting the form always fails due to an "Unknown property: profileVisibility" error.
I double- and triple checked the code for any typos but I cannot find any. The form-data
is submitted properly but calling "$user->save();" always breaks it.

snippet from /widgets/index/models/user.php
[code]
.....
public $displayGender;
public $displayGender_choices = array('Y','N');

// additional option to toggle profile visibility
public $profileVisibility;
public $profileVisibility_choices = array('all', 'friends', 'me');

/** xn-ignore-start 2365cb7691764f05894c2de6698b7da0 **/
// Everything other than instance variables goes below here
.....
[/code]


snippet from /widgets/profiles/controllers/ProfileController.php
[code]
.....
$user->my->activityEvents = $_POST['activityEvents'] ? 'Y' : 'N';
}
$user->my->profileVisibility = $_POST['profileVisibility'];
$user->save();
........
[/code]

As far as I have seen in the documentation for the XNS/"Ning Content Store", the
property should exist as soon as I first call or declare it. So actually the line
"$user->my->profileVisibility = $_POST['profileVisibility'];" should be enough.
Or does anyone know what important part I am missing?

Tags: comment, custom, doc, fields, property, solved, unknown

Share

Replies are closed for this discussion.

Replies to This Discussion

OK. That was my own fault as I did not follow the tutorial meticulously enough.
Inserting the appropriate comment into models/User.php did the trick:
[code]
/**
* Who may see your profile.
*
* @var XN_Attribute::STRING optional
* @rule choice 1,1
* @since 3.2
*/
public $profileVisibility;
public $profileVisibility_choices = array('all', 'friends', 'me');
[/code]

RSS

© 2009   Created by Ning Developer Admin

Badges  |  Report an Issue  |  Privacy  |  Terms of Service