Skip to Content Skip to Menu

Custom PLugin with CB API help

  • decaye
  • decaye
  • OFFLINE
  • Posts: 3
  • Thanks: 0
  • Karma: 0
17 years 4 months ago #39115 by decaye
Custom PLugin with CB API help was created by decaye
I'm trying to do something very basic for now...but can't seem to accomplish this goal. In essence, I have a page that comes before the actual CB registration form that will POST data in a hidden form field...based on the data from that form field, I need to prevent or allow a section of the registration form to draw fields or not draw fields based on said value. That section is simply a tab with CB defined fields that need to be filled in at registration and likely be displayed on the profile. Just like any other tab, except it's a self-coded tab.

it's easier to explain in code...

class getartistsTab extends cbTabHandler {
/**
* Construnctor
*/
function getartistsTab() {
$this->cbPluginHandler();
}

**So here we are telling the tabs fields to show up on the registration form...
function getDisplayRegistration(&$tab,$user,$ui) {

** Now, here I am telling it to redeclare the hidden form fields variable from the PREVIOUS PAGE'S data into a variable called $level**
$level=$_REQUEST["usage"];

** Now, here is where we are having the problem. I already did a print_r($level) to make sure I was getting the value I need to set the condition to draw fields or not, so let's say that variable is '2'**

if ($level==2){
$tab->fields=false;
}


} // end of getDisplayRegistration function

AS you can see I wrote at the end that if that variable level is equal to 2 then don't draw the fields from that plugin on the registration page, yet they still show up. Any help would be appreciated.

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

  • p9939068
  • p9939068
  • OFFLINE
  • Posts: 186
  • Thanks: 0
  • Karma: 117
17 years 4 months ago #39127 by p9939068
Replied by p9939068 on topic Re:Custom PLugin with CB API help
The APC has already accomplished this.


Mike Feng
Creator of SIMGallery, SIMAnswers, and ParaInvite
www.simbunch.com
twitter.com/simbunch

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

  • decaye
  • decaye
  • OFFLINE
  • Posts: 3
  • Thanks: 0
  • Karma: 0
17 years 4 months ago #39134 by decaye
Replied by decaye on topic Re:Custom PLugin with CB API help
I'm well aware of Mikko's little plugin...this does not answer the question.

I'm fine with PHP, it's the CB API i'm having problems with...

I don't need to buy something when all I need is one IF else statement...and a little push in the right direction to see how to prevent CB from drawing fields based on it's own API. I've been through the documentation and still can't seem to...never mind..

I'm going to pull the fields variable out of the &tab and put into a 'return' and then declare it null, see what that does.

Post edited by: decaye, at: 2007/06/07 21:46

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

  • mikko
  • mikko
  • OFFLINE
  • Posts: 703
  • Thanks: 0
  • Karma: 115
17 years 4 months ago #39150 by mikko
Replied by mikko on topic Re:Custom PLugin with CB API help
You cannot toggle fields on and off using CB api. APC accomplishes this by creating a database abstraction layer, not through CB api.

If you really want to code this yourself, I suggest you study privacy policy plugin first.

mikko

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

Moderators: beatnantkrileon
Powered by Kunena Forum