Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: New plugin type setting...
Sorry, but it seems to me this is change for the sake of changing stuff. Why solve a problem that doesn’t exist. I don’t see regular postings asking about the meaning of various plugin types.
Can we get back on-topic, which was having an option for admin-only plugins?
Offline
Re: New plugin type setting...
It’s a change for improving TXP’s code and functionality. The update_to_4.0.X.php file can include an alter table query, so it’s not a very difficult modification.
Last edited by jm (2008-06-21 13:24:21)
Offline
#18 2008-07-23 15:32:18
- net-carver
- Archived Plugin Author
- Registered: 2006-03-08
- Posts: 1,648
Re: New plugin type setting...
Devs
Just to stop this dropping off the radar. from my pov, even if we don’t get a brand-new string-based plugin type, could we please…
- …get a
typevalue that makes a plugin load only in the admin interface? - …consider not loading library plugins by default on the public interface; instead have libraries loaded by the public plugins that explicitly load/require them?
— Steve
Offline
Re: New plugin type setting...
0 = public
1 = public+admin
2 = lib
3 (new) = admin
I wouldn’t object to that.
Are library plugins loaded by default on the public side? If so, that makes no sense, does it. What’s the difference with type 1?
Offline
#20 2008-07-23 16:49:44
- net-carver
- Archived Plugin Author
- Registered: 2006-03-08
- Posts: 1,648
Re: New plugin type setting...
ruud wrote:
Are library plugins loaded by default on the public side?
As fas as my code inspection goes, every single enabled plugin is loaded by default on the public side…
if ($use_plugins) load_plugins();
…taken from publish.php. Then load_plugins gets them all.
— Steve
Offline
Re: New plugin type setting...
Ouch… I think the library thing is a bug which should be fixed anyway.
Admin-side only plugins (type 3). I’ll write a patch. Unless there are objections against this (Robert or anyone else?) I think this is worth adding.
Offline
Re: New plugin type setting...
Something like this perhaps:
--- textpattern/lib/txplib_misc.php (revision 2946)
+++ textpattern/lib/txplib_misc.php (working copy)
@@ -537,7 +537,7 @@
}
// -------------------------------------------------------------
- function load_plugins($type=NULL)
+ function load_plugins($type=0)
{
global $prefs,$plugins, $plugins_ver;
@@ -557,9 +557,7 @@
}
}
- $where = 'status = 1';
- if ($type !== NULL)
- $where .= (" and type='".doSlash($type)."'");
+ $where = 'status = 1 and type IN ('.($type ? '1,3' : '0,1').')';
$rs = safe_rows("name, code, version", "txp_plugin", $where. ' order by load_order');
if ($rs) {
--- textpattern/include/txp_plugin.php (revision 2946)
+++ textpattern/include/txp_plugin.php (working copy)
@@ -295,7 +295,7 @@
extract($plugin);
- $type = empty($type) ? 0 : min(max(intval($type), 0), 2);
+ $type = empty($type) ? 0 : min(max(intval($type), 0), 3);
$order = empty($order) ? 5 : min(max(intval($order), 1), 9);
$exists = fetch('name','txp_plugin','name',$name);
Offline
#23 2008-07-23 17:24:20
- net-carver
- Archived Plugin Author
- Registered: 2006-03-08
- Posts: 1,648
Re: New plugin type setting...
Ruud
fantastic, thank you for looking at this. Don’t forget the documentation in Zem’s example plugin type ‘3’ would need adding and it’s not exactly accurate describing type 1 as ‘admin’. Should be ‘Common’ or ‘Public & Admin’ or some-such.
— Steve
Offline
Re: New plugin type setting...
ruud wrote:
Unless there are objections against this
Fine for me.
Offline
Re: New plugin type setting...
Offline
#26 2008-07-24 00:49:28
- net-carver
- Archived Plugin Author
- Registered: 2006-03-08
- Posts: 1,648
Re: New plugin type setting...
Great — thank you Ruud.
— Steve
Offline