Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Register Signup / Profile Menu in a external site navbar

13»

Comments

  • Options

    @vrijvlinder But what u said is the basic idea.

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited April 2014

    But if their signed in it shows sign in still

    no it does not if they are in the forum. because this is not in the forum that will not happen. for that to happen you would need to understand all of the parts that are needed to be called for it to work like the forum as peregrine explained. But not knowing how to implement it does not help you use it.

    so for now I recommend you simply ad the sign in link and the register link. As the others will not work unless they are logged in anyway. They will just redirect them to sign in if they are not logged in.

  • Options

    Ok Thanks!

  • Options

    @vrijvlinder Also how do I get the little Icons that show next to the text links

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    you can't that s part of the forum template and it is called a sprite, that means many images in one image and uses css to call the image based on a coordinate. What you can do is add the images yourself next to the links. using a < span > tag

     <li><a href="http://quollcraft.net/forum/messages/all" class="MeButton FlyoutButton" title="Inbox"><span><img src="url to image"/><span>Inbox</a></li>
    
  • Options

    I added that and It didnt show the image. Do i have to add a referance thing to it?

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited April 2014

    yes of course it did not show, you need to add a url to an image. You need to use a web inspector to help yourself see what your error is. This is basic html and you said you were good with html. So show me by paying more attention here .

    does src="url to image" go somewhere ? no it is not a url. So what to do? add a url to an image an icon anything you want to show there. Use some imagination here.

    Critical thinking is a prerequisite not just paste and expect it to work. I can't do it all for you. If that is what you want you need to hire me. I can give you free advice the best way I can. But the resources to achieve what you want are all over the internet in the form of tutorials if you lack the most basic skills like adding a url for an image .

  • Options

    I changed the "url to image" to a link to the icon and It still didnt work thats what I ment to say.

  • Options
    LincLinc Detroit Admin
    edited May 2014

    FYI: running the current 2.3a from the develop branch is batshit crazy. I'm not sure it's actually running anywhere in our entire infrastructure for a forum, not even testing. It's completely diverged from master and has no patches from the last year.

    We've actually been psyching ourselves up to merge that insanely-diverged branch back into master for approximately 2 months now. Also, it's regressing to the 2.2 versioning once it comes in from the cold.

    tl;dr holy crap. bad idea.

  • Options

    I have been updating it on that with some custom stuff @linc

  • Options

    Test

  • Options

    @peregrine said:
    .

    this is a simplistic - possibly not good way to determine if signed in or not.

    <?php // replace ["Vanilla]" in line below with the cookie name in your config.php if ($_COOKIE["Vanilla"]) { echo '<a href="/vanilla/profile">profile'; } else { echo 'Sign In'; } ?>

    here is a better way:

    add the code below to any external pages - and read the comments in the code.
    Make sure you have PATH ROOT defined correctly.

    for getting external session info in a non-vanilla web page.

    I added the links for you

        <?php
        /*
        * Include the Garden framework used by Vanilla.
        */
        // Define constants like the way that Vanilla does in its index.php file.
        define('APPLICATION', 'Vanilla');
        define('APPLICATION_VERSION', '2.1');
        define('DS', '/');
        define('PATH_ROOT', './forum'); // Change PATH_ROOT to the path to your forum.
        
        // Display all PHP errors for development purposes.
        error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR);
        ini_set('display_errors', 'on');
        ini_set('track_errors', 1);
        ob_start(); // Buffer the output of the code below.
        require_once(PATH_ROOT . '/bootstrap.php'); // Require the bootstrap for the framework used by Vanilla.
        $Dispatcher = Gdn::Dispatcher(); // Declare an alias for the dispatcher.
        // Set up the dispatcher.
        $EnabledApplications = Gdn::ApplicationManager()->EnabledApplicationFolders();
        $Dispatcher->EnabledApplicationFolders($EnabledApplications);
        $Dispatcher->PassProperty('EnabledApplications', $EnabledApplications);
        // Mimic the DiscussionsController().
        $Controller = new DiscussionsController();
        Gdn::Controller($Controller);
        Gdn::Request()->WebRoot('');
        ob_end_flush(); // Stop and send the buffer for the code above.
        /*
         /*
        * The above code is to include Garden framework used by Vanilla, so you can use its functions.
        * You can put your code in this file. See the example below.
        * You can also make a separate file with your code and include this file by a require() above all.
        */
       
        $Session = Gdn::Session(); // Declare an alias for the user session.
        // Check if the user session is valid.
        if($Session->IsValid()) {
       // echo "The user is logged in!"; // The session is valid, so the user is logged in.
        $Username = ($Session->User->Name);
        // display link to user profile
         echo '<a href="/vanilla/profile">'.$Username . '</a>';
        } else {
      //  echo "The user is not logged in."; // The session is invalid, so the user is not logged in.
       // display sign in link to user profile
         echo  '<a rel="nofollow" href="/vanilla/entry/signin">Sign In</a>';
       }
       ?>
    

    lifted from shadowdare's code

    http://vanillaforums.org/discussion/comment/195082/#Comment_195082

    I used the bottom code selection and it works on the homepage only. I copied the code from my home page (looks like this:
    <?php /* * Include the Garden framework used by Vanilla. */ // Define constants like the way that Vanilla does in its index.php file. define('APPLICATION', 'Vanilla'); define('APPLICATION_VERSION', '2.1'); define('DS', '/'); define('PATH_ROOT', './forum'); // Change PATH_ROOT to the path to your forum. // Display all PHP errors for development purposes. error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR); ini_set('display_errors', 'on'); ini_set('track_errors', 1); ob_start(); // Buffer the output of the code below. require_once(PATH_ROOT . '/bootstrap.php'); // Require the bootstrap for the framework used by Vanilla. $Dispatcher = Gdn::Dispatcher(); // Declare an alias for the dispatcher. // Set up the dispatcher. $EnabledApplications = Gdn::ApplicationManager()->EnabledApplicationFolders(); $Dispatcher->EnabledApplicationFolders($EnabledApplications); $Dispatcher->PassProperty('EnabledApplications', $EnabledApplications); // Mimic the DiscussionsController(). $Controller = new DiscussionsController(); Gdn::Controller($Controller); Gdn::Request()->WebRoot(''); ob_end_flush(); // Stop and send the buffer for the code above. /* /* * The above code is to include Garden framework used by Vanilla, so you can use its functions. * You can put your code in this file. See the example below. * You can also make a separate file with your code and include this file by a require() above all. */ $Session = Gdn::Session(); // Declare an alias for the user session. // Check if the user session is valid. if($Session->IsValid()) { // echo "The user is logged in!"; // The session is valid, so the user is logged in. $Username = ($Session->User->Name); // display link to user profile echo '

    '; } else { // echo "The user is not logged in."; // The session is invalid, so the user is not logged in. // display sign in link to user profile echo ' '; } ?>)
    But when i put it on a different page eg: www.quollcraft.net/vote it shows this error:
    Fatal error: require_once(): Failed opening required '/forum/bootstrap.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/quollcr1/public_html/vote/index.php on line 93 Why wont it work. It works on my home page (www.quollcraft.net)
  • Options

    @‌peregrine I managed to get this code to work. how ever is just works on the home page. When i copied it to a different page: www.quollcraft.net/vote it showed this error:
    Fatal error: require_once(): Failed opening required '/forum/bootstrap.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/quollcr1/public_html/vote/index.php on line 93

    Here is my code I got to work if it helps:
    <?php /* * Include the Garden framework used by Vanilla. */ // Define constants like the way that Vanilla does in its index.php file. define('APPLICATION', 'Vanilla'); define('APPLICATION_VERSION', '2.1'); define('DS', '/'); define('PATH_ROOT', '/forum'); // Change PATH_ROOT to the path to your forum. // Display all PHP errors for development purposes. error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR); ini_set('display_errors', 'on'); ini_set('track_errors', 1); ob_start(); // Buffer the output of the code below. require_once(PATH_ROOT . '/bootstrap.php'); // Require the bootstrap for the framework used by Vanilla. $Dispatcher = Gdn::Dispatcher(); // Declare an alias for the dispatcher. // Set up the dispatcher. $EnabledApplications = Gdn::ApplicationManager()->EnabledApplicationFolders(); $Dispatcher->EnabledApplicationFolders($EnabledApplications); $Dispatcher->PassProperty('EnabledApplications', $EnabledApplications); // Mimic the DiscussionsController(). $Controller = new DiscussionsController(); Gdn::Controller($Controller); Gdn::Request()->WebRoot(''); ob_end_flush(); // Stop and send the buffer for the code above. /* /* * The above code is to include Garden framework used by Vanilla, so you can use its functions. * You can put your code in this file. See the example below. * You can also make a separate file with your code and include this file by a require() above all. */ $Session = Gdn::Session(); // Declare an alias for the user session. // Check if the user session is valid. if($Session->IsValid()) { // echo "The user is logged in!"; // The session is valid, so the user is logged in. $Username = ($Session->User->Name); // display link to user profile echo '

    '; } else { // echo "The user is not logged in."; // The session is invalid, so the user is not logged in. // display sign in link to user profile echo ' '; } ?>
Sign In or Register to comment.