Advertisement:

Author Topic: How to make users backend shows 100 users per page as default?  (Read 1223 times)

lucato

  • Full Member
  • ***
  • Posts: 182
  • [<o>] Brasil
Hi folks, how to make users backend shows 100 users per page as default or even more than that per page?

Thanks

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: How to make users backend shows 100 users per page as default?
« Reply #1 on: July 11, 2015, 03:30:14 pm »
***FLAWED***

Hi,

Add this at the very bottom of your theme functions.php:
Notes:
1.- Take care not to leave blank lines after this.
2.- If your theme functions.php doesn't end with ?> skip first line of my code.


Code: [Select]
<?php
function cust_admin_additional_users_per_page($additional_option 200) {
    
if (Params::getParam('page') == 'users') { 
        Params::setParam('iDisplayLength'$additional_option); ?>

        <script type="text/javascript">
                $('select[name=iDisplayLength]').append('<option value="<?php echo $additional_option?>"<?php if( Params::getParam('iDisplayLength') == $additional_option) echo 'selected'?> ><?php printf(__('%d Users'), $additional_option) ; ?></option>');
        </script>
<?php }
}

osc_add_hook('before_show_pagination_admin','cust_admin_additional_users_per_page');


Change "200" to the number you want.

Note.- Take into account that this will work only while you have that theme active, if you usually switch themes, repeat this procedure for every theme you have.

Regards
« Last Edit: July 11, 2015, 04:54:44 pm by teseo »

lucato

  • Full Member
  • ***
  • Posts: 182
  • [<o>] Brasil
Re: How to make users backend shows 100 users per page as default?
« Reply #2 on: July 11, 2015, 04:16:11 pm »
Hey Teseo, thanks a lot, I appreciated that. It worked!

Just clouple comments on your code:
1. The text shows as "Listings" intead of "Users" ;0)
2. If I change the number of listings per page, it is acting also on users page. So, if on managing listings I select 50 per page, when I go back to users, it is 50 too instead of 200 as I had left. 

Not sure if this code need some little adjustment.

By the way, how to make it works also for listings as 200. Thanks.

Have a great weekend.
« Last Edit: July 11, 2015, 04:17:52 pm by lucato »

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: How to make users backend shows 100 users per page as default?
« Reply #3 on: July 11, 2015, 04:53:09 pm »
1. The text shows as "Listings" intead of "Users" ;0)

That's because I revamped another function that I already had for Items.

Anyway, I can see now that the original function was to always show 200 Items (or Users in this case). In fact it disables the whole number select. :(

The thing is trickier than I imagined, I'll get back to you tomorrow.

Regards

fre2mansur

  • Hero Member
  • *****
  • Posts: 711
Re: How to make users backend shows 100 users per page as default?
« Reply #4 on: December 16, 2015, 06:56:18 am »
Hi, how can I do that for search page? in front end?