PDA

View Full Version : Post Timestamp Visibility


Prisoner
10-28-2011, 12:42 PM
Is there any mod that would allow only admins or select groups to see the timestamp of a message?

Lynne
10-28-2011, 03:14 PM
I've never heard of one. I would imagine you could just put a condition around the timestamp in the postbit. Or write a plugin to do the same thing (with no template edit)

hook location - postbit_display_complete
if (!is_member_of($vbulletin->userinfo,6))
{
$post['posttime'] = ' ';
$post['postdate'] = ' ';
}
Modify to suite your needs.

Prisoner
10-28-2011, 04:06 PM
Thank you, I will try it.

--------------- Added 1319899447 at 1319899447 ---------------

I'm sorry, I looked for the lines above, posttime and postdate, but couldn't find them. Are they in the postbit template.

Am I looking in the right place?

Prisoner
10-30-2011, 11:07 AM
I found it, applied it by creating the plugin, but the time and date wasn't visible for anyone.

BirdOPrey5
10-30-2011, 11:19 AM
It works for me, what was the exact code you used?

Prisoner
10-30-2011, 11:41 AM
Exactly as she had in the example, tried it with '6' and '22' my webmaster usergroup.

if (!is_member_of($vbulletin->userinfo,22))
{
$post['posttime'] = ' ';
$post['postdate'] = ' ';
}

BirdOPrey5
10-30-2011, 11:44 AM
6 is the admin usergroup- usually. As it was written ONLY users in group 6 should see the date.

Prisoner
10-30-2011, 12:12 PM
Maybe it's because I use two groups, Administrators and Webmaster. Will try it in a few.

BirdOPrey5
10-30-2011, 01:35 PM
This would be the line for both groups:

if (!is_member_of($vbulletin->userinfo, 6, 22))

Prisoner
10-30-2011, 03:27 PM
Still the same, no matter which group I put in there, it disappears for everyone.

When I make the plugin inactive, it comes back. When I take the Date line out of it, just the date shows.

I must be missing something.

Sorry to be such a bother.

BirdOPrey5
10-30-2011, 03:57 PM
What this does is not show the timestamp if anyone is logged in is NOT an administrator.

Perhaps you are trying to hide the date on posts that were not made by an administrator for everyone? (Different logic?)

If so that code would be:


if (!is_member_of($post, 6,22))
{
$post['posttime'] = ' ';
$post['postdate'] = ' ';
}

BirdOPrey5
10-30-2011, 04:02 PM
Also this only works on posts on showthread.php - it does not hide the date/time on "Last Post" on other pages.

Prisoner
10-30-2011, 04:21 PM
That shows the date and time of my posts and everybody can see it.

I just want to make it so that only Admins can see the date and time.

--------------- Added 1319991928 at 1319991928 ---------------

Also this only works on posts on showthread.php - it does not hide the date/time on "Last Post" on other pages.
Yes, I will try to find the hook for those once I get this working.

BirdOPrey5
10-30-2011, 04:42 PM
If this isn't working like that all I can think is maybe another mod is interfering. Try disabling any other mods you may use.

Prisoner
10-30-2011, 05:31 PM
Thanks for all your help. I will set up a test forum and try it.

Prisoner
10-30-2011, 07:16 PM
Same result with a fresh install. Here's a screen shot of the plugin I created. Maybe that is where the problem is. This is the first time I have tried to do this, so I am learning as I go.

BirdOPrey5
10-30-2011, 07:20 PM
That is correct... does your forum use some sort of page caching?

Prisoner
10-30-2011, 07:42 PM
No, I don't think so. Before I install it, the date shows, when I install it, it doesn't, then when I disable it, the date shows again. Tried it in both Internet Explorer and Firefox.

BirdOPrey5
10-30-2011, 07:55 PM
Since you got a test site, if you want PM me login info and I'll see if I can figure it out.

Prisoner
10-30-2011, 08:33 PM
Thanks!

BirdOPrey5
10-30-2011, 09:32 PM
Thanks!

We forgot 1 important line in the code-


global $vbulletin;

if (!is_member_of($vbulletin->userinfo, 6))
{
$post['posttime'] = ' ';
$post['postdate'] = ' ';
}


Working now. :)

Prisoner
10-30-2011, 09:51 PM
Thanks for hanging in there with me all day! It looks like it's working.

Prisoner
11-01-2011, 07:41 PM
I hate to ask for more help but, what are the hooks for the time display on the ForumHome and Thread Display?

BirdOPrey5
11-01-2011, 08:27 PM
Probably forumhome_complete and threadbit_process...

However you also need to change the variable, $post only works in postbit.

For forumhome it looks like:

$lastpostinfo['lastpostdate']

and for threadbit it looks like:

$thread['lastpostdate']

The way I did this by the way for future reference was to go to Admin CP -> Options -> General Settings -> Add Template Name in HTML Comments -> set to YES

Then load the pages you are curios about- in the source of the page will be comments saying what template the data is coming from.

Then I look in that template and see the variables being used where I want-

Template variables either look like {vb: raw thread.lastpostdate} or $thread['lastpostdate'] depending how they are used... but in plugins and php files they are ALWAYS the latter.

Prisoner
11-02-2011, 01:28 PM
Thanks, I am trying to figure it out now.

Prisoner
11-04-2011, 04:33 AM
I have it working in threadbit_process. I just had to change the variable to ['lastposttime'] in order to remove the time.

Just not able to find it in Forumhome.

BirdOPrey5
11-04-2011, 12:56 PM
What code do you have for the forumhome_complete plugin?

Prisoner
11-04-2011, 01:23 PM
This is one of many that I have tried.

global $vbulletin;

if (!is_member_of($vbulletin->userinfo, 6))
{
$lastpostinfo['lastpostdate'] = ' ';
}

--------------- Added 1320428735 at 1320428735 ---------------

Haha! I'm learning...or lucky. It olny took me three tries to get it off the Search Results Page with.

search_results_threadbit

global $vbulletin;

if (!is_member_of($vbulletin->userinfo, 6))
{
$thread['lastposttime'] = ' ';
}

BirdOPrey5
11-04-2011, 10:54 PM
Been looking at forumhome... seems to be a very unusual situation here. First the actual hook would have been forumbit_display, not forumhome_complete. But even that doesn't work. There is no hook to let us alter the date/time on this page.

Instead you will need to edit the template directly.

In your style manger choose your style -> edit templates

Find the template: forumhome_lastpostby

Find the code:

<div align="$stylevar[right]" style="white-space:nowrap">
$lastpostinfo[lastpostdate] <if condition="!$show['detailedtime']"><span class="time">$lastpostinfo[lastposttime]</span></if>
<a href="showthread.php?$session[sessionurl]p=$lastpostinfo[lastpostid]#post$lastpostinfo[lastpostid]"><img class="inlineimg" src="$stylevar[imgdir_button]/lastpost.gif" alt="$vbphrase[go_to_last_post]" border="0" /></a>
</div>


and change it to:


<div align="$stylevar[right]" style="white-space:nowrap">
<if condition="is_member_of($bbuserinfo, 6, 22)">$lastpostinfo[lastpostdate] <if condition="!$show['detailedtime']"><span class="time">$lastpostinfo[lastposttime]</span></if></if>
<a href="showthread.php?$session[sessionurl]p=$lastpostinfo[lastpostid]#post$lastpostinfo[lastpostid]"><img class="inlineimg" src="$stylevar[imgdir_button]/lastpost.gif" alt="$vbphrase[go_to_last_post]" border="0" /></a>
</div>


(added code in red)

Prisoner
11-05-2011, 03:00 AM
Thanks again, I'll give it a try.