# WordPress new user notifications on your phone > Get a push notification when a new user account is created on your WordPress site, with their role, so an unexpected administrator stands out. - Company: WordPress (https://www.justpush.io/recipes/wordpress) - Event: `user.registered` (New user registration) - Tags: Websites, Security - Install: https://studio.justpush.io/recipes/wordpress/new-user - Web page: https://www.justpush.io/recipes/wordpress/new-user ## Setup 1. Click Install in Studio and sign in. The recipe is added to your account and you get a personal webhook URL. 2. Copy the PHP snippet from the setup notes below. It already contains your endpoint URL. 3. Save it as a new .php file in wp-content/mu-plugins/ on your site (create the folder if it doesn't exist). 4. WordPress loads it automatically. Trigger a New user registration to test. 5. WordPress doesn't send webhooks by itself, so this recipe comes with a small **must-use plugin**. Save the code below as `wp-content/mu-plugins/justpush-new-user.php` (create the `mu-plugins` folder if it doesn't exist). WordPress loads files there automatically; there's nothing to activate. 6. ```php 7. false, // don't slow the page down waiting for JustPush 20. 'timeout' => 3, 21. 'headers' => array('Content-Type' => 'application/json'), 22. 'body' => wp_json_encode(array( 23. 'event' => 'user.registered', 24. 'site' => get_bloginfo('name'), 25. 'name' => $user->display_name, 26. 'email' => $user->user_email, 27. 'roles' => array_values($user->roles), 28. 'url' => admin_url('user-edit.php?user_id=' . $user_id), 29. )), 30. )); 31. }, 100, 1); 32. ``` 33. To stop the notifications, delete the file. ## Code Studio calls `handleRequest(request)` with the incoming webhook (`{ method, headers, body, query, raw }`) and sends the message object it returns. Returning `null` sends nothing. ```js // WordPress → new user registration // Fires when the "JustPush — New user" mu-plugin (see INSTALL.md) reports a // "user.registered" event. WordPress has no webhooks of its own, so the snippet sends them. // The snippet sends plain strings; treat blanks as missing. function text(value) { return typeof value === "string" && value.trim() ? value.trim() : null } // Only link to real http(s) URLs. function link(url, cta) { return typeof url === "string" && /^https?:\/\//.test(url) ? [{ cta, url }] : [] } function handleRequest(request) { const event = request.body // Guard: only handle this recipe's event, so other snippets on this integration stay quiet. if (event?.event !== "user.registered") { console.log(`Ignoring WordPress event "${event?.event ?? "unknown"}"`) return null } const roles = Array.isArray(event.roles) ? event.roles.filter((role) => typeof role === "string") : [] // A new administrator you didn't create is a classic sign of a compromised site. const admin = roles.includes("administrator") const who = text(event.name) ?? text(event.email) ?? "Someone" const email = text(event.email) && text(event.email) !== who ? ` (${text(event.email)})` : "" return { title: admin ? "🛡️ New administrator account" : "👤 New user", message: `${who}${email} joined` + (roles.length ? ` as ${roles.join(", ")}` : ""), topic: "WordPress", priority: admin ? 1 : -1, // High for admins, Low for everyone else buttons: link(event.url, "View user"), } } ``` ## WordPress user.registered webhook payload (sample) ```json { "url": "https://example.com/wp-admin/user-edit.php?user_id=42", "name": "Sam Lee", "site": "My Site", "email": "sam@example.com", "event": "user.registered", "roles": [ "subscriber" ] } ``` ## FAQ ### Does this work on iPhone and Android? Yes. Install the JustPush app from the App Store or Google Play and sign in. Every phone signed in to your account gets the notification. ### Do I need to write code? No. Install the recipe in Studio, paste your webhook URL into WordPress and you are done. The code is there if you want to change the text, the sound or the buttons. ### Can I change what the notification says? Yes. After install the recipe's code is yours. Edit it in Studio and test it against the sample payload before you save. ### What does it cost? JustPush is free for 30 days. After that it's $19.99 a year, or $39.99 once. There is no extra charge for recipes.