×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

How do I change URL links in a login | register button?

How do I change URL links in a login | register button?

How do I change URL links in a login | register button?

(OP)
Hi

I have a problem with my "login | register" / "username | logout" link on WP theme ‘LMS'. I need to change the URLs where they are pointing
As it is now, the login | register link works in the following way.


If logged out, it will show a login | register option. Clicking on it takes you to wp-login (using the S2member plugin in some way) which doesn’t collect the registration info I need

If logged in, it will show ‘username' and a ‘logout’ option. Clicking on the username takes you to an S2member account page which looks awful and doesn’t show the info I need to show.


I would like both links to point to different URLs.

If user is logged out and they click on 'login | register', then should take them to http://www.asned.org/greenlight/login-4/
If user is logged in and clicks on username, then should take them to http://www.asned.org/greenlight/account-3/ OR if they logout should take them to http://www.asned.org/greenlight/


The code I need to change is below. I know very little about php, but am keen to learn.

Would somebody be able to help and show me what I need to change?

Many thanks in advance

Mick



CODE --> PHP

<div class="header-register">                    
                        <ul>
<?php
                            if(!is_user_logged_in()): 
                                $login = dttheme_get_page_permalink_by_its_template('tpl-login.php'); 
                                $login = is_null($login) ? home_url()."/wp-login.php" : $login;
                            ?>
                                <li><a href="<?php echo $login; ?>" title="<?php _e('Login / Register Now', 'dt_themes');?>"><i class="fa fa-user"></i><?php echo __('Login', 'dt_themes').'<span> | </span>'.__('Register', 'dt_themes'); ?></a></li>
                            <?php
                            else:
                                $current_user = wp_get_current_user();
                                $welcome = dttheme_get_page_permalink_by_its_template('tpl-welcome.php');
                                if( dttheme_is_plugin_active('s2member/s2member.php') ):
                                    $login_welcome_page = get_option('ws_plugin__s2member_cache');
                                    $login_welcome_page = $login_welcome_page['login_welcome_page'];
                                    $page = $login_welcome_page['page'];
                                    if( !empty($page) ):
                                        $link = $login_welcome_page['link'];
                                        $title =  get_the_title($page);
                                        echo '<li><a href="'.$link.'">'.get_avatar( $current_user->ID, 30).'<span>'.__('Welcome, ', 'dt_themes').' '.$current_user->display_name.' | </span>'.'</a></li>';
elseif(!is_null($welcome)):
echo '<li><a href="'.$welcome.'">'.get_avatar( $current_user->ID, 30).'<span>'.__('Welcome, ', 'dt_themes').' '.$current_user->display_name.' | </span>'.'</a></li>';
                                    endif;
                                elseif(!is_null($welcome)):
                                    echo '<li><a href="'.$welcome.'">'.get_avatar( $current_user->ID, 30).'<span>'.__('Welcome, ', 'dt_themes').' '.$current_user->display_name.' | </span>'.'</a></li>';
                                else:
                                    echo '<li><a href="#">'.get_avatar( $current_user->ID, 30).'<span>'.__('Welcome, ', 'dt_themes').' '.$current_user->display_name.' | </span>'.'</a></li>';
                                endif;
                                                            
                                echo '<li><a href="'.wp_logout_url(get_permalink()).'" title="'.__('Logout', 'dt_themes').'">'.__('Logout', 'dt_themes').'</a></li>';
                            endif;

if(class_exists('WooCommerce') && dttheme_option('appearance', 'enable-header-cart')) {
global $woocommerce;
$cart_url = $woocommerce->cart->get_cart_url();
echo '<li class="dt-sc-cart"><a href="'.$cart_url.'"><i class="fa fa-shopping-cart"></i></a></li>';
}
                            ?>
                        </ul>
                    </div> 

RE: How do I change URL links in a login | register button?

I think that you will find that you are looking in the wrong place.

For Wordpress, URLs are very rarely "hard wired" into the PHP code, they are in the various database tables or as DEFINES in configuration files and are retrieved via 'core' or 'theme' functions,

This for example.

$cart_url = $woocommerce->cart->get_cart_url();

Which "requests" a URL from the $woocommerce 'plugin' class properties and methods, and the class in turn in turn fetches the data from the woocommerce table structure.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum

RE: How do I change URL links in a login | register button?

(OP)
Thanks Chris
The login | register link comes from the WP theme I have installed. The theme developers told me that I need to look at and edit this particular file.
The first half of the code seems to deal with login and welcome (which is the account page after the user has logged in)
Are you pretty sure the code I have provided doesn't set the URL locations having logged on, logged out, taking to user's account page?
Thanks again
Mick

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close