Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#16 2008-06-21 13:14:57

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

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

#17 2008-06-21 13:23:25

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

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…

  1. …get a type value that makes a plugin load only in the admin interface?
  2. …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

#19 2008-07-23 16:41:23

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

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

#21 2008-07-23 17:08:15

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

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

#22 2008-07-23 17:19:19

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

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

#24 2008-07-23 17:28:58

wet
Developer Emeritus
From: Vöcklabruck, Austria
Registered: 2005-06-06
Posts: 3,416
Website GitHub Mastodon

Re: New plugin type setting...

ruud wrote:

Unless there are objections against this

Fine for me.

Offline

#25 2008-07-23 18:12:25

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

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

Board footer

Powered by FluxBB