phpBB SnippetsUser's post count anywhere

Post Reply
User avatar
Topic Starter
Restless Rancor
Great Britain

Site Admin
New Member
Posts: 48
Joined: October 15th, 2018, 3:14 pm
Age: 25
Location: Hampshire, England
Contact:

User's post count anywhere

#1

Post by Restless Rancor » October 15th, 2018, 7:29 pm

This snippet adds the ability to display a logged in member's post count to them anywhere on the forum.
 ! Message from: Restless Rancor
This snippet has been converted into an extension. Click [HERE] to go to the development topic.


Tested On:
Open root/includes/functions.php

Find:

Code: Select all

'S_USERNAME'			=> $user->data['username'],
Add After:

Code: Select all

		'S_USER_ID'             => $user->data['user_id'],
		'USER_POST_COUNT' 	    => $user->data['user_posts'], 
Use {USER_POST_COUNT} in templates to pull the post count of the logged in member viewing the page.
Use {S_USER_ID} to pull the User ID of that user.

Example usage:

Code: Select all

{% if S_REGISTERED_USER %}<a href="search.php?author_id={S_USER_ID}&sr=posts">You have {USER_POST_COUNT} posts!</a>{% endif %}
Changelog:
► Show Spoiler


These aren't the droids you're looking for.

User avatar
Topic Starter
Restless Rancor
Great Britain

Site Admin
New Member
Posts: 48
Joined: October 15th, 2018, 3:14 pm
Age: 25
Location: Hampshire, England
Contact:

#2

Post by Restless Rancor » October 16th, 2018, 8:36 pm

16/10/2018 21:36 UTC+1, version 1.0.1:
  • [UPDATE] phpBB template syntax replaced with twig template syntax in example usage.
These aren't the droids you're looking for.

Post Reply

Topic Subscribers

1 user subscribed to this topic: Restless Rancor