You're reading our legacy documentation, the documentation for deprecated versions of UserFrosting. To read the docs for the current version of UserFrosting, visit learn.userfrosting.com.

    Forms API

    These are pages which accept a GET request and return a prerendered HTML form. Forms are rendered server-side so that they can be customized for a particular user's context. For example, the "user" form will render differently if we are creating, versus updating, a user's information. All form api pages are stored in the forms directory. Success, error, and warning messages are sent to the alert stream, and can be accessed via api/user_alerts.php.

    form_user.php

    Loads a customized form/panel for creating, updating, or displaying a user.

    Login required: no

    Securable page: yes

    GET request

    Variable nameDescription
    box_idThe desired id of the div that will contain the form.
    render_modeRender the form as a popup (modal) window, or in a flat panel. Set to modal or panel.
    [user_id]If specified, will load the relevant data for the user into the form. Used for viewing/updating a user.
    [fields]A list of fields to render. If not specified, the following fields will be rendered by default:
    • user_name
    • display_name
    • email
    • title
    • sign_up_stamp
    • last_sign_in_stamp
    • groups
    By default, they will all be read-only fields.
    [buttons]A list of buttons to render. If not specified, the following fields will be rendered by default:
    • btn_edit
    • btn_activate (inactive users only)
    • btn_enable (disabled users only)
    • btn_disable (enabled users only)
    • btn_delete

    GET response

    A JSON object containing the following fields:

    Variable nameDescription
    dataThe fully rendered HTML for the form/panel.

    Possible alerts generated

    • SQL_ERROR: Database error.
    • Authorization failed