HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


ocnoobs addon

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#101037 (In Topic #19821)
Avatar

Community saint

Hi,

Has anyone tried this add-on ?

If I just call the block with out filter or max values then it works and returns the default last 10 members from any of the user groups that we have.

If I add a max and/or filter on the groups then it always returns "no entries at this time".

I am guessing that the parsing of the inputted parameters is to blame, but I cannot see how $map gets populated in the run function:

Code

   function run($map)
   {
      $number=array_key_exists('max',$map)?intval($map['max']):10;
      $filter=array_key_exists('filter',$map)?$map['filter']:'*';

      $out=new ocp_tempcode();

      require_code('ocf_members');
      require_code('ocf_members2');
      require_code('ocfiltering');

      $sql_filter=ocfilter_to_sqlfragment($filter,'m_primary_group');
      $sql_filter_2=ocfilter_to_sqlfragment($filter,'gm_group_id');

      $rows=$GLOBALS['FORUM_DB']->query('SELECT m.* FROM '.$GLOBALS['FORUM_DB']->get_table_prefix().'f_members m LEFT JOIN '.$GLOBALS['FORUM_DB']->get_table_prefix().'f_group_members g ON (m.id=g.gm_member_id AND gm_validated=1) LEFT JOIN '.$GLOBALS['FORUM_DB']->get_table_prefix().'f_member_custom_fields f ON m.id=f.mf_member_id WHERE (('.$sql_filter.') OR ('.$sql_filter_2.')) AND id<>'.strval($GLOBALS['FORUM_DRIVER']->get_guest_id()).(can_arbitrary_groupby()?' GROUP BY m.id':'').' ORDER BY m.m_join_time DESC',$number);
      $rows=remove_duplicate_rows($rows,'id');

      if (count($rows)==0)
      {
         return do_template('BLOCK_NO_ENTRIES',array('HIGH'=>false,'TITLE'=>do_lang_tempcode('RECENT',make_string_tempcode(integer_format($number)),do_lang_tempcode('MEMBERS')),'MESSAGE'=>do_lang_tempcode('NO_ENTRIES'),'ADD_NAME'=>'','SUBMIT_URL'=>''));
      } else
      {
         foreach ($rows as $row)
         {
            $out->attach(render_member_box($row['id'],true));
         }
      }

      return $out;
   }

Any idea of the tweak that I would need to make ?

Cheers
Ade
Back to the top
 
Posted
Rating:
#101038
Avatar

I'm trying this out, and wow is the display ugly - I'm going to fix that first.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#101039
Avatar

Community saint

It is !!!

I modified the call to render_member_box() to turn off the Avatars, then at least they show as a list :-)
I also hard coded the max and filter to get the last 100 back from group 9 (newbies).

I want to extend this to be able to show the last x number if users that were in the paid members group but did not renew - not sure if the data is there to work that out though !

Cheers
Ade
Back to the top
 
Posted
Rating:
#101040
Avatar

I couldn't reproduce a bug, but I have pushed an updated version of the addon with a CSS file that lays it out better.

Make sure you specify numeric usergroup IDs.

FYI $map is the block parameters. Every block gets them via this being passed into the run function (or injected into the global scope if it's a miniblock).


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#101062
Avatar

Community saint

Hi Chris,

I have updated the addin to your new version, but i cannot get it to display any data unless I hard code the parameters in.

http://vwgolfmk1.org.u…dex.php?page=groupJoiners

It is a admin/committee only page at the moment.

Cheers
Ade
Back to the top
 
Posted
Rating:
#101065
Avatar

You have both double and single quotes around the parameter values. I removed the single quotes and that seemed to work when I clicked preview.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#101068
Avatar

Community saint

Thanks Chris, I was sure I cut and pasted the example line - oh well at least it works now.

Cheers
Ade
Back to the top
 
1 guests and 0 members have just viewed this: None
Control functions:
 Add topic 

Quick reply   Contract

Your name:
Your message: