Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Forum message to guests?

Asked Modified Viewed 2,605 times
T
TwifanUK
T
  • Junior Member, joined since
  • Contributed 48 posts on the community forums.
  • Started 13 threads in the forums
  • Started this discussions
asked
Junior Member

Hi,

Is there a way of changing the message that appears when a guest clicks on the forums? At the moment it simply says "There are no Forums defined." which could lead people to think there are no forums created.

Ideally I'd like for a message along the lines of "You must register or log in to use the forums"

http://www.gigglesnort.net/forum/

Thanks,
Jo
0 replies

8 posts

A
arat
A
arat 10
  • Member, joined since
  • Contributed 79 posts on the community forums.
  • Started 21 threads in the forums
answered
Member

0 replies
T
TwifanUK
T
  • Junior Member, joined since
  • Contributed 48 posts on the community forums.
  • Started 13 threads in the forums
  • Started this discussions
answered
Junior Member

Thanks, that looks perfect. Only problem is with installing it now.

I uploaded it to /infusions, but the readme is very vague and I don't know what it's referring to. What file and where do I put that snippet of code?

Restrict access.
PHPFusion: V7
Author(s): Domi & fetloser
Web: http://www.venue.nu


//add this under include ../../maincore.php etc.

if(!iMEMBER){redirect("".INFUSIONS."restricted/index.php"); exit;}

Grats your done! ;)

0 replies
A
arat
A
arat 10
  • Member, joined since
  • Contributed 79 posts on the community forums.
  • Started 21 threads in the forums
answered
Member

Quote

TwifanUK wrote:
Thanks, that looks perfect. Only problem is with installing it now.

I uploaded it to /infusions, but the readme is very vague and I don't know what it's referring to. What file and where do I put that snippet of code?


Just add this line to each page you want the message to appear on. (i.e. forum/index.php)

if(!iMEMBER){redirect("".INFUSIONS."restricted/index.php"); exit;}


BACKUP YOUR FILES FIRST :-)
0 replies
T
TwifanUK
T
  • Junior Member, joined since
  • Contributed 48 posts on the community forums.
  • Started 13 threads in the forums
  • Started this discussions
answered
Junior Member

I added that snippet to forums/index.php but now it redirects to http://www.gigglesnort.net/infusions/restricted/index.php and I have loads of errors? Have I done it wrong?

I just uploaded the 'restricted' folder to infusions.

This is my forums/index.php (from the main /forums and not the themes/.../forum/index.php)

<?php
/*-------------------------------------------------------+
| PHPFusion Content Management System
| Copyright (C) 2002 - 2010 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: index.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "../maincore.php";
require_once THEMES."templates/header.php";
include LOCALE.LOCALESET."forum/main.php";

if (!isset($lastvisited) || !isnum($lastvisited)) { $lastvisited = time(); }

if(!iMEMBER){redirect("".INFUSIONS."restricted/index.php"); exit;}

add_to_title($locale['global_200'].$locale['400']);

opentable($locale['400']);
echo "<!--pre_forum_idx--><table cellpadding='0' cellspacing='1' width='100%' class='tbl-border forum_idx_table'>\n";

$forum_list = ""; $current_cat = "";
$result = dbquery(
   "SELECT f.*, f2.forum_name AS forum_cat_name, u.user_id, u.user_name, u.user_status
   FROM ".DB_FORUMS." f
   LEFT JOIN ".DB_FORUMS." f2 ON f.forum_cat = f2.forum_id
   LEFT JOIN ".DB_USERS." u ON f.forum_lastuser = u.user_id
   WHERE (".groupaccess('f.forum_access')." OR ".groupaccess('f.forum_moderators').") AND f.forum_cat!='0'
   GROUP BY forum_id ORDER BY f2.forum_order ASC, f.forum_order ASC"
);
if (dbrows($result) != 0) {
   while ($data = dbarray($result)) {
      if ($data['forum_cat_name'] != $current_cat) {
         $current_cat = $data['forum_cat_name'];
         echo "<tr>\n<td colspan='2' class='forum-caption forum_cat_name'><!--forum_cat_name-->".$data['forum_cat_name']."</td>\n";
         echo "<td align='center' width='1%' class='forum-caption' style='white-space:nowrap'>".$locale['402']."</td>\n";
         echo "<td align='center' width='1%' class='forum-caption' style='white-space:nowrap'>".$locale['403']."</td>\n";
         echo "<td width='1%' class='forum-caption' style='white-space:nowrap'>".$locale['404']."</td>\n";
         echo "</tr>\n";
      }
      $moderators = "";
      if ($data['forum_moderators']) {
         $mod_groups = explode(".", $data['forum_moderators']);
         foreach ($mod_groups as $mod_group) {
            if ($moderators) $moderators .= ", ";
            $moderators .= $mod_group<101 ? "<a href='".BASEDIR."profile.php?group_id=".$mod_group."'>".getgroupname($mod_group)."</a>" : getgroupname($mod_group);
         }
      }
      $forum_match = "\|".$data['forum_lastpost']."\|".$data['forum_id'];
      if ($data['forum_lastpost'] > $lastvisited) {
         if (iMEMBER && ($data['forum_lastuser'] == $userdata['user_id'] || preg_match("({$forum_match}\.|{$forum_match}$)", $userdata['user_threads']))) {
            $fim = "<img src='".get_image("folder")."' alt='".$locale['561']."' />";
         } else {
            $fim = "<img src='".get_image("foldernew")."' alt='".$locale['560']."' />";
         }
      } else {
         $fim = "<img src='".get_image("folder")."' alt='".$locale['561']."' />";
      }
      echo "<tr>\n";
      echo "<td align='center' width='1%' class='tbl2' style='white-space:nowrap'>$fim</td>\n";
      echo "<td class='tbl1 forum_name'><!--forum_name--><a href='viewforum.php?forum_id=".$data['forum_id']."'>".$data['forum_name']."</a><br />\n";
      if ($data['forum_description'] || $moderators) {
         echo "<span class='small'>".$data['forum_description'].($data['forum_description'] && $moderators ? "<br />\n" : "");
         echo ($moderators ? "<strong>".$locale['411']."</strong>".$moderators."</span>\n" : "</span>\n")."\n";
      }
      echo "</td>\n";
      echo "<td align='center' width='1%' class='tbl2' style='white-space:nowrap'>".$data['forum_threadcount']."</td>\n";
      echo "<td align='center' width='1%' class='tbl1' style='white-space:nowrap'>".$data['forum_postcount']."</td>\n";
      echo "<td width='1%' class='tbl2' style='white-space:nowrap'>";
      if ($data['forum_lastpost'] == 0) {
         echo $locale['405']."</td>\n</tr>\n";
      } else {
         echo showdate("forumdate", $data['forum_lastpost'])."<br />\n";
         echo "<span class='small'>".$locale['406'].profile_link($data['forum_lastuser'], $data['user_name'], $data['user_status'])."</span></td>\n";
         echo "</tr>\n";
      }
   }
} else {
   echo "<tr>\n<td colspan='5' class='tbl1'>".$locale['407']."</td>\n</tr>\n";
}
echo "</table><!--sub_forum_idx_table-->\n<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>\n";
echo "<td class='forum'><br />\n";
echo "<img src='".get_image("foldernew")."' alt='".$locale['560']."' style='vertical-align:middle;' /> - ".$locale['409']."<br />\n";
echo "<img src='".get_image("folder")."' alt='".$locale['561']."' style='vertical-align:middle;' /> - ".$locale['410']."\n";
echo "</td><td align='right' valign='bottom' class='forum'>\n";
echo "<form name='searchform' method='get' action='".BASEDIR."search.php?stype=forums'>\n";
echo "<input type='hidden' name='stype' value='forums' />\n";
echo "<input type='text' name='stext' class='textbox' style='width:150px' />\n";
echo "<input type='submit' name='search' value='".$locale['550']."' class='button' />\n";
echo "</form>\n</td>\n</tr>\n</table><!--sub_forum_idx-->\n";
closetable();

require_once THEMES."templates/footer.php";
?>
0 replies
A
arat
A
arat 10
  • Member, joined since
  • Contributed 79 posts on the community forums.
  • Started 21 threads in the forums
answered
Member

Looks like you added it in the wrong place. Try this for 7.01.05

<?php
/*-------------------------------------------------------+
| PHPFusion Content Management System
| Copyright (C) 2002 - 2011 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: index.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "../maincore.php";
require_once THEMES."templates/header.php";
include LOCALE.LOCALESET."forum/main.php";
if(!iMEMBER){redirect("".INFUSIONS."restricted/index.php"); exit;}

if (!isset($lastvisited) || !isnum($lastvisited)) { $lastvisited = time(); }

add_to_title($locale['global_200'].$locale['400']);

opentable($locale['400']);
echo "<!--pre_forum_idx--><table cellpadding='0' cellspacing='1' width='100%' class='tbl-border forum_idx_table'>\n";

$forum_list = ""; $current_cat = "";
$result = dbquery(
   "SELECT f.*, f2.forum_name AS forum_cat_name, u.user_id, u.user_name, u.user_status
   FROM ".DB_FORUMS." f
   LEFT JOIN ".DB_FORUMS." f2 ON f.forum_cat = f2.forum_id
   LEFT JOIN ".DB_USERS." u ON f.forum_lastuser = u.user_id
   WHERE (".groupaccess('f.forum_access')." OR ".groupaccess('f.forum_moderators').") AND f.forum_cat!='0'
   GROUP BY forum_id ORDER BY f2.forum_order ASC, f.forum_order ASC"
);
if (dbrows($result) != 0) {
   while ($data = dbarray($result)) {
      if ($data['forum_cat_name'] != $current_cat) {
         $current_cat = $data['forum_cat_name'];
         echo "<tr>\n<td colspan='2' class='forum-caption forum_cat_name'><!--forum_cat_name-->".$data['forum_cat_name']."</td>\n";
         echo "<td align='center' width='1%' class='forum-caption' style='white-space:nowrap'>".$locale['402']."</td>\n";
         echo "<td align='center' width='1%' class='forum-caption' style='white-space:nowrap'>".$locale['403']."</td>\n";
         echo "<td width='1%' class='forum-caption' style='white-space:nowrap'>".$locale['404']."</td>\n";
         echo "</tr>\n";
      }
      $moderators = "";
      if ($data['forum_moderators']) {
         $mod_groups = explode(".", $data['forum_moderators']);
         foreach ($mod_groups as $mod_group) {
            if ($moderators) $moderators .= ", ";
            $moderators .= $mod_group<101 ? "<a href='".BASEDIR."profile.php?group_id=".$mod_group."'>".getgroupname($mod_group)."</a>" : getgroupname($mod_group);
         }
      }
      $forum_match = "\|".$data['forum_lastpost']."\|".$data['forum_id'];
      if ($data['forum_lastpost'] > $lastvisited) {
         if (iMEMBER && ($data['forum_lastuser'] == $userdata['user_id'] || preg_match("({$forum_match}\.|{$forum_match}$)", $userdata['user_threads']))) {
            $fim = "<img src='".get_image("folder")."' alt='".$locale['561']."' />";
         } else {
            $fim = "<img src='".get_image("foldernew")."' alt='".$locale['560']."' />";
         }
      } else {
         $fim = "<img src='".get_image("folder")."' alt='".$locale['561']."' />";
      }
      echo "<tr>\n";
      echo "<td align='center' width='1%' class='tbl2' style='white-space:nowrap'>$fim</td>\n";
      echo "<td class='tbl1 forum_name'><!--forum_name--><a href='viewforum.php?forum_id=".$data['forum_id']."'>".$data['forum_name']."</a><br />\n";
      if ($data['forum_description'] || $moderators) {
         echo "<span class='small'>".$data['forum_description'].($data['forum_description'] && $moderators ? "<br />\n" : "");
         echo ($moderators ? "<strong>".$locale['411']."</strong>".$moderators."</span>\n" : "</span>\n")."\n";
      }
      echo "</td>\n";
      echo "<td align='center' width='1%' class='tbl2' style='white-space:nowrap'>".$data['forum_threadcount']."</td>\n";
      echo "<td align='center' width='1%' class='tbl1' style='white-space:nowrap'>".$data['forum_postcount']."</td>\n";
      echo "<td width='1%' class='tbl2' style='white-space:nowrap'>";
      if ($data['forum_lastpost'] == 0) {
         echo $locale['405']."</td>\n</tr>\n";
      } else {
         echo showdate("forumdate", $data['forum_lastpost'])."<br />\n";
         echo "<span class='small'>".$locale['406'].profile_link($data['forum_lastuser'], $data['user_name'], $data['user_status'])."</span></td>\n";
         echo "</tr>\n";
      }
   }
} else {
   echo "<tr>\n<td colspan='5' class='tbl1'>".$locale['407']."</td>\n</tr>\n";
}
echo "</table><!--sub_forum_idx_table-->\n<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>\n";
echo "<td class='forum'><br />\n";
echo "<img src='".get_image("foldernew")."' alt='".$locale['560']."' style='vertical-align:middle;' /> - ".$locale['409']."<br />\n";
echo "<img src='".get_image("folder")."' alt='".$locale['561']."' style='vertical-align:middle;' /> - ".$locale['410']."\n";
echo "</td><td align='right' valign='bottom' class='forum'>\n";
echo "<form name='searchform' method='get' action='".BASEDIR."search.php?stype=forums'>\n";
echo "<input type='hidden' name='stype' value='forums' />\n";
echo "<input type='text' name='stext' class='textbox' style='width:150px' />\n";
echo "<input type='submit' name='search' value='".$locale['550']."' class='button' />\n";
echo "</form>\n</td>\n</tr>\n</table><!--sub_forum_idx-->\n";
closetable();

require_once THEMES."templates/footer.php";
?>
0 replies
T
TwifanUK
T
  • Junior Member, joined since
  • Contributed 48 posts on the community forums.
  • Started 13 threads in the forums
  • Started this discussions
answered
Junior Member

@arat: I copy/pasted that code into the forums/index.php but still get errors on http://www.gigglesnort.net/infusions/restricted/index.php

My ../../infusions/restricted/locale/English.php:
<?php
$locale['res_01'] = "Access Denied!";
$locale['res_02'] = "<b>Only registred members are allowed to use this function.<br />If you are already registered, please log in. <br /><br /> Please select one of the following:</b>";
$locale['res_03'] = "Register";
$locale['res_04'] = "Lost my password";
$locale['res_05'] = "Login";
?>


My /infusions/restricted/index.php:

<?php
/*-------------------------------------------------------+
| PHPFusion Content Management System
| Copyright © 2002 - 2008 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: index.php
| Version: 2.0
| Author: Domi
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "../../maincore.php";
require_once THEMES."templates/header.php";


if (file_exists(INFUSIONS."restricted/locale/".$settings['locale'].".php")) {
   include INFUSIONS."restricted/locale/".$settings['locale'].".php";
} else {
   include INFUSIONS."restricted/locale/English.php";
}

   opentable($locale['res_01']." <a href='http://earnit.se' title='EarnIT' target='_blank'>&copy;</a>");
   echo "<br /><center><img src='".INFUSIONS."restricted/restricted.gif' alt='".$locale['res_01']."'><br /><br />".$locale['res_02']."
   <br /><br /><img src='".THEME."images/bullet.gif'><a href='".BASEDIR."register.php'> ".$locale['res_03']." </a><img src='".THEME."images/bulletb.gif'><br /><img src='".THEME."images/bullet.gif'><a href='".BASEDIR."lostpassword.php'> ".$locale['res_04']." </a><img src='".THEME."images/bulletb.gif'><br /><img src='".THEME."images/bullet.gif'><a href='".BASEDIR."login.php'> ".$locale['res_05']." </a><img src='".THEME."images/bulletb.gif'><br /><br /></center>";
   closetable();

require_once THEMES."templates/footer.php";
?>


If this doesn't work, is there an easier way to just change the text on the forums for guests telling them to register/log in to view instead of saying 'no forums defined'?
0 replies
A
arat
A
arat 10
  • Member, joined since
  • Contributed 79 posts on the community forums.
  • Started 21 threads in the forums
answered
Member

SOLVED... just in case anyone else has the problem.

Change the locale file from english.php to English.php (case sensitive)
0 replies
T
TwifanUK
T
  • Junior Member, joined since
  • Contributed 48 posts on the community forums.
  • Started 13 threads in the forums
  • Started this discussions
answered
Junior Member

Thanks @arat for your help. It's now sorted. :)

If anyone else has this issue, it was sorted by renaming locales/english.php to locales/English.php as I'm on a Unix server.

[edit] Wasn't quick enough posting! ^^What he said :)
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 8 posts
  • Votes 0 votes
  • Topic users 2 members

2 participants

A
A
arat 10
  • Member, joined since
  • Contributed 79 posts on the community forums.
  • Started 21 threads in the forums
T
T
  • Junior Member, joined since
  • Contributed 48 posts on the community forums.
  • Started 13 threads in the forums
  • Started this discussions

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet