News:

SMF 2.1.2 has been released! Take it for a spin! Read more.

Main Menu

[Tip&trick] Vb postbit

Started by babjusi, July 31, 2008, 04:24:42 PM

Previous topic - Next topic

babjusi

Recently I made this for someone here who asked me. It displays the post info at the topic view in a bordered way, vb style. Which I think it's a more organized look and will be effective in every post on your forum. That guy had seen it at another forum, not smf, and asked me to port it over to his smf forum as well. So, I did that and I thought to share it here as well.


Here we go.

First of all make a backup of the files before you apply the changes

Add the following set of code all the way to the bottom of the style.css file in your theme''s directory

.memdetails {
    padding-top: 3px;
    padding-right: 0px;
    padding-bottom: 3px;
    padding-left: 3px;
    margin: 3px 0px 3px 3px;
    background-color: #fafcfe;
    border-top: 1px solid #686868 ;
    border-right: 1px solid #686868 ;
    border-left: 3px solid #686868 ;
    border-bottom: 1px solid #686868;
}       


Save the changes and re-upload the file back overwriting the old one.

Next, upload the Display.template.php file from your /Themes/ directory  to your pc and open it with a decent php editor program and find the following code:

// Show the member's custom title, if they have one.
      if (isset($message['member']['title']) && $message['member']['title'] != '')
         echo '
                        ', $message['member']['title'], '<br />';



Change it to:

// Show the member's custom title, if they have one.
      if (isset($message['member']['title']) && $message['member']['title'] != '')
         echo '
                        <div class="memdetails">', $message['member']['title'], '</div>';



Find:

// Show the member's primary group (like 'Administrator') if they have one.
      if (isset($message['member']['group']) && $message['member']['group'] != '')
         echo '
                        ', $message['member']['group'], '<br />';



Change it to:

// Show the member's primary group (like 'Administrator') if they have one.
      if (isset($message['member']['group']) && $message['member']['group'] != '')
         echo '
                        <div class="memdetails">', $message['member']['group'], '</div>';



Find:

// Show the post group if and only if they have no other group or the option is on, and they are in a post group.
         if ((empty($settings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '')
            echo '
                        ', $message['member']['post_group'], '<br />';
         echo '
                        ', $message['member']['group_stars'], '<br />';



Change it to:

// Show the post group if and only if they have no other group or the option is on, and they are in a post group.
         if ((empty($settings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '')
            echo '
                        <div class="memdetails">', $message['member']['post_group'], '</div>';
         echo '
                        <div class="memdetails">', $message['member']['group_stars'], '</div>';




Find:

// Is karma display enabled?  Total or +/-?
         if ($modSettings['karmaMode'] == '1')
            echo '
                        <br />
                        ', $modSettings['karmaLabel'], ' ', $message['member']['karma']['good'] - $message['member']['karma']['bad'], '<br />';
         elseif ($modSettings['karmaMode'] == '2')
            echo '
                        <br />
                        ', $modSettings['karmaLabel'], ' +', $message['member']['karma']['good'], '/-', $message['member']['karma']['bad'], '<br />';


Change it to:

// Is karma display enabled?  Total or +/-?
         if ($modSettings['karmaMode'] == '1')
            echo '
                       
                        <div class="memdetails">', $modSettings['karmaLabel'], ' ', $message['member']['karma']['good'] - $message['member']['karma']['bad'], '</div>';
         elseif ($modSettings['karmaMode'] == '2')
            echo '
                        <div class="memdetails">', $modSettings['karmaLabel'], ' +', $message['member']['karma']['good'], '/-', $message['member']['karma']['bad'], '</div>';



Find:

// Show online and offline buttons?
         if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest'])
            echo '
                        ', $context['can_send_pm'] ? '<a href="' . $message['member']['online']['href'] . '" title="' . $message['member']['online']['label'] . '">' : '', $settings['use_image_buttons'] ? '<img src="' . $message['member']['online']['image_href'] . '" alt="' . $message['member']['online']['text'] . '" border="0" style="margin-top: 2px;" />' : $message['member']['online']['text'], $context['can_send_pm'] ? '</a>' : '', $settings['use_image_buttons'] ? '<span class="smalltext"> ' . $message['member']['online']['text'] . '</span>' : '', '<br /><br />';


Change it to:

// Show online and offline buttons?
         if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest'])
            echo '
                        <div class="memdetails">', $context['can_send_pm'] ? '<a href="' . $message['member']['online']['href'] . '" title="' . $message['member']['online']['label'] . '">' : '', $settings['use_image_buttons'] ? '<img src="' . $message['member']['online']['image_href'] . '" alt="' . $message['member']['online']['text'] . '" border="0" style="margin-top: 2px;" />' : $message['member']['online']['text'], $context['can_send_pm'] ? '</a>' : '', $settings['use_image_buttons'] ? '<span class="smalltext"> ' . $message['member']['online']['text'] . '</span>' : '', '<br /></div>';



Find:

// Show how many posts they have made.
         echo '
                        ', $txt[26], ': ', $message['member']['posts'], '<br />
                        <br />';



Change it to:

// Show how many posts they have made.
         echo '
                        <div class="memdetails">', $txt[26], ': ', $message['member']['posts'], '</div>';



Find:

// Show their personal text?
         if (!empty($settings['show_blurb']) && $message['member']['blurb'] != '')
            echo '
                        ', $message['member']['blurb'], '<br />
                        <br />';


Change it to:

// Show their personal text?
         if (!empty($settings['show_blurb']) && $message['member']['blurb'] != '')
            echo '
                        <div class="memdetails">', $message['member']['blurb'], '</div>
                        <br />';



That was it. Save the changes and re-upload the file back overwriting the old one. Personally I do think that this looks very nice on topic view. But you can judge by yourself based on the screenshot attached.

Here is like it looks in action. This is for the 1.1. series


The mod version can be found here

http://custom.simplemachines.org/mods/index.php?mod=1371


Hoochie Coochie Man

İnadına SMF 1.1.X

Eliana Tamerin

Do NOT PM me for support.

SimplePortal 2.3.6 is OUT!
SimplePortal Project Manager
Download | Docs
SimplePortal: Power of Simplicity!

ormuz

How to add this trick to custom profile mod?

babjusi

Quote from: ormuz on August 25, 2008, 02:38:45 PM
How to add this trick to custom profile mod?

I am not sure that I understood you. What is is exactly that you mean or want to accomplish by doing that? Because this has nothing to do with the custom profile mod.

ormuz

Quote from: babjusi on August 25, 2008, 02:43:41 PM
Quote from: ormuz on August 25, 2008, 02:38:45 PM
How to add this trick to custom profile mod?

I am not sure that I understood you. What is is exactly that you mean or want to accomplish by doing that? Because this has nothing to do with the custom profile mod.

Costum profile mod add the ability to add costum fields to the postbit on the display.template.php

I just want to add this trick (the memdetails div) to the field that I have in my postbit

this is the code from the mod in the display template, how to add this trick to the mod?
              global $sourcedir, $messagevars;
$messagevars = $message;
require_once($sourcedir . '/CustomProfile.php');
DisplayFieldPosts();

babjusi

Quote from: ormuz on August 25, 2008, 02:58:54 PM
Quote from: babjusi on August 25, 2008, 02:43:41 PM
Quote from: ormuz on August 25, 2008, 02:38:45 PM
How to add this trick to custom profile mod?

I am not sure that I understood you. What is is exactly that you mean or want to accomplish by doing that? Because this has nothing to do with the custom profile mod.

Costum profile mod add the ability to add costum fields to the postbit on the display.template.php

I just want to add this trick (the memdetails div) to the field that I have in my postbit

this is the code from the mod in the display template, how to add this trick to the mod?
              global $sourcedir, $messagevars;
$messagevars = $message;
require_once($sourcedir . '/CustomProfile.php');
DisplayFieldPosts();


I don''t think you can add this through the custom profile mod.

Eliana Tamerin

You could if you arranged the styling in CustomProfile.php.
Do NOT PM me for support.

SimplePortal 2.3.6 is OUT!
SimplePortal Project Manager
Download | Docs
SimplePortal: Power of Simplicity!

ormuz

Quote from: Eliana Tamerin on August 26, 2008, 09:31:59 AM
You could if you arranged the styling in CustomProfile.php.

I ask that in the mod support topic, but a smf moderator remove my doubt there...

ccbtimewiz

Try out this:

echo '<div class="memdetails">', DisplayFieldPosts(), '</div>';

ormuz

Quote from: ccbtimewiz on August 26, 2008, 04:05:33 PM
Try out this:

echo '<div class="memdetails">', DisplayFieldPosts(), '</div>';

That was my first try, and it works! But if the custom field is empty, it show the div too... Any ideas?

ccbtimewiz

Quote from: ormuz on August 26, 2008, 07:00:10 PM
Quote from: ccbtimewiz on August 26, 2008, 04:05:33 PM
Try out this:

echo '<div class="memdetails">', DisplayFieldPosts(), '</div>';

That was my first try, and it works! But if the custom field is empty, it show the div too... Any ideas?

Yes.

if( DisplayFieldPosts() = true ) { echo '<div class="memdetails">', DisplayFieldPosts(), '</div>'; }

babjusi

Quote from: Eliana Tamerin on August 26, 2008, 09:31:59 AM
You could if you arranged the styling in CustomProfile.php.

Maybe, I am not familiar with the mod in question.

Eliana Tamerin

Quote from: ormuz on August 26, 2008, 07:00:10 PM
Quote from: ccbtimewiz on August 26, 2008, 04:05:33 PM
Try out this:

echo '<div class="memdetails">', DisplayFieldPosts(), '</div>';

That was my first try, and it works! But if the custom field is empty, it show the div too... Any ideas?

No need to do anything more, the user figured it out.
Do NOT PM me for support.

SimplePortal 2.3.6 is OUT!
SimplePortal Project Manager
Download | Docs
SimplePortal: Power of Simplicity!


ccbtimewiz

Perhaps a better title would be better... borderdataontopicview is kinda off the tongue. :P

babjusi

Quote from: ccbtimewiz on September 01, 2008, 12:30:56 PM
Perhaps a better title would be better... borderdataontopicview is kinda off the tongue. :P

It could be, but at the moment when I made it couldn''t find a better name for it :D

ormuz



Smoky "Rider" Blue

you did a great job with this babjusi, thanks for sharing! :)
**Take the time to remember friendships and family.. Sometimes it's all we have, and missed very much**

Advertisement: