• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Newest Members Sidebar [Deleted]

erich37

Well-known member
#2
Hi Borbole,

great add-on!

question:
was this block previously showing below the "top posters"-block (from the top posters add-on) ?
Did you switch this order?

Thanks!
 

borbole

Well-known member
#3
Hi Borbole,

great add-on!

question:
was this block previously showing below the "top posters"-block (from the top posters add-on) ?
Did you switch this order?

Thanks!
If you use it in the combination with my other add on, sidebar higest-posting members, then the the order of showing up in the sidebar will depend on which add on you will install first.
 

ArnyVee

Well-known member
#5
I just posted on the other one ('daily' new members), but maybe it would be more appropriate within this one.

Any chance for a 'random members' block?

Best would be a combined 'newest' and 'random' separated by a line or something with the same block. :)
 

borbole

Well-known member
#6
I just posted on the other one ('daily' new members), but maybe it would be more appropriate within this one.

Any chance for a 'random members' block?

Best would be a combined 'newest' and 'random' separated by a line or something with the same block. :)
Yes, but I will not include it in this mod as it is better done as a new separate mod. I can code one for you but if it is a paid request as I do not have much free time to spend woking on free mods.
 

ArnyVee

Well-known member
#7
Yes, but I will not include it in this mod as it is better done as a new separate mod. I can code one for you but if it is a paid request as I do not have much free time to spend woking on free mods.
Thank you for the answer. I may reach out to you the closer I get to bringing my sites over to xF. I have a few custom mods being worked on right now, so I'll be sure to reach out to you if/when I need to. Thanks again :)
 

borbole

Well-known member
#8
Thank you for the answer. I may reach out to you the closer I get to bringing my sites over to xF. I have a few custom mods being worked on right now, so I'll be sure to reach out to you if/when I need to. Thanks again :)
No problem. Thank you for your reply :)
 
R

ragtek

Guest
#9
one small suggestion and i hope you'll not take it bad like some other devs...
It's just a small share of my own experiance:)

PHP:
<?php
 
class Borbole_NewestMembers_Listener
{
    public static function templateHook($hookName, &$contents, array $params, XenForo_Template_Abstract $template)
    {
        if ($hookName == 'page_container_sidebar')
{
            $options = XenForo_Application::get('options');
            $newusersnumber = $options->newusersnumber;
         
$criteria = array(
'user_state' => 'valid',
'is_banned' => 0
  );
 
$latestUsers = XenForo_Model::create('XenForo_Model_User')->getLatestUsers($criteria,
                                                                                      array('limit' => $newusersnumber));
                                                                                   
            $params = array(
                'latestUsers' => $latestUsers
            );
 
            $search = '<!-- end block: sidebar_online_users -->';
            $contents = str_replace($search, $search . $template->create('borbole_newest_members', $params), $contents);
        }
    }
}
it's better if you change it to
PHP:
class Borbole_NewestMembers_Listener
{
    public static function templateHook($hookName, &$contents, array $params, XenForo_Template_Abstract $template)
    {
        if ($hookName == 'page_container_sidebar') {
            $search = '<!-- end block: sidebar_online_users -->';
            if (strpos($search, $contents)) {
                $options = XenForo_Application::get('options');
                $newusersnumber = $options->newusersnumber;
                $criteria = array(
                    'user_state' => 'valid',
                    'is_banned' => 0
                );
                $latestUsers = XenForo_Model::create('XenForo_Model_User')->getLatestUsers($criteria,
                    array('limit' => $newusersnumber));
                $params = array(
                    'latestUsers' => $latestUsers
                );
                $contents = str_replace($search, $search . $template->create('borbole_newest_members', $params), $contents);
            }
        }
    }
}
because then the query will only be run, if the search block is found in the template.
There are some places, where the code will be run BUT not outputet (is it said so?, not really or?:D ).
e.g. if somebody uses <xen:sidebar>my sidebar content</xen:sidebar> the code will be run, but the output won't be shown, because <!-- end block: sidebar_online_users --> isn't present, which means that the database query will be run + 1 additional query for the template if there are no other uncached templates ( i'm doing it like you,.. i also don't precache the template for the sidebar block..) but it's because of the other query => to grab the users
 

borbole

Well-known member
#10
one small suggestion and i hope you'll not take it bad like some other devs...
It's just a small share of my own experiance:)
First of all there is no reason as to why I should take your suggestion bad. All well meant suggestions and constractive chritisism are always welcome :)

That said, atm I do not have much free time at all to spend on my free mods. But at the first chance I get I will look into this for sure. Thank you for your suggestion.