Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Tutorials and Tips

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 03-10-2013, 01:58 AM
Hedgen's Avatar
Hedgen Hedgen is offline
Member
 
Join Date: Oct 2012
Posts: 36
Gender: Male
Credits: 4,860
Hedgen is on a distinguished road
Default Hedgen's Small Tutorials

Hey everyone! I am posting this thread for small things I figure out that some of you might have issues with, such as moving things from the :SIDEFEED: to the :LINKSBAR:, so as I make modifications to my adoptables site, I'll be adding things here (Or when helping people, if I answer someone with something to do with code I'll add it here in case anyone else has trouble with the same thing.

I will reply to this with the tutorials, and link to them on this post, that way this post isn't to long, and you won't have to look through this thread for them.

Last edited by Hedgen; 03-26-2013 at 01:51 PM.
Reply With Quote
  #2  
Old 03-10-2013, 04:15 AM
Hedgen's Avatar
Hedgen Hedgen is offline
Member
 
Join Date: Oct 2012
Posts: 36
Gender: Male
Credits: 4,860
Hedgen is on a distinguished road
Default :SIDEFEED: to :LINKSBAR:

Note1: This is for Mysidia Version 1.3.2, It may or may not work for Version 1.3.3, I haven't tested it for 1.3.3 yet.
Note2: This tutorial might seem a little long, I might have been able to explain things more clearly, and I probably could have made it shorter, but bare with me, I'm not use to writing tutorials.

So I wanted to move my login form from the :SIDEFEED: to the :LINKSBAR: part of the site (SIDEFEED has the login form, and other single links, while LINKSBAR has drop down menus) so I messed with the code until I figured out how to do it.

This tutorial is mostly showing how to move the location of the login form, you can do this with other parts of the sidefeed but I'm only showing the login form. I am using the main theme, so my :LINKSBAR: is a horizontal dropdown menu on top of the site.

So to start, open up class_page.php (classes/class_page.php) and find:
PHP Code:
private function getsidebar() 
Once there, copy:
PHP Code:
if($mysidia->user->isloggedin == TRUE) {
        
$msgctr "<a href='messages.php'>Messages</a>";        
        
$data $mysidia->db->select("messages", array("touser"), "touser='{$mysidia->user->username}' and status='unread'")->fetchAll();

        if(
count($data) > 0$msgctr "<a href='messages.php'>Messages <b>(".count($data).")</b></a>";
        
$sidebar "You have {$mysidia->user->money} {$mysidia->settings->cost}.<br />
                   <a href='donate.php'>Donate money to friends</a><br />
                   <br /><strong>Your links:</strong><br />
                   <ul><li><a href='adopt.php'>Adopt New Pets</a></li>
                   <li><a href='pound.php'>Acquire Pounded Pets</a></li>
                   <li><a href='myadopts.php'>Manage Adoptables</a></li>
                   <li><a href='account.php'>Go to My Account</a></li>
                   <li>
{$msgctr}<li><a href='changestyle.php'>Change Theme</a></li>
                   <li><a href='logout.php'>Log Out</a></li>"
;

        
$row $mysidia->db->select("users", array("uid""username"), "username='{$mysidia->user->username}' and usergroup='1'")->fetchObject();        
        if(
is_object($row)) $sidebar .= "<li><a href='admincp/'>Admin Center</a></li><br />";
     }
     else {
        
$sidebar "<b><u>Member Login:</u></b><br />
        <form name='form1' method='post' action='login.php'>
          <p>Username: <input name='username' type='text' id='username'></p>
          <p>Password: <p><input name='password' type='password' id='password'></p>
          <p><input type='submit' name='Submit' value='Log In'></p>
        </form>Don't have an account?<br /><a href='register.php'>Register Free</a><br /><a href='forgotpass.php'>Forgot Password?</a><br />"
;
     } 
to your favorite text editor. (You don't have to copy it to a text editor, but I find it easier if I am modifying code that I am going to place somewhere else to do it in a blank file.)

Once you did or did not do that, you really only need to keep these parts of the code:
PHP Code:
if($mysidia->user->isloggedin == TRUE) {
        
$sidebar "";
     }
     else {
        
$sidebar "<b><u>Member Login:</u></b><br />
        <form name='form1' method='post' action='login.php'>
          <p>Username: <input name='username' type='text' id='username'></p>
          <p>Password: <p><input name='password' type='password' id='password'></p>
          <p><input type='submit' name='Submit' value='Log In'></p>
        </form>Don't have an account?<br /><a href='register.php'>Register Free</a><br /><a href='forgotpass.php'>Forgot Password?</a><br />"
;
     } 
Once you have that, decide whether you want the login form above or below your :LINKSBAR:.

If you wish to have the login form above the linksbar:
  Spoiler: Above Linksbar 

Change both of the "$sidebar =" to "$links ="
Once you have done that, place your html div tags, or whatever you are using to style your site, right inside of the quotes.
You should now have something like this:

PHP Code:
if($mysidia->user->isloggedin == TRUE) {
        
$links "<div class='ddmenu' style='top:-25px;'>";
     }
     else {
        
$links "<div class='ddmenu' style='top:0px;'>
            <b><u>Member Login:</u></b><br />
            <form name='form1' method='post' action='login.php'>
                  <p>Username: <input name='username' type='text' id='username'></p>
                  <p>Password: <p><input name='password' type='password' id='password'></p>
                  <p><input type='submit' name='Submit' value='Log In'></p>
            </form>Don't have an account?<br /><a href='register.php'>Register Free</a><br /><a href='forgotpass.php'>Forgot Password?</a><br />"
;
     } 
Note: your <div> tag will probably be different than mine. I have a menu that floats above my website so I have to style mine a little differently.

Okay, so now you have gotten that set up, let's place it in the LINKSBAR.

Find "private function getlinks()" in the same file.
Once there, you want add our login form above
PHP Code:
$links "<div class='ddmenu'>\n<ul>"
After that, change
PHP Code:
$links "<div class='ddmenu'>\n<ul>"
to
PHP Code:
$links .= "\n<ul>"
so the menu displays properly.

You should now have something similar to:

  Spoiler:  
PHP Code:
private function getlinks(){
     
// This method gets the links for the top bar from the database
     
     
global $mysidia;     
     if(
$mysidia->user->isloggedin == TRUE) {
        
$links "<div class='ddmenu' style='top:-25px;'>";
     }
     else {
        
$links "<div class='ddmenu' style='top:0px;'>
            <b><u>Member Login:</u></b><br />
            <form name='form1' method='post' action='login.php'>
                  <p>Username: <input name='username' type='text' id='username'></p>
                  <p>Password: <p><input name='password' type='password' id='password'></p>
                  <p><input type='submit' name='Submit' value='Log In'></p>
            </form>Don't have an account?<br /><a href='register.php'>Register Free</a><br /><a href='forgotpass.php'>Forgot Password?</a><br />"
;
     }
     
$links .= "\n<ul>";     
     
$stmt $mysidia->db->select("links", array(), "linkparent < 1 ORDER BY id ASC");       
     while (
$category $stmt->fetchObject()) {
        
$links .= "\n<li><a class='hide' href='{$category->linkurl}'>{$category->linktext}</a>
               \n<ul>"
;
        
$stmt2 $mysidia->db->select("links", array(), "linkparent='{$category->id}' ORDER BY id ASC");
        while(
$item $stmt2->fetchObject()){
            
$links .= "<li><a href='{$item->linkurl}' title='{$item->linktext}'>{$item->linktext}</a></li>";      
        }
        
$links .= "</ul>
              \n</li>"
;
     }    
     
$links .= "\n</ul>";
     return 
$links;
  } 


After you got that, you can edit the login form layout to get it to how you want it, and then you are done with getting it above the menu!


If you wish to have the login form below the linksbar:
  Spoiler: Below Linksbar 
Change both of the "$sidebar =" to "$links .=" so when you place it below the linksbar it adds it to the menu. You should have something like this:

PHP Code:
if($mysidia->user->isloggedin == TRUE) {
        
$links .= "";
     }
     else {
        
$links .= "
            <b><u>Member Login:</u></b><br />
            <form name='form1' method='post' action='login.php'>
                  <p>Username: <input name='username' type='text' id='username'></p>
                  <p>Password: <p><input name='password' type='password' id='password'></p>
                  <p><input type='submit' name='Submit' value='Log In'></p>
            </form>Don't have an account?<br /><a href='register.php'>Register Free</a><br /><a href='forgotpass.php'>Forgot Password?</a><br />"
;
     } 
Find
PHP Code:
private function getlinks() 
in the same file
and place this modified if statement under

PHP Code:
while ($category $stmt->fetchObject()) {
        
$links .= "\n<li><a class='hide' href='{$category->linkurl}'>{$category->linktext}</a>
               \n<ul>"
;
        
$stmt2 $mysidia->db->select("links", array(), "linkparent='{$category->id}' ORDER BY id ASC");
        while(
$item $stmt2->fetchObject()){
            
$links .= "<li><a href='{$item->linkurl}' title='{$item->linktext}'>{$item->linktext}</a></li>";      
        }
        
$links .= "</ul>
              \n</li>"
;
     }    
     
$links .= "\n</ul>"
but above
PHP Code:
return $links
You should have something like this:
  Spoiler:  
PHP Code:
private function getlinks(){
     
// This method gets the links for the top bar from the database
     
     
global $mysidia;     
     
     
$links "<div class='ddmenu' style='top:0px;'><ul>";     
     
$stmt $mysidia->db->select("links", array(), "linkparent < 1 ORDER BY id ASC");       
     while (
$category $stmt->fetchObject()) {
        
$links .= "\n<li><a class='hide' href='{$category->linkurl}'>{$category->linktext}</a>
               \n<ul>"
;
        
$stmt2 $mysidia->db->select("links", array(), "linkparent='{$category->id}' ORDER BY id ASC");
        while(
$item $stmt2->fetchObject()){
            
$links .= "<li><a href='{$item->linkurl}' title='{$item->linktext}'>{$item->linktext}</a></li>";      
        }
        
$links .= "</ul>
              \n</li>"
;
     }    
     
$links .= "\n</ul>";
     if(
$mysidia->user->isloggedin == TRUE) {
        
$links .= "";
     }
     else {
        
$links .= "
            <b><u>Member Login:</u></b><br />
            <form name='form1' method='post' action='login.php'>
                  <p>Username: <input name='username' type='text' id='username'></p>
                  <p>Password: <p><input name='password' type='password' id='password'></p>
                  <p><input type='submit' name='Submit' value='Log In'></p>
            </form>Don't have an account?<br /><a href='register.php'>Register Free</a><br /><a href='forgotpass.php'>Forgot Password?</a><br />"
;
     }
     return 
$links;
  } 

And then you can edit the login form to however you want it, and then you are done!



If you have any questions about this tutorial, or any others I post, please say so here. I know that I sometimes don't explain things very well so I try to explain the best I can.

Last edited by Hedgen; 03-26-2013 at 01:52 PM.
Reply With Quote
  #3  
Old 03-10-2013, 04:32 AM
Hedgen's Avatar
Hedgen Hedgen is offline
Member
 
Join Date: Oct 2012
Posts: 36
Gender: Male
Credits: 4,860
Hedgen is on a distinguished road
Default Redirect people after X seconds

Note: This is for Mysidia Version 1.3.2, It may or may not work for Version 1.3.3, I haven't tested it for 1.3.3 yet. Since it is just a little bit of HTML, you should be able to add it to any page, but again I haven't tested it yet.

Someone asked about redirecting people to the home page after logging in after 5 seconds, so I found this little bit of html code you place in your header of any page, and it will redirect people to wherever you specify.

Place this in whatever page you want:
HTML Code:
<head>
<meta http-equiv='refresh' content='timeinseconds; URL=yoursite.com'>
</head>
Replace "timeinseconds" with the amount of time in seconds you want to wait until the redirect. So if you wanted them to wait 5 seconds, set "content=" to 5.
Replace "yoursite.com" with the page you want them to be redirected to.

How to redirect someone from the login page after 5 seconds:
  Spoiler: login.php 
Go to login.php and find:
// Validation succeeded, now begins the actual login procedure

a couple lines below that, there should be "$mysidia->page->addcontent"
Place the html code right inside the quotes for that.
It should now be something like this:
PHP Code:
// Validation succeeded, now begins the actual login procedure
         
         
$mysidia->page->settitle($lang->success_title);
         
$mysidia->page->addcontent("<head>
                         <meta http-equiv='refresh' content='5;
                          URL=redirectedpage.com'>
                          </head>
                          Welcome back 
{$mysidia->input->post("username")}{$lang->success}"); 
content='5; being 5 second wait, and URL=redirectedpage.com' being the page you want people to be redirected to.


How to redirect someone from the logout page after 5 seconds:
  Spoiler: logout.php 

Go to logout.php, once there edit:
PHP Code:
  $mysidia->page->addcontent($lang->default); 
to
PHP Code:
  $mysidia->page->addcontent("<head>
            <meta http-equiv='refresh' content='5; URL=redirectedpage.com'>
            </head>"
$lang->default); 
Again, content='5; being 5 second wait, and URL=redirectedpage.com being the page you want people to be redirected to.

Last edited by Hedgen; 03-26-2013 at 01:53 PM.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Small Add-On Bloodrun Mys v1.1.x Mods 6 01-18-2011 05:06 PM
Small Help jcga Questions and Supports 2 01-22-2010 09:44 PM
small problem Roconza Questions and Supports 12 01-21-2010 03:20 PM
Small Problem SJC Questions and Supports 0 07-02-2009 09:40 AM
Small PHP Question snowman01 Other Chat 2 02-19-2009 07:06 PM


All times are GMT -5. The time now is 07:01 PM.

Currently Active Users: 9856 (0 members and 9856 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636