cfitz619 Posted January 30, 2022 Report Posted January 30, 2022 I am trying to figure out how to show discord only to logged-in members. Right now it is visible on my front page. Here is my current code for the discord section. Any help would be greatly appreciated. If it helps, I am on phpvms 5.5.2.72. PHP version is 7.2. <!--Begin Discord --> <div class="blueIce-block clearfix"> <div class="blueIce-blockheader"> <h3 class="t">Discord</h3> </div> <div class="blueIce-blockcontent"><p> <br> <div align="center"> <iframe src="https://discord.com/widget?id=937311209793912923&theme=dark" width="240" height="500" allowtransparency="true" frameborder="0" sandbox="allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts"></iframe> </div> </p> </div> </div> </div> <!--End Discord --> Quote
Administrators ProAvia Posted January 30, 2022 Administrators Report Posted January 30, 2022 If you have other areas of the site or specific modules that are only visible to members, look thru them for how they are restricted to members only. Quote
cfitz619 Posted January 30, 2022 Author Report Posted January 30, 2022 I'll try that again. I tried that earlier this morning. It ended up messing my whole page up. Thank You. Quote
Administrators ProAvia Posted January 31, 2022 Administrators Report Posted January 31, 2022 As I recall, it has something to do with adding if(Auth::LoggedIn()) { Do this }else{ Do something different } "Do this" would be to display your discord stuff "Do something else" would be to maybe return to the home page or display an error message Quote
DisposableHero Posted January 31, 2022 Report Posted January 31, 2022 if (Auth::LoggedIn()) { // User is logged in // Do anything you wish here } else { // User is not logged in, probably a quest visitor // Do another thing for quests if you need to } if (Auth::LoggedIn()) { // User is logged in // Do anything you need here } if (Auth::LoggedIn() == true) { // User is logged in // Do anything you need here } if (!Auth::LoggedIn()) { // User is NOT logged in // You can show a note here maybe like "Dear visitor, please Login or Register" } if (Auth::LoggedIn() == false) { // User is NOT logged in // You can show a note here maybe like "Dear visitor, please Login or Register" } Some examples Quote
DisposableHero Posted January 31, 2022 Report Posted January 31, 2022 <?php if (Auth::LoggedIn() == true) { ?> <div class="blueIce-block clearfix"> <div class="blueIce-blockheader"> <h3 class="t">Discord</h3> </div> <div class="blueIce-blockcontent" align="center"> <iframe src="https://discord.com/widget?id=937311209793912923&theme=dark" width="240" height="500" allowtransparency="true" frameborder="0" sandbox="allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts"></iframe> </div> </div> <?php } ?> Something like this should do the trick. 1 Quote
cfitz619 Posted February 3, 2022 Author Report Posted February 3, 2022 Thans for the help. I will try that. Quote
cfitz619 Posted February 3, 2022 Author Report Posted February 3, 2022 On 1/31/2022 at 6:49 AM, DisposableHero said: <?php if (Auth::LoggedIn() == true) { ?> <div class="blueIce-block clearfix"> <div class="blueIce-blockheader"> <h3 class="t">Discord</h3> </div> <div class="blueIce-blockcontent" align="center"> <iframe src="https://discord.com/widget?id=937311209793912923&theme=dark" width="240" height="500" allowtransparency="true" frameborder="0" sandbox="allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts"></iframe> </div> </div> <?php } ?> That worked like a charm! Thank You very much. 1 Quote
DisposableHero Posted February 4, 2022 Report Posted February 4, 2022 On 2/3/2022 at 3:25 AM, cfitz619 said: That worked like a charm! Thank You very much. Nice to hear that Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.