Show a 'Topic Subscribers' list in viewtopic [SOLVED?]

Looking for a MOD? Have a MOD request? Post here for help. (Note: This forum is community supported; phpBB does not have official MOD authors)
Scam Warning
Locked
User avatar
Volksdevil
Registered User
Posts: 2415
Joined: Sun Oct 03, 2010 2:03 pm
Location: Lancashire, UK
Name: Neil
Contact:

Show a 'Topic Subscribers' list in viewtopic [SOLVED?]

Post by Volksdevil »

As title, I've had a search and haven't found anything specific.

When viewing a topic, would it be possible to list the members that are subscribed to that topic? Maybe styled like the 'Online list' which shows at the bottom of the topic.

Cheers.
Last edited by Volksdevil on Mon Mar 17, 2014 5:41 pm, edited 1 time in total.
My phpBB Extensions
Finally found great Website Hosting from :arrow: KUALO!
Do NOT use 123-reg.co.uk - Incapable of running phpBB!
:ugeek: TekNeil - Streamer on Twitch | My Volkswagen Corrado G60
User avatar
AmigoJack
Registered User
Posts: 6041
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Show a 'Topic Subscribers' list in viewtopic

Post by AmigoJack »

Open /viewtopic.php and find:

Code: Select all

// Update topic view and if necessary attachment view counters ... but only for humans and if this is the first 'page view'  
Before, add:

Code: Select all

/*** 2014-03-17 BEGIN AmigoJack
    http://www.phpbb.com/community/viewtopic.php?t=2232626 ***/
$sql= 'SELECT u.user_id, u.username, u.user_colour
    FROM '. TOPICS_WATCH_TABLE. ' tw
    INNER JOIN '. USERS_TABLE. ' u ON tw.user_id= u.user_id
    WHERE tw.topic_id= '. $topic_id. '
    ORDER BY u.username_clean';
$hResult= $db-> sql_query( $sql );
while( $aRow= $db-> sql_fetchrow( $hResult ) ) {
    $template-> assign_block_vars
    ( 'subscribers'
    , array
        (    'NAME'=> get_username_string( 'no_profile', $aRow['user_id'], $aRow['username'], $aRow['user_colour'] )
        , 'U_PROFILE'=> append_sid( "{$phpbb_root_path}memberlist.$phpEx", "mode=viewprofile&u=". $aRow['user_id'] )
        )
    );
}
$db-> sql_freeresult( $hResult );
/*** 2014-03-17 END ***/
Open /styles/*/template/viewtopic_body.html and find:

Code: Select all

<!-- IF S_DISPLAY_ONLINE_LIST -->
Before, add:

Code: Select all

<!-- IF .subscribers -->
	<h3><a name="subscribers">{L_SUBSCRIBERS}</a></h3>
	<p><!-- BEGIN subscribers --><!-- IF not subscribers.S_FIRST_ROW --> &bull; <!-- ENDIF --> <a href="{subscribers.U_PROFILE}">{subscribers.NAME}</a><!-- END subscribers --></p>
<!-- ENDIF -->
Open /language/*/viewtopic.php and find:

Code: Select all

));
Before, add:

Code: Select all

    /*** 2014-03-17 BEGIN AmigoJack
        http://www.phpbb.com/community/viewtopic.php?t=2232626 ***/
    'SUBSCRIBERS'=> 'Subscribers',
    /*** 2014-03-17 END ***/
Tested.
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
User avatar
Jessica
Former Team Member
Posts: 4342
Joined: Sun Jul 18, 2010 2:53 pm
Location: Pennsylvania, USA
Name: Jessica
Contact:

Re: Show a 'Topic Subscribers' list in viewtopic

Post by Jessica »

Pro-choice, Atheist, Pro-LGBT rights
Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid. - Albert Einstein
User avatar
Volksdevil
Registered User
Posts: 2415
Joined: Sun Oct 03, 2010 2:03 pm
Location: Lancashire, UK
Name: Neil
Contact:

Re: Show a 'Topic Subscribers' list in viewtopic

Post by Volksdevil »

Wicked, thanks AmigoJack, works perfectly! 8-)

Cheers for the link Jessica, It may be a little more than I need but I'll bookmark it. In fact...

Hmmmm. A 'Bookmark' list could be handy. Just don't want to bloat things too much?

EDIT: Wow, I actually got something to do with database queries working all by myself! :lol: :D
I copied the original code given and eduted it to provide a 'Bookmarkers' list. Probably a better way to do it though...I'm useless with this stuff.

viewtopic.php added for bookmark list:

Code: Select all

/*** 2014-03-17 BEGIN AmigoJack
    http://www.phpbb.com/community/viewtopic.php?t=2232626 ***/
$sql= 'SELECT u.user_id, u.username, u.user_colour
    FROM '. BOOKMARKS_TABLE. ' tw
    INNER JOIN '. USERS_TABLE. ' u ON tw.user_id= u.user_id
    WHERE tw.topic_id= '. $topic_id. '
    ORDER BY u.username_clean';
$hResult= $db-> sql_query( $sql );
while( $aRow= $db-> sql_fetchrow( $hResult ) ) {
    $template-> assign_block_vars
    ( 'bookmarkers'
    , array
        (    'NAME'=> get_username_string( 'no_profile', $aRow['user_id'], $aRow['username'], $aRow['user_colour'] )
        , 'U_PROFILE'=> append_sid( "{$phpbb_root_path}memberlist.$phpEx", "mode=viewprofile&u=". $aRow['user_id'] )
        )
    );
}
$db-> sql_freeresult( $hResult );
/*** 2014-03-17 END ***/ 
My phpBB Extensions
Finally found great Website Hosting from :arrow: KUALO!
Do NOT use 123-reg.co.uk - Incapable of running phpBB!
:ugeek: TekNeil - Streamer on Twitch | My Volkswagen Corrado G60
Locked

Return to “[3.0.x] MOD Requests”