JSPT Docs > Case Studies > JSPT API

JSPT API

This JSPT API allows you to customize certain functionality according to your needs.

Collect User's Profile Type from user-id

function getUserProfiletype($userid, $what='id')
  • $userid - The first parameter is the Unique id of user.
  • $what=' ' - The second parameter is the user's profile type id or users profile type Name. You can mention it accordingly{$what='name',$what='id'}. If you do not mention anything then by default value is 'id' .

hence, This function will return either ProfileType id or ProfileType Name.

Update user's Profile Type

function setUserProfiletype($userId, $profiletypeId, $reset = 'ALL')
  • $userId - The first parameter is the Unique id of that user whose profiletype want to update.
  • $profiletypeId - The second parameter is the new Profiletype Id.
  • $reset =' ' - The third parameter is the attributes you want to reset, you can use (profiletype, jusertype, avatar, group, privacy etc.). You can mention it accordingly{$reset='profiletype',$reset='jusertype' etc. }. If you do not mention anything then default is 'ALL' .

hence, This function will not return anything.

Give the Profile Types attributes

function getProfiletypeInfo($id=0, $filter=array())
  • $id=0 - The first parameter is the Profiletype Id. if Profiletype Id is specify than function returns particular Profiletype information otherwise function returns all profiletypes.
  • $filter=array() - The second parameter is the Associative array to define conditions. For e.g., If you want to get Published Profiletype information than value of $filter will be array('published'=>1).

hence, This function will return Array of Profiletype Objects.

Get Default Profile Type

function getDefaultProfiletype()

hence, This function will return default Profile Type.

Get User's Information

function getUserInfo($userid, $what='PROFILETYPE')
  • $userid - The first parameter is the Unique id of user.
  • $what=' ' - The second parameter is 'PROFILETYPE' or 'TEMPLATE'. You can mention it accordingly. If you do not mention anything then default is 'PROFILETYPE'.

hence, This function will return user information.

Get Global Configuration settings in JSPT

function getGlobalConfig($paramName='', $defaultValue=0)
  • $paramName=' ' - The first parameter is Parameter Name whose value is require
  • $defaultValue=0 - The second parameter is the default value. If setting is not find out in global configuration than default value will be returned.

hence, This function will return value from configuration settings.

Get Profile Type Name

function getProfileTypeName($profileTypeId)
  • $profileTypeId - The first parameter is the Profiletype Id.

hence, This function will return Profile Type Name.

Get Profile Type Id

function getProfileTypeIds($filter= '')
  • $filter=' ' - The first parameter is the Associative array to define conditions. For e.g., If you want to get Published Profiletype information than value of $filter will be array('published'=>1).

hence, This function will return array of all published Profile Type id.

Get JomSocial Profile Fields

function getJSProfileFields($fieldId=0)
  • $fieldId - The first parameter is the field id. If field Id is not given than return objects of all fields.

hence, This function will return Object of field id.

Get Profile-Type fields according to Profile Type

function filterProfileTypeFields(&$fields, $selectedProfiletypeID, $from)
  • &$fields - The first parameter is the fields information.
  • $selectedProfiletypeID - The second parameter is the selected profile type id.
  • $from - The third parameter is the '_loadAllFields', 'getEditableProfile' or 'getViewableProfile' information.

hence, This function will return filtered Profile-Type fields according to Profile Type.

  • Thursday, 18 November 2010

Comments (0)

Leave a comment

You are commenting as guest.