Saturday, March 28, 2020

Wordpress wp-members customization - login failure message

How to Change the Message Displayed to Users When They Logon to WP-MEMBERS pages

The default link shown to users when they fail to logon is just URL/wp-profile which is just plain stupid. You can change it to a custom logon page.

You will be editing these files:
dialogs.php, class-wp-members.php and api-forms.php
full paths:
./wp-content/plugins/wp-members/includes/api/api-forms.php
./wp-content/plugins/wp-members/includes/class-wp-members.php
./wp-content/plugins/wp-members/includes/legacy/dialogs.php

Step1: Add a handler in api-forms.php

If you have a php file called login.php then it will show this link in the failure message. Add this near the bottom of the file.
...append this function to the end of api-forms.php...

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
function my_login_failed_msg( $str )
{
    // The generated html for the login failed message

    // is passed to this filter as $str and includes the

    // formatting tags. You can change it or append to it.

    $str = str_replace("/my-profile/", "/login.php", $str);

    return $str;
}

Step 2: Add this to class_wp_members.php

... add this line to a function called load_hooks() inside class_wp_members.php, add it near the end of the function right before the final IF statement.
add_filter( 'wpmem_login_failed', 'my_login_failed_msg' );
...

Step 3: Customize the wpmem_inc_loginfailed() failure handler

Find this in dialogs.php then add something to heading_before. By default this array element only has h2 in it. you can add an H1 element to spruce it up.
..here.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
        $defaults = array(
                'div_before'     => '<div align="center" id="wpmem_msg">',
                'div_after'      => '</div>',
                'heading_before' => '<h1>Smardii Partners</h1><h2>',
                'heading'        => $wpmem->get_text( 'login_failed_heading' ),
                'heading_after'  => '</h2>',
                'p_before'       => '<p>',
                'message'        => $wpmem->get_text( 'login_failed' ), // @todo $wpmem->error
                'p_after'        => '</p>',
                'link'           => '<a href="' . esc_url( $_SERVER['REQUEST_URI'] ) . '">' . $wpmem->get_text( 'login_failed_link' ) . '</a>',
        );
...


References:  https://rocketgeek.com/plugins/wp-members/docs/filter-hooks/wpmem_login_failed/
https://www.php.net/manual/en/function.str-replace.php

Wednesday, March 4, 2020

The QuickBooksDBXX service on Local Computer started and then stopped

The QuickBooks Database Service Just Starts and Then Stops


A typical small business scenario is to run everything from their Windows Domain Controller, using something like Small Business Server, or just using a single DC in a file server and QB server role. Sometimes the QB Database server will fail to start due to the competition for port 53, that it shares with the DNS server.   The fix is to stop the DNS Server service then start up the QB services first, finally start the DNS Server service.  There is some terrible advice on Intuit's own website. It's just plain wrong.  Do not try to reinstall Quickbooks Server.  The solution is to delay the start of DNS services, and to change the service user of the QB servers to QBDataServiceUserXX