WordPress.org

Ready to get started?Download WordPress

Forums

Business Directory Plugin
[resolved] Installed plugin but cannot activate - Call-time pass-by-referen (10 posts)

  1. MCM
    Member
    Posted 2 years ago #

    Fatal error: Call-time pass-by-reference has been removed in /var/www/vhosts/y/u/11666916_m0264030/wp-content/plugins/business-directory-plugin/api/form-fields.php on line 456

    http://wordpress.org/extend/plugins/business-directory-plugin/

  2. MCM
    Member
    Posted 2 years ago #

    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,
    						 esc_attr($field->label));
    
    		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;
    	}
  3. MCM
    Member
    Posted 2 years ago #

    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.

  4. businessdirectoryplugin
    Member
    Plugin Author

    Posted 2 years ago #

    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.

  5. MCM
    Member
    Posted 2 years ago #

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

  6. businessdirectoryplugin
    Member
    Plugin Author

    Posted 2 years ago #

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

  7. MCM
    Member
    Posted 2 years ago #

    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

    form-fields.php
    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) {

    payments.php
    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 :)

  8. businessdirectoryplugin
    Member
    Plugin Author

    Posted 2 years ago #

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

  9. Shinbone
    Member
    Posted 2 years ago #

    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?

  10. Shinbone
    Member
    Posted 2 years ago #

    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!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.