Jump to content

Grab Member Count in Pages


Recommended Posts

2 hours ago, Daniel F said:

{{$count=\IPS\Db::i()->select( 'COUNT(*)', 'core_members', ['completed=?', true] )->first();}}
Total Members: {$count}

 

I get an error when doing this:

ParseError: syntax error, unexpected '}' (0)
#0 /home/unified1/public_html/system/Helpers/Form/FormAbstract.php(377): IPS\cms\Blocks\_Block->IPS\cms\Blocks\{closure}('{{$count=\\IPS\\D...')
#1 /home/unified1/public_html/system/Helpers/Form/TextArea.php(119): IPS\Helpers\Form\_FormAbstract->validate()
#2 /home/unified1/public_html/system/Helpers/Form/FormAbstract.php(165): IPS\Helpers\Form\_TextArea->validate()
#3 /home/unified1/public_html/system/Helpers/Form/FormAbstract.php(142): IPS\Helpers\Form\_FormAbstract->setValue(true)
#4 /home/unified1/public_html/system/Helpers/Form/TextArea.php(66): IPS\Helpers\Form\_FormAbstract->__construct('block_content', '', false, Array, Object(Closure), NULL, NULL, 'block_content')
#5 /home/unified1/public_html/system/Helpers/Form/Codemirror.php(68): IPS\Helpers\Form\_TextArea->__construct('block_content', '', false, Array, Object(Closure), NULL, NULL, 'block_content')
#6 /home/unified1/public_html/applications/cms/sources/Blocks/Block.php(668): IPS\Helpers\Form\_Codemirror->__construct('block_content', '', false, Array, Object(Closure), NULL, NULL, 'block_content')
#7 /home/unified1/public_html/system/Node/Controller.php(489): IPS\cms\Blocks\_Block->form(Object(IPS\Helpers\Form))
#8 /home/unified1/public_html/init.php(820) : eval()'d code(16): IPS\Node\_Controller->_addEditForm(Object(IPS\cms\Blocks\Block))
#9 /home/unified1/public_html/system/Node/Controller.php(388): IPS\Node\rules_hook_ipsNodeController->_addEditForm(Object(IPS\cms\Blocks\Block))
#10 /home/unified1/public_html/system/Dispatcher/Controller.php(85): IPS\Node\_Controller->form()
#11 /home/unified1/public_html/system/Node/Controller.php(62): IPS\Dispatcher\_Controller->execute()
#12 /home/unified1/public_html/applications/cms/modules/admin/pages/blocks.php(39): IPS\Node\_Controller->execute()
#13 /home/unified1/public_html/system/Dispatcher/Dispatcher.php(152): IPS\cms\modules\admin\pages\_blocks->execute()
#14 /home/unified1/public_html/admin/index.php(14): IPS\_Dispatcher->run()
#15 {main}

Code:

{{$count=\IPS\Db::i()->select( 'COUNT(*)', 'core_members', ['completed=?', true] )->first();}}
{$count}

 

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...
On 3/23/2020 at 8:34 AM, Morrigan said:

@Kyle F

Use this:


Total Members: {expression="\IPS\Db::i()->select( 'COUNT(*)', 'core_members', ['completed=?', true] )->first()"}

 

Thanks, Morrigan! That worked.

Sorry for the late response here; PC power supply became defective and had to go through a 3 week wait for a replacement from Corsair. Finally got my PC back! 🙂

Link to comment
Share on other sites

24 minutes ago, Morrigan said:

@Kyle F


{expression="\IPS\Db::i()->select( 'COUNT(*)', 'core_members', ['member_group_id=?', ##])->first()"}

I think.

Oof. When using that above I get this:

Quote

Something went wrong. Check the values provided on the marked tabs and try again.

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...