• Resolved iNasser

    (@inasser)


    Hello,

    I am getting the following PHP error

    I am getting the following PHP error
    [23-Aug-2024 10:58:55 UTC] PHP Warning: foreach() argument must be of type array|object, string given in /home/nuclearmed/htdocs/nuclearmed.org/wp-content/plugins/quiz-master-next/php/template-variables.php on line 530

    This is the content of the template-variables.php from line 504 to 536
    /**

    • Returns user values for all contact fields
      *
    • @since 5.0.0
    • @return string The HTML for the content
      */
      function qsm_all_contact_fields_variable( $content, $results ) {
      global $mlwQuizMasterNext;
      $contact_form = $mlwQuizMasterNext->pluginHelper->get_quiz_setting( ‘contact_form’ ); $return = ”;
      if ( isset( $results[‘contact’] ) && ( is_array( $results[‘contact’] ) || is_object( $results[‘contact’] ) ) ) {
      foreach ( $results[‘contact’] as $results_contact ) {
      $options = qsm_get_options_of_contact_fields($contact_form, $results_contact[‘label’], $results_contact[‘type’] );
      $isRadioOrSelect = in_array($results_contact[‘type’], [ ‘radio’, ‘select’ ], true);
      $hasOptions = ! empty(trim($options)); if ( ($isRadioOrSelect && $hasOptions) || ! $isRadioOrSelect ) { $return .= $results_contact['label'] . ': ' . $results_contact['value'] . '<br>'; } } }
      $content = str_replace( ‘%CONTACT_ALL%’, $return, $content );
      return $content;
      }
      function qsm_get_options_of_contact_fields( $data, $label, $type ) {
      foreach ( $data as $item ) {
      if ( $item[‘label’] === $label && $item[‘type’] === $type ) {
      return $item[‘options’];
      }
      }
      return null; // Option not found
      }

      Can you please help me fix it?

      Best regards,
      Nasser

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Support sadiyakhanam

    (@sadiyakhanam)

    Hi, @inasser ,

    Thank you for taking the time to explain the problem you are experiencing.

    We’ve reviewed the situation and have implemented a temporary fix to manage the error. Our team is actively working on a more comprehensive solution, which will be included in our next release. We’re confident that this update will address the issue effectively.

    I’ll keep you updated and let you know as soon as the fix is ready. We appreciate your patience and understanding.

    If you have any more questions or need help with anything else, please feel free to reach out.

    Best regards,
    Sadiya

Viewing 1 replies (of 1 total)

The topic ‘$data is being passed as a string rather than an array’ is closed to new replies.