AI Search
Classic Search
 Search Phrase:
 Search Type:
Advanced search options
 Search in Forums:
 Search in date period:

 Sort Search Results by:

AI Assistant
Notifications
Clear all

[Solved] Can I load the LOGIN page by default if not logged in?

5 Posts
4 Users
4 Reactions
2,560 Views
Posts: 3
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@kwit)
Active Member
Joined: 9 years ago
[#3550]

I'd link to have a FORUM link on the top-right of my site. When clicked, if the user is not logged in, it should take them to the LOGIN tag but if logged in, it should just load the main forum categories tab. 

Is there a way to do this within the settings or do I need custom-code?

Thanks,

 


4 Replies
Robert
Posts: 10753
Admin
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@robert)
Support Team
Joined: 3 months ago

I'm sorry but I don't have solution for this. This is a custom development, there is no an easy way to do this.


BlackRaz
Posts: 397
Admin
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@blackraz)
Contributor
Joined: 9 years ago

Hi Dear KW Web & IT Consultant,

Thank you for using wpForo Forum
Please take a look at this
URL:   http://www.screencast.com/t/JyXKjViRtdV

 


Posts: 6
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@pepi1025)
Active Member
Joined: 9 years ago

Just write two new lines into index.php.

change this:

if($template == 'search'){
include( wpftpl('search.php') );

to this:

if ( !is_user_logged_in() ){
include( wpftpl('login.php') );
}elseif($template == 'search'){
include( wpftpl('search.php') );


Posts: 3
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@kwit)
Active Member
Joined: 9 years ago

@Robert - You gave up too easily 🙂

@blackraz - Excellent solution and works easily. How did you come across that query solution?

@pepi1025 - Thanks, but I did no attempt to use your code based solution as blackraz's solution worked with just a url query edit

 


Share: