Welcome to Geeklog, Anonymous Sunday, October 06 2024 @ 09:24 am EDT

Geeklog Forums

Members View Real-Time Postings, Guests Only View Old Postings...


TBG

Anonymous
Hello,

Members of the site will be able to view real-time stories as
they are posted and guests will only be able to view 7 day old data, stories. Do you know of a plugin that will do this or do you know of an easy way to adjust the PHP code to make this happen? Thanks.
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
I'm not aware of a plugin or hack that does this, but it shouldn't be too hard to tweak index.php to make it do that.

bye, Dirk
 Quote

TBG

Anonymous
I added this to my index.php and now that functionality is working. Let me know of any comments or feedback. Thank you.

// These statements below allows only members of the site to view the stories as
// they are posted. Guest view stories that have been posted x days ago (in this
// case it's 7 days).

if ($_USER['uid']>1) {
$sql = "FROM {$_TABLES['stories']} WHERE (date } else {
$sql = "FROM {$_TABLES['stories']} WHERE (date }
 Quote

TBG

Anonymous
Sorry, here is the full code:

// These statements below allows only members of the site to view the stories as
// they are posted. Guest view stories that have been posted x days ago (in this
// case it's 7 days).

if ($_USER['uid']>1) {
$sql = "FROM {$_TABLES['stories']} WHERE (date } else {
$sql = "FROM {$_TABLES['stories']} WHERE (date }
 Quote

TBG

Anonymous
Last time: here it is, sorry. I needed to post in Text Mode.

// These statements below allows only members of the site to view the stories as
// they are posted. Guest view stories that have been posted x days ago (in this
// case it's 7 days).

if ($_USER['uid']>1) {
$sql = "FROM {$_TABLES['stories']} WHERE (date <= NOW()) AND (draft_flag = 0)";
} else {
$sql = "FROM {$_TABLES['stories']} WHERE (date <= DATE_SUB(NOW(),INTERVAL 7 DAY)) AND (draft_flag = 0)";
}
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Quote by TBG: Last time: here it is, sorry. I needed to post in Text Mode.

Hint: If you had registered as a user with this site, you could have edited your posts ... Wink

bye, Dirk
 Quote

All times are EDT. The time is now 09:24 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content