<<

NAME

MT::Author - Movable Type author record

SYNOPSIS

    use MT::Author;
    my $author = MT::Author->new;
    $author->name('Foo Bar');
    $author->set_password('secret');
    $author->save
        or die $author->errstr;

    my $author = MT::Author->load($author_id);

DESCRIPTION

An MT::Author object represents a user in the Movable Type system. It contains profile information (name, nickname, email address, etc.), global permissions settings (blog creation, activity log viewing), and authentication information (password, public key). It does not contain any per-blog permissions settings--for those, look at the MT::Permission object.

USAGE

As a subclass of MT::Object, MT::Author inherits all of the data-management and -storage methods from that class; thus you should look at the MT::Object documentation for details about creating a new object, loading an existing object, saving an object, etc.

The following methods are unique to the MT::Author interface:

$author->set_password($pass)

One-way encrypts $pass with a randomly-generated salt, using the Unix crypt function, and sets the password data field in the MT::Author object $author.

Because the password is one-way encrypted, there is no way of recovering the initial password.

$author->is_valid_password($check_pass)

Tests whether $check_pass is a valid password for the MT::Author object $author (ie, whether it matches the password originally set using set_password). This check is done by one-way encrypting $check_pass, using the same salt used to encrypt the original password, then comparing the two encrypted strings for equality.

DATA ACCESS METHODS

The MT::Author object holds the following pieces of data. These fields can be accessed and set using the standard data access methods described in the MT::Object documentation.

  • id

    The numeric ID of the author.

  • name

    The username of the author. This is the username used to log in to the system.

  • nickname

    The author nickname (or "display" name). This is the preferred name used for publishing the author's name.

  • password

    The author's password, one-way encrypted. If you wish to check the validity of a password, you should use the is_valid_password method, above.

  • type

    The type of author record. Currently, MT stores authenticated commenters in the author table. The type column can be one of AUTHOR or COMMENTER (constants defined in this package).

  • status

    A column that defines whether the records of an AUTHOR type are ACTIVE, INACTIVE or PENDING (constants declared in this package).

  • commenter_status

    This method requires a blog id to be passed as the argument and a value of APPROVED, BANNED or PENDING (constants declared in this package) is returned.

  • email

    The author's email address.

  • url

    The author's homepage URL.

  • hint

    The answer to the question used when recovering the user's password. Currently this is the birthplace of the author, though this may change in the future.

  • external_id

    A column for holding a value used to synchronize the MT author record with an external record.

  • can_create_blog

    A boolean flag specifying whether the author has permission to create a new blog in the system.

  • can_view_log

    A boolean flag specifying whether the author has permission to view the global system activity log.

  • created_by

    The author ID of the author who created this author. If the author was created by a process where no user was logged in to Movable Type, the created_by column will be empty.

  • public_key

    The author's ASCII-armoured public key, to be used in the future for verifying incoming email messages.

DATA LOOKUP

In addition to numeric ID lookup, you can look up or sort records by any combination of the following fields. See the load documentation in MT::Object for more information.

  • name
  • email

NOTES

  • When you remove an author using MT::Author::remove, in addition to removing the author record, all of the author's permissions (MT::Permission objects) will be removed, as well.

AUTHOR & COPYRIGHTS

Please see the MT manpage for author, copyright, and license information.

<<