TinyPortal

Development => Support => Topic started by: technodragon73 on March 22, 2006, 01:58:44 AM

Title: Creating a Custom Who's Online Action
Post by: technodragon73 on March 22, 2006, 01:58:44 AM
I originally posted this over at SMF but was subsequestly ignored...you guys here are excellent at replting...could you please help me?
Quote
I have searched all over this forum and while I have found snippets leading to this end I have found no solid expolanation on how to create/add a custom action to the who's online page.

I have several mods that when a member goes to them it says unknown action.

I understand that you go into I believe the who.template and add a whoall to the list, but it still does not work.  I have seen others say add a get action as well, but where?

If anyone could help me so I can get the who's online page to show when members are visiting those specific pages  Iwould greatly appreciate it.

I am using SMF 1.1RC2 and TPv0.8.6
Title: Re: Creating a Custom Who's Online Action
Post by: ontap on March 22, 2006, 02:16:31 AM
Quote
i understand that you go into I believe the who.template and add a whoall to the list, but it still does not work.  I have seen others say add a get action as well, but where?

If anyone could help me so I can get the who's online page to show when members are visiting those specific pages  Iwould greatly appreciate it.

you add online actions to "Modifications.english.php" or "Who.english.php",

Example: Going into TP Admin section,
on your users online it might say "Unkown action"..

just add this bit of code to Modifications.english.php
$txt['whoall_tpadmin'] = 'Viewing The TP Admin Pannel';

?action=arcade would be
$txt['whoall_arcade'] = 'Viewing The <a href="' . $scripturl . '?action=arcade">Arcade</a>';

your own action would be something like
$txt['whoall_actionhere'] = 'Text Here';
Title: Re: Creating a Custom Who's Online Action
Post by: technodragon73 on March 22, 2006, 02:34:10 AM
So I don't have to modify any other files but one of those two? 

And thank you so very much for aswering...everybody here is so awesome!
Title: Re: Creating a Custom Who's Online Action
Post by: ontap on March 22, 2006, 02:42:00 AM
Quote from: technodragon73 on March 22, 2006, 02:34:10 AM
So I don't have to modify any other files but one of those two? 

nope, just add the action and it should work.  :)
Title: Re: Creating a Custom Who's Online Action
Post by: technodragon73 on March 22, 2006, 02:47:58 AM
I just did...it is working wonderfully...again...thanks a million you are awesome!

Okay...then can you answer how to get that custom action to show in the link tree?

Right now when  Iclick on the button the link tree shows Hom, then forum, but not the action after it...ex: when you go to the arcade it shows, home, forum, arcade
Title: Re: Creating a Custom Who's Online Action
Post by: TwinsX2Dad on March 22, 2006, 06:42:50 AM
Do you mean the forum button vanishes when you're in the forum and the home button goes away when you're on the home page, but both appear in the arcade?

I am confused.
Title: Re: Creating a Custom Who's Online Action
Post by: technodragon73 on March 22, 2006, 01:13:11 PM
Quote from: TwinsX2Dad on March 22, 2006, 06:42:50 AM
Do you mean the forum button vanishes when you're in the forum and the home button goes away when you're on the home page, but both appear in the arcade?

I am confused.

No, I the link tree...
Home
 |_Forum
 |_  |_(pagename)  <-----this is the part I want to know how to add as some pages don't show the title, just the first two parts
Title: Re: Creating a Custom Who's Online Action
Post by: bloc on March 22, 2006, 01:35:32 PM
Any addon to the linktree variable is usually done in the source file - the file used for the custom action. Its done like this:

$context['linktree'][] = array('url' => 'yourlinkhere', 'name' => 'nameofthelink');
Title: Re: Creating a Custom Who's Online Action
Post by: technodragon73 on March 22, 2006, 02:41:41 PM
Quote from: Bloc on March 22, 2006, 01:35:32 PM
Any addon to the linktree variable is usually done in the source file - the file used for the custom action. Its done like this:

$context['linktree'][] = array('url' => 'yourlinkhere', 'name' => 'nameofthelink');

Coolness...so is there any specific palce in the sorce file?  or does it just go any where after the globals call?

The reason I ask...is some of the files in question have two pars...a file.php and a file.template.php
Title: Re: Creating a Custom Who's Online Action
Post by: ontap on March 22, 2006, 02:45:37 PM

could you paste your source file?
Title: Re: Creating a Custom Who's Online Action
Post by: technodragon73 on March 22, 2006, 02:52:26 PM
Quote
The reason I ask...is some of the files in question have two pars...a file.php and a file.template.php

you got me while i was editing
Title: Re: Creating a Custom Who's Online Action
Post by: ontap on March 22, 2006, 02:53:37 PM

its the file.php that goes into "Sources"
Title: Re: Creating a Custom Who's Online Action
Post by: technodragon73 on March 22, 2006, 03:08:29 PM
Quote from: OnTapÂÃ,© on March 22, 2006, 02:53:37 PM

its the file.php that goes into "Sources"

ok, if that is the case...then here is the entire code from that file:
<?php
if (!defined('SMF'))
die('Hacking attempt...');

function
logd() {
// This is gonna be needed...
loadTemplate('logd');
}
?>
Title: Re: Creating a Custom Who's Online Action
Post by: ontap on March 23, 2006, 03:14:36 AM
Quote from: technodragon73 on March 22, 2006, 03:08:29 PM
<?php
if (!defined('SMF'))
die('Hacking attempt...');

function
logd() {
// This is gonna be needed...
loadTemplate('logd');
}
?>


It Would go something like below.


<?php
if (!defined('SMF'))
die(
'Hacking attempt...');

function
logd() {
global
$context;
$context['linktree'][] = array('url' => '?action=logd', 'name' => 'logd');
$context['page_title'] = 'Forum Title - logd';
// This is gonna be needed...
loadTemplate('logd');
}
?>
Title: Re: Creating a Custom Who's Online Action
Post by: technodragon73 on March 23, 2006, 03:38:02 AM
Actually...I kept toying with it...I needed to put it into the template file not the source file

here is what I put:
//Show this page in the linktree?
$context['page_title'] = "Legend of the Green Dragon"; // Set title
$context['linktree'][]['url'] = "{$scripturl}?action=logd"; // Add Legend of the Green Dragon to linktree
$context['linktree'][count($context['linktree']) - 1]['name'] = "Legend of the Green Dragon";


Works perfectly...Thank you guys for your help...most of the time if someone just points me in right direction I can get it figured out myself...you both did that very well...again thank you!