MCP Snippet: Search user posts in user notes

A perfect place for code snippets to small to be a MOD or a library.
Or for examples on how to use our libraries.
Post Reply
User avatar
RMcGirr83
Supporter
Supporter
Posts: 6242
Joined: 30 Nov 2006, 14:23
Real name: Rich McGirr

MCP Snippet: Search user posts in user notes

Post by RMcGirr83 »

The following snippet will allow a moderator to view a users posts when they are viewing a users notes within the MCP.

Currently the users post count will display with no link being presented to view that users posts (eg, see pic).

Untitled.png
Untitled.png (11.49 KiB) Viewed 10114 times


So let's make it a link

OPEN

includes/mcp/mcp_notes.php

FIND

Code: Select all

         'POSTS'            => ($userrow['user_posts']) ? $userrow['user_posts'] : 0,


BEFORE, ADD

Code: Select all

         'U_SEARCH_POSTS'   => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id=$user_id&sr=posts") : '',   


OPEN

styles/xxx/template/mcp_notes_user.html

FIND

Code: Select all

{POSTS}


REPLACE WITH

Code: Select all

<!-- IF POSTS and U_SEARCH_POSTS --><a href="{U_SEARCH_POSTS}">{POSTS}</a><!-- ELSE -->{POSTS}<!-- ENDIF -->


and that's it. The post count will now be a link to the users posts displayed via search within the MCP of that user.

If you want it to open in a new window (instead of right clicking)

Code: Select all

<!-- IF POSTS and U_SEARCH_POSTS --><a href="{U_SEARCH_POSTS}" onclick="window.open(this.href);return false;">{POSTS}</a><!-- ELSE -->{POSTS}<!-- ENDIF -->
Post Reply