Developer reference
Who this is for
This page is for developers who need to extend the plugin using WordPress hooks and filters. Most users can accomplish everything through Settings without code.
Actions (hooks)
Actions let you run custom code at specific points in the password reset flow.
| Action | When it fires | Parameters | Use for |
|---|---|---|---|
somfrp_before_form | Before form HTML | None | Add notices, tracking |
somfrp_after_form | After form HTML | None | Add help text, links |
somfrp_lost_pass_action | After email validation | $user_info | Admin notifications |
somfrp_reset_pass_action | After password validation | $user, $new_pass | Log changes, send emails |
Examples
Add custom notice before form:
add_action( 'somfrp_before_form', 'add_security_notice' );
function add_security_notice() {
echo '<div class="notice">For security, ensure your email is correct.</div>';
}
Send admin notification:
add_action( 'somfrp_lost_pass_action', 'notify_admin' );
function notify_admin( $user_info ) {
wp_mail(
get_option( 'admin_email' ),
'Password Reset Request',
"User $user_info requested password reset"
);
}
Log successful password changes:
add_action( 'somfrp_reset_pass_action', 'log_password_change', 10, 2 );
function log_password_change( $user, $new_pass ) {
// NEVER log the actual password!
update_user_meta( $user->ID, 'last_password_reset', current_time( 'mysql' ) );
}
Filters
Filters let you modify data before the plugin uses it.
| Filter | What it modifies | Parameters | Use for |
|---|---|---|---|
somfrp_retrieve_password_title | Email subject | $title, $user_login, $user_data | Custom subject lines |
somfrp_retrieve_password_message | Email body | $message, $key, $user_login, $user_data | HTML emails, branding |
Examples
Customize email subject:
add_filter( 'somfrp_retrieve_password_title', 'custom_email_subject', 10, 3 );
function custom_email_subject( $title, $user_login, $user_data ) {
return sprintf( '[%s] Reset Your Password', get_bloginfo( 'name' ) );
}
Create HTML email:
add_filter( 'somfrp_retrieve_password_message', 'html_email', 10, 4 );
function html_email( $message, $key, $user_login, $user_data ) {
$reset_url = som_get_lost_password_url() . '?somresetpass=true&key=' . $key . '&uid=' . $user_data->ID;
return '<html><body style="font-family: Arial;">
<h2>Password Reset</h2>
<p>Hello ' . esc_html( $user_login ) . ',</p>
<p><a href="' . esc_url( $reset_url ) . '">Reset Password</a></p>
</body></html>';
}
Increase password reset link expiration time:
add_filter( 'password_reset_expiration', 'custom_password_reset_expiration', 10, 3 );
function custom_password_reset_expiration( $expiration_time, $user_id, $action ) {
// Set expiration time in seconds (e.g., 3 days = 259200 seconds)
return 259200; // Default is 24 hours (86400 seconds)
}
note
The password_reset_expiration filter is a WordPress core filter, not plugin-specific, but it works with Frontend Reset Password.
Helper functions
som_get_lost_password_url()
Returns custom password reset page URL (from plugin settings).
$reset_url = som_get_lost_password_url();
echo '<a href="' . esc_url( $reset_url ) . '">Forgot Password?</a>';
Settings access
Access plugin settings programmatically:
$general = get_option( 'somfrp_gen_settings' );
$security = get_option( 'somfrp_security_settings' );
$design = get_option( 'somfrp_design_settings' );
What's next
- Template overrides - Customize form appearance
- Styling and CSS - Visual customization
- Email customization - Customize emails