check if mambot is published
Moderators: tjay, seadap, Rogue4ngel, matthewhayashida
check if mambot is published
hi, whats the best way to check if the mambot id published or not.?
I see a lot of mambots which still interfere with stuff evn when they are unpublished (you actually have to remove the mambot to stop it)!
So whats the code or syntax to do it properly?
Many thanks
Lee
I see a lot of mambots which still interfere with stuff evn when they are unpublished (you actually have to remove the mambot to stop it)!
So whats the code or syntax to do it properly?
Many thanks
Lee
Re: check if mambot is published
is it just as simple as
Code: Select all
if( !$published ) return true;
- AmyStephen
- Joomla! Guru
- Posts: 579
- Joined: Wed Nov 22, 2006 3:35 pm
- Location: Nebraska
- Contact:
Re: check if mambot is published
If you look at the code for the loadmodule plugin (plugins/content/loadmodule.php), you will find this code:
Hope that helps!
Amy
Code: Select all
// check whether plugin has been unpublished
if ( !$pluginParams->get( 'enabled', 1 ) ) {
$row->text = preg_replace( $regex, '', $row->text );
return true;
}
Hope that helps!
Amy
~*~ Joomla!'s Queen of the Blues - Jennifer Marriott ~*~
http://OpenSourceCommunity.org/node/1719/
http://OpenSourceCommunity.org/node/1719/
Re: check if mambot is published
Amy, thanks for the reply. I have looked in several mambots but as I am not a coder I dont realy understand whats going on ;-(
I have managed to put together a mambot which does exactly what I want and the code I posted above sems to work but your seems to be a better guide.
However, as I dont know what it means, a plain english translation of your above code would be:-
where should this go in the code? if you put it at the very bottom of the mambot function would that not put an overhead on the page load (even with the mambot unpublished) as the whole function would still be performed before deciding not to output the result?
I hope I am making sense.
Thanks again for any help
I have managed to put together a mambot which does exactly what I want and the code I posted above sems to work but your seems to be a better guide.
However, as I dont know what it means, a plain english translation of your above code would be:-
Code: Select all
check if mambot is published - if yes do the replace - end?
where should this go in the code? if you put it at the very bottom of the mambot function would that not put an overhead on the page load (even with the mambot unpublished) as the whole function would still be performed before deciding not to output the result?
I hope I am making sense.
Thanks again for any help
Last edited by yoshi on Mon Oct 08, 2007 9:02 am, edited 1 time in total.
- AmyStephen
- Joomla! Guru
- Posts: 579
- Joined: Wed Nov 22, 2006 3:35 pm
- Location: Nebraska
- Contact:
Re: check if mambot is published
Yoshi -
I am also just learning. The best way, IMO, to learn is to study an existing, working example. The code snippets I shared with you came directly from the plugins\content\loadmodule.php file in the Joomla! core.
That code is saying if the plugin is NOT enabled (not the ! in front of the phrase), then remove the {loadposition}xxx{/loadpostion} syntax in the article with nothing and exit the plugin.
I've used loadmodule over and over and over.
Good luck with your project and I hope you are having fun like I am!
Amy
I am also just learning. The best way, IMO, to learn is to study an existing, working example. The code snippets I shared with you came directly from the plugins\content\loadmodule.php file in the Joomla! core.
That code is saying if the plugin is NOT enabled (not the ! in front of the phrase), then remove the {loadposition}xxx{/loadpostion} syntax in the article with nothing and exit the plugin.
I've used loadmodule over and over and over.
Good luck with your project and I hope you are having fun like I am!
Amy
~*~ Joomla!'s Queen of the Blues - Jennifer Marriott ~*~
http://OpenSourceCommunity.org/node/1719/
http://OpenSourceCommunity.org/node/1719/
Re: check if mambot is published
Amy, I am a little bit confused here. If a plugin is unpublished it shouldn't be executed at all.
But wait, loadmodule plugin is not written in the new way of 1.5. I think the old way doesn't handle the publishing itself, right?
But wait, loadmodule plugin is not written in the new way of 1.5. I think the old way doesn't handle the publishing itself, right?
My Joomla! 1.5 extensions - http://joomla.ercan.us
Progress is made by lazy men looking for easier ways to do things.
Progress is made by lazy men looking for easier ways to do things.
Re: check if mambot is published
exactly my point Pentacle. it seems a lot of mambots for 1.0 actually get 'processed' for want of a better term even if their results are not output to the screen.
- AmyStephen
- Joomla! Guru
- Posts: 579
- Joined: Wed Nov 22, 2006 3:35 pm
- Location: Nebraska
- Contact:
Re: check if mambot is published
Pentacle wrote:Amy, I am a little bit confused here. If a plugin is unpublished it shouldn't be executed at all.
But wait, loadmodule plugin is not written in the new way of 1.5. I think the old way doesn't handle the publishing itself, right?
Is that so? Hmm. I don't know. I have been using loadmodule as an example. Do you know of a good example of the new way?
Thanks!
Amy
~*~ Joomla!'s Queen of the Blues - Jennifer Marriott ~*~
http://OpenSourceCommunity.org/node/1719/
http://OpenSourceCommunity.org/node/1719/
Re: check if mambot is published
AmyStephen wrote:
Is that so? Hmm. I don't know. I have been using loadmodule as an example. Do you know of a good example of the new way?
Thanks!
Amy
Hmm. Most of the core plugins (especially content) ain't touched since 1.0 I think. So Ian's slider plugin or my youtube one (not *good* but a simple example ) can show this behavior. I didn't use these checks about plugin is published or not. But when I disabled it, replacement wasn't taking place.
Ercan.
My Joomla! 1.5 extensions - http://joomla.ercan.us
Progress is made by lazy men looking for easier ways to do things.
Progress is made by lazy men looking for easier ways to do things.
- DeanMarshall
- Joomla! Apprentice
- Posts: 46
- Joined: Fri Aug 19, 2005 2:26 am
- Location: Lancaster, Lancashire, United Kingdom
- Contact:
Re: check if mambot is published
Just to clarify one point - mambots/plugins are executed even when unpublished
to allow the module - where necessary - to remove the { ... } mambot tag so
as to tidy up display.
Dean
to allow the module - where necessary - to remove the { ... } mambot tag so
as to tidy up display.
Dean
Dean Marshall - http://www.deanmarshall.co.uk/
Mambo and Joomla Consultant
Add an Amazon Store to your site: http://www.Project-TinA.com/ (coming soon)
Mambo and Joomla Consultant
Add an Amazon Store to your site: http://www.Project-TinA.com/ (coming soon)
- AmyStephen
- Joomla! Guru
- Posts: 579
- Joined: Wed Nov 22, 2006 3:35 pm
- Location: Nebraska
- Contact:
Re: check if mambot is published
Even for J! v 1.5? I realize it does so in v 1.0.x but it seems like v 1.5 might be different. Otherwise, we would continue to need to check if were published, or else it would go ahead and run simply because it was installed.
Nice to see you, Dean, and I appreciate your response, always.
Amy
Nice to see you, Dean, and I appreciate your response, always.
Amy
~*~ Joomla!'s Queen of the Blues - Jennifer Marriott ~*~
http://OpenSourceCommunity.org/node/1719/
http://OpenSourceCommunity.org/node/1719/
Re: check if mambot is published
Right now, I'm playing with some 1.5 plugins and if it's not published, I can't do anything. Not echoing, not replacing. An explanation from the core team would be great.
My Joomla! 1.5 extensions - http://joomla.ercan.us
Progress is made by lazy men looking for easier ways to do things.
Progress is made by lazy men looking for easier ways to do things.
- DeanMarshall
- Joomla! Apprentice
- Posts: 46
- Joined: Fri Aug 19, 2005 2:26 am
- Location: Lancaster, Lancashire, United Kingdom
- Contact:
Re: check if mambot is published
AmyStephen wrote:Even for J! v 1.5? I realize it does so in v 1.0.x but it seems like v 1.5 might be different. Otherwise, we would continue to need to check if were published, or else it would go ahead and run simply because it was installed.
Nice to see you, Dean, and I appreciate your response, always.
Amy :)
Hi Amy,
My comment was an off the cuff 'in general' - just trying to explain
the situation from my experience, which is mainly J1.0.x - I haven't
really dabbled that much with J1.5
A quick check of the pagebreak plugin shows this:
Code: Select all
// check whether plugin has been unpublished
if ( !JPluginHelper::isEnabled('content', 'pagebreak') ||
$params->get( 'intro_only' )||
$params->get( 'popup' ) ||
$full)
{
$row->text = preg_replace( $regex, '', $row->text );
return;
}
Which according to the comments checks whether the plugin is unpublished
and if it is or we are on a page showing intro text only, or in a popup the
plugin tag is replaced by the empty string.
Dean
Dean Marshall - http://www.deanmarshall.co.uk/
Mambo and Joomla Consultant
Add an Amazon Store to your site: http://www.Project-TinA.com/ (coming soon)
Mambo and Joomla Consultant
Add an Amazon Store to your site: http://www.Project-TinA.com/ (coming soon)
- AmyStephen
- Joomla! Guru
- Posts: 579
- Joined: Wed Nov 22, 2006 3:35 pm
- Location: Nebraska
- Contact:
Re: check if mambot is published
That's what we were noticing, as well, but we were wondering if really the plugins could be updated to remove that logic.
You know, Dean, v 1.5 is a whole lot of fun to play with. Hope you are able to find time to play soon!
Amy
You know, Dean, v 1.5 is a whole lot of fun to play with. Hope you are able to find time to play soon!
Amy
~*~ Joomla!'s Queen of the Blues - Jennifer Marriott ~*~
http://OpenSourceCommunity.org/node/1719/
http://OpenSourceCommunity.org/node/1719/