Author Topic: [SMF 2.0] Profile Current Action  (Read 1721 times)

0 Members and 1 Guest are viewing this topic.

Offline ccbtimewiz

  • Dreamer
  • Guru
  • *
  • Posts: 1304
  • Karma: 2100
  • Gender: Male
  • $info->close();
    • Dream Portal
  • SMF Version: SMF 2.0 RC4
[SMF 2.0] Profile Current Action
« on: October 01, 2008, 06:09:45 PM »
This is a small hack for the SMF 2.0 series that will show a user's current action in their profile. You can set set permissions for it to show to select groups by choosing the right replacement code.

SMF 2.0 BETA versions (NOT RC versions)


Open ./Themes/default/Profile.template.php

Find:
:
            <tr>
<td><b>', $txt['lastLoggedIn'], ': </b></td>
<td>', $context['member']['last_login'], '</td>
</tr>';

Replace with:
: (Show profile actions to all users and guests)
if (!empty($context['member']['action']))
echo '
<tr>
<td><strong>', $txt['current_action'], ': </strong></td>
<td>', $context['member']['action'], '</td>
</tr>';

Or replace with:
: (Show profile actions to only users that are logged in)
if ((!empty($context['member']['action'])) && ($context['user']['is_logged']))
echo '
<tr>
<td><strong>', $txt['current_action'], ': </strong></td>
<td>', $context['member']['action'], '</td>
</tr>';


Or replace with:
: (Show profile actions to only admins)
if ((!empty($context['member']['action'])) && ($context['user']['is_admin']))
echo '
<tr>
<td><strong>', $txt['current_action'], ': </strong></td>
<td>', $context['member']['action'], '</td>
</tr>';

Or replace with:
: (Show profile actions to specific membergroups)
// Delimit the following line with commas within an array. Example: array(1, 2, 5, 8, 12, 6). Group 3 will not work.
$groups_can_see = array(1, 2);
$can_view_action = count(array_intersect($groups_can_see, $user_info['groups'])) > 0;

if ((!empty($context['member']['action'])) && ($can_view_action))
echo '
<tr>
<td><strong>', $txt['current_action'], ': </strong></td>
<td>', $context['member']['action'], '</td>
</tr>';

Open ./Themes/default/languages/Modifications.english.php

Find:
:
?>
Replace with:
:
$txt['current_action'] = 'Current Action';
?>



SMF 2.0 RC versions (NOT BETA versions)



Open ./Themes/default/Profile.template.php

Find:
:
echo '
<dt>', $txt['lastLoggedIn'], ': </dt>
<dd>', $context['member']['last_login'] ,'</dd>';

Add after:
: (Show profile actions to all users and guests)
if (!empty($context['member']['action']))
echo '
<dt><strong>', $txt['current_action'], ': </strong></dt>
<dd>', $context['member']['action'], '</dd>';

Or instead, add after:
: (Show profile actions to only users that are logged in)
if ((!empty($context['member']['action'])) && ($context['user']['is_logged']))
echo '
<dt><strong>', $txt['current_action'], ': </strong></dt>
<dd>', $context['member']['action'], '</dd>';


Or instead, add after:
: (Show profile actions to only admins)
if ((!empty($context['member']['action'])) && ($context['user']['is_admin']))
echo '
<dt><strong>', $txt['current_action'], ': </strong></dt>
<dd>', $context['member']['action'], '</dd>';

Or instead, add after:
: (Show profile actions to specific membergroups)
// Delimit the following line with commas within an array. Example: array(1, 2, 5, 8, 12, 6). Group 3 will not work.
$groups_can_see = array(1, 2);
$can_view_action = count(array_intersect($groups_can_see, $user_info['groups'])) > 0;

if ((!empty($context['member']['action'])) && ($can_view_action))
echo '

<dt><strong>', $txt['current_action'], ': </strong></dt>
<dd>', $context['member']['action'], '</dd>';

Open ./Themes/default/languages/Modifications.english.php

Find:
:
?>
Replace with:
:
$txt['current_action'] = 'Current Action';
?>
« Last Edit: February 27, 2009, 04:01:29 PM by ccbtimewiz »

Offline brianjw

  • Guru
  • *
  • Posts: 2346
  • Karma: 1408
  • Gender: Male
  • What?!?! You mean they're sold out!
Re: Adding current action to profile summary (SMF 2.0)
« Reply #1 on: October 01, 2008, 07:23:07 PM »
Isn't there a mod that does this as well?

Offline ccbtimewiz

  • Dreamer
  • Guru
  • *
  • Posts: 1304
  • Karma: 2100
  • Gender: Male
  • $info->close();
    • Dream Portal
  • SMF Version: SMF 2.0 RC4
Re: Adding current action to profile summary (SMF 2.0)
« Reply #2 on: October 01, 2008, 08:01:48 PM »
There is, but that's for SMF 1.1.x. ;)

Offline brianjw

  • Guru
  • *
  • Posts: 2346
  • Karma: 1408
  • Gender: Male
  • What?!?! You mean they're sold out!
Re: Adding current action to profile summary (SMF 2.0)
« Reply #3 on: October 01, 2008, 10:21:28 PM »
There is, but that's for SMF 1.1.x. ;)
Ahh okay. :grin

Offline ccbtimewiz

  • Dreamer
  • Guru
  • *
  • Posts: 1304
  • Karma: 2100
  • Gender: Male
  • $info->close();
    • Dream Portal
  • SMF Version: SMF 2.0 RC4
Re: Adding current action to profile summary (SMF 2.0)
« Reply #4 on: October 01, 2008, 10:33:31 PM »
As you can see it's much easier to do on 2.0. :p

Offline gstek

  • New Member
  • *
  • Posts: 57
  • Karma: 104
  • Gender: Male
  • hac_king realm
    • hac_king realm
  • SMF Version: 2.0 beta RC1
Re: Adding current action to profile summary (SMF 2.0)
« Reply #5 on: October 06, 2008, 08:54:37 AM »
Hey thanx for this hack ;) repooo to you

Offline ccbtimewiz

  • Dreamer
  • Guru
  • *
  • Posts: 1304
  • Karma: 2100
  • Gender: Male
  • $info->close();
    • Dream Portal
  • SMF Version: SMF 2.0 RC4
Re: [SMF 2.0] Profile Current Action
« Reply #6 on: February 27, 2009, 04:01:58 PM »
Updated with further options, and provided edits for SMF 2.0 RC1.

Offline AST3R1X

  • V.I.P.
  • *
  • Posts: 1210
  • Karma: 1002
  • Gender: Male
    • Demon Pixels
  • SMF Version: SMF 2.0 Gold
Re: [SMF 2.0] Profile Current Action
« Reply #7 on: February 27, 2009, 05:30:06 PM »
Nice one ccb  ;)
 
+ 1

Offline tyty1234

  • V.I.P.
  • *
  • Posts: 823
  • Karma: 1109
  • Gender: Male
    • tytyweb
  • SMF Version: 2.0.2
Re: [SMF 2.0] Profile Current Action
« Reply #8 on: February 28, 2009, 03:24:08 AM »
what is a <dt> and a <dd>?  ???

Offline AST3R1X

  • V.I.P.
  • *
  • Posts: 1210
  • Karma: 1002
  • Gender: Male
    • Demon Pixels
  • SMF Version: SMF 2.0 Gold
Re: [SMF 2.0] Profile Current Action
« Reply #9 on: February 28, 2009, 05:49:11 AM »
what is a <dt> and a <dd>?  ???

The <dt> tag defines an item in a definition list
 
The <dd> tag is used to describe an item in a definition list
 
I didnt know either tyty just looked it up  :)