0
votes

Can I apply it in WordPress like the entry of the site I have given below? There are many plugins on this subject but they don't meet my needs. ex: http://example.com/wp-login.php?autologin=demo I don't want a long link like this, I will login normally ex: http://example.com/wp-admin/ Then there will be login buttons Admin, Store Manager, User Whatever button I press, that username and password will automatically enter I want to do the same site entry below in WordPress.

Sample Site : https://demo.smart-school.in/site/login

1

1 Answers

2
votes

To accomplish that, you should make a copy of wp-login.php and add the buttons yourself. With the help of JavaScript you could code something like this:

<p><button onclick="myFunction()">Administrator</button></p>

This creates a button.

<div id="myDIV">[email protected]</div>

And this is the text you want to change.

<script>
function myFunction() {
  var x = document.getElementById("myDIV");
  if (x.innerHTML === "[email protected]") {
    x.innerHTML = "[email protected]";
  } else {
    x.innerHTML = "[email protected]";
  }
}
</script>

Changing the text is possible with this script.

Another way of accomplishing this is by creating custom login links. I think this is going to be the easiest option for you. With a plugin like 'Autologin Links' (https://nl.wordpress.org/plugins/autologin-links/) you can create automatic login links for all users.

Connect the links, like this, to different buttons and you are ready to go.

<button onclick="window.location.href='/page1'">Superuser</button>
<button onclick="window.location.href='/page2'">Admin</button>
<button onclick="window.location.href='/page3'">Viewer</button>