Display Names differ from Usernames in WordPress?

 

Do users register in your WordPress website and their profile display name is different than their registered Username? Well all you need to do is to add the below code in your functions.php file. This php code will force usernames to be the same as display names. Note that it is always recommended to write the code in the functions.php file located inside a child-theme because you will not lose any modifications you write there, even if you update your theme.

functions.php

function wpse_filter_user_data( $data, $update, $id) {
  if( isset( $data[ 'user_login' ] ) ) {
    $data[ 'display_name' ] = $data[ 'user_login' ];
    return $data;
  }
  $user = get_user_by( 'email', $data[ 'user_email' ] );
  $data[ 'display_name' ] = $user->user_login;
  return $data;
}
add_filter( 'wp_pre_insert_user_data', 'wpse_filter_user_data', 10, 3 );



Using Jquery-Ajax and PHP Mail function to send emails

In this tutorial, i will show you how to make a functional html contact form using Jquery-Ajax and php using the built in php mail function. Firstly i will download the html template  from codepen. Then we need to create the JavaScript code to collect user’s data which will be asynchronously sent to php. In PHP we will setup the headers and send the email.

Step 1: Find the html template (Design)

Firstly, we need to find the html template we like. There are lots of great html contact form templates that you can download for free. Personally, in this tutorial i used Minimalistic contact form found on colorlib. You can download it from codepen. To download as zip file, you can click on the export button on the bottom right of the page. Click and choose Export.zip. Now we have our template ready and we are ready to proceed with the JavaScript code.




Continue reading Using Jquery-Ajax and PHP Mail function to send emails

Php price calculation using checkboxes

Hello, in this tutorial, i will show you how to calculate price in php webpage using html checkboxes.

Step 1: Create the html form

The first thing you need to do is to create the html document and make the form with the checkboxes.

<form action="index.php" method="get">
<input name="choice[]" type="checkbox" value="1" /> Chicken, Price: 8 Euros<br/>
<input name="choice[]" type="checkbox" value="2" /> Meat, Price: 10 Euros <br/>
<input name="choice[]" type="checkbox" value="3" /> Potatoes, Price: 2.50 Euros<br/>
<input name="choice[]" type="checkbox" value="4" /> Salad, Price: 5 Euros <br/>
<input type="submit" value="order" />
</form>

The above code gives the following output:

Chicken, Price: 8 Euros
Meat, Price: 10 Euros
Potatoes, Price: 2.50 Euros
Salad, Price: 5 Euros



Step 2: Create the php code

It is required to make a new index.php  file, since the form action is set to index.php. Index.php is the file we will write the below code.

<?php
        if(isset( $_GET["choice"] ))
        {
        $food = $_GET["choice"];
        $c = count($food);
        $price = 0.0;
        
         for($i=0;$i<$c;$i++){
            if($food[$i] == 1){
                $price = $price + 8;
                echo "You have selected chicken<br>";
            }
            if($food[$i] == 2){
                $price = $price + 10;
                echo "You have selected meat<br>";
            }
            if($food[$i] == 3){
                $price = $price + 2.50;
                echo "You have selected potatoes<br>";
            }
            if($food[$i] == 4){
                $price = $price + 5;
                echo "You have selected salad<br>";
            }
        }//end for
        echo "<br>Final Price is:" .$price. "<br>";
        }//end isset
        else{
            echo 'Please choose something!';
        }

A complete result of this tutorial is like below:

Chicken, Price: 8 Euros
Meat, Price: 10 Euros
Potatoes, Price: 2.50 Euros
Salad, Price: 5 Euros
 

 

You can watch the video tutorial on youtube.

How to remove windows 10 login password (Easy steps)

Does windows 10 still asking for login password even if you unticked the checkbox in user accounts? It’s because you need to click apply and enter the correct password for that account, then go to sign in options and make sure require sign-in is set to never. Follow the steps on this video to remove windows 10 login password and login screen.



i5 650 vs Xeon x3470 (Rx 460 2gb): Benchmark on 5 games

In this video i am comparing two first generation CPUs with some benchmarks and gaming. i5 650 (dual core) is compared with the Xeon x3470 (quad core).

My pc specs on Dell Inspiron 580:

CPU: Xeon x3470 2.9 Ghz

Gpu: Rx 460 2gb Memory: 6gb ddr3 @ 1333Mhz

Motherboard: 0C2KJT

Benchmarked games: Cs go , Farcry Primal, witcher 3, gta v, battlefield 1. Note that games are recorded with software, so fps drop especially on the i5. My current PC specs: http://www.userbenchmark.com/UserRun/…




Frequently asked questions:

-Is Xeon x3470 still a good CPU in 2018?

Yes, combined with a gtx 1050ti, would be still very powerful to play most games with decent fps.

– Can Xeon x3470 be overclocked?

Yes, if your motherboard supports it.

-Where can i find that cpu?

You can find that used on Aliexpress for less than 35 EU

-How can i see if my motherboard supports Xeon x3470?

See for user benchmarks on that cpu in the following link: https://goo.gl/J7BSVG

-Do i need to replace the stock cooler when upgrading to xeon?

if xeon’s TDP (95 watts) is greater than your old cpu TDP, then yes.

Unknown directx error occurred in LoL in Windows 10 [2018 fix]

Did you build your new PC and you get directx issues in league of legends or any other game?
Don’t worry the solution is really simple, you have to install windows 10 graphics tools. Follow my video to do it.



 

If the below video did not help enough to fix the issue, replace your league of legends Game.cfg file, usually found on the following path : C:\Riot Games\League of Legends\Config\Game.cfg with the new Game.cfg found on the link below.