News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

How to make old forum ARCHIVED?

Started by akoladica, January 26, 2012, 12:12:45 PM

Previous topic - Next topic

akoladica

So everybody can read posts and search for old topics, but can not login and use forum in normal way.
So ARCHIVE only.

Of course Administrator needs to access still everything as adming.


kat

The entire forum?

Allow guest views, remove all membergroups, except guest, and give guests read-only permissions?

How's that sound?

Oldiesmann

You can prevent people from posting by locking down board permissions - just set all the boards to use the "read-only" profile.

The only real way to disable logins for everyone but the admin is to modify the code. This should do it.

Sources/LogInOut.php

Find
// Hmm... maybe 'admin' will login with no password. Uhh... NO!

Add before that
elseif($_POST['user'] != 'adminusername')
{
fatal_lang_error('Message explaining why logins have been disabled goes here', false);
}


That will cause it to die with an error explaining why logins have been disabled if anyone but the admin tries to login.

If you have multiple admins, you can change that elseif to this:
elseif (!in_array($_POST['user'], array('admin1', 'admin2'))

Just customize things to fit your situation.

Also, if you want to force everyone who's currently logged in "forever" to logout, you can change the cookie name in the server settings area of the admin center. Note that this will cause you to be logged out as well.
Michael Eshom
Christian Metal Fans

akoladica

@Oldiesmann

I had success with locking down board permissions, thank you.

I had also luck with:
"elseif($_POST['user'] != 'adminusername')"

but NO luck with:
   {
      fatal_lang_error('Message explaining why logins have been disabled goes here', false);
   }

Simply, this message is not displayed at all, the only message I have displayed is :
"An Error Has Occurred! "

How to change to something more informative.

Well done for suggesting that I maybe have multiple admins which I do.
But this "elseif (!in_array($_POST['user'], array('admin1', 'admin2'))" part is also not working.
It says something that there is an error on line 197.

Big thanks

Dzonny

Can you please paste code from that line here, and exact error here?

Regards.

Oldiesmann

Sorry about that :)

First: Change that to fatal_error. The fatal_lang_error function is used to specify a particular $txt string to display (used to display the error message in the user's appropriate language). Using fatal_error will have it display the specific message you specify instead.

Second: Add another ) at the end of that.
Michael Eshom
Christian Metal Fans

akoladica

Quote from: Oldiesmann on January 26, 2012, 04:56:37 PM
Sorry about that :)

First: Change that to fatal_error. The fatal_lang_error function is used to specify a particular $txt string to display (used to display the error message in the user's appropriate language). Using fatal_error will have it display the specific message you specify instead.
I dont get this?

Second: Add another ) at the end of that. I fixed this part

akoladica

I got it now.

I changed "fatal_lang_error" u "fatal_error".

Thanks to Dzonny and Oldiesmann this has been solved with ease and success.

Must read better next time :)

Advertisement: