Support » Plugin: Business Directory Plugin » [Plugin: Business Directory Plugin] Installed plugin but cannot activate – Call-time pass-by-referen

Viewing 9 replies - 1 through 9 (of 9 total)
  • Line 456 is inside the following function inside the form-fields.php

    public function render_select(&$field, $value=null, $multiselect=false) {
    		if (is_string($value))
    			return $this->render_select($field, explode("\t", $value), $multiselect);
    		$html = '';
    		$html .= sprintf('<p class="wpbdmp"><label for="%s">%s</label></p>',
    						 'wpbdp-field-' . $field->id,
    		if ($value) {
    			if (!$multiselect) $value = array($value[0]);
    			$value = array_map('trim', $value);
    		} else {
    			$value = array();
    		if ($field->association == 'category') {
    			$html .= wp_dropdown_categories( array(
    					'taxonomy' => wpbdp()->get_post_type_category(),
    					'show_option_none' => _x('Choose One', 'form-fields-api category-select', 'WPBDM'),
    					'orderby' => 'name',
    					'selected' => $value[0],
    					'order' => 'ASC',
    					'hide_empty' => 0,
    					'hierarchical' => 1,
    					'echo' => 0,
    					'id' => 'wpbdp-field-' . $field->id,
    					'name' => 'listingfields[' . $field->id . ']',
    					'class' => $field->is_required ? 'inselect required' : 'inselect'
    				) );
    		} else {
    			$html .= sprintf('<select id="%s" name="%s" %s class="%s %s">',
    							'wpbdp-field-' . $field->id,
    							'listingfields[' . $field->id . ']' . ($multiselect ? '[]' : ''),
    							$multiselect ? 'multiple="multiple"' : '',
    							$multiselect ? 'inselectmultiple' : 'inselect',
    							$field->is_required ? 'required' : '');
    			if (isset($field->field_data['options'])) {
    				foreach ($field->field_data['options'] as $option) {
    					$html .= sprintf('<option value="%s" %s>%s</option>', esc_attr($option), in_array($option, $value) ? 'selected="selected"' : '', esc_attr($option));
    			$html .= '</select>';
    		return $html;

    I managed to figure this out after googling 🙂

    It is the PHP version 5.4 that is not happy.

    However, even though the plugin now activates, I get duplicate Field Names.

    e.g. Business Name: test listing
    Business Name: test listing

    BOTH when posted and creating the post.

    Also, I cannot see the post fields when adding a listing.

    Plugin Author businessdirectoryplugin


    PHP 5.4, eh? None of my web hosts have that yet, but it’s good to know that’s a coming problem. I’ll see what I can do about both.

    The duplicate fields may have been caused by the PHP error, and you can delete the duplicates directly in the database in the wpbdp_form_fields. That should get you past that aspect.

    I fixed the php code myself I will update this post shortly with my fixes. 🙂

    Plugin Author businessdirectoryplugin


    Thanks for that. We’ll add the fixes and test them against older versions of PHP as well.

    I tested the following on my PHP 5.4.3 on my local machine.
    All the changes had to be done in files in the api/ folder.

    Software:= xampp-win32-1.8.0-usb-lite-beta13

    Files – form-fields.php, payments.php

    Format below
    A – Line Number
    B – Before
    C – After

    A – 456
    B – if ($this->isValidField($field, &$errors)) { :
    C – if ($this->isValidField($field, $errors)) {

    A – Line 494
    B – echo $this->render(&$field, $value, false);
    C – echo $this->render($field, $value, false);

    A – Line 503
    B – public function render_textfield(&$field, value=null) {
    C – public function render_textfield(&$field, $value=null) {

    A – line 142
    B- if ($this->is_valid_fee($fee, &$errors)) {
    C – if ($this->is_valid_fee($fee, $errors)) {

    PS: Yes, I removed the excess database records and all is well 🙂

    Plugin Author businessdirectoryplugin


    Thanks for that detailed report! Much appreciated. We’ll put those in, test them out and make sure we’re 5.4 compliant.

    getting the following fatal error Call-time pass-by-reference has been removed in C:\wamp\www\wp-content\plugins\business-directory-plugin\api\form-fields.php on line 456 after activating business directory plugin. How can I fix this?

    As I’m new to all this wp stuff didn’t realise nathmie had already posted a solution!! Thanks for doing so, plugin now working. Slainte!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Plugin: Business Directory Plugin] Installed plugin but cannot activate – Call-time pass-by-referen’ is closed to new replies.