News:

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

Main Menu

[TIP/TRICK] Who Viewed The Topic

Started by [SiNaN], June 04, 2008, 11:45:57 AM

Previous topic - Next topic

Eliana Tamerin

Do NOT PM me for support.

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


[SiNaN]

Former SMF Core Developer | My Mods | SimplePortal


[SiNaN]

Here is your codes:

Display.php

Find:

fatal_lang_error('smf232', false);

Replace:

fatal_lang_error('smf232', false);

$request = db_query("
SELECT ID_MEMBER_STARTED
FROM {$db_prefix}topics
WHERE ID_TOPIC = $topic
LIMIT 1", __FILE__, __LINE__);
list ($starter) = mysql_fetch_row($request);
mysql_free_result($request);

if($starter = $ID_MEMBER || allowedTo('moderate_forum'))
$context['can_view_who_viewed'] = true;
else
$context['can_view_who_viewed'] = false;

if(!empty($_REQUEST['sa']) && $_REQUEST['sa'] == 'log' && $context['can_view_who_viewed']) {
    DisplayLog();
}


And in the DisplayLog() function, you should remove:

isAllowedTo('moderate_forum');

Also you can use $context['can_view_who_viewed'] in the template file to show the button only for the starter.
Former SMF Core Developer | My Mods | SimplePortal

Kalina

#25
I think I am doing something wrong, how can I make it so any member can view the list? I want anyone except guests to be able to view it. Thanks. :)

I put this in MessageIndex.template.php
                            ', !$context['user']['is_guest'] ? '<a href="' . $scripturl . '?topic='. $topic['id'] . '.0;sa=log">' . $topic['views'] . '</a>' : $topic['views'], '

But it says to regular members: "You are not allowed to moderate this forum."

I thought the code above would make it so anyone but guests can see.

Edit: Ok, so I just had to remove "   isAllowedTo('moderate_forum');" from my Display.php

[SiNaN]

Glad that you've managed to do it. You can deny guests by just adding this code instead of the one you removed:

is_not_guest();
Former SMF Core Developer | My Mods | SimplePortal

Sarge

That's cool, [SiNaN] :)

Can you package it as a mod?

    Please do not PM me with support requests unless I invite you to.

http://www.zeriyt.com/   ~   http://www.galeriashqiptare.net/


Quote
<H> I had zero posts when I started posting

[SiNaN]

It's quite ready. Just need to check permissions in the Display.template.php.

The mod will include:

- How many times member viewed
- Time of members' last view
- Sorting of members by username, position, last view time, times viewed
- Showing 20 members per page
Former SMF Core Developer | My Mods | SimplePortal

Sarge

Quote from: [SiNaN] on July 05, 2008, 06:54:36 AM
- Showing 20 members per page

Can you make the number configurable?

    Please do not PM me with support requests unless I invite you to.

http://www.zeriyt.com/   ~   http://www.galeriashqiptare.net/


Quote
<H> I had zero posts when I started posting

[SiNaN]

I just do not want to add something to the ModSettings. I don't think it is that much important. If you personally want to change the number, just you need to change the number 20 to what you want in Display.php.

But if you say, we need, they I can add. Do we really need?
Former SMF Core Developer | My Mods | SimplePortal

Sarge

Quote from: [SiNaN] on July 05, 2008, 07:02:23 AM
But if you say, we need, they I can add. Do we really need?

It was just a suggestion (I personally don't need it).

It's totally up to you. :)

    Please do not PM me with support requests unless I invite you to.

http://www.zeriyt.com/   ~   http://www.galeriashqiptare.net/


Quote
<H> I had zero posts when I started posting

Kalina

Quote from: [SiNaN] on July 05, 2008, 06:54:36 AM
It's quite ready. Just need to check permissions in the Display.template.php.

The mod will include:

- How many times member viewed
- Time of members' last view
- Sorting of members by username, position, last view time, times viewed
- Showing 20 members per page

That's awesome, looking forward to it. Thank you. :)

Nibogo

Quote from: [SiNaN] on July 05, 2008, 06:54:36 AM
It's quite ready. Just need to check permissions in the Display.template.php.

The mod will include:

- How many times member viewed
- Time of members' last view
- Sorting of members by username, position, last view time, times viewed
- Showing 20 members per page

Awesome ideas!!

[SiNaN]

Quote from: Sarge on July 05, 2008, 07:07:18 AM
It was just a suggestion (I personally don't need it).

It's totally up to you. :)

Sorry Sarge, didn't thought of that you can code a better one if you will need. :)
Former SMF Core Developer | My Mods | SimplePortal

Eliana Tamerin

If you make sure the number is easy to find in the code, it'll be easy for anyone who wants to change that to do so.
Do NOT PM me for support.

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

edi67

CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

avf

Quote from: [SiNaN] on July 05, 2008, 06:54:36 AM
It's quite ready. Just need to check permissions in the Display.template.php.

The mod will include:

- How many times member viewed
- Time of members' last view
- Sorting of members by username, position, last view time, times viewed
- Showing 20 members per page

very nice thank you
waiting for the updated version
avf

[SiNaN]

Former SMF Core Developer | My Mods | SimplePortal

Deprecated

Quote from: [SiNaN] on June 04, 2008, 12:20:53 PM
Nothing is impossible. :P

That's the essence of why we all like writing software. :)

Other mortals walk around the mountain, walk over the mountain. We programmers lift up the mountain and walk under it. ;)

Advertisement: