No Post ("0 Post") Users Message

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Post Reply
User avatar
Exclusive
Registered User
Posts: 205
Joined: Mon Jun 25, 2018 1:33 pm
Contact:

No Post ("0 Post") Users Message

Post by Exclusive » Tue Jul 17, 2018 9:42 am

Hello, Just like I have added a Guest Welcome Message, How do I add a welcome message to users/members with "0" post on my board. I mean this message should only be shown to logged in members with no post.

See image below:
no post users message.png
no post users message.png (6.99 KiB) Viewed 447 times
Sample (Is there anything like):

Code: Select all

<!-- IF S_USER_LOGGED_IN and S_USER (has no post script/users post-record)-->
Hello {USERNAME},
Our records indicate that you have never posted to our forum! Why not make your first post today and become an active part of the GSM-Tutors Forum now! 
<!-- ENDIF -->
??
Use Search Button to get Instant Results | Follow Forum Rules
Avoid Spams in the forum to prevent banning the offending account. | Visit My Website!

User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 2812
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.
Contact:

Re: No Post ("0 Post") Users Message

Post by thecoalman » Tue Jul 17, 2018 10:30 am

If you look in includes/functions.php at the end there is big array of common template variables that are avaiable in any template. You will also find these arrays at the bottom of individual scripts like viewtopic and viewforum. The template variables with S_ are commonly used as switches.

Around line 4375 you'll find:

Code: Select all

		'S_USER_NEW'					=> $user->data['user_new'],
After that add:

Code: Select all

		'S_NEW_USER_MESSAGE'				=> ($user->data['user_posts'] == 0) ? true : false,
In your template:

Code: Select all

<!-- IF S_USER_LOGGED_IN and S_NEW_USER_MESSAGE -->
//HTML to pe parsed for users with 0 post count
<!-- ENDIF -->
This is untested but should work.

User avatar
Exclusive
Registered User
Posts: 205
Joined: Mon Jun 25, 2018 1:33 pm
Contact:

Re: No Post ("0 Post") Users Message

Post by Exclusive » Tue Jul 17, 2018 11:29 am

Lemme try this, I will give you feedback!
Last edited by Mick on Tue Jul 17, 2018 12:26 pm, edited 1 time in total.
Reason: Removed unnecessary quoting.
Use Search Button to get Instant Results | Follow Forum Rules
Avoid Spams in the forum to prevent banning the offending account. | Visit My Website!

User avatar
Exclusive
Registered User
Posts: 205
Joined: Mon Jun 25, 2018 1:33 pm
Contact:

Re: No Post ("0 Post") Users Message

Post by Exclusive » Tue Jul 17, 2018 11:40 am

I tried that now and it's working perfectly. But there is a little challenge
1. It doesn't show the Username of the logged-in member
Use Search Button to get Instant Results | Follow Forum Rules
Avoid Spams in the forum to prevent banning the offending account. | Visit My Website!

User avatar
Exclusive
Registered User
Posts: 205
Joined: Mon Jun 25, 2018 1:33 pm
Contact:

Re: No Post ("0 Post") Users Message

Post by Exclusive » Tue Jul 17, 2018 12:21 pm

Thanks a lot man! I've done it by adding the below code:

Code: Select all

{CURRENT_USERNAME_SIMPLE}
Last edited by Exclusive on Thu Aug 02, 2018 1:43 pm, edited 1 time in total.
Use Search Button to get Instant Results | Follow Forum Rules
Avoid Spams in the forum to prevent banning the offending account. | Visit My Website!

User avatar
Mick
Support Team Member
Support Team Member
Posts: 20364
Joined: Fri Aug 29, 2008 9:49 am
Location: Cardiff

Re: No Post ("0 Post") Users Message

Post by Mick » Tue Jul 17, 2018 12:27 pm

If you’ve got zero post members who have registered, gone away and never returned they’re probably spam anyway.

Please keep in mind that we have a six hour bumping rule. All team members and community members here are volunteers, so we ask you to wait at least six hours before bumping your topic or, if no-one has replied to your last post, edit your last post. Thanks!
"The more connected we get the more alone we become" - Kyle Broflovski

There are no ‘threads’ in phpBB, they are topics.

User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 2812
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.
Contact:

Re: No Post ("0 Post") Users Message

Post by thecoalman » Tue Jul 17, 2018 12:42 pm

Little bit of a tip here, if you are going to be editing core files you should keep a list of the files you edited and comment your edits. Instead of this:

Code: Select all

		'S_NEW_USER_MESSAGE'				=> ($user->data['user_posts'] == 0) ? true : false,
Use this:

Code: Select all

		
		//My Mod - Added for user message
		'S_NEW_USER_MESSAGE'				=> ($user->data['user_posts'] == 0) ? true : false,
		

In templates you make comments like this:

Code: Select all

<!-- IF 0 -->My Mod - Put you comment text here<!-- ENDIF -->
<!-- IF S_USER_LOGGED_IN and S_NEW_USER_MESSAGE -->
//HTML to pe parsed for users with 0 post count
<!-- ENDIF -->
When there is new release phpBB has a changed files package that just includes files that have changed since last release.

https://www.phpbb.com/downloads/#changedfiles

Compare your list to the changed files, if any files you have edited exist in the changed files package you will need to merge your edits into the new files. You can use a tool like Winmerge or there is file comparison tool in Notepad++ that will allow you to compare the files. When you are making the file comparison as lng as you have commented everything you'l know exactly what you have edited in and why.

Post Reply

Return to “phpBB Custom Coding”

Who is online

Users browsing this forum: Lumpy Burgertushie and 13 guests