Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • asnmedia Friend
    #184747

    For some reason I cant figure this out, maybe it’s because I’ve been staring at this for too long.

    I wanted to edit JA Login to do two things.

    1. Add a “My Profile” button next to the logout button, which takes them to a unique page and their met with a custom layout
    2. Redirect after log-in to their custom page.

    I was wondering if anyone has any experience with this process. I’m trying to stay away from the obvious hidden menu item way of doing it. Help Needed ASAP!

    Phill Moderator
    #482743

    Adding a button to JA Login should be relatively simple. Simply edit the file mod_jalogintmpldefault.php and add your custom code in the area below. You will need to work out your code depending on exactly where you want to link to and how.

    [PHP]<?php if ($params->get(‘greeting’)) : ?>
    <div class=”login-greeting”>
    <?php if($params->get(‘name’) == 0) :
    echo JText::sprintf(‘HINAME’, $user->get(‘username’));
    else :
    echo JText::sprintf(‘HINAME’, $user->get(‘name’));
    endif; ?>
    </div>
    <?php endif; ?>
    <div class=”logout-button”>
    <input type=”submit” name=”Submit” class=”button” value=”<?php echo JText::_(‘JLOGOUT’); ?>” />
    </div>
    <input type=”hidden” name=”option” value=”com_users” />
    <input type=”hidden” name=”task” value=”user.logout” />
    <input type=”hidden” name=”return” value=”<?php echo $return; ?>” />
    <?php echo JHTML::_(‘form.token’);?>
    </form>
    </li>
    <?php else : ?>
    [/PHP]

    As for the redirect that will be simple if whatever component you are using for their custom page has a menu* item. For instance, if we create a menu item of the type “User Profile” then in the back end of the JA Login modules settings you can select it to go to this menu item on login. So from then on, if any user logs in they will then automatically go to their user profile. Yes, that is the obvious hidden menu method but as far as I can see it is the only sensible way of achieving what you want.

    *I am sure you know this but I am detailing it for those that may not.

    asnmedia Friend
    #482749

    Okay, I’ve got the log out and My profile button set up.

    I was editing the right file. The main issue I had was I was editing inside modulesmod_jalogintmpl

    And I needed to be in templatesMYTEMPLATEhtmlmod_jalogin so it wasn’t showing

    I added the code under <input type=”submit” name=”Submit”…

    How would I go about making the newly made My Profile button a link and not a logout button (which now it is) ?

    i really need to get back into php lol.

    Phill Moderator
    #482750

    Ah, didn’t realise you we’re using a template with an override. What page exactly do you want the button to link to?

    asnmedia Friend
    #482813

    I wanted to link it to a profile page for the user. I need to be able to edit it easily per user, so I’m debating on if I should use the default Joomla profile page or create my own. I’m thinking using the default Joomla page would be easier, So that’s what I need it to link to.

    I have it inside the same div class to keep it looking the same.

    asnmedia Friend
    #483093

    Does anyone know how I would go about linking the new “My Profile” button in JA_Login?

    Ninja Lead Moderator
    #483171

    @asnmedia: You can try with my suggestion

    1) Open templates/ja_mendozite/html/mod_jalogin/default.php file
    from

    <div class="logout-button">
    <input type="submit" name="Submit" class="button" value="<?php echo JText::_('JLOGOUT'); ?>" />
    </div>

    change to

    <div class="logout-button">
    <a href="<?php echo JRoute::_('index.php?option=com_users&view=profile');?>">My Profile</a>  <input type="submit" name="Submit" class="button" value="<?php echo JText::_('JLOGOUT'); ?>" />
    </div>

    2) You can configure from back-end JA Login Module, see the screenshot


    1. JA-Login
    asnmedia Friend
    #486219

    I tried your suggestion, with one issue. It’s hard to explain so I’ll just attach a photo.

    EDIT:

    I fixed the button. I created a new div class. All I need is to send the button to profile page. it still acts like a log out button.

    Could it be because of the top part <?php if($type == ‘logout’) : ?>

    Heres what it looks like so far.


    1. Screenshot-from-2013-03-12-135802
    2. Screenshot-from-2013-03-12-141406
    Ninja Lead Moderator
    #486282

    Please pm me with url, admin access and ftp account, i shall help you out.

Viewing 9 posts - 1 through 9 (of 9 total)

This topic contains 9 replies, has 3 voices, and was last updated by  Ninja Lead 11 years, 8 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum