Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)

  • moui
    Participant

    @moui

    actually it looks like registration is the same, and I had made some wrong assumptions! in any case, thanks!


    moui
    Participant

    @moui

    I think this is handling a single field at a time, rather than giving me a $_POST I can work with, so I can’t do exactly the same process. That said, I can make this work. Thanks!


    moui
    Participant

    @moui

    I should add that I am using some forms as a UI for the end user to control these filters. So what I really want to know is, what is the best practice for providing the user’s input to the bp ajax handler and passing it through to my filter?

    I also want to have that data available when I am emitting the form so I can persist the selected options.

    I am currently displaying the form via a function in a BP_Group_Extension class. Here’s the function that provides it:

      public function display_group_filters($raw_filters = []) {
        $sl = [];
        $tf_semester = [];
        $tf_year = [];
        if(!empty($raw_filters['student_level'])){
          $sl = $raw_filters['student_level'];
        }
    
        if(!empty($raw_filters['semester'])){
          $tf_semester = $raw_filters['semester'];
        }
        if(!empty($raw_filters['year'])){
          $tf_year = $raw_filters['year'];
        }
    
        $out = '
        <div id="group-dir-filter"
          class="col-xs-12 col-md-3 col-md-pull-9" role="filter">
          <form action="" method="get" id="filters">
            <h3>Filters</h3>
            <p>
            Use the controls below to limit what projects are shown.
            </p>
            <div class="filter-section col-xs-6 col-md-12">
              <h4>Student level</h4>';
        $out .= $this->student_levels_markup($sl, false);
        $out .= '
            </div>
            <div class="filter-section col-xs-6 col-md-12">
              <h4>Timeframe</h4>';
        $out .= $this->semester_markup($tf_semester, $tf_year, false);
        $out .= '
            </div>
            <input type="hidden" name="action" value="tp_filter_group" />
            <button class="btn btn-warning" type="button"
            onclick="window.location.href=\''.esc_url( home_url( '/' ) ).'/groups\'" />Reset</button>
            <button type="submit" class="btn btn-info">Filter</button>
          </form>
        </div>';
        echo $out;
        return $out;
      }
Viewing 3 replies - 1 through 3 (of 3 total)
Skip to toolbar