News:

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

Main Menu

Need Small Help

Started by Vonotna, September 01, 2015, 07:43:44 PM

Previous topic - Next topic

Kindred

well, you would need to delete TWO lines there in most cases
both the echo and the content.

Additionally, the start of that code is part of an conditions (if/else) clause and youwould need to make sure that is not left hanging by deleting the wrong bit of it.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Pipke

Ok here we go..

Go to Admin->Configuration->Features and Options->Profile Fields

Then scroll down on the page, there is the costum field you have (already) setup!

There you see Field Name! (see my attachment image)

We need the field name ie: test2 (yours will be different, i guess?)

Go to the file in Sources/PortalBlocks.php

About on line 217/218 you find this:

<li>', sp_embed_image('dot'), ' <a href="', $scripturl, '?action=unread">', $txt['unread_topics_visit'], '</a></li>
<li>', sp_embed_image('dot'), ' <a href="', $scripturl, '?action=unreadreplies">', $txt['unread_replies'], '</a></li>';

change it to this:
Code (replace with) Select

<li>', sp_embed_image('dot'), ' <a href="', $scripturl, '?action=unread">', $txt['unread_topics_visit'], '</a></li>
<li>', sp_embed_image('dot'), ' <a href="', $scripturl, '?action=unreadreplies">', $txt['unread_replies'], '</a></li>';
if (!empty($member_info['options']['cust_test2']))
echo'<li>', sp_embed_image('dot'), ' <strong>Example:</strong> ', $member_info['options']['cust_test2'], '</li>';


As you see in my code there is two times in the code the text 'cust_test2' you need to change that with your profile field name

so $member_info['options']['cust_test2'] to $member_info['options']['cust_your profile field name']

The text between <strong> and </strong> ie: 'Example' is hardcoded text, and i will know for sure Kindred wil say something about it, so you should check this to fix that with a string!

so <strong>Example:</strong> to <strong> ', $txt['this_is_text'], '</strong> '

Good luck with the edit ;)



"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

Vonotna

Thank you for the nice instruction but am sure I followed them all right but it didn't change anything.
I made it like this
                              <li>', sp_embed_image('dot'), ' <a href="', $scripturl, '?action=unread">', $txt['unread_topics_visit'], '</a></li>
                              <li>', sp_embed_image('dot'), ' <a href="', $scripturl, '?action=unreadreplies">', $txt['unread_replies'], '</a></li>';
                              if (!empty($member_info['options']['cust_points']))
                                 echo'<li>', sp_embed_image('dot'), ' <strong>Example:</strong> ', $member_info['options']['cust_points'], '</li>';


It doenst add anything nor does it give any error no idea what mastake did I make.

Kindred

is your custom field actually named JUST "points"?
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Pipke

Just to check something else, did you entered something on your forum profile in the profile field wich you have setup?
The field 'points' must have a value?
"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

Vonotna

yes its named just points
and yes there is a value if I understood what you meant by it
"Points: 32"

Illori

echo'<pre>';
print_r($member_info['options']);die();


can you add that code and post the results? afterwards you can delete the code.

Vonotna

Yey, the last code made me realise that I have changed the profile field name in the past, and I needed to type in the field name that was originaly created by.
It works now. THANK YOU ALL SO MUCH.
Sorry about this but now I have another question (this will probbly be easier :D )
Now i have this:


I have tried for like an hour to delete the

Posts
Recent Unread Topics
Updated Topics

but everytime I get error on my whole forum.
How should I do it or if its easier delete it for me I have attached the code in notepad.
I can't express how grateful I am at the moment  O:)

Vonotna

In short I want to have:

Total Messages:
New Massages:
Points:

Would do it myself but seems like I just can't figure out which paragraphs to delete

margarett

Delete this
echo '
<li>', sp_embed_image('dot'), ' <strong>', $txt['posts'], ':</strong> ', $member_info['posts'], '</li>';


And this
echo '
<li>', sp_embed_image('dot'), ' <a href="', $scripturl, '?action=unread">', $txt['unread_topics_visit'], '</a></li>
<li>', sp_embed_image('dot'), ' <a href="', $scripturl, '?action=unreadreplies">', $txt['unread_replies'], '</a></li>';


Should work ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Vonotna

THe posts were deleted
But when I delete the second code I get the 500 internal server error :(

Pipke

The complete function  (without posts/unread/updated, with karma, if you turned this option on)

function sp_userInfo($parameters, $id, $return_parameters = false)
{
global $context, $txt, $scripturl, $memberContext, $modSettings, $user_info, $color_profile, $settings;

$block_parameters = array();

if ($return_parameters)
return $block_parameters;

echo '
<div class="sp_center sp_fullwidth">';

if ($context['user']['is_guest'])
{
echo '
<script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/sha1.js"></script>
<form action="', $scripturl, '?action=login2" method="post" accept-charset="', $context['character_set'], '"', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' . $context['session_id'] . '\');"' : '', ' >
<table>
<tr>
<td class="sp_right"><label for="sp_user">', $txt['username'], ':</label>&nbsp;</td>
<td><input type="text" id="sp_user" name="user" size="9" value="', !empty($user_info['username']) ? $user_info['username'] : '', '" /></td>
</tr><tr>
<td class="sp_right"><label for="sp_passwrd">', $txt['password'], ':</label>&nbsp;</td>
<td><input type="password" name="passwrd" id="sp_passwrd" size="9" /></td>
</tr><tr>
<td>
<select name="cookielength">
<option value="60">', $txt['one_hour'], '</option>
<option value="1440">', $txt['one_day'], '</option>
<option value="10080">', $txt['one_week'], '</option>
<option value="43200">', $txt['one_month'], '</option>
<option value="-1" selected="selected">', $txt['forever'], '</option>
</select>
</td>
<td><input type="submit" value="', $txt['login'], '" class="button_submit" /></td>
</tr>
</table>
<input type="hidden" name="hash_passwrd" value="" />
</form>', sprintf($txt['welcome_guest'], $txt['guest_title']);
}
else
{
loadMemberData($user_info['id']);
loadMemberContext($user_info['id'], true);

$member_info = $memberContext[$user_info['id']];

if (sp_loadColors($member_info['id']) !== false)
$member_info['colored_name'] = $color_profile[$member_info['id']]['colored_name'];

$member_info['karma']['total'] = $member_info['karma']['good'] - $member_info['karma']['bad'];

echo '
', strtolower($member_info['name']) === 'okarin' ? 'Okae-Rin, ' : $txt['hello_member'], ' <strong>', !empty($member_info['colored_name']) ? $member_info['colored_name'] : $member_info['name'], '</strong>
<br /><br />';

if (!empty($member_info['avatar']['image']))
echo '
<a href="', $scripturl, '?action=profile;u=', $member_info['id'], '">', $member_info['avatar']['image'], '</a><br /><br />';

if (!empty($member_info['group']))
echo '
', $member_info['group'], '<br />';
else
echo '
', $member_info['post_group'], '<br />';

echo '
', $member_info['group_stars'], '<br />';

echo '
<br />
<ul class="sp_list">';

if (!empty($modSettings['karmaMode']))
{
echo '
<li>', sp_embed_image('dot'), ' <strong>', $modSettings['karmaLabel'], '</strong> ';

if ($modSettings['karmaMode'] == 1)
echo $member_info['karma']['total'];
elseif ($modSettings['karmaMode'] == 2)
echo '+', $member_info['karma']['good'], '/-', $member_info['karma']['bad'];

echo '</li>';
}

if (allowedTo('pm_read'))
{
echo '
<li>', sp_embed_image('dot'), ' <strong>', $txt['sp-usertmessage'], ':</strong> <a href="', $scripturl, '?action=pm">', $context['user']['messages'], '</a></li>
<li>', sp_embed_image('dot'), ' <strong>', $txt['sp-usernmessage'], ':</strong> ', $context['user']['unread_messages'], '</li>';
}

if (!empty($member_info['options']['cust_test2']))
echo'<li>', sp_embed_image('dot'), ' <strong>Example:</strong> ', $member_info['options']['cust_test2'], '</li>';

echo '
</ul>
<br />';

echo '
', sp_embed_image('arrow'), ' <a href="', $scripturl, '?action=profile">', $txt['profile'], '</a> ', sp_embed_image('arrow'), ' <a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">', $txt['logout'], '</a>';
}

echo '
</div>';
}


without posts/unread/updated/karma


function sp_userInfo($parameters, $id, $return_parameters = false)
{
global $context, $txt, $scripturl, $memberContext, $modSettings, $user_info, $color_profile, $settings;

$block_parameters = array();

if ($return_parameters)
return $block_parameters;

echo '
<div class="sp_center sp_fullwidth">';

if ($context['user']['is_guest'])
{
echo '
<script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/sha1.js"></script>
<form action="', $scripturl, '?action=login2" method="post" accept-charset="', $context['character_set'], '"', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' . $context['session_id'] . '\');"' : '', ' >
<table>
<tr>
<td class="sp_right"><label for="sp_user">', $txt['username'], ':</label>&nbsp;</td>
<td><input type="text" id="sp_user" name="user" size="9" value="', !empty($user_info['username']) ? $user_info['username'] : '', '" /></td>
</tr><tr>
<td class="sp_right"><label for="sp_passwrd">', $txt['password'], ':</label>&nbsp;</td>
<td><input type="password" name="passwrd" id="sp_passwrd" size="9" /></td>
</tr><tr>
<td>
<select name="cookielength">
<option value="60">', $txt['one_hour'], '</option>
<option value="1440">', $txt['one_day'], '</option>
<option value="10080">', $txt['one_week'], '</option>
<option value="43200">', $txt['one_month'], '</option>
<option value="-1" selected="selected">', $txt['forever'], '</option>
</select>
</td>
<td><input type="submit" value="', $txt['login'], '" class="button_submit" /></td>
</tr>
</table>
<input type="hidden" name="hash_passwrd" value="" />
</form>', sprintf($txt['welcome_guest'], $txt['guest_title']);
}
else
{
loadMemberData($user_info['id']);
loadMemberContext($user_info['id'], true);

$member_info = $memberContext[$user_info['id']];

if (sp_loadColors($member_info['id']) !== false)
$member_info['colored_name'] = $color_profile[$member_info['id']]['colored_name'];

$member_info['karma']['total'] = $member_info['karma']['good'] - $member_info['karma']['bad'];

echo '
', strtolower($member_info['name']) === 'okarin' ? 'Okae-Rin, ' : $txt['hello_member'], ' <strong>', !empty($member_info['colored_name']) ? $member_info['colored_name'] : $member_info['name'], '</strong>
<br /><br />';

if (!empty($member_info['avatar']['image']))
echo '
<a href="', $scripturl, '?action=profile;u=', $member_info['id'], '">', $member_info['avatar']['image'], '</a><br /><br />';

if (!empty($member_info['group']))
echo '
', $member_info['group'], '<br />';
else
echo '
', $member_info['post_group'], '<br />';

echo '
', $member_info['group_stars'], '<br />';

echo '
<br />
<ul class="sp_list">';

if (allowedTo('pm_read'))
{
echo '
<li>', sp_embed_image('dot'), ' <strong>', $txt['sp-usertmessage'], ':</strong> <a href="', $scripturl, '?action=pm">', $context['user']['messages'], '</a></li>
<li>', sp_embed_image('dot'), ' <strong>', $txt['sp-usernmessage'], ':</strong> ', $context['user']['unread_messages'], '</li>';
}

if (!empty($member_info['options']['cust_test2']))
echo'<li>', sp_embed_image('dot'), ' <strong>Example:</strong> ', $member_info['options']['cust_test2'], '</li>';

echo '
</ul>
<br />';

echo '
', sp_embed_image('arrow'), ' <a href="', $scripturl, '?action=profile">', $txt['profile'], '</a> ', sp_embed_image('arrow'), ' <a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">', $txt['logout'], '</a>';
}

echo '
</div>';
}
"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

Vonotna

Nope.. tried both of the codes even tought I have karma disabled didn't work still error :(

Pipke

what error? and can you give your site link so we can take a look.
"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

Vonotna

Sorry I can't post the link, but its the common 500 internal page erorr.

Kindred

a 500 error is an server error...  possibly because of a bad chmod permissions on the file when you save.   How are you editing the file?
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Vonotna

Directly in the file manager on my hosting
But everything before worked so I don't see why this removal won't. :(
And i have full permissions on the file just checked.

Illori

try

function sp_userInfo($parameters, $id, $return_parameters = false)
{
global $context, $txt, $scripturl, $memberContext, $modSettings, $user_info, $color_profile, $settings;

$block_parameters = array();

if ($return_parameters)
return $block_parameters;

echo '
<div class="sp_center sp_fullwidth">';

if ($context['user']['is_guest'])
{
echo '
<script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/sha1.js"></script>
<form action="', $scripturl, '?action=login2" method="post" accept-charset="', $context['character_set'], '"', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' . $context['session_id'] . '\');"' : '', ' >
<table>
<tr>
<td class="sp_right"><label for="sp_user">', $txt['username'], ':</label>&nbsp;</td>
<td><input type="text" id="sp_user" name="user" size="9" value="', !empty($user_info['username']) ? $user_info['username'] : '', '" /></td>
</tr><tr>
<td class="sp_right"><label for="sp_passwrd">', $txt['password'], ':</label>&nbsp;</td>
<td><input type="password" name="passwrd" id="sp_passwrd" size="9" /></td>
</tr><tr>
<td>
<select name="cookielength">
<option value="60">', $txt['one_hour'], '</option>
<option value="1440">', $txt['one_day'], '</option>
<option value="10080">', $txt['one_week'], '</option>
<option value="43200">', $txt['one_month'], '</option>
<option value="-1" selected="selected">', $txt['forever'], '</option>
</select>
</td>
<td><input type="submit" value="', $txt['login'], '" class="button_submit" /></td>
</tr>
</table>
<input type="hidden" name="hash_passwrd" value="" />
</form>', sprintf($txt['welcome_guest'], $txt['guest_title']);
}
else
{
loadMemberData($user_info['id']);
loadMemberContext($user_info['id'], true);

$member_info = $memberContext[$user_info['id']];

if (sp_loadColors($member_info['id']) !== false)
$member_info['colored_name'] = $color_profile[$member_info['id']]['colored_name'];

$member_info['karma']['total'] = $member_info['karma']['good'] - $member_info['karma']['bad'];

echo '
', strtolower($member_info['name']) === 'okarin' ? 'Okae-Rin, ' : $txt['hello_member'], ' <strong>', !empty($member_info['colored_name']) ? $member_info['colored_name'] : $member_info['name'], '</strong>
<br /><br />';

if (!empty($member_info['avatar']['image']))
echo '
<a href="', $scripturl, '?action=profile;u=', $member_info['id'], '">', $member_info['avatar']['image'], '</a><br /><br />';

if (!empty($member_info['group']))
echo '
', $member_info['group'], '<br />';
else
echo '
', $member_info['post_group'], '<br />';

echo '
', $member_info['group_stars'], '<br />';

echo '
<br />
<ul class="sp_list">';

if (!empty($modSettings['karmaMode']))
{
echo '
<li>', sp_embed_image('dot'), ' <strong>', $modSettings['karmaLabel'], '</strong> ';

if ($modSettings['karmaMode'] == 1)
echo $member_info['karma']['total'];
elseif ($modSettings['karmaMode'] == 2)
echo '+', $member_info['karma']['good'], '/-', $member_info['karma']['bad'];

echo '</li>';
}

if (allowedTo('pm_read'))
{
echo '
<li>', sp_embed_image('dot'), ' <strong>', $txt['sp-usertmessage'], ':</strong> <a href="', $scripturl, '?action=pm">', $context['user']['messages'], '</a></li>
<li>', sp_embed_image('dot'), ' <strong>', $txt['sp-usernmessage'], ':</strong> ', $context['user']['unread_messages'], '</li>';
}

if (!empty($member_info['options']['cust_earned']))
echo'<li>', sp_embed_image('dot'), ' <strong>Points:</strong> ', $member_info['options']['cust_earned'], '</li>';

echo '
</ul>
<br />';

echo '
', sp_embed_image('arrow'), ' <a href="', $scripturl, '?action=profile">', $txt['profile'], '</a> ', sp_embed_image('arrow'), ' <a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">', $txt['logout'], '</a>';
}

echo '
</div>';
}


that should work although it is untested.

Vonotna

Nope that isnt neccesery.
I fixed it.
THANK YOU ALL FOR THE HELP.
If someone needs an answer it was really simple.
I replaced:
      echo '
                              <li>', sp_embed_image('dot'), ' <a href="', $scripturl, '?action=unread">', $txt['unread_topics_visit'], '</a></li>
                              <li>', sp_embed_image('dot'), ' <a href="', $scripturl, '?action=unreadreplies">', $txt['unread_replies'], '</a></li>';
                              if (!empty($member_info['options']['cust_earned']))
                                 echo'<li>', sp_embed_image('dot'), ' <strong>Points:</strong> ', $member_info['options']['cust_earned'], '</li>';


With:

      if (!empty($member_info['options']['cust_earned']))
         echo '
                              <li>', sp_embed_image('dot'), ' <strong>Points:</strong> ', $member_info['options']['cust_earned'], '</li>';

Advertisement: