Author Topic: Need help with modifications  (Read 3795 times)

Offline theunder-ground

Need help with modifications
« on: August 20, 2006, 06:10:51 am »
I have asked this at the SMF support forums, but it was only merged with daniel's shop mod post.  Any one that would be willing to help?  I think that my staff would love you forever.

I am trying to make the shop mod fit my needs.  I've almost got it done, but there is a few that are confusing me.

One of the main things that I want to be able to do is edit the currency amount through the profile.  I got the box to show up, it edits the database as needed, but unlike the place you edit the posts it doesn't show how much they currently have.  The other thing that heppens is that when the person makes another post their amount is reset to 0

I am also trying to get this amount to show up in the profile summary and it will not.

These are all the changes I made:

in sources/profile.php

find

Code: [Select]
// Change the number of posts.
if (isset($_POST['posts']) && allowedTo('moderate_forum'))
$profile_vars['posts'] = $_POST['posts'] != '' ? (int) $_POST['posts'] : '\'\'';

Add after
Code: [Select]
// Change the number of Diamonds.
if (isset($_POST['money']) && allowedTo('moderate_forum'))
$profile_vars['money'] = $_POST['money'] != '' ? (int) $_POST['money'] : '\'\'';

in themes/default/Profile.template.php

Find

Code: [Select]
<tr>
<td><b>', $txt[86], ': </b></td>
<td>', $context['member']['posts'], ' (', $context['member']['posts_per_day'], ' ', $txt['posts_per_day'], ')</td>
</tr><tr>

Add After
               
Code: [Select]
<td><b>', $modSettings['shopCurrencyPrefix'], ' </b></td>
<td>', $context['member']['money'], '</td>
</tr><tr>

Find

   
Code: [Select]
// If karma is enabled let the admin edit it...
if ($user_info['is_admin'] && !empty($modSettings['karmaMode']))
{
echo '
<tr>
<td colspan="2"><hr width="100%" size="1" class="hrcolor" /></td>
</tr><tr>
<td valign="top"><b>', $modSettings['karmaLabel'], '</b></td>
<td>
', $modSettings['karmaApplaudLabel'], ' <input type="text" name="karmaGood" size="4" value="', $context['member']['karma']['good'], '" onchange="setInnerHTML(document.getElementById(\'karmaTotal\'), this.value - this.form.karmaBad.value);" style="margin-right: 2ex;" /> ', $modSettings['karmaSmiteLabel'], ' <input type="text" name="karmaBad" size="4" value="', $context['member']['karma']['bad'], '" onchange="this.form.karmaGood.onchange();" /><br />
(', $txt[94], ': <span id="karmaTotal">', ($context['member']['karma']['good'] - $context['member']['karma']['bad']), '</span>)
</td>
</tr>';
}
Add After   

Code: [Select]
// Diamonds
if ($user_info['is_admin'])
{
echo '
<tr>
<td colspan="2"><hr width="100%" size="1" class="hrcolor" /></td>
</tr><tr>
<td valign="top"><b>', $modSettings['shopCurrencyPrefix'], '</b></td>
<td><input type="text" name="money" size="4" value="', $context['member']['money'], '" /></td>

</tr>';
}

Offline Daniel15

Re: Need help with modifications
« Reply #1 on: August 24, 2006, 07:58:27 pm »
Quote
but unlike the place you edit the posts it doesn't show how much they currently have
That's because the $context['member']['money'] variable is not set. Unfortunately, I can't remember where the $context['member'] variables are set, so I can't help you there.