add_filter( 'wpmem_login_form', function( $form, $action ) { global $wpmem; if ( 'login' == $action ) { // HTML for forgot password link will be this in a standard setup. $forgot_link_html = '<div class="link-text"><span class="link-text-forgot">Forgot password? <a href="' . add_query_arg( 'a', 'pwdreset', $wpmem->user_pages['profile'] ) . '">Click here to reset</a></span></div>'; // Remove forgot link html from form with str_replace( $old, $new, $string ). $form = str_replace( $forgot_link_html, '', $form ); /* * Now put the forgot link string into the HTML before the login button. * This is the tricky part. Uses wpmem_get_sub_str() utility which splits * a string into parts. We can use that to split the form html (with the * fogot link HTML already extracted above) at the point where the login button is. */ $needle = '<input name="a" type="hidden" value="login" />'; $haystack = $form; $form_parts = wpmem_get_sub_str( $needle, $haystack, 'split', true ); /* * Return the split form HTML with the forgot link html inserted in between * (We split it at the form button so everything from the button on to the end * is in the "after" portion). */ return $form_parts['before'] . $forgot_link_html . $form_parts['after']; } // If this is not the login form, return the unchanged form. return $form; }, 10, 2);
Not sure what to do with this code?
You're not a "coder" and don't know what to do? Don't worry! Code Snippets are the basic building blocks of WordPress customization, and once you know the basics, they are simple to use.
Here are some free articles to get you started:
- Using Code Snippets from the Site
- Using a code snippets plugin
- The functions.php File
- Create a plugin file for custom functions
- Create a child theme
- Do not modify plugin files!
For "hands on" help, consider a plugin support subscription or the Pro Bundle.