SimplePortal

Customization => Custom Coding => Topic started by: iain sherriff on May 02, 2015, 09:15:23 AM

Title: User block
Post by: iain sherriff on May 02, 2015, 09:15:23 AM
Hi.
We don't have PM enabled on this board I admin.

Wheer do I go to remove the two lines from the block please?

thanks  :nervous-happy:
Title: Re: User block
Post by: Chen Zhen on May 02, 2015, 12:13:32 PM
iain sherriff,

File: ../Sources/PortalBlocks.php

find:
Code: [Select]
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>';
}

replace with:
Code: [Select]
/* 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>';
} */

Regards.
Title: Re: User block
Post by: ♦ Ninja ZX-10RR ♦ on May 02, 2015, 01:22:27 PM
ian sherriff
Open your Sources/PortalBlocks.php and remove:
Code: [Select]
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>';
}
This should do what you want :) Please backup your files before editing them, I haven't tested this edit, even if I am pretty sure it will work.
Regards

EDIT: ninja'd :( had this page opened for hours and replied when I found some time :/
Title: Re: User block
Post by: iain sherriff on May 05, 2015, 05:31:11 AM
Most greatful for both answers
thank you  :nervous-happy:
Title: Re: User block
Post by: iain sherriff on May 05, 2015, 05:40:18 AM
Chen............I see what you did there. The number of times I have wanted to do that as a test instead of removing the code  :-[

Very usefull for the future  ;D
Title: Re: User block
Post by: ♦ Ninja ZX-10RR ♦ on May 05, 2015, 08:50:56 AM
Yes, he commented out the lines :) You can do it like this:
Code: [Select]
/* code to be left out goes here */
FYI it works in .css files as well.
Title: Re: User block
Post by: iain sherriff on May 05, 2015, 09:11:59 AM
That is going to save me so much time.......I knew about "commenting out" (is that right) but never got a handle on what it was
Title: Re: User block
Post by: ♦ Ninja ZX-10RR ♦ on May 05, 2015, 09:46:05 AM
It can be done also like this:
Code: [Select]
// commented out code
Non commented out code (new line)
But the first method is much better because it doesn't depend on lines and it also works in .css files, this method does NOT work in .css files instead.
Title: Re: User block
Post by: iain sherriff on May 05, 2015, 09:52:00 AM
ah. right, thanks
Title: Re: User block
Post by: ♦ Ninja ZX-10RR ♦ on May 05, 2015, 10:17:36 AM
You're welcome :)
Title: Re: User block
Post by: ccbtimewiz on May 05, 2015, 12:48:38 PM
Could also set allowedTo('pm') to false the line above it, though commenting/removing works just as good.
SimplePortal 2.3.8 © 2008-2024, SimplePortal