Skip to Content Skip to Menu

Parameter passing question

  • bascherz
  • bascherz
  • OFFLINE
  • Posts: 228
  • Thanks: 29
  • Karma: 11
17 years 6 months ago #35413 by bascherz
Parameter passing question was created by bascherz
Okay, I give up. I am writing a plug-in that has an onAfterUserUpdate event handler. I have verified that the handler gets called (so do all the other handlers in this plugin). Good so far. However, I am calling $params->get('cb_myfield',0) to try to fetch the value of a checkbox field that is not defined in the install XML file. This field was added manually in the Field Manager to a tab that is defined in the XML file. I always get the default value for this field, which leads me to believe this can't be done.

I have tried forcing the plugin_id field to equal the id of the plugin where this handler is defined, but that made no difference. Is this a requirement to be able to use the $params->get function? Is having defined the tab in the XML for the plugin a requirement? The API document only talks about fields defined in the XML file being accessible this way in plugin code.

What am I missing?

Thanks in advance,
Bruce

Bruce S - Vienna, VA

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

  • mikko
  • mikko
  • OFFLINE
  • Posts: 703
  • Thanks: 0
  • Karma: 115
17 years 6 months ago #35417 by mikko
Replied by mikko on topic Re:Parameter passing question
Params is not same as fields.

Params are back end parameters which are set when you configure a plugin.

Field values are accessible through $user or $rowExtras objects.

mikko

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

  • nant
  • nant
  • OFFLINE
  • Posts: 12339
  • Thanks: 1467
  • Karma: 877
17 years 6 months ago #35418 by nant
Replied by nant on topic Re:Parameter passing question
bascherz wrote:

Okay, I give up. I am writing a plug-in that has an onAfterUserUpdate event handler. I have verified that the handler gets called (so do all the other handlers in this plugin). Good so far. However, I am calling $params->get('cb_myfield',0) to try to fetch the value of a checkbox field that is not defined in the install XML file. This field was added manually in the Field Manager to a tab that is defined in the XML file. I always get the default value for this field, which leads me to believe this can't be done.

I have tried forcing the plugin_id field to equal the id of the plugin where this handler is defined, but that made no difference. Is this a requirement to be able to use the $params->get function? Is having defined the tab in the XML for the plugin a requirement? The API document only talks about fields defined in the XML file being accessible this way in plugin code.

What am I missing?

Thanks in advance,
Bruce


study the helloworld plugins.

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

  • bascherz
  • bascherz
  • OFFLINE
  • Posts: 228
  • Thanks: 29
  • Karma: 11
17 years 6 months ago #35436 by bascherz
Replied by bascherz on topic Re:Parameter passing question
Hey Mikko,

I wondered about the $rowExtras argument. Neither this nor the $row argument (where it appears) is explained in the API document. However, I could swear I read somewhere in there that $params->get could get both front and back end items, so I assumed it referred to the tab fields.

So is it as simple as $rowExtras->fieldname or is there some other magic required?

Thanks a bunch,
Bruce

Bruce S - Vienna, VA

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

  • bascherz
  • bascherz
  • OFFLINE
  • Posts: 228
  • Thanks: 29
  • Karma: 11
17 years 6 months ago #35438 by bascherz
Replied by bascherz on topic Re:Parameter passing question
Helloworld does not clear anything up for me Nick. Sorry.

Bruce S - Vienna, VA

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

  • nant
  • nant
  • OFFLINE
  • Posts: 12339
  • Thanks: 1467
  • Karma: 877
17 years 6 months ago #35445 by nant
Replied by nant on topic Re:Parameter passing question
bascherz wrote:

Helloworld does not clear anything up for me Nick. Sorry.


Now lets see how can we access additional information about the actual profile being viewed. This is actually provided for us by the CB plugin API. The $user object which is referenced in the getDisplayTab function contains all the information about the viewed profile user (actually all of the fields in the comprofiler table for this profile user are contained in this $user object). Using the print_r($user); in line 39 we can see all the goodies in the object referenced by the $user variable. You will see all the extra fields defined by CB - either via the CB field Management backend or any installed plugins. Lines 58 and 60 use the $user variable to display the profile owners name and the profile owners email.

(from helloworld part 2)

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

Moderators: beatnantkrileon
Powered by Kunena Forum