Firefox PHP

Howto alter Phorum[data][mod_x] content from settings.php?

Posted by Hermann 
Howto alter Phorum[data][mod_x] content from settings.php?
March 14, 2014 06:02AM
Hi folks,

I am trying quite a while to build a new module "timeline". So I read the manual and studied lots of other modules.

The problem I have is, that I can't access the Phorum[DATA][mod_timeline] content within the settings.php in the admin menu. I want to be able to alter the data stored in Phorum[Data][mod_timeline] which should be available in every situation.

[DATA] ---- [MOD_timeline]
.......................... |
.........................[code_name]
........................................ |
...................................... [....]
.......................... |
...........................[date_time]
.........................................|
......................................[.....]


That means:
the hook: hook: common|mod_timeline_common
the function in timeline.php:
Language: PHP
function mod_timeline_common() { global $PHORUM; $PHORUM[';DATA';][';MOD_TIMELINE_ENABLED';] = 1; $PHORUM[';DATA';][';MOD_TIMELINE';] = []; $PHORUM[';DATA';][';MOD_TIMELINE';][';date_time';] = []; }

In this way I can access the data of the Phorum[DATA][mod_timeline] array from every page like list.php and read.php so I can use it to alter the template output.

How can i access these data from the settings.php? If I print the Phorum[Data] content from the settings.php page, it only contains basic information and does not content the phorum[data][mod_timeline].

I appreciate your time and help.
Best from Germany,
Hermann



Edited 2 time(s). Last edit at 03/14/2014 06:04AM by Hermann.
Re: Howto alter Phorum[data][mod_x] content from settings.php?
March 18, 2014 01:57AM
$PHORUM[DATA] is the array with data prepared for the template. You can't directly "store" something in it.
That's how you can save *settings* from your module: [www.phorum.org]
These are then saved into the database as shown there.
It will be available in your common function in $PHORUM['mod_foo'] and you can put the info you want from that array into the $PHORUM['DATA'] array.


Thomas Seifert
Re: Howto alter Phorum[data][mod_x] content from settings.php?
March 22, 2014 05:16PM
Hi Thomas,

Besten Dank! Thank you for your assistance. It worked like you told. Since this is a general question I would like to know how you can get access to the general data, if you are in a hook, like hook:list. How can you access the data like ['URL'] if you are in the hook:list-path, which only contains the [MESSAGE] information...
Do I have to use the common hook in this case, and how - like if (isset($PHORUM["MESSAGES"])) ...?
Since I don't have a form-input section, like mode_thank-flame, how can I get the hook common get to work?

Best
Hermann



Edited 1 time(s). Last edit at 03/22/2014 05:18PM by Hermann.
Re: Howto alter Phorum[data][mod_x] content from settings.php?
March 23, 2014 05:53AM
sorry I don't get what you are trying to do.
Try to follow when which hook is run.
e.g. common hook is run after initializing the settings and BEFORE the view data like $PHORUM['DATA']['MESSAGES'] is set up. when you check the code where the hook is called then you can see what happens before / after.


Thomas Seifert
Sorry, only registered users may post in this forum.

Click here to login