Jump to content

Module:Contact

From nUSA Wiki
Revision as of 23:45, 3 January 2025 by Jord (talk | contribs) (Created page with "local p = {} function p.form( frame ) local username = mw.title.getCurrentTitle().getText() -- Get the current username (assumes the user is logged in) local subject = frame.args.subject or "" -- Get the subject input, if present local message = frame.args.message or "" -- Get the message input, if present -- Create a simple form for submitting the message return string.format([[ <form action="/w/index.php" method="post"> <input type=...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:Contact/doc

local p = {}

function p.form( frame )
    local username = mw.title.getCurrentTitle().getText()  -- Get the current username (assumes the user is logged in)
    local subject = frame.args.subject or ""  -- Get the subject input, if present
    local message = frame.args.message or ""  -- Get the message input, if present

    -- Create a simple form for submitting the message
    return string.format([[
    <form action="/w/index.php" method="post">
        <input type="hidden" name="title" value="Special:Contact">
        <input type="hidden" name="username" value="%s">
        <label for="subject">Subject:</label>
        <input type="text" name="subject" value="%s" required>
        <br>
        <label for="message">Message:</label>
        <textarea name="message" required>%s</textarea>
        <br>
        <input type="submit" value="Send Message">
    </form>
    ]], username, subject, message)
end

return p