View Full Version : Contents of New Post or New Thread to be displayed only if user is an Admin
ExcelFox
09-16-2011, 07:04 PM
Hi,
Could anybody help me with a code snippet that will only show the content of the new post/thread if the user is an Admin/Mod. For all other users, the new post/thread mail should only contain the URL to the new post/thread.
Regards,
ExcelFox
Lynne
09-16-2011, 10:23 PM
Why not just use the Forum Permissions to make it so other usergroups cannot read the threads in that forum?
ExcelFox
09-17-2011, 02:51 AM
Lynne, thanks for reverting. I should have clarified my OP.
What I was looking for, is to have the new post email when there is a new post notification for a subscribed thread, to contain only the text that there is a new post, and that ..... is the url. And only if it is an admin/mod, send the content of the post as well.
Like
if usergroupid=1 { (send entire content of new post)
else
(send only the notification, along with the URL)}
Lynne
09-17-2011, 03:17 AM
You will need to look at the file includes/functions_digest.php . Do a search for "pagetext" in that file and you'll see where it is defined. There is a hook just under there, digest_thread_post, where you may edit that variable before the phrase digestpostbit is used to create the message.
ExcelFox
09-17-2011, 01:10 PM
Thanks Lynne. I wasn't able to decipher the code, so I modified the notify phrase, and added the following line
if ($touser[username] = 'Admin ABC' OR $touser[username] = 'Mod DEF')
{
Here is the message that has just been posted:
***************
$pagetext
***************
}
and it worked.
Wasn't sure if $touser[usergroupid] = 6 would work, so didn't use that.
Having said that, if one were to know the ERD of the database, it would have been a bit more easier for a lot of people. Any idea where I could get that Lynne?
Lynne
09-17-2011, 03:43 PM
We do not have an ERD posted anywhere of the database. (Don't know why, as it would have helped when I was just starting to code!).
You could probably try:
if (is_member_of($touser,6))Not sure if that would work, but if you have a test site then you can test it out.
edit: You said you modified the phrase and added that in? Hmmm, I would not have thought that php would work in it. :/
Any idea why VB would not add this as an option to send the text of the message in the email or not?
I still have users answering emails for posts or PM's and it is such a waste. I would simply like to notify them that they have a PM or someone has replied to a thread they have subscribed to; without the text of the PM message or the reply. Sure makes sense to me.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.