Advertisement:

Author Topic: [Workaround] Bender Themes user dashboard pagination  (Read 2057 times)

mmcsus

  • Hero Member
  • *****
  • Posts: 704
  • Open Source
[Workaround] Bender Themes user dashboard pagination
« on: July 07, 2013, 10:28:22 pm »

In oc-content/themes/your_bender_theme/functions.php find around line 341

Code: [Select]
    if( !function_exists('get_user_menu') ) {
        function get_user_menu() {
            $options   = array();
            $options[] = array(
                'name'  => __('Dashboard', 'bender'),
                'url'   => osc_user_dashboard_url(),
                'class' => 'opt_dashboard'
            );
         
Right after the above code add the following:

Code: [Select]
   $options[] = array(
                'name'  => __('Manage your listings', 'bender'),
                'url'   => osc_user_list_items_url(),
                'class' => 'opt_items'
            );

In the above code where you see 'bender' you will want to put your theme. Example: 'bender_black' ...etc.

In oc-content/themes/your_bender_theme/user-dashboard.php find around line 78

Code: [Select]
  <div class="paginate" >
        <?php echo osc_search_pagination(); ?>
  </div>

Change to:

 
Code: [Select]
       <div class="paginate" >
                    <?php for($i 0$i osc_list_total_pages(); $i++) {
                        if(
$i == osc_list_page()) {
                            
printf('<a class="searchPaginationSelected" href="%s">%d</a>'osc_user_list_items_url($i), ($i 1));
                        } else {
                            
printf('<a class="searchPaginationNonSelected" href="%s">%d</a>'osc_user_list_items_url($i), ($i 1));
                        }
                    } 
?>

        </div>
      
Now you will have a new menu item "Manage your listings" when selected will give you pagination.


« Last Edit: July 07, 2013, 10:49:43 pm by mmcsus »

InstaladorX

  • Full Member
  • ***
  • Posts: 109
  • I live without rest! Osclass 3.2.1 Theme Bender
Re: [Workaround] Bender Themes user dashboard pagination
« Reply #1 on: November 22, 2013, 04:32:54 am »
Thanks for doing this!

I leave a small correction:

The first page despite the URL ends title as "... page=user&action=items", actually it is the  "items&iPage=1".

In the code below (the original), the page 1 would be in pagination 2.

Clicking for pagination (2) we'd be returning to the same page (1).


Code: [Select]
       <div class="paginate" >
                    <?php for($i 0$i osc_list_total_pages(); $i++) {
                        if(
$i == osc_list_page()) {
                            
printf('<a class="searchPaginationSelected" href="%s">%d</a>'osc_user_list_items_url($i), ($i 1));
                        } else {
                            
printf('<a class="searchPaginationNonSelected" href="%s">%d</a>'osc_user_list_items_url($i), ($i 1));
                        }
                    } 
?>

        </div>

The detail is here:

Where we have:

Code: [Select]
osc_user_list_items_url($i), ($i + 1));
We replaced it with this:

Code: [Select]
osc_user_list_items_url($i+1), ($i + 1));
The complete code would be this:

Code: [Select]
       <div class="paginate" >
                    <?php for($i 0$i osc_list_total_pages(); $i++) {
                        if(
$i == osc_list_page()) {
                            
printf('<a class="searchPaginationSelected" href="%s">%d</a>'osc_user_list_items_url($i+1), ($i 1));
                        } else {
                            
printf('<a class="searchPaginationNonSelected" href="%s">%d</a>'osc_user_list_items_url($i+1), ($i 1));
                        }
                    } 
?>

        </div>

Again, thank you!

 8) Go beyond!