Skip to Content Skip to Menu

Retrieving Plugin Parameters from External Script

  • pointri
  • pointri
  • OFFLINE
  • Posts: 118
  • Thanks: 0
  • Karma: 27
17 years 11 months ago #24556 by pointri
Maybe I'm overthinking this one, and I'm not too handy with the OOP, but I'm extending rg66's CB Advanced Search to work with a modified version of the Google Maps plugin to allow for proximity searches of user profiles, and ran into a snag.

For sake of efficacy, I'd like to retrieve the parameters and execute a function within the Google Maps CB plugin in the Advanced Search component, but I can't seem to get what I guess is a cbParameters object returned.

The code in the component looks like this...

[code:1]require_once($mosConfig_absolute_path.'/components/com_comprofiler/plugin/user/plug_geocoder/geocoder.php');
$geo = new getGeocoderTab();
$geocode_params = $geo->_getParams();
...
[/code:1]

and the function that returns the parameters within the getGeocoderTab class is just...

[code:1]
function _getParams() {
$params = $this->params;
return $params;
}
[/code:1]

Am I missing a step or two to retrieve that cbParameters object, or would it not be advisable to go about it this way? Thanks in advance!

Joomlapolitan zealot and a somewhat stealthy, rather passive CB3PD developer.
www.constructionlounge.com Construction Lounge: Online resource and networking portal for the construction and remodeling industries.

Please Log in or Create an account to join the conversation.

  • mikko
  • mikko
  • OFFLINE
  • Posts: 703
  • Thanks: 0
  • Karma: 115
17 years 11 months ago #24559 by mikko
I would do this by directly running an SQL query againts the table #__comprofiler_plugin, and then parsing the data directly from the column params.

mikko

Please Log in or Create an account to join the conversation.

  • pointri
  • pointri
  • OFFLINE
  • Posts: 118
  • Thanks: 0
  • Karma: 27
17 years 11 months ago #24590 by pointri
Thanks, Mikko. That approach worked out fine. Here was the end result:

[code:1]
// Results map
$params_query = "SELECT params FROM #__comprofiler_plugin p WHERE p.element = 'geocoder'";
$database->setQuery($params_query);
$params_str = $database->loadResult();
if ($params_str) {
$params_str = str_replace("\n","&",$params_str);
parse_str($params_str, $pm); // $pm is the parameter array
} else {
$message = _CB_AS_ERROR_PARAMS; // Or whatever error message you'd like to output
mosRedirect(sefRelToAbs("index.php?option=com_cb_search&Itemid=".$Itemid."&task=geocode"«»),$message);
}[/code:1]

Post edited by: pointri, at: 2006/11/13 23:58

Joomlapolitan zealot and a somewhat stealthy, rather passive CB3PD developer.
www.constructionlounge.com Construction Lounge: Online resource and networking portal for the construction and remodeling industries.

Please Log in or Create an account to join the conversation.

  • mikko
  • mikko
  • OFFLINE
  • Posts: 703
  • Thanks: 0
  • Karma: 115
17 years 11 months ago #24597 by mikko
Cool. As a favor, can you bump the thread in my signature.

mikko

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum