Jump to content


Photo

Recent Status Updates Block


  • Please log in to reply
5 replies to this topic

#1 Steve

Steve

    Advanced Member

  • Administrators[Admin]
  • PipPipPip
  • 130 posts
  • Gender:Male

Posted 28 September 2009 - 09:33 AM

ACP -> My Apps -> Unreal Portal -> Add Custom Block

Remove:
<!-- This is the default custom block template. You can either replace this comment tag with your own content to create a simple custom block or you can remove the entire content and have your own formatting-->

And add this in it's place:

<?php

$this->registry	= ipsRegistry::instance();
$this->DB = $this->registry->DB();

$this->DB->build( array(
					'select' 	=> 'pp.*',
					'from'		=> array( 'profile_portal' => 'pp' ),
					'where'		=> 'pp.pp_status <> ""',
					'order'		=> 'pp.pp_status_update DESC',
					'limit'		=> array( 0, 10 ),
					'add_join'	=> array(
									array(
											'select'	=> 'm.members_display_name, m.members_seo_name',
											'from'		=> array( 'members' => 'm' ),
					                 	 			'where'		=> 'pp.pp_member_id=m.member_id',
											'type'		=> 'left'
										)
								)
			)	);
$q = $this->DB->execute();

$rows = array();
		
while( $r = $this->DB->fetch( $q ) )
{
		$r = ipsMember::buildProfilePhoto( $r );
		$rows[] = $r;
	}

echo $this->registry->output->getTemplate( 'boards' )->hookBoardIndexStatusUpdates( $rows );

?>


***This only works if the status hook is installed.

#2 SolidSnke

SolidSnke

    Newbie

  • Members
  • Pip
  • 5 posts
  • Gender:Male

Posted 08 October 2009 - 08:20 AM

Thanks great little code.

#3 dieseltec

dieseltec

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 24 October 2009 - 03:11 PM

Thx for the share :) will make good use of this..

I have been trying to put something like that together for the Top Posters Hook,

but i can only get it to show pics, always comes out with 0 as post an no member name,
any help :)

#4 highlander

highlander

    Advanced Member

  • Members
  • PipPipPip
  • 36 posts

Posted 04 July 2010 - 09:22 PM

an updated code box would be awesome!

#5 HappyBoy

HappyBoy

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 15 January 2011 - 09:26 PM

i tried putting this code in my unreal portal problem is when i put it in and reload my site it comes up with "service not available" or a number like "507" but when i delete the recent status update tab and reload my page it loads normally.

what could be causing the problem?

#6 Jas

Jas

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 27 February 2012 - 01:26 PM

For IPB32, Im still looking for a better way to do it. For the meantime, this is what I did

In your skin, Add New Bit
Template Bit name: unrealstatus
Add to Group: skin_uportal
Data Variables: $rows

Copy the following code into your new template

<div class='general_box clearfix'>
    	<ul class='hfeed block_list'>
            	<if test="recent_status_updates:|:is_array( $rows ) && count( $rows )">
                    	{parse striping="recent_status" classes="row1,row2 altrow"}
                    	<foreach loop="status_update_hook:$rows as $r">
                            	<li class='hentry {parse striping="recent_status"}'>
                                    	<span class='left' style='margin-right: 5px;'><img src='{$r['pp_mini_photo']}' width='{$r['pp_mini_width']}' height='{$r['pp_mini_height']}' class='photo' alt="{$r['members_display_name']}{$this->lang->words['users_photo']}" /></span><address class="author vcard"><a class="url fn" href="{parse url="showuser={$r['pp_member_id']}" template="showuser" seotitle="{$r['members_seo_name']}" base="public"}" title='{$this->lang->words['view_profile']}'>{$r['members_display_name']}</a></address><span class='date'>{parse template="user_popup" group="global" params="$r['pp_member_id'], $r['members_seo_name']"}: {$r['content']}<br />
                                    	<abbr class="published" title="{parse expression="date( 'c', $r['date'] )"}">{parse date="$r['date']" format="short"}</abbr> Reply ({$r['reply']})</span>
                            	</li>
                    	</foreach>
            	<else />
                    	<li>{$this->lang->words['norecent_status_updates']}</li>
            	</if>
    	</ul>
        
</div>
 

Add new block for your status, copying the following code to the new block

<table class='ipb_table'>
    
    	<tr>
   			<td class='row2' align="left" width="200" wrap>
 
<?php
 
$this->registry = ipsRegistry::instance();
$this->DB = $this->registry->DB();
 
$this->DB->build( array(
'select' => 'msu.status_id,msu.status_member_id,msu.status_date as date,msu.status_content as content,msu.status_is_latest,msu.status_replies as reply,pp.pp_member_id, pp.pp_main_photo, pp.pp_thumb_photo, pp.pp_thumb_width, pp.pp_thumb_height',
'from' => array( 'member_status_updates' => 'msu', 'profile_portal' => 'pp'),
'where' => 'msu.status_member_id=pp.pp_member_id AND msu.status_is_latest=1',
'order' => 'msu.status_id DESC',
'limit' => array(0,7),
'add_join' => array(
array(
'select' => 'm.members_display_name, m.member_group_id, m.members_seo_name',
'from' => array( 'members' => 'm' ),
'where' => 'pp.pp_member_id=m.member_id',
'type' => 'left'
)
)
) );
 
$q = $this->DB->execute();
 
while( $r = $this->DB->fetch( $q ) )
{
$r = ipsMember::buildProfilePhoto( $r );
$r['members_display_name'] = IPSMember::makeNameFormatted( $r['members_display_name'], $r['member_group_id'] );
$r['content']=IPSText::truncate( $r['content'], 75)  ;
$rows[] = $r;
}
 
echo $this->registry->output->getTemplate( 'uportal' )->unrealstatus( $rows );
 
?>
</td>
</tr>
 
</table>
 
<br />





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users