Ning OpenSocial Extensions

The Ning OpenSocial extensions allow you to query for viewer and container information that is unique to Ning.

Enabling Ning Extensions

If your application will only be running on Ning Networks, you can use the following require in <ModulePrefs>:

<Require feature="ning" />

Making the Ning extensions required will cause your application to fail when run in other OpenSocial containers. To make a portable application use the following line instead:

<Optional feature="ning" />

Then before any call to a Ning extension, test that it is available using:

if (gadgets.util.hasFeature("ning")) {
  // [... you are running on ning ...]
} else {
  // [... you are *NOT* running on ning ...]

Member Extensions


var env = opensocial.getEnvironment();

function response(data) {
  var user = data.get("req").getData();
  output("User: " + user.getDisplayName());

  if (env.supportsField(opensocial.Environment.ObjectType.PERSON, ning.Person.Field.CREATOR)) {
    var creator = user.getField(ning.Person.Field.CREATOR);
    output(creator ? "User is Network Creator!" : "User is not Network Creator!");
  } else {
    output("Container does not support " + ning.Person.Field.CREATOR);

  if (env.supportsField(opensocial.Environment.ObjectType.PERSON, ning.Person.Field.ADMIN)) {
    var creator = user.getField(ning.Person.Field.ADMIN);
    output(creator ? "User is Network Admin!" : "User is not Network Admin!");
  } else {
    output("Container does not support " + ning.Person.Field.ADMIN);


The method opensocial.getEnvironment().getDomain(); will return “” in all cases; this is to offer developers a way to differentiate between Ning and other social containers. Developers should use or if they would like a way to generate a unique primary key.

Container Information


The ning.core.AppStatus object is a function for Developers to easily find out whether their OpenSocial code is being run as a Ning App, a Profile View of a Ning App or a Profile App.

status = ning.core.getAppStatus();

if (status === ning.core.AppStatus.INDIVIDUAL) {
  output("I am a Profile App");
} else if (status === ning.core.AppStatus.NETWORK) {
  output("I am a Ning App");
} else if (status === ning.core.AppStatus.CHILD) {
  output("I am a profile view of a Ning App");
} else {
  output("Status is unknown, assume profile app");


To test the above code sample, add the OpenSocial Dev App as a Ning App and as a Profile App. Three different messages will be displayed from the above code sample, depending on the where the module is viewed.


ning.core.getNetworkDomain() returns the domain name of the Ning Network your application is running on.

Running this code on, returns If the network is using a custom domain name, the function will return the custom domain. For example, if your application was running on the network that had the custom domain mapping, the function will return This function will return whatever the user the member sees in their browsers address bar.

Note that using the common OpenSocial function:


Will return in all cases. This is to offer developers a way to differentiate between Ning and other social containers.

ning.core.getNetworkDomain() should not be used to uniquely identify a network, it can change over time. If you need a unique identifier for a particular Ning Network, use that is returned from


The version of the source code that the Ning Network is running. This is not the current OpenSocial version.

if (gadgets.util.hasFeature("ning")) {
  output("Current Container Version is " + ning.core.getContainerVersion());
} else {
  output("Not running on Ning!");


Ning Network Information

This function provides descriptive information about the Ning Network your application is running on. To a list of all of the properties use the following code in the OpenSocial Dev App:

function callback(foo) {
  if (foo.hadError()) {
    output("Error found!");
  } else {
    for (var x in {
      if ( {
        if (foo.getField([x])) {
          output("Field " + x + ": " + foo.getField([x]));

if (gadgets.util.hasFeature("ning")) {;
} else {
  output("Not running on Ning!");

As of this time, supports the following read-only attributes:

Field Description Sample Output
ID The unique ID for the Ning Network 2962556
NAME The name of the Ning Network. This is My Test Ning Network
DESCRIPTION The description of your Ning Network (['DESCRIPTION']) will not exist if no description exists) This is my Network Description.
TAGLINE The tagline of your Ning Network (['DESCRIPTION']) will not exist if no description exists) This is my Network Tagline
LOCALE The language of the Ning Network en_US
PUBLISHED Boolean value of whether your Ning Network has been published true
BAZEL Boolean value of if this is a Ning Network. true
SEARCHABLE Boolean value that states whether the network has been indexed in Ning Network searches. true
PUBLIC True if the Ning Network is public true
CREATED_DATE The date the Ning Network was created Wed Mar 04 00:39:39 GMT 2009
UPDATED_DATE The last time the Ning Network’s configuration was changed Fri Mar 06 00:49:39 GMT 2009
TZ_OFFSET The time zone the Ning Network is in 480
USING_DST True if the Ning Network is currently in daylight savings time true
TAGS The Ning Network’s tags Cooking, Hobbies
DOMAINS The domains the Ning Network uses
SUB_DOMAIN The Ning subdomain examplenetwork
MEMBER_COUNT Contains the total number of members in the Ning Network. 1