Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: FAQ: How To, Code Snippets and Solutions

I once posted a forum article about having profile information in the registration-mail to the admin, when a new member registers. We couldn’t accomplish that, but a friend of mine made it possible to have a direct link to the members-profile. That’s one click away and helps me very much, so that I don’t have to search for them. Here is the code, just put it in a php-file and in the mu-plugins folder:

<?php
/*
Plugin Name: My Register Form
Description: Customisations for the Registration Form
Version: 0.1
Author: Marc Cawood
*/

// Custom Message in Registration Mail
add_filter( 'newuser_notify_siteadmin', 'my_newuser_notify_siteadmin');

function my_newuser_notify_siteadmin($msg) {
global $current_site;
// Extract member name
$member = substring_between($msg, ': ', "n");
// Link to member profile
$member_url = clean_url("http://{$current_site->domain}{$current_site->path}members/".$member."/profile");
return $msg . "nn" . $member_url;
}

function substring_between($haystack,$start,$end) {
$start_position = strpos($haystack,$start)+strlen($start);
$end_position = strpos($haystack,$end);
return substr($haystack,$start_position,$end_position-$start_position);
}

?>

Skip to toolbar