Viewing 9 replies - 16 through 24 (of 24 total)
  • Plugin Author xnau webdesign

    (@xnau)

    I suggest you try

    <?php if ($this->participants_values['approved'] !== 'non' ) : ?>

    because the record won’t have a value for the approved field until you approve it, so you have to test for the absence of the field. I mentioned this before.

    Thread Starter Rem_FR

    (@rem_fr)

    Thread Starter Rem_FR

    (@rem_fr)

    Ok I change to this first

    <?php
    /*
     * default template for the [pdb_record] shortcode for editing a record on the frontend
     *
     * this template uses a table to format the form
     */
    ?>
    <?php if ($this->participants_values['approved'] === 'non' ) : ?>
    
    <div class="wrap <?php echo $this->wrap_class ?>">
    
      <?php // output any validation errors
     $this->print_errors(); ?>
    
      <?php // print the form header
      $this->print_form_head()
      ?>
    
      <?php while ($this->have_groups()) : $this->the_group(); ?>
        <?php $this->group->print_title() ?>
        <?php $this->group->print_description() ?>
    
        <table  class="form-table">
    
          <tbody class="field-group field-group-<?php echo $this->group->name ?>">
    
          <?php
          // step through the fields in the current group
    
            while ($this->have_fields()) : $this->the_field();
              ?>
    
          <tr class="<?php $this->field->print_element_class() ?>">
    
            <th><?php $this->field->print_label() ?></th>
            <td id="<?php $this->field->print_element_id() ?>">
    
              <?php $this->field->print_element(); ?>
    
                  <?php if ($this->field->has_help_text()) : ?>
              <span class="helptext"><?php $this->field->print_help_text() ?></span>
              <?php endif ?>
    
            </td>
    
          </tr>
    
          <?php endwhile; // field loop ?>
    
          </tbody>
    
        </table>
    
      <?php endwhile; // group loop ?>
        <table class="form-table">
    
        <tbody class="field-group field-group-submit">
    
          <tr>
            <th><h3><?php $this->print_save_changes_label() ?></h3></th>
            <td class="submit-buttons">
              <?php $this->print_submit_button('button-primary'); // you can specify a class for the button ?>
            </td>
          </tr>
    
        </tbody>
    
        </table><!-- end group -->
    
      <?php $this->print_form_close() ?>
    
    </div>
    
    <?php else : ?>
    
    Désolé, vous n'avez plus le droit d'éditer votre fiche pour l'instant !
    
    <?php endif ?>

    This sentence “Désolé, vous n’avez plus le droit d’éditer votre fiche pour l’instant !” appears all the time even if i checked approved field or not. So i think there is an error with that code
    Then i modified to
    <?php if ($this->participants_values[‘approved’] !== ‘non’ ) : ?>
    This time, no sentence and the participant can change his record.

    So with
    <?php if ($this->participants_values['approved'] !== 'non' ) : ?>
    or
    <?php if ($this->participants_values['approved'] === 'non' ) : ?>

    though values are different in 2 participants record, i get the same resultat

    Plugin Author xnau webdesign

    (@xnau)

    Well, it’s important to know what the contents of the database are to make sure you’re applying the right test. You need to look at records that have been approved and see what is stored. This is why I suggest testing for !== 'oui' because there won’t be anything in the record in the field unless you’ve approved it.

    Thread Starter Rem_FR

    (@rem_fr)

    Well, I think i have tried all the possibilies :

    !== ‘oui’
    !== ‘non’
    === ‘oui’
    === ‘non’

    i get differents results but not what i wanted… that’s boring PHP coding !!!

    Did you success yourself on your installation ?

    Plugin Author xnau webdesign

    (@xnau)

    Yes, it works for me, but that doesn’t matter. You need to look closer at your code…you misspelled the variable name…should be $this->participant_values['approved']

    Thread Starter Rem_FR

    (@rem_fr)

    i did it.

    with :
    <?php if ($this->participants_values[‘approved’] !== ‘non’ ) : ?>
    <?php if ($this->participants_values[‘approved’] !== ‘oui’ ) : ?>
    <?php if ($this->participants_values[‘approved’] === ‘non’ ) : ?>
    or
    <?php if ($this->participants_values[‘approved’] === ‘oui’ ) : ?>
    etc.

    i tested also with other values i had in my sql base.

    Plugin Author xnau webdesign

    (@xnau)

    Reread my last post. you have the variable misspelled.

    Thread Starter Rem_FR

    (@rem_fr)

    OH YES ! There is no S on the word participant.

    Thank you !

Viewing 9 replies - 16 through 24 (of 24 total)
  • The topic ‘Disable [pdb_record] if approved ?’ is closed to new replies.