What it is
MemberHistory extensions accept member history records that have been stored and translate the data for display.
How to use
The extension defines 2 methods, and then you will need to store member history records separately when appropriate.
The parseLogType column accepts the log type as the $value parameter and the log data (the row from the database) as the $row parameter, and is expected to return a human-understandable representation of the log type. For instance, if a user is moved from Status A to Status B in your application, you will want to return a string similar to "Promoted from Status A to Status B". You can use a language string and sprintf arguments to accomplish this.
/**
* Parse LogType column
*
* @param string $value column value
* @param array $row entire log row
* @return string
*/
public function parseLogType( $value, $row )
{
return $value;
}
The parseLogData() method accepts the log data as the $value parameter and the entire row as the $row parameter and is expected to return a human-understandable string representing the log data. You can return raw HTML (for instance, to return a font-awesome icon representing the data type) or a generic string. You can reference applications/core/dev/html/admin/members/logType.phtml as an example HTML template used to represent certain log data types in the core application.
/**
* Parse LogData column
*
* @param string $value column value
* @param array $row entire log row
* @return string
*/
public function parseLogData( $value, $row )
{
return $value;
}
As previously mentioned, for this extension to have any use you will also need to log when a member's account has changed in some fashion. You can do this by calling the logHistory() method against the member.
/**
* Log Member Action
*
* @param mixed $app The application action applies to
* @param string $type Log type
* @param mixed $extra Any extra data for the type
* @param mixed $by The member performing the action. NULL for currently logged in member or FALSE for no member
*
* @return void
*/
public function logHistory( $app, $type, $extra=NULL, $by=NULL )
\IPS\Member::loggedIn()->logHistory(... );
Report Document