SHOW SIGN IN / JOIN – Changing Code so that Clicking on Link directs to Login Pa

Posted in: Newspaper
Post count: 37

SHOW SIGN IN / JOIN – Changing Code so that Clicking on this Link on TOP Bar MENU directs to my own Login Page instead of opens the Modal Window!

I want to use the “Show Sign In / Join” Link on the TOP BAR MENU but i want to change the code – so that when clicked – instead of Opening the Modal Window a non Logged-In User is redircted to my own Login Page.

The same procedure I want at the Post Page for the Comments Section – When a non Logged-In User must logged-In first before he is able to write a Comment.

For better unserstanding I included two Screenshots:
https://www.portal-regional.at/wp-content/uploads/2016/09/TOP-Header-Menu-Login.jpg

https://www.portal-regional.at/wp-content/uploads/2016/09/Comments-logged-out.jpg

Which Code in which Newspaper Theme File do I have to change?

Thank your for your answer
Karl

Post count: 22421

Hello,

If you want to alter the login widgets, for the top one you must edit this code:
http://screencast.com/t/luvcwJO0
You can replace it with something like:
echo '<ul class="top-header-menu td_ul_login"><li class="menu-item"><a class= href="your custom url">click me</a><span class="td-sp-ico-login td_sp_login_ico_style"></span></li></ul>';
And for the comments form: http://screencast.com/t/OoENdvZYC

Thank you!

Post count: 37

@Bogdan B.

Hi Bogdan, thank´s for the fast repsonse.

The Login/Register is working with my custom Link im TOP-BAR-MENU. (SHOW SIGN IN / JOIN). I just modified your Code because there was “class=” which was preventing the Link:

echo '<ul class="top-header-menu td_ul_login"><li class="menu-item"><a href="https://www.portal-regional.at/login/">Login / Registrieren</a><span class="td-sp-ico-login td_sp_login_ico_style"></span></li></ul>';

Maybe you can give me more advice for the Comments.php File. I don´t know what to do here. Sorry I´m not an experience Programmer, just a User 🙁

// login with our login modal when you want to write a comment

	        if (td_util::get_option('tds_login_sign_in_widget') == 'show') {
		        $url = '#login-form';
	        } else {
		        $post_id = get_the_ID();
		        $url = wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) );
	        }
            $defaults['must_log_in'] = '<p class="must-log-in td-login-comment"><a href="' . $url .'">' . __td('Log in to leave a comment', TD_THEME_NAME) . ' </a></p>';

            comment_form($defaults);
            //comment_form();

Do I have just to replace the following line?

$defaults['must_log_in'] = '<p class="must-log-in td-login-comment"><a href="' . $url .'">' . __td('Log in to leave a comment', TD_THEME_NAME) . ' </a></p>';

With this Line of Code?

$defaults['must_log_in'] = '<p class="must-log-in td-login-comment"><a href="https://www.portal-regional.at/login/">' . __td('Log in to leave a comment', TD_THEME_NAME) . ' </a></p>';

Thanks for your reply

With best Regards,
Karl

  • This reply was modified 9 years by kstockl.
Post count: 6535

HI

Try to add this line of code in comments.php file like here: http://screencast.com/t/9Vxn99PxlhfI

$defaults['must_log_in'] = '<p class="must-log-in td-login-comment"><a href="your-custom-url">' . __td('Log in to leave a comment', TD_THEME_NAME) . ' </a></p>';

Just add the desired url ten test the site again, it should work fine.
Thanks!

Post count: 37

@Andrei L.

I changed the Code and it is working like I want 🙂

TagDiv Team, thank´s again for your great Support!

With best Regards,
Karl

  • This reply was modified 9 years by kstockl.
Post count: 37

Forgot to ask for this Link modification when a User is already logged in!

When a User is logged in now, the Avatar and Name of the User ist shown in Top Bar Menu – and by default if the Users clicks on his Users Name he get redirected to his Authors Page ( /author/ ).

Where I am able to change the Code so that by clicking the Users Name the Link is redirecting to the Profile ( /wp-admin/profile.php) ?

I think this is my last question in this Thread 😀

Thank you for your reply
With best Regards, Karl

Post count: 23312

Hi kstocki,

If you want to change that functionality for widget login, please notice that you will have to alter the code from the top-menu.php core file, like this -> http://prntscr.com/cht24p and the WordPress function which you should use in this regard is -> get_edit_profile_url

Hope this helps!

Thanks!

Post count: 37

@Catalin

Hi Catalin, yes this works. Just replaced the code as you adviced 🙂

Thanks so much for your Support!

With best Regards,
Karl, Austria

Post count: 37

Hi, me again
As I know have redirections for Login / Register in TOP-Bar-Menu and in comments I discovered that I have to redirect also the Login / Register in Smartphone View:

Smartohone View Responsive

When viewing on Smartphone there is also the Login /Register – here I want to redirect the Users to the Login page (Login ) and the register page (Join).

Where I am able to change this links in which file with which code?

Thank´s for your reply

With best Regards, Karl

Post count: 23312

Hi,

If you want to change the functionality for the login widget for mobile mode, please notice that you should edit the menu-mobile.php core file from mobile directory, like this -> http://screencast.com/t/wcO4LoTWQzVG

Hope this helps!

Thanks.

Post count: 37

@Catalin

Hi Catalin,
as I looked deeper now in the structure I discovered in mobile-menu.php the following Code:

<code> <!-- login section -->
        <?php if (td_util::get_option('tds_login_sign_in_widget') == 'show') { ?>
            <div class="td-menu-login-section">
                <?php
                if ( is_user_logged_in() ) {
                    locate_template('parts/logged.php', true);
                } else {
                    locate_template('parts/login.php', true);
                }
                ?>
            </div>
        <?php } ?>

I opened the File /parts/login.php an changed the code in following ways:

//if admin permits registration
$users_can_register_tab = '';

if ($users_can_register == 1) {
//add the Register tab to the modal window if
Anyone can register chec
$users_can_register_tab = ' <span></span>' . __td('Join', TD_THEME_NAME) . '';
}

echo '
<div class="td-guest-wrap">
<div class="td-menu-avatar"><div class="td-avatar-container">' . get_avatar($current_user->ID, 80) . '</div></div>
<div class="td-menu-login">' . __td('Sign in', TD_THEME_NAME) . '' . $users_can_register_tab . '</div>
</div>
';

This seems to work in Mobile View. Instead of showing now the Login Tab a Link now redirects to my own Login Page. The same with Join Tab – A unregistered User is redirected to the Register Page.

Can you confirm that my changed Code in Theme is free from Error?

And last but not least in Mobile View there is another Link I discovered within Login. If an User is logged out and he has to be logged In to write a Comment the Login View opens in a Modal Window in Mobile View.

In which file an where to change this part of Code to get redirected to my own Login Page instead of opening a Modal Window for Login?

Thanks for your reply

Greets, Karl

Post count: 37

Sorry, 2 Code Inserts in the Forum seems not working:

So here again the Code I have changed:

Modal Login in Mobile View

  • This reply was modified 9 years by kstockl.
Post count: 37
Post count: 436

Hi kstockl

I just registered to your website to check the login modal redirect issues that I am facing since I installed Newspaper theme. Here is the related thread:

https://forum.tagdiv.com/topic/still-facing-login-redirect-issue-with-ajax-based-login-popup-of-newspaper-theme/

I tried all possible solution but unable to fix it, but when I checked it on your website, I noticed that after successfully logging in , if someone tried to open user profile ( /wp-admin/profile.php) or dashboard ( ( /wp-admin/), it redirects to the login page again, even when I was already logged in.

Hey TagDiv, shouldn’t you look into this issue again? I doubt that this issue is being faced by many of us. So, please.

Thank you.

  • This reply was modified 9 years by Nano.
Post count: 37

@nano2408

Hi Nano2408 please try again. And try to reproduce the Issues you have discovered on my Site.I made a small modification while you stayed at my Site.

I think I found a more simple way for my Site. And I will give more details when I´m finised the Testings with modified Code.

Karl

Post count: 37

Hi again.
Why I asked for modification in Newspaper Theme 7.4 in this Thread?

To prevent unwanted Spam Users to Register. The inbuilt Login / Register function has no option for including Captchas or other Plugins to check if this is a real User. So for me it is to unsecure to use this function.

After a long ride a found a Solution which fullfills my needs when I modified the Code in following folder:
/Newspaper/parts/header/top-menu.php

Answer:

//show login widget (must be disabled in Theme : disabled Show SignIn/Join in NewspaperTheme in Header – TOP Bar
So I was able to prevent all the Modals which are used for Login/ Register / Login in Comments to open

//To show Logged-Out Users a Login/Register Link to my own Login/Register Page in Top-Bar

//To show logged-In Users their Avatar and a Logout Out Link in Top Bar

//To prevent unwanted Spam Users to register without verifying
cause Newspaper Modal has no option for including Captchas or other Security Plugins without heavy modifications

The modified Code can be viewed here:

Modified top-menu.php file

It activates the Login / Register Link in Top Bar Menu

Please note: In Mobil view the “Login/Register” or if a User is loggedIn the “Avatar/UserName/Logout” isn´t shown but it will do in Desktop View. And for my Users I have a seperate Login / Register / Account Page. So this isn´t really a problem.

Maybe in a Future Newspaper Update we get the possibility in Theme Setting to have a own setting for include a Url for: Login / SignIN – so that we don´t need to activate the Modal Login/Register if we have our own plugin which handles the Registration / Login of our users. But have the Login/Register | User Account/Logout Links displayed in Top-Bar Menu. In Desktop View and in Mobil View.

Post count: 436

Hi kstockl,

I tried but since now you have disbaled Modal login , so I am not able to reproduce that error. The error that I have mentioned here is directly related with Modal login popup.

Though what you have done is also very interested specially in case when we don’t want Spammers to login and to aslo enable Social login options.

I will surely try to use the method you have explained above oneday.

Post count: 2

I’m having my own plugin to manage registrations.
I hope there is upcoming planned changes to allow us redirect.

Viewing 18 posts - 1 through 18 (of 18 total)
You must be logged in to reply to this topic.