Jump to the post that solved this thread.
Solved: 1 Year, 5 Months, 2 Weeks ago How To Make Custom Index Message Seen By Certain Usergroup
#1
Solved: 1 Year, 5 Months, 2 Weeks ago
Hello MyBB Community --

Okay so this may be something simple. I coded in a message in the index template to make guests either login or register.
https://i.imgur.com/upI7I2z.png
I forgot completely that once the user does whatever, the message will still be up.

Where do I actually need to put the code at so only guests can see it?

Thanks for taking the time to read this!
Reply
#2
Solved: 1 Year, 5 Months, 2 Weeks ago
use mybb index_start hook and check if user have your condition, redirect it to a custom page
Reply
#3
Solved: 1 Year, 5 Months, 2 Weeks ago
(2021-08-14, 06:37 PM)Mostafa.Shiraali Wrote: use mybb index_start hook and check if user have your condition, redirect it to a custom page

Thanks for your reply! Sorry for my lack of knowledge, I haven't coded in a while let along on MyBB. The current code I got is:
<table class="tborder" cellspacing="1" cellpadding="4" border="0">
	<thead>
		<tr>
			<td class="thead">
				<strong>Welcome Guest</strong>
			</td>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td class="trow1">Welcome to ModdedLobby.com! Please note that you must <a href="https://moddedlobby.com/member.php?action=login">login</a> or register free <a href="https://moddedlobby.com/member.php?action=register">here</a> to see threads. Thanks for understanding and also for your cooperation!</td>
		</tr>
	</tbody>
</table>

What exactly should I add to it? Again, thanks for your reply!
Reply
#4
Solved: 1 Year, 5 Months, 2 Weeks ago
Go to Home » Board Settings » Login and Registration Options -> Force Users to Login -> Yes

Then users will be required to login in order to access the board.

But it won't display a custom message. To do so you will need a plugin.
Reply
#5
Solved: 1 Year, 5 Months, 2 Weeks ago
The easiest way to edit the message is modifying the following line:
https://github.com/mybb/mybb/blob/ea3002....php#L1151

Change it to:
error("Please login or register.");
Reply
#6
Solved: 1 Year, 5 Months, 2 Weeks ago
(2021-08-16, 05:47 AM)Omar G. Wrote: Go to Home » Board Settings » Login and Registration Options -> Force Users to Login -> Yes

Then users will be required to login in order to access the board.

But it won't display a custom message. To do so you will need a plugin.

Hi Omar --

Thanks for your reply!
I remember seeing a plugin a while back for it but couldn't ever find it again, haha. I went into my Login and Registration Options and did what you said so that will do it for me. Smile

Again, thanks for your assistance!
Reply
Jump to the post that solved this thread.


Forum Jump:


Users browsing this thread: 1 Guest(s)