Jump to content

4.1 equivalent of ClassDB.php


rgf100

Recommended Posts

Posted

With 3.4 I was able to use this resource and a certain amount of brain juice to make custom blocks that would, for example, give me a feed of post from new members, of highest rated posts for the week, etc. For example the following looks for posts made in the last day, by members with less than five posts. The idea is that staff can use this to find those posts and make sure new members are being welcomed, finding the info they need, etc. 

 

$onedayago = time() - (86400);
$this->DB->build( array(
		'select'	=> 'p.pid, p.author_name, p.author_id, p.post_date, p.queued, t.title, t.approved, m.posts',
		'from'		=> array( 'posts' => 'p'),
		'where'		=> "p.post_date > $onedayago AND p.queued = 0 AND m.posts < 5 AND t.approved = 1",
		'order'		=> 'p.post_date DESC',
		'add_join'	=> array(
							array(
								'select'	=> 'm.member_id, m.posts',
								'from'		=> array( 'members' => 'm' ),
								'where'		=> 'm.member_id=p.author_id',
								'type'		=> 'left',
								),
							array(
								'select'	=> 't.title',
								'from'		=> array( 'topics' => 't' ),
								'where'		=> 'p.topic_id=t.tid',
								'type'		=> 'left',
								),
							)
		)		 );

I'm trying to reproduce these in 4.1, but am effectively starting from scratch and I can't spot an equivalent guide or documentation. Does anyone know of a guide or tutorial or...anything.... that might give me a place to start in how the new database class works?

 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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