Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 MyBB Hacks Mood System
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #1
MyBB Hacks Mood System
Because some plugin developer really like using My as prefix for their plugin, we will use MyBB Hacks as prefix for this modification Biggrin
So, we can call it as MyBB Hacks Mood System Biggrin

Not too hard to do this, because we have the amazing tools, conditional in template.
So, to do this, we need Template Conditionals plugin or PHP in Templates / Complex Templates plugin. We will "combine" it with Custom Profile Fields.

The mood can be selected in UserCP -> Edit Profile.
The mood can be displayed in several area, like Postbit, Member Profile, Header (Member Panel) and Member List.

Here is how to do that:
In this example, we use Custom Profile Fields ID = 4. The mood images is png images, in images/mybbhacksmood folder/directory. So, maybe we need to modify it as our needs.
  1. Create a custom profile fields with these settings:
    • Title: Mood
      Modify it as our needs.
    • Short Description: Your mood today. You can edit your mood whenever you want by visiting this page.
      Modify it as our needs.
    • Field Type: Select Box
    • Field Length: 1
    • Selectable Options?:

      Code:
      Happy
      Sad
      In Love

      Modify it as our needs.

  2. Upload mood images. For the example mood above:
    • Mood: Happy
      Mood Image: Happy.png
    • Mood: Sad
      Mood Image: Sad.png
    • Mood: In Love
      Mood Image: InLove.png
  3. Now, we will displaying the MyBB Hacks Mood.
    • In Postbit:
      Put this code in our postbit_author_user template:

      HTML Code
      <if $post['fid4'] then>
      	<div>
      		Mood: <img src="images/mybbhacksmood/<?=str_replace(' ', '', $post['fid4'])?>.png" alt="{$post['fid4']}" title="{$post['fid4']}" />
      	</div>
      </if>

      Modify it as our needs. Change the 4 to our MyBB Hacks Mood custom profile fields id.
      Or, we can put it in our postbit and postbit_classic template.

    • In Profile:
      member_profile_customfields_field template.
      If we didn't modified this template before, replace the template contents with:

      HTML Code
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      <if $customfield['fid'] == 4 then>
      	<if $userfields['fid4'] != '' then>
      		<tr>
      			<td class="{$bgcolor}" width="40%"><strong>{$customfield['name']}:</strong></td>
      			<td class="{$bgcolor}" width="60%"><img src="images/mybbhacksmood/<?=str_replace(' ', '', $customfieldval)?>.png" alt="{$customfieldval}" title="{$customfieldval}" /></td>
      		</tr>
      	</if>
      <else>
      	<tr>
      		<td class="{$bgcolor}" width="40%"><strong>{$customfield['name']}:</strong></td>
      		<td class="{$bgcolor}" width="60%">{$customfieldval}</td>
      	</tr>
      </if>

      Modify it as our needs. Change the 4 to our MyBB Hacks Mood custom profile fields id. If a user didn't select any mood, the MyBB Hacks Mood column will not be displayed.

    • In Header:
      Put this code in our header_welcomeblock_member template:

      HTML Code
      <if $mybb->user['fid4'] then>
      	<div>
      		Mood: <img src="images/mybbhacksmood/<?=htmlspecialchars_uni(str_replace(' ', '', $mybb->user['fid4']))?>.png" alt="<?=htmlspecialchars_uni($mybb->user['fid4'])?>" title="<?=htmlspecialchars_uni($mybb->user['fid4'])?>" />
      	</div>
      </if>

      Modify it as our needs. Change the 4 to our MyBB Hacks Mood custom profile fields id.
      BTW, do you think other Mood System has this feature (displaying mood in header template)? MyBB Hacks Mood System is the pioneer Biggrin

    • In Member List:
      Put this code in our memberlist_user template:

      HTML Code
      <if $user['fid4'] then>
      	<div>
      		Mood: <img src="images/mybbhacksmood/<?=htmlspecialchars_uni(str_replace(' ', '', $user['fid4']))?>.png" alt="<?=htmlspecialchars_uni($user['fid4'])?>" title="<?=htmlspecialchars_uni($user['fid4'])?>" />
      	</div>
      </if>

      Modify it as our needs. Change the 4 to our MyBB Hacks Mood custom profile fields id.
      Again, do you think other Mood System has this feature (displaying mood in member list page)? MyBB Hacks Mood System is the pioneer again Biggrin



That's it. Please tell me if I did something wrong Biggrin

Note: For PHP In Template plugin, the code is a bit different.

11-22-2010 09:53 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
MyBB Hacks Mood System - RateU - 11-22-2010 09:53 AM
RE: MyBB Hacks Mood System - Skiilz - 11-22-2010, 10:32 AM
RE: MyBB Hacks Mood System - ZiNgA BuRgA - 11-22-2010, 11:16 AM
RE: MyBB Hacks Mood System - leefish - 11-22-2010, 11:25 AM
RE: MyBB Hacks Mood System - ZiNgA BuRgA - 11-22-2010, 11:33 AM
RE: MyBB Hacks Mood System - leefish - 11-22-2010, 12:06 PM
RE: MyBB Hacks Mood System - RateU - 11-23-2010, 04:58 AM
RE: MyBB Hacks Mood System - Skiilz - 12-01-2010, 03:27 AM
RE: MyBB Hacks Mood System - RateU - 12-01-2010, 03:55 AM
RE: MyBB Hacks Mood System - Skiilz - 12-01-2010, 05:06 AM
RE: MyBB Hacks Mood System - RateU - 12-01-2010, 06:16 AM
RE: MyBB Hacks Mood System - Skiilz - 12-01-2010, 07:49 AM
RE: MyBB Hacks Mood System - RateU - 12-01-2010, 08:00 AM
RE: MyBB Hacks Mood System - Skiilz - 12-01-2010, 08:22 AM
RE: MyBB Hacks Mood System - ZiNgA BuRgA - 12-01-2010, 10:28 AM
RE: MyBB Hacks Mood System - Skiilz - 12-01-2010, 09:26 PM
RE: MyBB Hacks Mood System - RateU - 12-02-2010, 04:01 AM
RE: MyBB Hacks Mood System - Skiilz - 12-02-2010, 06:59 AM
RE: MyBB Hacks Mood System - RateU - 12-03-2010, 06:07 AM
RE: MyBB Hacks Mood System - Skiilz - 12-03-2010, 07:46 AM

 Standard Tools
Forum Jump: