Best practice for Designing a Plugin with this scenario

You can create a page after your plugin is activated. Take a look at this: register_activation_hook( __FILE__, ‘insert_page’ ); function insert_page(){ $my_page = array( ‘post_title’ => ‘My Page’, ‘post_name’ => ‘MyPage’, ‘post_content’ => ‘My page’s content.’, ‘post_status’ => ‘publish’, ‘post_author’ => get_current_user_id(), ‘post_type’ => ‘page’, ); wp_insert_post( $my_page, ” ); } Then assign your template … Read more

How to set default’ => $current_user->user_login

Your question is not very clear to me but here’s a version of your code which you may try: <?php global $current_user; get_currentuserinfo(); return array( ‘author’ => array( ‘label’ => __(‘Author’, ‘ait-toolkit’), ‘type’ => ‘select-dynamic’, ‘dataFunction’ => ‘AitItemCpt::fillAuthorMetabox’, ‘default’ => $current_user->ID, // or try changing it to $current_user->user_login if it doesn’t work ‘capabilities’ => true, … Read more

Redirect users after login

I have tried your code with little modification in 2 Page Templates and it seems to be working. The only change I did was in the redirect parameter. Below is the updated code with the redirect parameter. You need to provide absolute path in redirect parameter. Please check the function reference of wp_login_form on following … Read more

Automatic Website user password generation

In Settings -> General -> Membership check the box Anyone can register. This setting allows new user to register and receive an e-mail with a link to reset his password. This method does not involve the administrator and it is secure, because no passwords are being send via e-mail.

WooCommerce Admin order – Only run action if user is loaded

One way of doing this is check with the get_current_user() and check if return something, if yes, run the code. Like the example below: add_action( ‘woocommerce_admin_order_data_after_order_details’, ‘ccef_order_switch_to’, 99 ); /** * Add a switch to user link on the order details. * * @param object $order The WC Order that we’re working with. */ function … Read more