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?

Help with php code

Asked Modified Viewed 1,950 times
J
jannik
J
jannik 10
  • Member, joined since
  • Contributed 80 posts on the community forums.
  • Started 26 threads in the forums
  • Started this discussions
asked
Member

Hi all how do I change this code from admin/members.php


echo "<a href='".FUSION_SELF.$aidlink."&amp;".$list_link."&amp;status=0'>".$locale['417']."</a> ::\n";


so it only shows poeple from usergroup 1 ??
0 replies

5 posts

J
jannik
J
jannik 10
  • Member, joined since
  • Contributed 80 posts on the community forums.
  • Started 26 threads in the forums
  • Started this discussions
answered
Member

Okay.... tell me if it not in here...

   global $locale;
      global $aidlink;
      $a_pm = "&amp;area=pm&amp;step="; $a_PM = "&area=pm";
      $a_pe = "&amp;area=pe&amp;step="; $a_PE = "&area=pe";
      $a_db = "&amp;area=db&amp;step="; $a_DB = "&area=db";
      $a_inv = "&amp;area=inv&amp;step=edit"; $a_INV = "&area=inv";
      $attention = 0;
   $result = dbquery("SELECT * FROM ".DB_USERS." WHERE".$user_name." user_status='".$_GET['status']."'AND user_level<'104'");
   $rows = dbrows($result);
   if (!isset($_GET['rowstart']) || !isnum($_GET['rowstart'])) $_GET['rowstart'] = 0;
   $result = dbquery("SELECT * FROM ".DB_USERS." WHERE".$user_name." user_status='".$_GET['status']."'AND user_level<'104' ORDER BY user_status DESC, user_name");
   echo "<div style='text-align:center;margin-bottom:10px;'>\n";
   echo "<a href='".FUSION_SELF.$aidlink."&amp;".$list_link."&amp;status=0'>".$locale['417']."</a> ::\n";
   echo "<a href='".FUSION_SELF.$aidlink."&amp;".$list_link."&amp;status=2'>".$locale['418']."</a> ::\n";
   echo "<a href='".FUSION_SELF.$aidlink."&amp;".$list_link."&amp;status=1'>".$locale['419']."</a> ::\n";
   echo "<a href='".FUSION_SELF.$aidlink."&amp;step=add'>".$locale['402']."</a>\n";
   echo "</div>\n";
   if ($rows) {
      $i = 0;
0 replies
F
fanggaming
F
  • Junior Member, joined since
  • Contributed 43 posts on the community forums.
  • Started 3 threads in the forums
answered
Junior Member

This works but I should mention its possible it will return too many pages in the makepagenav section. but it should never show users outside of group 1.
replace this :


$result = dbquery("SELECT * FROM ".DB_USERS." WHERE".$user_name." user_status='".$_GET['status']."'AND user_level<'102'");
$rows = dbrows($result);
if (!isset($_GET['rowstart']) || !isnum($_GET['rowstart'])) $_GET['rowstart'] = 0;
$result = dbquery("SELECT * FROM ".DB_USERS." WHERE".$user_name." user_status='".$_GET['status']."'AND user_level<'102' ORDER BY user_status DESC, user_level DESC, user_name LIMIT ".$_GET['rowstart'].",20");
echo "<div style='text-align:center;margin-bottom:10px;'>\n";
echo "<a href='".FUSION_SELF.$aidlink."&amp;".$list_link."&amp;status=0'>".$locale['417']."</a> ::\n";
echo "<a href='".FUSION_SELF.$aidlink."&amp;".$list_link."&amp;status=2'>".$locale['418']."</a> ::\n";
echo "<a href='".FUSION_SELF.$aidlink."&amp;".$list_link."&amp;status=1'>".$locale['419']."</a> ::\n";
echo "<a href='".FUSION_SELF.$aidlink."&amp;step=add'>".$locale['402']."</a>\n";
echo "</div>\n";
if ($rows) {
$i = 0;
echo "<table cellpadding='0' cellspacing='1' width='450' class='tbl-border center'>\n<tr>\n";
echo "<td class='tbl2'><strong>".$locale['401']."</strong></td>\n";
echo "<td align='center' width='1%' class='tbl2' style='white-space:nowrap'><strong>".$locale['403']."</strong></td>\n";
echo "<td align='center' width='1%' class='tbl2' style='white-space:nowrap'><strong>".$locale['404']."</strong></td>\n";
echo "</tr>\n";
while ($data = dbarray($result)) {
$cell_color = ($i % 2 == 0 ? "tbl1" : "tbl2");
echo "<tr>\n<td class='$cell_color'><a href='".FUSION_SELF.$aidlink."&amp;step=view&amp;user_id=".$data['user_id']."'>".$data['user_name']."</a></td>\n";
echo "<td align='center' width='1%' class='$cell_color' style='white-space:nowrap'>".getuserlevel($data['user_level'])."</td>\n";
echo "<td align='center' width='1%' class='$cell_color' style='white-space:nowrap'>";
if ($data['user_level'] < 102) echo "<a href='".FUSION_SELF.$aidlink."&amp;step=edit&amp;user_id=".$data['user_id']."'>".$locale['406']."</a>\n";
if ($data['user_status'] == "2") {
echo "- <a href='".FUSION_SELF.$aidlink."&amp;step=activate&amp;".$list_link."&amp;status=".$_GET['status']."&amp;rowstart=".$_GET['rowstart']."&amp;user_id=".$data['user_id']."'>".$locale['407']."</a>\n";
} elseif ($data['user_status'] == "1") {
echo "- <a href='".FUSION_SELF.$aidlink."&amp;step=ban&amp;act=off&amp;".$list_link."&amp;status=".$_GET['status']."&amp;rowstart=".$_GET['rowstart']."&amp;user_id=".$data['user_id']."'>".$locale['408']."</a>\n";
} else {
if ($data['user_level'] < 102) echo "- <a href='".FUSION_SELF.$aidlink."&amp;step=ban&amp;act=on&amp;".$list_link."&amp;status=".$_GET['status']."&amp;rowstart=".$_GET['rowstart']."&amp;user_id=".$data['user_id']."'>".$locale['409']."</a>\n";
}
if ($data['user_level'] < 102) echo "- <a href='".FUSION_SELF.$aidlink."&amp;step=delete&amp;".$list_link."&amp;status=".$_GET['status']."&amp;rowstart=".$_GET['rowstart']."&amp;user_id=".$data['user_id']."' onclick='return DeleteMember();'>".$locale['410']."</a>";
echo "</td>\n</tr>\n"; $i++;
}
echo "</table>\n";
}



with this:

$result = dbquery("SELECT * FROM ".DB_USERS." WHERE".$user_name." user_status='".$_GET['status']."'AND user_level<'102' AND user_groups LIKE '%.1%'");
$rows = dbrows($result);
if (!isset($_GET['rowstart']) || !isnum($_GET['rowstart'])) $_GET['rowstart'] = 0;
$result = dbquery("SELECT * FROM ".DB_USERS." WHERE".$user_name." user_status='".$_GET['status']."'AND user_level<'102' AND user_groups LIKE '%.1%' ORDER BY user_status DESC, user_level DESC, user_name LIMIT ".$_GET['rowstart'].",20");
echo "<div style='text-align:center;margin-bottom:10px;'>\n";
echo "<a href='".FUSION_SELF.$aidlink."&amp;".$list_link."&amp;status=0'>".$locale['417']."</a> ::\n";
echo "<a href='".FUSION_SELF.$aidlink."&amp;".$list_link."&amp;status=2'>".$locale['418']."</a> ::\n";
echo "<a href='".FUSION_SELF.$aidlink."&amp;".$list_link."&amp;status=1'>".$locale['419']."</a> ::\n";
echo "<a href='".FUSION_SELF.$aidlink."&amp;step=add'>".$locale['402']."</a>\n";
echo "</div>\n";
if ($rows) {
$i = 0;
echo "<table cellpadding='0' cellspacing='1' width='450' class='tbl-border center'>\n<tr>\n";
echo "<td class='tbl2'><strong>".$locale['401']."</strong></td>\n";
echo "<td align='center' width='1%' class='tbl2' style='white-space:nowrap'><strong>".$locale['403']."</strong></td>\n";
echo "<td align='center' width='1%' class='tbl2' style='white-space:nowrap'><strong>".$locale['404']."</strong></td>\n";
echo "</tr>\n";
while ($data = dbarray($result)) {
$user_groups = explode(".", $data['user_groups']);
if (in_array("1", $user_groups, true)) {
$cell_color = ($i % 2 == 0 ? "tbl1" : "tbl2");
echo "<tr>\n<td class='$cell_color'><a href='".FUSION_SELF.$aidlink."&amp;step=view&amp;user_id=".$data['user_id']."'>".$data['user_name']."</a></td>\n";
echo "<td align='center' width='1%' class='$cell_color' style='white-space:nowrap'>".getuserlevel($data['user_level'])."</td>\n";
echo "<td align='center' width='1%' class='$cell_color' style='white-space:nowrap'>";
if ($data['user_level'] < 102) echo "<a href='".FUSION_SELF.$aidlink."&amp;step=edit&amp;user_id=".$data['user_id']."'>".$locale['406']."</a>\n";
if ($data['user_status'] == "2") {
echo "- <a href='".FUSION_SELF.$aidlink."&amp;step=activate&amp;".$list_link."&amp;status=".$_GET['status']."&amp;rowstart=".$_GET['rowstart']."&amp;user_id=".$data['user_id']."'>".$locale['407']."</a>\n";
} elseif ($data['user_status'] == "1") {
echo "- <a href='".FUSION_SELF.$aidlink."&amp;step=ban&amp;act=off&amp;".$list_link."&amp;status=".$_GET['status']."&amp;rowstart=".$_GET['rowstart']."&amp;user_id=".$data['user_id']."'>".$locale['408']."</a>\n";
} else {
if ($data['user_level'] < 102) echo "- <a href='".FUSION_SELF.$aidlink."&amp;step=ban&amp;act=on&amp;".$list_link."&amp;status=".$_GET['status']."&amp;rowstart=".$_GET['rowstart']."&amp;user_id=".$data['user_id']."'>".$locale['409']."</a>\n";
}
if ($data['user_level'] < 102) echo "- <a href='".FUSION_SELF.$aidlink."&amp;step=delete&amp;".$list_link."&amp;status=".$_GET['status']."&amp;rowstart=".$_GET['rowstart']."&amp;user_id=".$data['user_id']."' onclick='return DeleteMember();'>".$locale['410']."</a>";
echo "</td>\n</tr>\n"; $i++;
}
}
echo "</table>\n";
}
0 replies
J
jannik
J
jannik 10
  • Member, joined since
  • Contributed 80 posts on the community forums.
  • Started 26 threads in the forums
  • Started this discussions
answered
Member

Okay yes it works, but not as I planned:-) I want to create more links... so there also is one that shows from group 2

But cant see from your code how it is done...
0 replies
F
fanggaming
F
  • Junior Member, joined since
  • Contributed 43 posts on the community forums.
  • Started 3 threads in the forums
answered
Junior Member

Ah I see you will need to decide on a method of selecting the various groups I would take some code from the forums.php in administration as that has decent method of handling group selection (saves time)

then you will need to send the variable back to your page and update lines 2 , 5 and 21 in the code I put in above to remove the hard coded "1" and put in your new variable.
0 replies
J
jannik
J
jannik 10
  • Member, joined since
  • Contributed 80 posts on the community forums.
  • Started 26 threads in the forums
  • Started this discussions
answered
Member

I dont understand :o

Have tried to look in forums.php, but don know where to start:@

0 replies

Category Forum

User Administration - 8

Labels

None yet

Statistics

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

2 participants

J
J
jannik 10
  • Member, joined since
  • Contributed 80 posts on the community forums.
  • Started 26 threads in the forums
  • Started this discussions
F
F
  • Junior Member, joined since
  • Contributed 43 posts on the community forums.
  • Started 3 threads in the forums

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet