Closed rica-carv closed 3 years ago
@rica-carv I am almost sure, that CaMeRon will want to know where you use this method. F.e. in plugin shortcodes (local, global).
@rica-carv It's not deprecated. Menus are now loaded in HEADERF instead of class2.php. Jimmi is correct. Where are you running it from?
@CaMer0n I'm running it from a plugin that depends of a it's own menu to be loaded. I know, there's currently only one plugin that uses this function: Featurebox....
So, at runtime, how can i check if my menu is loaded or not? I'm currently checking for it at the plugin main file code start, before fetching data, run templates, etc., because the main plugin depends of it's own menu.... So, @Jimmi08 currently it's checked before everything else, even before running HEADERF (that it's at the code bottom)....
Thaks you all, got it running....
Good to hear @rica-carv ! Where did you move the check?
Good to hear @rica-carv ! Where did you move the check?
@CaMer0n I didn't move it. It stayed where it was originally, because i need it at the begining of the code, so that if the menu is not there, the page displays only a error...
So, i ended up moving HEADERF
to before the check.... and had to put a few if then
below......
okay, thank you!
Well, i spoke too soon....
If i use the code like this:
if (!(e107::getmenu()->isLoaded("philcat"))) {
$msg->warning(PHCAT_L05);
if (ADMIN == TRUE) {
$msg->error(PHCAT_L06);
}
require_once(HEADERF);
i got the msg displayed, but the menu is not detected.... If i use it like this:
require_once(HEADERF);
if (!(e107::getmenu()->isLoaded("philcat"))) {
$msg->warning(PHCAT_L05);
if (ADMIN == TRUE) {
$msg->error(PHCAT_L06);
}
the menu is detected but the msg is not displayed.....
@rica-carv This should solve it:
echo $mes->render();
I still don't know where you're getting the method warning()
from?
I still don't know where you're getting the method
warning()
from?
Err, @CaMer0n , i've copyed it from another plugin, long time ago, but indeed, suposedly it shouldn't work, but it does....
I have no code to change the $msg
method, but it works....
Also, the error()
shouldn't also work, but it does, and it's currently also in another core plugins....
P.S.: Thanks for the render()
tip, it works now... Re-Closing...
Glad to hear it's working. I would be careful with those methods. Is it possible you have old files in your installation? (Run File Inspector? )
Glad to hear it's working. I would be careful with those methods. Is it possible you have old files in your installation? (Run File Inspector? )
No, @CaMer0n , i'm working on a fresh v2 install, so there's no old files, maybe just my plugin, but i'm cleanning it up to bring it to v2 standards...
Sounds good :+1:
@rica-carv please see https://e107.org/developer-manual/classes-and-methods/alerts
I strongly recommend not to use other methods (like warning()
). They may work (for whatever reason) but are not the standard and may stop functioning at any time.
@Moc Working on it. Thanks for the tip.... I don't get it why it's working, since my code doesn't change anything on the message handler....
In current stable version, the method
e107::getmenu()->isLoaded
is available and populated, but with latest github files, it's almost empty, and therefore the->isLoaded
doesn't work.Is this intended or is it a bug???