Jump to content

Create a new super user?


Recommended Posts

Hello

Can anyone help with the following please?

We are new to Processwire having just inherited a site designed using the software.

We have been given a login user name and password but it appears it is not for a super user account.

With the limited access we have is there a way to either upgrade the account we do have or create a new super user?

Any help much appreciated.

David

Link to comment
Share on other sites

Hello Jonathan

Many thanks for the quick reply and advice.

I tried the code and ran it on our url/reset.php

However I still can not login in with user admin.

We seem to have ProcessWire 2.2.3

We have no actually forgotten our password just don't have a super user account we can access.

Does this code assume there is a default admin account and it is this password we are resetting?

Sorry for lack of knowledge, this is new to us.

Thanks

David

Link to comment
Share on other sites

Be careful with your site. 😉

Please create a backup of your website files and database first before trying anything else.

No access is better than no site.

Does your /reset.php work or do you see a 404 page not found page or errors at all?

If it does work you could try this code to create a new SUPERUSER:

<?php

// if previously tried with this solution
// https://processwire-recipes.com/recipes/resetting-admin-password-via-api/
// you need to include ProcessWire here as well - line below
// require "index.php";

    $newadmin = new User();
    $newadmin->of(false);
    $newadmin->name = "newCmsAdminUser";
    $newadmin->email = "user@domain.tld";
    $newadmin->pass = "aSecurePasswordHere";
    $newadmin->addRole("superuser");
    $newadmin->save();
    $newadmin->of(true);
?>

I really don't know if this will work with ProcessWire 2.2.3 or if you need further adjustments.

 

 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...