1
redheadedrod
Question about how the PM module works to override PMlite in core

I am relatively new to PHP at this point but I am curious how it works that in the core without any modules added you are able to send some basic Private Messages. Then when you install the PM module the core Private Message stuff is bypassed and the PM module is used instead. I am curious how this works and if the same mechanism can be used to "overload" other functions of the core with a module such as a tab in the admin menu as an example.

I think if I understand how the PM module replaces the core "Pmlite" then it will help me along with a project I am looking at.

Thanks!

2
Catzwolf
Re: Question about how the PM module works to override PMlite in core
  • 2010/8/1 10:46

  • Catzwolf

  • Home away from home

  • Posts: 1392

  • Since: 2007/9/30


The pmlite (which should have been taken out when the PM module was created) is 'overloaded' with the new preloader system. Look in the PM module Preloader and that should give a good understanding of how this is done.

I also think that there is a smarty plugin somewhere, I might be wrong.

3
redheadedrod
Re: Question about how the PM module works to override PMlite in core

Is that found in the pmlite.php file of both the core and pm module?

Also I assume that this same method will work with other core functions that I would like to replace with a more extensive version?

I am looking to add things to one of the admin tabs and don't want to hack the core to do it but this method looks like a simpler way to tie into it.

Rodney


4
Catzwolf
Re: Question about how the PM module works to override PMlite in core
  • 2010/8/1 13:14

  • Catzwolf

  • Home away from home

  • Posts: 1392

  • Since: 2007/9/30


The preloader folder will be found in the pm module folder.

I'm not quite sure that you will be able to do it from the way you are suggesting, but it is worth a try.

You should however be able to add another tab quite easy by adding one by editing the '/module/pm/admin/menu.php' file:

and

$adminmenu = array();
$adminmenu[1]['title'] = _PM_MI_INDEX;
$adminmenu[1]['link'] = "admin/admin.php";
$adminmenu[2]['title'] = _PM_MI_PRUNE;
$adminmenu[2]['link'] = "admin/prune.php";
$adminmenu[3]['title'] = 'Newtabconstant;
$adminmenu[3]['link'] = "newtabfile.php";

Easypeasy huh

5
trabis
Re: Question about how the PM module works to override PMlite in core
  • 2010/8/1 13:32

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


There are some hooks(event triggers) availabe in Xoops files being one of them in pmlite.php if I'm not mistaken. Modules that listen to those events must follow some folder, file and class name conventions. You can start by looking into preloads folder in modules such as PM, Profile, Protector, XLanguage, Defacer. When this Xoops hooks are met during script execution, the listening methods are executed. Methods can issue redirects(as in PM module) or perform any other logic, they can also manipulate any entities that are passed as arguments by the hook. There are limited hooks in XOOPS core, there is no hook available for extending admin menus. The hooks are mainly placed in system front controllers(pmlite.php, register.php, user.php),and in bootstrap files such as common.php, header.php, and footer.php.

If you need to hack xoops core, instead of placing all your logic in the file you need to hack, you could just add a hook there, then you can build a preload to reply to that hook. It will keep upgrades easier for you. You can then propose that hook to the core team.

6
redheadedrod
Re: Question about how the PM module works to override PMlite in core

Thanks Trabis, I was hoping to keep away from hacking the core but for what I want to do at this point I don't see any other option.
Attending College working towards Bachelors in Software Engineering and Network Security.

Login

Who's Online

185 user(s) are online (108 user(s) are browsing Support Forums)


Members: 0


Guests: 185


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits