Cross-plugin config options

Discussion corner for Developers of Serendipity.
Post Reply
mattsches
Regular
Posts: 440
Joined: Sat Nov 05, 2005 9:35 pm
Location: Wiesbaden, Germany
Contact:

Cross-plugin config options

Post by mattsches »

I've searched the forum, yet couldn't find an answer to my question: How can I access a config option of one plugin from within another?

Particularly, I need the taglink path that is set by the freetag plugin, and I need it in my socialbookmarks plugin. The db contains several rows that are related to a taglink: a general taglink (default url?), a freetag taglink (the one I entered after installing the freetag plugin), and a socialbookmarks taglink (still empty).

Where are all these options set? And how can I access them?

- Mattsches
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Cross-plugin config options

Post by garvinhicking »

Hi!

That's a bit tougher to do. The plugins are actually independent from each other, so you would either need to iterate through the list of all available serendipity plugins (serendipity_plugin_api::get_event_plugins) and then do the 'get_config' method call on the plugin you want to use.

Or you go the easier route and just issue a SQL query on the serendipity_config DB table, use a wildcard "serendipity_event_freetag:%" name for the "name" column of that table, and then just fetch the 'value' column of that table for the plugin...

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
mattsches
Regular
Posts: 440
Joined: Sat Nov 05, 2005 9:35 pm
Location: Wiesbaden, Germany
Contact:

Post by mattsches »

Thanks for the reply, Garvin! I thought about the iteration method, but didn't like it. Querying the DB directly seems to be a better way.

One questions remains, though: In my DB, there is a row with the name '/taglink' and the wrong url as value. Where does it come from, and do I still need it (or can I just correct the url)?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Hm, the value of it should come from the configuration of your plugin! I'm not sure what you mean?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
mattsches
Regular
Posts: 440
Joined: Sat Nov 05, 2005 9:35 pm
Location: Wiesbaden, Germany
Contact:

Post by mattsches »

Nevermind, I'm not sure what I'm talking about myself :wink:
I will have to double-check my plugin, but thanks to your help it should be easy to fix.

- Mattsches
stm999999999
Regular
Posts: 1531
Joined: Tue Mar 07, 2006 11:25 pm
Location: Berlin, Germany
Contact:

Post by stm999999999 »

Ciao, Stephan
mattsches
Regular
Posts: 440
Joined: Sat Nov 05, 2005 9:35 pm
Location: Wiesbaden, Germany
Contact:

Post by mattsches »

That's what I've just done, actually 8) ... I'll give it a try tomorrow
Post Reply