Skip to content

Commit

Permalink
Allow themes to load a certain number of attachments in the profile page
Browse files Browse the repository at this point in the history
Signed-off-by: emanuele <emanuele45@gmail.com>
  • Loading branch information
emanuele45 committed Jun 15, 2013
1 parent 60f13c6 commit 72ec024
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 2 additions & 3 deletions sources/controllers/ProfileInfo.controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,12 @@ function action_summary()

// Load up the most recent attachments for this user for use in profile views etc.
$context['thumbs'] = array();
if (!empty($modSettings['attachmentEnable']) && allowedTo('view_attachments'))
if (!empty($modSettings['attachmentEnable']) && allowedTo('view_attachments') && !empty($settings['attachments_on_summary']))
{
$limit = 8;
$boardsAllowed = boardsAllowedTo('view_attachments');
if (empty($boardsAllowed))
$boardsAllowed = array(-1);
$attachments = list_getAttachments(0, $limit, 'm.poster_time DESC', $boardsAllowed , $context['member']['id']);
$attachments = list_getAttachments(0, $settings['attachments_on_summary'], 'm.poster_time DESC', $boardsAllowed , $context['member']['id']);

// load them in to $context for use in the template
$i = 0;
Expand Down
4 changes: 4 additions & 0 deletions themes/default/ProfileInfo.template.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ function template_ProfileInfo_init()

// This piece is used to style attachments awaiting approval in the list
$settings['attachments_awaiting_approval'] = '{attachment_link}&nbsp;(<em>{txt_awaiting}</em>)';

// This setting is used to load a certain number of attachments
// in the user's profile summary, change it to a number if you need any
$settings['attachments_on_summary'] = 0;
}

/**
Expand Down

0 comments on commit 72ec024

Please sign in to comment.