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?

Add panel to only one page

Asked Modified Viewed 3,345 times
H
hedonism
H
  • Junior Member, joined since
  • Contributed 12 posts on the community forums.
  • Started 7 threads in the forums
  • Started this discussions
asked
Junior Member

I have a side panel which allows users to join or leave user groups at their own leisure without admin support. Is there a way to add this only into edit_profile and register.php so it isn't on every page? It doesn't need to be a panel, as long as I get it on those two pages only.

Thanks for any help
0 replies

4 posts

D
Diemux
D
Diemux 10
Over 1200 v6 and v7 downloads available here: PHPFusion-mods.net

Updated almost daily!
  • Junior Member, joined since
  • Contributed 46 posts on the community forums.
  • Started 8 threads in the forums
answered
Junior Member

You could include the panel in the edit_profile.php page?

Or more simple:

Find:

closetable();


and below add your contents of the usergroup panels in a new table:


opentable("Sign Up in one or more Usergroups!");

echo "Content panel";

closetable();


If you add that below you will just see the join buttons below the edit profile fields.
0 replies
H
hedonism
H
  • Junior Member, joined since
  • Contributed 12 posts on the community forums.
  • Started 7 threads in the forums
  • Started this discussions
answered
Junior Member

Thanks Diemux. I didnt' realize I needed to change openside to opentable. I was hoping to allow users to join groups upon registration if possible, but it works great inside of edit_profile once a registration is complete.
0 replies
G
googlebot
G
Visit the new home of the merge between Hacking Vs. Security and Security Override!
My copyright removal has been switched over from HvS to SecurityOverride.
  • Senior Member, joined since
  • Contributed 638 posts on the community forums.
  • Started 28 threads in the forums
answered
Senior Member

Quote

hedonism wrote:
Thanks Diemux. I didnt' realize I needed to change openside to opentable. I was hoping to allow users to join groups upon registration if possible, but it works great inside of edit_profile once a registration is complete.

You don't. You could have very well kept it as openside. You could have added the code with openside(); and closeside(); functions (that is, the whole code of the panel) and added it after the closetable();

Also, the registration wouldn't be terribly hard to create - although I don't think it would be very useful, because most users probably wouldn't know which group they want to join, or which ones they don't want to join. But if you want it, post the panel code here, and I'll get you a registration.php file with that incorporated (if I remember to check back here - send me a pm if you want to remind me. ;) ).
0 replies
H
hedonism
H
  • Junior Member, joined since
  • Contributed 12 posts on the community forums.
  • Started 7 threads in the forums
  • Started this discussions
answered
Junior Member

Hi googlebot,

Thanks for taking your time to help.


if(iMEMBER) {

opentable("User Groups");

///this is an array. input the id of the groups users are allowed to join, comma separated

$groups = array(3,4,2,6,1,5,7,8);

/// controls max width of the button that displays of the user_group name
$max_width = 150;



if(isset($_POST['group_name'])) {



   $group_name = trim(preg_replace("(Join|Leave)","",$_POST['group_name']));

   $group_id   = dbresult(dbquery("SELECT group_id FROM ".DB_USER_GROUPS." WHERE group_name = '".$group_name."'"),0);
   $groups = explode(".",$userdata['user_groups']);

   if(in_array($group_id,$groups)) {



      $user_groups = ereg_replace(".".$group_id,"",$userdata['user_groups']);

      dbquery("UPDATE ".DB_USERS." SET user_groups = '".$user_groups."' WHERE user_id = '".$userdata['user_id']."'");

   }else {

      $user_groups = $userdata['user_groups'].".".$group_id;

      dbquery("UPDATE ".DB_USERS." SET user_groups = '".$user_groups."' WHERE user_id = '".$userdata['user_id']."'");

   }

   redirect(FUSION_SELF);

}



   echo "<form action='".FUSION_SELF."' method='POST'>";

   foreach($groups as $group_id) {

      $group_name = dbresult(dbquery("SELECT group_name FROM ".DB_USER_GROUPS." WHERE group_id = '".$group_id."'"),0);
      $groups = explode(".",$userdata['user_groups']);

      if(in_array($group_id,$groups)) {

         echo "<input type='submit' align='center' value='Leave ".$group_name."' class='button' name='group_name' style='width:{$max_width}px;overflow:hidden;'>";

      }else {

         echo "<input type='submit' align='center' value='Join ".$group_name."' class='button' name='group_name' style='width:{$max_width}px;overflow:hidden;'>";

      }

      echo "<br />";

   }

   echo "</form>";


closetable();


}


You don't have to keep it styled with buttons, if you think checkboxes or something would suit it better for the registration page.
Thanks again.
Jon
Edited by hedonism on 30-12-2008 23:11,
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 4 posts
  • Votes 0 votes
  • Topic users 3 members

3 participants

H
H
  • Junior Member, joined since
  • Contributed 12 posts on the community forums.
  • Started 7 threads in the forums
  • Started this discussions
D
D
Diemux 10
Over 1200 v6 and v7 downloads available here: PHPFusion-mods.net

Updated almost daily!
  • Junior Member, joined since
  • Contributed 46 posts on the community forums.
  • Started 8 threads in the forums
G
G
Visit the new home of the merge between Hacking Vs. Security and Security Override!
My copyright removal has been switched over from HvS to SecurityOverride.
  • Senior Member, joined since
  • Contributed 638 posts on the community forums.
  • Started 28 threads in the forums

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet