#1 WordPress forum plugin created by gVectors Team

wpForo – WordPress Forum Plugin
  • Home
  • Forum
  • Migrate to wpForo
  • Addons
  • Addons Demo
  • Documentation

Forum

Home | Forum

wpDiscuz - WordPress Comment Plugin
  • Forums
  • Members
  • Recent Posts
Forums
Main Support Forums
How-to and Troubles...
Redirect non-logged...
 
Share:
Share
Tweet
Share
Notifications
Clear all

Redirect non-logged in user to login page

    Last Post
RSS

hill-seeker91
Posts: 17
 hill-seeker91
Topic starter
March 15, 2020 4:50 pm
(@hill-seeker91)
Active Member
Joined: 2 years ago

Hi I'm just experimenting with setting up wpforo on a new site with a private forum.

While wpForo seems to hide topics and posts from non-logged in users, it would be nice if there was a setting to simply redirect anyone trying to access the forum who isn't logged in to the login page. (Easier user experience for members to work out that's what they've forgotten to do, and more secure that it doesn't show there is a valid forum board with that name)

Is this possible? If so, how do I do it? Thanks.

 

Topic Tags
redirection login
3 Replies
Sofy
Posts: 4057
Sofy - Facebook Sofy - Twitter
 Sofy
Admin
March 16, 2020 1:12 pm
(@sofy)
Support Team
Joined: 4 years ago

Hi @hill-seeker91,

Please put the following code in your current active theme functions.php file:

 
add_filter('wpforo_after_init_current_object', function ($current_object){
    if( in_array($current_object['template'], array('forum', 'topic')) ){
        if( !WPF()->current_userid && !WPF()->perm->forum_can('vf', $current_object['forumid']) ){
	        wp_redirect( wpforo_login_url() );
	        exit();
        }
    }
    return $current_object;
});

In case you want to say thank you !)
We'd really appreciate and be thankful if you leave a good review on plugin page. This is the best way to say thank you to this project and support team.

Reply
2 Replies
hill-seeker91
 hill-seeker91
(@hill-seeker91)
Joined: 2 years ago

Active Member
Posts: 17
March 16, 2020 1:35 pm
Reply toSofySofy

@sofy Thanks I'll try that. 

Spoke a bit too soon on the other thread (and can't now post as you've closed it!) Can you reopen that so I can add a post please as although it's a great workaround there is an underlying issue which probably ought to be resolved in a future release. Thanks

 

Reply
Sofy
 Sofy
Admin
(@sofy)
Joined: 4 years ago

Support Team
Posts: 4057
Sofy - Facebook Sofy - Twitter
March 16, 2020 1:38 pm
Reply tohill-seeker91hill-seeker91
Sofy

@hill-seeker91,

the thread is opened. 

 

In case you want to say thank you !)
We'd really appreciate and be thankful if you leave a good review on plugin page. This is the best way to say thank you to this project and support team.

Reply
  All forum topics
  Previous Topic
Next Topic  
Related Topics
  • Redirect
    2 months ago
  • WpForo customization
    7 months ago
  • Redirect after Registration
    7 months ago
  • How to modify login screen
    8 months ago
  • Threaded layout's User column profile picture not showing correctly
    8 months ago
Topic Tags:  redirection (10), login (38),

Forum Search

Join Us!

Download wpForo plugin
on WordPress.org

wpForo Addons

wpforo-private-messages wpforo-advanced-attachments-128x128 wpforo-embeds-128x128 wpForo User Custom Fields addon wpForo – Blog Cross Posting addon wpForo Ads Manager wpForo – WooCommerce Memberships Integration wpForo Emoticons wpForo – Tenor GIFs Integration
View all Addons »

Recent Topics

  • Costume text and image on every forum

    By Vijiki, 5 hours ago

  • Forum topics and pages not indexing

    By Vijiki, 14 hours ago

  • Can't send confirmation email from topics when suscribe for new topic

    By gilbau, 17 hours ago

  • Can't add shortcodes to wpForo

    By avorai, 17 hours ago

  • New Feature H1 title for tags

    By annushka, 1 day ago

  • File in antisapm protection not deleted

    By pesimist57, 2 days ago

Topic Tags

  • translation49
  • css49
  • plugin conflict48
  • seo45
  • new features44
  • buddypress42
  • ultimate member40
  • avatar40
  • forum40
  • moderation38
  • login38
  • registration36
  • threaded layout35
  • cache33
  • editor32
  • menu32
  • shortcode31
  • spam29
  • phrases28
  • forum accesses28
View all tags (2162)

Recent Posts

  • RE: Show Likers with their avatar

    No, I don't use any such function. The reason I asked i...

    By fawp, 5 hours ago

  • Costume text and image on every forum

    Is there a way I can add text or image on forum pages ...

    By Vijiki, 5 hours ago

  • RE: Can't send confirmation email from topics when suscribe for new topic

    @gilbau, wpForo uses WordPress wp_mail() function. wp...

    By Robert, 11 hours ago

  • RE: Forum topics and pages not indexing

    So all is ok from wpForo site. I have nothing to add he...

    By Robert, 11 hours ago

  • RE: Can't add shortcodes to wpForo

    @avorai, Again, I don't see any relation of this issu...

    By Robert, 12 hours ago

  • RE: Can users be in multiple forums?

    @monimair, wpForo has secondary usergroups function so...

    By Chris, 14 hours ago

  • RE: H1 title for tags

    Hi @annushka, Your suggestion has been added to our t...

    By Chris, 15 hours ago

Share:
Share
Tweet
Share
  Forum Statistics
20 Forums
9,755 Topics
49.4 K Posts
4 Online
43.5 K Members

Latest Post: Show Likers with their avatar Our newest member: sportstototopcom09 Recent Posts Unread Posts Tags

Forum Icons: Forum contains no unread posts Forum contains unread posts

Topic Icons: Not Replied Replied Active Hot Sticky Unapproved Solved Private Closed

Powered by wpForo | Copyright © 2016-2022 gVectors Team
Copyright Registration Service - Click here for more information or to register work
wpForo is Registered with the IP Rights Office
Copyright Registration Service

Ref: 4477265538
  • Home
  • Forum
  • Migrate to wpForo
  • Addons
  • Addons Demo
  • Documentation