Editing Who is online page

Forum
Last Post
Threads / Messages

Kandria

Member
Member
Joined
Jul 4, 2020
Messages
43
Points
8
Age
38
Mysidian Dollar
371
Right now I feel like the online page is giving too much info, I'm looking to remove everything but the username, but my knowledge of php is minimal and in my limited testing of trying to remove the rest, has led to a white page/error kicking.
If anyone has a few seconds to just tell me what area(s) I should be changing quickly to do this I would be grateful, I can even pay for it if it's invasive work that's more than a quick fix too.

1.3.6 version (forgot to add that) I can't roll back to any prior versions as my host doesn't allow the older php versions anymore
 
If you replace the view/main/onlineview file with this it'll just show username:


PHP:
<?php

namespace View\Main;
use Resource\Core\View;
use Resource\GUI\Component\Link;

class OnlineView extends View{
    
    public function index(){
        $document = $this->document;           
        $document->setTitle($this->lang->title);
        $document->addLangvar($this->lang->default);
        
        $total = $this->getField("total");
        $members = $this->getField("members");
        $membersIterator = $members->iterator();
        while($membersIterator->hasNext()){
            $member = $membersIterator->next();
            $onlineLink = new Link("profile/view/{$member->getID()}");
            $onlineLink->setClass("onlinelist");
            $onlineInfo = "<span class='onlinelistt'>{$member->getUsername()}</span>";                         
            $onlineLink->setText($onlineInfo);
            $onlineLink->setLineBreak(TRUE);
            $document->add($onlineLink);           
        }
        $document->addLangvar($this->lang->visitors . $total->getValue());
        $this->refresh(30);
    }
}

If you want to change the table headings, that's in lang/main/lang_online.

To completely remove the table headings, change it to:

PHP:
<?php

//Language variables used for Online Page

$lang['title'] = "Who's Online";
$lang['default'] = "<div style='text-align:left;'>This page shows you all online users within the last 5 minutes. After 5 minutes of inactivity they will be marked as offline and will not be shown here</div><br /><hr /><br />";
$lang['visitors'] = "Total Visitors: ";

2023-10-18 00_54_07-Mysidia Adoptables v1.3.6 and 9 more pages - Personal - Microsoft​ Edge.png


If you want them to appear next to each other use these instead:

onlineview:

PHP:
<?php

namespace View\Main;
use Resource\Core\View;
use Resource\GUI\Component\Link;

class OnlineView extends View{
    
    public function index(){
        $document = $this->document;           
        $document->setTitle($this->lang->title);
        $document->addLangvar($this->lang->default);
        
        $total = $this->getField("total");
        $members = $this->getField("members");
        $membersIterator = $members->iterator();
        while($membersIterator->hasNext()){
            $member = $membersIterator->next();
            $onlineLink = new Link("profile/view/{$member->getID()}");
            $onlineLink->setClass("onlinelist");
            $onlineInfo = "<span class='onlinelistt'>{$member->getUsername()}</span>";                         
            $onlineLink->setText($onlineInfo);
            $document->add($onlineLink);           
        }
        $document->addLangvar($this->lang->visitors . $total->getValue());
        $this->refresh(30);
    }
}

lang_online:

PHP:
<?php

//Language variables used for Online Page

$lang['title'] = "Who's Online";
$lang['default'] = "<div style='text-align:left;'>This page shows you all online users within the last 5 minutes. After 5 minutes of inactivity they will be marked as offline and will not be shown here</div><br /><hr /><br />";
$lang['visitors'] = "<br><br>Total Visitors: ";

2023-10-18 00_57_38-Mysidia Adoptables v1.3.6 and 9 more pages - Personal - Microsoft​ Edge.png
 
thank you so much, that's already roughly what I was doing with the code but it wasn't working. I'll compare yours to mine though and see what part I was missing as your fix is working perfectly!
 
thank you so much, that's already roughly what I was doing with the code but it wasn't working. I'll compare yours to mine though and see what part I was missing as your fix is working perfectly!
Sometimes it's a blasted bracket or two making the issue LOL. Code is finicky.
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,277
Messages
33,119
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Top