portal_send_login()

Email one person their portal login: InfoLobby generates a password, saves it to their record and sends it with the portal's Welcome email. It is the same as pressing Send login under Portal settings, then People. Run it in a loop to invite a whole list at once.

Syntax

portal_send_login(portalId, recordId)

Parameters

Name Type Required Description
portalId int yes The portal's id: the number at the end of its address in the portal builder, /portals/<id>.
recordId int yes A record on the portal's sign-in table. Usually $record["_meta"]["id"]. Also accepts a whole record.

Returns

The email address the login went to.

Example

Invite everyone marked "Ready" in one run:

$rows = records_query("clients", ["field" => "status", "op" => "=", "value" => "Ready"](/help/field-status-op-value-ready));
foreach ( $rows as $row ) {
    portal_send_login(7, $row);
    record_update("clients", $row["_meta"]["id"], ["status" => "Invited"]);
}

Or send one login whenever a record is created, from an automation on the sign-in table:

portal_send_login(7, $record);

Example output

"jane@acme.example"

Notes

  • The password is never returned to your automation and never appears in its run log. Use this rather than writing a password yourself and emailing it with smtp_email_send(): that email, password included, is saved in the run log, where every workspace admin can read it.
  • Each call sets a new password and signs that person out everywhere. Running it twice for the same person sends two different passwords and only the second works.
  • The portal must be published, and its sign-in table must be in this automation's workspace scope.
  • Throws if the record has no email address or the email cannot be sent. Portal email limits apply: 4 emails per person every 15 minutes, and 300 per portal per hour. For a list bigger than that, invite in batches.
  • portal_send_link() sends a one-use sign-in link instead of a password.