News:

Wondering if this will always be free?  See why free is better.

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**

Heartlander

Can anyone please answer the question regarding the purpose of this mod?
Thanks.

babjusi

Quote from: Heartlander on September 07, 2008, 03:20:23 PM
Can anyone please answer the question regarding the purpose of this mod?
Thanks.

I have explained it in the first post of the topic. For more info have a look at the screenshot attached under my very first post :)

matasanos

please someone knows how to add a bordered way but all items in a div element..
i hope i had explained well..sorry for my bad english.

Oldiesmann

Do you still need help with this matasanos?
Michael Eshom
Christian Metal Fans

Futbolero90

#24
=S i´ve installed this mod, without problems, but the postbit still looking like the default post bit :S
check: http://fifaps3xtreme.co.cc/index.php?topic=2.0
i have to activate this mod in the adminpanel or something like that?
grettings from México
and sorry my bad english

Edit:
its ok now, excelent mod :D

DakOon


chrislittle09


SilverKnight

This is now a mod.. should probably be moved.

Smoky "Rider" Blue

it's now my mod Silverknight  ;)
**Take the time to remember friendships and family.. Sometimes it's all we have, and missed very much**

JBlaze

Jason Clemons
Former Team Member 2009 - 2012

Smoky "Rider" Blue

thanks Jblaze.. i took over it for Babjusi..  ;)
**Take the time to remember friendships and family.. Sometimes it's all we have, and missed very much**

JBlaze

Quote from: SmokyBlue on April 24, 2009, 08:14:01 PM
thanks Jblaze.. i took over it for Babjusi..  ;)

Stealing is not nice.... :P
Jason Clemons
Former Team Member 2009 - 2012

Smoky "Rider" Blue

lmao i didnt steal it, Babjusi gave me all his mods.. he wanted me to have them JBlaze..  8)
**Take the time to remember friendships and family.. Sometimes it's all we have, and missed very much**

JBlaze

Quote from: SmokyBlue on April 24, 2009, 10:27:16 PM
lmao i didnt steal it, Babjusi gave me all his mods.. he wanted me to have them JBlaze..  8)

mhm....

lol
Jason Clemons
Former Team Member 2009 - 2012

Smoky "Rider" Blue



                                         :P
**Take the time to remember friendships and family.. Sometimes it's all we have, and missed very much**

_F3R_

Hello guys, I install the custom profile field mod and the  Vb postbit.
in the posts the custom profile field mod doesn't work when vbpostbit.
This is display.template.php

global $sourcedir, $messagevars;
$messagevars = $message;
require_once($sourcedir . '/CustomProfile.php');
DisplayFieldPosts();

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


the class of vbpostbit is <div class="windowbg4">

and this is custom profile.php

<?php

if (!defined('SMF'))
die('Hacking attempt...');

function 
EditFields()
{
global $context$modSettings;
$i 1;
while (isset($modSettings['enable_CP' $i '']))
{
if ($modSettings['enable_CP' $i ''])
{
if ($modSettings['CP' $i '_edit'] && !$context['user']['is_admin'])
{
$i++;
continue;
}
if ($modSettings['CP' $i '_hr'] == 'edit' || $modSettings['CP' $i '_hr'] == 'summary_edit')
{
echo '
<tr>
<td colspan="2"><hr width="100%" size="1" class="hrcolor" /></td>
</tr>'
;
}
if ($modSettings['CP' $i '_type']=='text')
{
echo '
<tr>
<td><b>' 
$modSettings['CP' $i '_name'] . ': </b>' , !empty($modSettings['CP' $i '_desc']) ? '<div class="smalltext">' $modSettings['CP' $i '_desc'] . '</div>' '' '</td><td><input type="text" name="default_options[' $modSettings['CP' $i '_id'] . ']" size="50" value="', @$context['member']['options'][$modSettings['CP' $i '_id']], '" /></td>
</tr>'
;
}
if ($modSettings['CP' $i '_type']=='textarea')
{
echo '
<tr>
<td><b>' 
$modSettings['CP' $i '_name'] . ': </b>' , !empty($modSettings['CP' $i '_desc']) ? '<div class="smalltext">' $modSettings['CP' $i '_desc'] . '</div>' '' '</td><td><textarea name="default_options[' $modSettings['CP' $i '_id'] . ']" rows="4" cols="80" class="editor">', @$context['member']['options'][$modSettings['CP' $i '_id']], '</textarea></td>
</tr>'
;
}
if ($modSettings['CP' $i '_type']=='select')
{
echo '
<tr>
<td><b>' 
$modSettings['CP' $i '_name'] . ': </b>' , !empty($modSettings['CP' $i '_desc']) ? '<div class="smalltext">' $modSettings['CP' $i '_desc'] . '</div>' '' '</td>
<td><select name="default_options[' 
$modSettings['CP' $i '_id'] . ']">';
$r 1;
while (isset($modSettings['CP' $i '_data' $r '']) && !empty($modSettings['CP' $i '_data' $r '']))
{
if (isset($context['member']['options'][$modSettings['CP' $i '_id']]) && $context['member']['options'][$modSettings['CP' $i '_id']] == $modSettings['CP' $i '_data' $r ''])
{
echo '
<option selected="selected">' 
$modSettings['CP' $i '_data' $r ''] . '</option>';
}
else
{
echo '
<option>' 
$modSettings['CP' $i '_data' $r ''] . '</option>';
}
$r++;
}
echo '
</select></td>'
;
}
if ($modSettings['CP' $i '_type']=='check')
{
echo '
<tr>
<td><b>' 
$modSettings['CP' $i '_name'] . ': </b>' , !empty($modSettings['CP' $i '_desc']) ? '<div class="smalltext">' $modSettings['CP' $i '_desc'] . '</div>' '' '</td><td><input type="hidden" name="default_options[' $modSettings['CP' $i '_id'] . ']" value="0" /><input type="checkbox" name="default_options[' $modSettings['CP' $i '_id'] . ']" value="1"', @$context['member']['options'][$modSettings['CP' $i '_id']] ? ' checked="checked"' ''' class="check" /></td>
</tr>'
;
}
}
$i++;
}
}

function 
RegistrationFields()
{
global $context$modSettings;
$i 1;
while (isset($modSettings['enable_CP' $i '']))
{
if ($modSettings['enable_CP' $i ''] && $modSettings['CP' $i '_reg'])
{
if ($modSettings['CP' $i '_type']=='text')
{
echo '
<tr>
<td><b>' 
$modSettings['CP' $i '_name'] . ': </b>' , !empty($modSettings['CP' $i '_desc']) ? '<div class="smalltext">' $modSettings['CP' $i '_desc'] . '</div>' '' '</td><td><input type="text" name="default_options[' $modSettings['CP' $i '_id'] . ']" size="50" value="', @$context['member']['options'][$modSettings['CP' $i '_id']], '" /></td>
</tr>'
;
}
if ($modSettings['CP' $i '_type']=='textarea')
{
echo '
<tr>
<td><b>' 
$modSettings['CP' $i '_name'] . ': </b>' , !empty($modSettings['CP' $i '_desc']) ? '<div class="smalltext">' $modSettings['CP' $i '_desc'] . '</div>' '' '</td><td><textarea name="default_options[' $modSettings['CP' $i '_id'] . ']" rows="4" cols="80" class="editor">', @$context['member']['options'][$modSettings['CP' $i '_id']], '</textarea></td>
</tr>'
;
}
if ($modSettings['CP' $i '_type']=='select')
{
echo '
<tr>
<td><b>' 
$modSettings['CP' $i '_name'] . ': </b>' , !empty($modSettings['CP' $i '_desc']) ? '<div class="smalltext">' $modSettings['CP' $i '_desc'] . '</div>' '' '</td>
<td><select name="default_options[' 
$modSettings['CP' $i '_id'] . ']">';
$r 1;
while (isset($modSettings['CP' $i '_data' $r '']) && !empty($modSettings['CP' $i '_data' $r '']))
{
if (isset($context['member']['options'][$modSettings['CP' $i '_id']]) && $context['member']['options'][$modSettings['CP' $i '_id']] == $modSettings['CP' $i '_data' $r ''])
{
echo '
<option selected="selected">' 
$modSettings['CP' $i '_data' $r ''] . '</option>';
}
else
{
echo '
<option>' 
$modSettings['CP' $i '_data' $r ''] . '</option>';
}
$r++;
}
echo '
</select></td>'
;
}
if ($modSettings['CP' $i '_type']=='check')
{
echo '
<tr>
<td><b>' 
$modSettings['CP' $i '_name'] . ': </b>' , !empty($modSettings['CP' $i '_desc']) ? '<div class="smalltext">' $modSettings['CP' $i '_desc'] . '</div>' '' '</td><td><input type="hidden" name="default_options[' $modSettings['CP' $i '_id'] . ']" value="0" /><input type="checkbox" name="default_options[' $modSettings['CP' $i '_id'] . ']" value="1"', @$context['member']['options'][$modSettings['CP' $i '_id']] ? ' checked="checked"' ''' class="check" /></td>
</tr>'
;
}
}
$i++;
}
}

function 
CheckFieldInput()
{
global $modSettings$txt$forum_version;
$i 1;
while (isset($modSettings['enable_CP' $i '']))
{
if ($modSettings['enable_CP' $i ''] && $modSettings['CP' $i '_reg']=='force' && empty($_POST['default_options'][$modSettings['CP' $i '_id']]))
{
loadLanguage('CustomProfile');
$txt['cp_regerror'] = preg_replace('/FIELDNAME/'$modSettings['CP' $i '_name'], $txt['cp_regerror']);
fatal_lang_error('cp_regerror'false);
}
$i++;
}

// The strings aren't cleaned properly on registration.
if (version_compare($forum_version'1.1.5') != 1)
{
if (isset($_POST['default_options']))
$_POST['default_options'] = htmlspecialchars__recursive($_POST['default_options']);
if (isset($_POST['options']))
$_POST['options'] = htmlspecialchars__recursive($_POST['options']);
}
}

function 
DisplayFieldPosts()
{
global $context$modSettings$messagevars;
$i 1;
while (isset($modSettings['enable_CP' $i '']))
{
if ($modSettings['enable_CP' $i ''] && isset($messagevars['member']['options'][$modSettings['CP' $i '_id']]) && !empty($messagevars['member']['options'][$modSettings['CP' $i '_id']]) && $modSettings['CP' $i '_post'])
{
if ($modSettings['CP' $i '_view'] && !$context['user']['is_admin'])
{
$i++;
continue;
}
if ($modSettings['CP' $i '_type']=='text' || $modSettings['CP' $i '_type']=='textarea')
{
if ($modSettings['CP' $i '_post']!='text')
{
$i++;
continue;
}
$before preg_replace('/%1/'$messagevars['member']['options'][$modSettings['CP' $i '_id']], $modSettings['CP' $i '_data1']);
$after preg_replace('/%1/'$messagevars['member']['options'][$modSettings['CP' $i '_id']], $modSettings['CP' $i '_data2']);
if ($modSettings['CP' $i '_bbc'])
{
$field parse_bbc($before $messagevars['member']['options'][$modSettings['CP' $i '_id']] . $after);
}
else
{
$field $before $messagevars['member']['options'][$modSettings['CP' $i '_id']] . $after;
}
echo '
$modSettings['CP' $i '_name'] . ': ' $field '<br />';
}
if ($modSettings['CP' $i '_type']=='select')
{
if ($modSettings['CP' $i '_bbc'])
{
$field parse_bbc($messagevars['member']['options'][$modSettings['CP' $i '_id']]);
}
else
{
$field $messagevars['member']['options'][$modSettings['CP' $i '_id']];
}
echo '
$modSettings['CP' $i '_name'] . ': ' $field '<br />';
}
if ($modSettings['CP' $i '_type']=='check')
{
if ($modSettings['CP' $i '_bbc'])
{
$modSettings['CP' $i '_data1'] = parse_bbc($modSettings['CP' $i '_data1']);
$modSettings['CP' $i '_data2'] = parse_bbc($modSettings['CP' $i '_data2']);
}
if ($messagevars['member']['options'][$modSettings['CP' $i '_id']])
{
echo '
$modSettings['CP' $i '_name'] . ': ' $modSettings['CP' $i '_data1'] . '<br />';
}
else
{
echo '
$modSettings['CP' $i '_name'] . ': ' $modSettings['CP' $i '_data2'] . '<br />';
}
}
}
$i++;
}
}

function 
DisplayFieldPostsPictures()
{
global $context$modSettings$messagevars;
$i 1;
while (isset($modSettings['enable_CP' $i '']))
{
if ($modSettings['enable_CP' $i ''] && isset($messagevars['member']['options'][$modSettings['CP' $i '_id']]) && !empty($messagevars['member']['options'][$modSettings['CP' $i '_id']]) && $modSettings['CP' $i '_post'])
{
if ($modSettings['CP' $i '_view'] && !$context['user']['is_admin'])
{
$i++;
continue;
}
if ($modSettings['CP' $i '_type']=='text' || $modSettings['CP' $i '_type']=='textarea')
{
if ($modSettings['CP' $i '_post']!='image')
{
$i++;
continue;
}
$before preg_replace('/%1/'$messagevars['member']['options'][$modSettings['CP' $i '_id']], $modSettings['CP' $i '_data1']);
$after preg_replace('/%1/'$messagevars['member']['options'][$modSettings['CP' $i '_id']], $modSettings['CP' $i '_data2']);
if ($modSettings['CP' $i '_bbc'])
{
$field parse_bbc($before $messagevars['member']['options'][$modSettings['CP' $i '_id']] . $after);
}
else
{
$field $before $messagevars['member']['options'][$modSettings['CP' $i '_id']] . $after;
}
echo $field;
}
}
$i++;
}
}

function 
DisplayFieldsProfile()
{
global $context$modSettings;
$i 1;
while (isset($modSettings['enable_CP' $i '']))
{
if ($modSettings['enable_CP' $i ''] && isset($context['member']['options'][$modSettings['CP' $i '_id']]) && !empty($context['member']['options'][$modSettings['CP' $i '_id']]) && $modSettings['CP' $i '_profile'])
{
if ($modSettings['CP' $i '_view'] && !$context['user']['is_admin'])
{
$i++;
continue;
}
if ($modSettings['CP' $i '_hr'] == 'edit' || $modSettings['CP' $i '_hr'] == 'summary_edit')
{
echo '
<tr>
<td colspan="2"><hr width="100%" size="1" class="hrcolor" /></td>
</tr>'
;
}
if ($modSettings['CP' $i '_type']=='text' || $modSettings['CP' $i '_type']=='textarea')
{
$before preg_replace('/%1/'$context['member']['options'][$modSettings['CP' $i '_id']], $modSettings['CP' $i '_data1']);
$after preg_replace('/%1/'$context['member']['options'][$modSettings['CP' $i '_id']], $modSettings['CP' $i '_data2']);
if ($modSettings['CP' $i '_bbc'])
{
$context['member']['options'][$modSettings['CP' $i '_id']] = parse_bbc($before $context['member']['options'][$modSettings['CP' $i '_id']] . $after);
}
else
{
$context['member']['options'][$modSettings['CP' $i '_id']] = $before $context['member']['options'][$modSettings['CP' $i '_id']] . $after;
}
echo '
</tr><tr>
<td><b>' 
$modSettings['CP' $i '_name'] . ': </b></td>
<td>' 
$context['member']['options'][$modSettings['CP' $i '_id']] . '</td>';
}
if ($modSettings['CP' $i '_type']=='select')
{
if ($modSettings['CP' $i '_bbc'])
{
$field parse_bbc($context['member']['options'][$modSettings['CP' $i '_id']]);
}
else
{
$field $context['member']['options'][$modSettings['CP' $i '_id']];
}
echo '
</tr><tr>
<td><b>' 
$modSettings['CP' $i '_name'] . ': </b></td>
<td>' 
$field '</td>';
}
if ($modSettings['CP' $i '_type']=='check')
{
if ($modSettings['CP' $i '_bbc'])
{
$modSettings['CP' $i '_data1'] = parse_bbc($modSettings['CP' $i '_data1']);
$modSettings['CP' $i '_data2'] = parse_bbc($modSettings['CP' $i '_data2']);
}
if ($context['member']['options'][$modSettings['CP' $i '_id']])
{
echo '
</tr><tr>
<td><b>' 
$modSettings['CP' $i '_name'] . ': </b></td>
<td>' 
$modSettings['CP' $i '_data1'] . '</td>';
}
else
{
echo '
</tr><tr>
<td><b>' 
$modSettings['CP' $i '_name'] . ': </b></td>
<td>' 
$modSettings['CP' $i '_data2'] . '</td>';
}
}
}
$i++;
}
}

function 
CustomFieldSettings()
{
global $txt$scripturl$context$settings$sc$modSettings$txt;
loadLanguage('CustomProfile');

if (isset($_GET['cp']))
{
if ($modSettings['CP' $_GET['cp'] . '_type']=='text' || $modSettings['CP' $_GET['cp'] . '_type']=='textarea')
{
$cp $_GET['cp'];
$config_vars = array(
array('text''CP' $cp '_name'null$txt['cp_name']),
array('text''CP' $cp '_desc'null$txt['cp_desc']),
array('check''CP' $cp '_profile'null$txt['cp_profileshow']),
array('select''CP' $cp '_post', array('0' => $txt['cp_dontshow'], 'text' => $txt['cp_underpostcount'], 'image' => $txt['cp_underimages'],), $txt['cp_showposts']),
array('check''CP' $cp '_bbc'null$txt['cp_parsebbc']),
array('text''CP' $cp '_data1'null$txt['cp_before']),
array('text''CP' $cp '_data2'null$txt['cp_after']),
array('text''CP' $cp '_id'null$txt['cp_fieldid']),
array('select''CP' $cp '_hr', array('no' => $txt['cp_dontshow'], 'summary' => $txt['cp_hrsummary'], 'edit' => $txt['cp_hredit'], 'summary_edit' => $txt['cp_onboth'],), $txt['cp_hrule']),
array('select''CP' $cp '_reg', array('0' => $txt['cp_dontshow'], 'opt' => $txt['co_optinput'], 'force' => $txt['cp_forceinput'],), $txt['cp_showreg']),
array('check''CP' $cp '_edit'null$txt['cp_adminedit']),
array('check''CP' $cp '_view'null$txt['cp_adminview']),
'<a href="' $scripturl '?action=featuresettings;sa=profile;addfield=' $cp ';sesc=' $sc '">' $txt['cp_recreate'] . '</a>',
);
}
elseif ($modSettings['CP' $_GET['cp'] . '_type']=='check')
{
$cp $_GET['cp'];
$config_vars = array(
array('text''CP' $cp '_name'null$txt['cp_name']),
array('text''CP' $cp '_desc'null$txt['cp_desc']),
array('check''CP' $cp '_profile'null$txt['cp_profileshow']),
array('check''CP' $cp '_post'null$txt['cp_showposts']),
array('text''CP' $cp '_data1'null$txt['cp_checked']),
array('text''CP' $cp '_data2'null$txt['cp_notchecked']),
array('check''CP' $cp '_bbc'null$txt['cp_parsebbc']),
array('text''CP' $cp '_id'null$txt['cp_fieldid']),
array('select''CP' $cp '_hr', array('no' => $txt['cp_dontshow'], 'summary' => $txt['cp_hrsummary'], 'edit' => $txt['cp_hredit'], 'summary_edit' => $txt['cp_onboth'],), $txt['cp_hrule']),
array('select''CP' $cp '_reg', array('0' => $txt['cp_dontshow'], 'opt' => $txt['cp_show'],), $txt['cp_showreg']),
array('check''CP' $cp '_edit'null$txt['cp_adminedit']),
array('check''CP' $cp '_view'null$txt['cp_adminview']),
'<a href="' $scripturl '?action=featuresettings;sa=profile;addfield=' $cp ';sesc=' $sc '">' $txt['cp_recreate'] . '</a>',
);
}
elseif ($modSettings['CP' $_GET['cp'] . '_type']=='select')
{
$cp $_GET['cp'];
$config_vars = array(
array('text''CP' $cp '_name'null$txt['cp_name']),
array('text''CP' $cp '_desc'null$txt['cp_desc']),
array('check''CP' $cp '_profile'null$txt['cp_profileshow']),
array('check''CP' $cp '_post'null$txt['cp_showposts']),
array('check''CP' $cp '_bbc'null$txt['cp_parsebbc']),
array('text''CP' $cp '_id'null$txt['cp_fieldid']),
array('select''CP' $cp '_hr', array('no' => $txt['cp_dontshow'], 'summary' => $txt['cp_hrsummary'], 'edit' => $txt['cp_hredit'], 'summary_edit' => $txt['cp_onboth'],), $txt['cp_hrule']),
array('select''CP' $cp '_reg', array('0' => $txt['cp_dontshow'], 'opt' => $txt['cp_show'],), $txt['cp_showreg']),
array('check''CP' $cp '_edit'null$txt['cp_adminedit']),
array('check''CP' $cp '_view'null$txt['cp_adminview']),
);
$i 1;
while (isset($modSettings['CP' $cp '_data' $i '']))
{
$cp_option preg_replace('/OPTIONNUMBER/'$i$txt['cp_option']);
$config_vars[] = array('text''CP' $cp '_data'$i ''null$cp_option);
$i++;
}
$config_vars[] = '<a href="' $scripturl '?action=featuresettings;sa=profile;adddata=' $cp ';sesc=' $sc '">' $txt['cp_addoption'] . '</a>';
$config_vars[] = '<a href="' $scripturl '?action=featuresettings;sa=profile;addfield=' $cp ';sesc' $sc '">' $txt['cp_recreate'] . '</a>';
}
}
elseif (isset($_GET['addfield']))
{
checkSession('get');

$settings = array(
'enable_CP' $_GET['addfield'] . '' => '1',
'CP' $_GET['addfield'] . '_name' => $txt['cp_unnamed'],
'CP' $_GET['addfield'] . '_desc' => '',
'CP' $_GET['addfield'] . '_type' => 'text',
'CP' $_GET['addfield'] . '_post' => '0',
'CP' $_GET['addfield'] . '_profile' => '1',
'CP' $_GET['addfield'] . '_bbc' => '0',
'CP' $_GET['addfield'] . '_data1' => '',
'CP' $_GET['addfield'] . '_data2' => '',
'CP' $_GET['addfield'] . '_id' => 'CP' $_GET['addfield'] . '',
'CP' $_GET['addfield'] . '_hr' => '0',
'CP' $_GET['addfield'] . '_reg' => '0',
'CP' $_GET['addfield'] . '_edit' => '0',
'CP' $_GET['addfield'] . '_view' => '0',
);
addSettings($settings);
redirectexit('action=featuresettings;sa=profile');
}
elseif (isset($_GET['adddata']))
{
checkSession('get');

$i 1;
while (isset($modSettings['CP' $_GET['adddata'] . '_data' $i]))
$i++;
$settings = array(
'CP' $_GET['adddata'] . '_data' $i => '',
);
addSettings($settings);
redirectexit('action=featuresettings;sa=profile;cp=' $_GET['adddata']);
}
elseif (isset($_GET['moveup']))
{
checkSession('get');

moveUp($_GET['moveup']);
redirectexit('action=featuresettings;sa=profile');
}
elseif (isset($_GET['movedown']))
{
checkSession('get');

moveDown($_GET['movedown']);
redirectexit('action=featuresettings;sa=profile');
}
elseif (isset($_GET['delete']))
{
checkSession('get');

deleteField($_GET['delete']);
redirectexit('action=featuresettings;sa=profile');
}
else
{
$config_vars = array();
$i 1;
while (isset($modSettings['enable_CP' $i]))
{
$n $i 1;
if ($n 1)
{
$config_vars[] = '<a href="' $scripturl '?action=featuresettings;sa=profile;cp=' $n '">' $txt['cp_settings'] . '</a> <a href="' $scripturl '?action=featuresettings;sa=profile;moveup=' $n ';sesc=' $sc '">' $txt['cp_moveup'] . '</a> <a href="' $scripturl '?action=featuresettings;sa=profile;movedown=' $n ';sesc=' $sc '">' $txt['cp_movedown'] . '</a> <a href="' $scripturl '?action=featuresettings;sa=profile;delete=' $n ';sesc=' $sc '">' $txt['cp_delete'] . '</a>';
$config_vars[] = '';
}
elseif ($n 0)
{
$config_vars[] = '<a href="' $scripturl '?action=featuresettings;sa=profile;cp=' $n '">' $txt['cp_settings'] . '</a> <a href="' $scripturl '?action=featuresettings;sa=profile;movedown=' $n ';sesc=' $sc '">' $txt['cp_movedown'] . '</a> <a href="' $scripturl '?action=featuresettings;sa=profile;delete=' $n ';sesc=' $sc '">' $txt['cp_delete'] . '</a>';
$config_vars[] = '';
}
$cp_enable preg_replace('/FIELDNAME/'$modSettings['CP' $i '_name'], $txt['cp_enable']);
$config_vars[] = array('check''enable_CP' $i ''null$cp_enable);
$config_vars[] = array('select''CP' $i '_type', array('text' => $txt['cp_text'], 'textarea' => $txt['cp_textarea'], 'check' => $txt['cp_checkbox'], 'select' => $txt['cp_selectbox'],), $txt['cp_type']);
$i++;
}
$n $i 1;
if ($n 1)
{
$config_vars[] = '<a href="' $scripturl '?action=featuresettings;sa=profile;cp=' $n '">' $txt['cp_settings'] . '</a> <a href="' $scripturl '?action=featuresettings;sa=profile;moveup=' $n ';sesc=' $sc '">' $txt['cp_moveup'] . '</a> <a href="' $scripturl '?action=featuresettings;sa=profile;delete=' $n ';sesc=' $sc '">' $txt['cp_delete'] . '</a>';
$config_vars[] = '';
}
elseif ($n == 1)
{
$config_vars[] = '<a href="' $scripturl '?action=featuresettings;sa=profile;cp=' $n '">' $txt['cp_settings'] . '</a> <a href="' $scripturl '?action=featuresettings;sa=profile;delete=' $n ';sesc=' $sc '">' $txt['cp_delete'] . '</a>';
$config_vars[] = '';
}
$txt['cp_addfield'] = preg_replace('/FIELDNUMBER/'$i$txt['cp_addfield']);
$config_vars[] = '<a href="' $scripturl '?action=featuresettings;sa=profile;addfield=' $i ';sesc=' $sc '">' $txt['cp_addfield'] . '</a>';
}

if (isset($_GET['save']))
{
saveDBSettings($config_vars);
redirectexit('action=featuresettings;sa=profile');
}

if (isset($_GET['cp']))
{
$txt['cp_fieldsettings'] = preg_replace('/FIELDNUMBER/'$_GET['cp'], $txt['cp_fieldsettings']);
$context['settings_title'] = $txt['cp_fieldsettings'];
$context['post_url'] = $scripturl '?action=featuresettings2;save;sa=profile;cp=' $_GET['cp'] .'';
}
else
{
$context['settings_title'] = $txt['cp_cpfields'];
$context['post_url'] = $scripturl '?action=featuresettings2;save;sa=profile';
}

prepareDBSettingContext($config_vars);
}

function 
addSettings($settings$overwrite false)
{
global $db_prefix;

$string '';
foreach ($settings as $k => $v)
$string .= '
(\'' 
$k '\', \'' addslashes($v) . '\'),';

if ($string != '')
$result db_query("
. ($overwrite 'REPLACE' 'INSERT IGNORE') . " INTO {$db_prefix}settings
(variable, value)
VALUES" 
substr($string0, -1),__FILE__,__LINE__);
}

function 
moveDown($id)
{
global $modSettings;

$replace $id 1;
if (!isset($modSettings['enable_CP' $id '']) || !isset($modSettings['enable_CP' $replace '']))
return false;

$settings = array(
'enable_CP' $replace '' => $modSettings['enable_CP' $id],
'CP' $replace '_name' => $modSettings['CP' $id '_name'],
'CP' $replace '_desc' => $modSettings['CP' $id '_desc'],
'CP' $replace '_type' => $modSettings['CP' $id '_type'],
'CP' $replace '_post' => $modSettings['CP' $id '_post'],
'CP' $replace '_profile' => $modSettings['CP' $id '_profile'],
'CP' $replace '_bbc' => $modSettings['CP' $id '_bbc'],
'CP' $replace '_id' => $modSettings['CP' $id '_id'],
'CP' $replace '_hr' => $modSettings['CP' $id '_hr'],
'CP' $replace '_reg' => $modSettings['CP' $id '_reg'],
'CP' $replace '_edit' => $modSettings['CP' $id '_edit'],
'CP' $replace '_view' => $modSettings['CP' $id '_view'],
'enable_CP' $id '' => $modSettings['enable_CP' $replace],
'CP' $id '_name' => $modSettings['CP' $replace '_name'],
'CP' $id '_desc' => $modSettings['CP' $replace '_desc'],
'CP' $id '_type' => $modSettings['CP' $replace '_type'],
'CP' $id '_post' => $modSettings['CP' $replace '_post'],
'CP' $id '_profile' => $modSettings['CP' $replace '_profile'],
'CP' $id '_bbc' => $modSettings['CP' $replace '_bbc'],
'CP' $id '_id' => $modSettings['CP' $replace '_id'],
'CP' $id '_hr' => $modSettings['CP' $replace '_hr'],
'CP' $id '_reg' => $modSettings['CP' $replace '_reg'],
'CP' $id '_edit' => $modSettings['CP' $replace '_edit'],
'CP' $id '_view' => $modSettings['CP' $replace '_view'],
);

$i 1;
while (isset($modSettings['CP' $id '_data' $i]))
{
$settings['CP' $replace '_data' $i] = $modSettings['CP' $id '_data' $i];
$i++;
}
$i 1;
while (isset($modSettings['CP' $replace '_data' $i]))
{
$settings['CP' $id '_data' $i] = $modSettings['CP' $replace '_data' $i];
$i++;
}

addSettings($settingstrue);
}

function 
moveUp($id)
{
global $modSettings;

$replace $id 1;
if (!isset($modSettings['enable_CP' $id '']) || !isset($modSettings['enable_CP' $replace '']))
return false;

$settings = array(
'enable_CP' $replace '' => $modSettings['enable_CP' $id],
'CP' $replace '_name' => $modSettings['CP' $id '_name'],
'CP' $replace '_desc' => $modSettings['CP' $id '_desc'],
'CP' $replace '_type' => $modSettings['CP' $id '_type'],
'CP' $replace '_post' => $modSettings['CP' $id '_post'],
'CP' $replace '_profile' => $modSettings['CP' $id '_profile'],
'CP' $replace '_bbc' => $modSettings['CP' $id '_bbc'],
'CP' $replace '_id' => $modSettings['CP' $id '_id'],
'CP' $replace '_hr' => $modSettings['CP' $id '_hr'],
'CP' $replace '_reg' => $modSettings['CP' $id '_reg'],
'CP' $replace '_edit' => $modSettings['CP' $id '_edit'],
'CP' $replace '_view' => $modSettings['CP' $id '_view'],
'enable_CP' $id '' => $modSettings['enable_CP' $replace],
'CP' $id '_name' => $modSettings['CP' $replace '_name'],
'CP' $id '_desc' => $modSettings['CP' $replace '_desc'],
'CP' $id '_type' => $modSettings['CP' $replace '_type'],
'CP' $id '_post' => $modSettings['CP' $replace '_post'],
'CP' $id '_profile' => $modSettings['CP' $replace '_profile'],
'CP' $id '_bbc' => $modSettings['CP' $replace '_bbc'],
'CP' $id '_id' => $modSettings['CP' $replace '_id'],
'CP' $id '_hr' => $modSettings['CP' $replace '_hr'],
'CP' $id '_reg' => $modSettings['CP' $replace '_reg'],
'CP' $id '_edit' => $modSettings['CP' $replace '_edit'],
'CP' $id '_view' => $modSettings['CP' $replace '_view'],
);

$i 1;
while (isset($modSettings['CP' $id '_data' $i]))
{
$settings['CP' $replace '_data' $i] = $modSettings['CP' $id '_data' $i];
$i++;
}
$i 1;
while (isset($modSettings['CP' $replace '_data' $i]))
{
$settings['CP' $id '_data' $i] = $modSettings['CP' $replace '_data' $i];
$i++;
}

addSettings($settingstrue);
}

function 
deleteField($id)
{
global $modSettings;

if (!isset($modSettings['enable_CP' $id '']))
return false;

$i $id 1;
while (isset($modSettings['enable_CP' $i '']))
{
moveUp($i);
echo 'up';
$i++;
}
$i--;
$settings = array('enable_CP' $i'CP' $i '_name''CP' $i '_desc''CP' $i '_type''CP' $i '_post''CP' $i '_profile''CP' $i '_bbc''CP' $i '_id''CP' $i '_hr''CP' $i '_reg''CP' $i '_edit''CP' $i '_view',);
$n 1;
while (isset($modSettings['CP' $i '_data' $n]))
{
$settings[] = 'CP' $i '_data' $n;
$n++;
}

deleteSettings($settings);

}

function 
deleteSettings($settings)
{
global $db_prefix;

foreach ($settings as $delete)
$result db_query("DELETE FROM {$db_prefix}settings WHERE variable = '$delete' LIMIT 1"__FILE____LINE__);
}
?>


Sorry with my english, because i don't speack english
Tu Android Una nueva comunidad
http://forolines.com A new comunit

Realinfo

Can it possible in 2.0.2.............. Now I have 2.0.2.............. In 1.1.16, I could do it, but not in 2.0.2

mr.Curiosity


Zelite poptpuno besplatno reklamirati svoj server?
Posjetite  www.reklamiraj-server.netne.net
Ocekujemo Vas!

Advertisement: