We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Require Login for Members page?! How? | Forum

Stara
Stara Jan 10 '20
I have Members page set to only members to view. The widget is hidden (in admin panel>pages>manage pages) but if a guest types in site.com/users then they can still see the page without login. 

Is there a way to make this page also require registration to view?
Marcus
Marcus Jan 11 '20
You need a simple pluging to check the url or route then with controller check the rest. 
Marcus
Marcus Jan 11 '20
That's a custom job if you want me to do this for ya drop me a line. 
Marcus
Marcus Jan 11 '20
Basically what I would do is... If guest then redirect to sign-in page
Marcus
Marcus Jan 11 '20
Or even better.... Since your page got sign-in button above a assume Im gonna replace content of page with text of your choice... Will add lang key... Where you can say some like register or login to view this page. 
The Forum post is edited by Marcus Jan 11 '20
Catkin
Catkin Jan 11 '20
Pfffffft, just disallow access to the page in your .htaccess?
Marcus
Marcus Jan 11 '20
James and how do you gonna know whether the user is a member or guest.? Htaccess won't work 
Catkin
Catkin Jan 11 '20
It will just block everyone, it's a fast solve. I mean, working with Oxwall is just all about botching things and holding everything together with the code equivalent of tape. 
Patricia Zorrilla Leader
Patricia Zorrilla Jan 14 '20
Add this line:

if ( !OW::getUser()->isAuthenticated() ){ throw new AuthenticateException(); }

in the file:

ow_system_plugins/base/controllersuser_list.php

after the line 41, after this:

parent::__construct();





Patricia Zorrilla Leader
Patricia Zorrilla Jan 15 '20
Did it work for you?


Stara
Stara Jan 17 '20
Thank you, Patricia! It was great help! You are a good person and so helpful. Thank you very much.
Patricia Zorrilla Leader
Patricia Zorrilla Jan 27 '20

It has nothing to do with the theme.

Here it is working fine and you can change the subject

On the websites where it doesn't work, did you put them in debug mode? https://wiki.oxwall.com/plugin-tuts:enable-debug

Patricia Zorrilla Leader
Patricia Zorrilla Jan 28 '20

This warning refers to the use of an index of an array that does not exist.

You have to set a breakpoint at this point and inspect the variables involved to see what they contain and find out why they do not contain the referenced data.

There is no generic way to know what happens without doing this, you already say that with a similar configuration another website does work 

Bob Bob
Bob Bob Jan 29 '20
It looks to me like the referenced function ( theme_service.php, line 634 ) attempts to process the CSS file. It seems to be breaking down the CSS key-value pairs, using the colon ( : ) separator. 


So it seems like to me, the problem is probably being caused by something in the CSS file (a missing punctuation mark, perhaps, or a similar issue). That's my best guess, anyway.

The Forum post is edited by Bob Bob Jan 29 '20
Patricia Zorrilla Leader
Patricia Zorrilla Jan 29 '20

It can't be a code error since Rob says he has two websites with identical settings and the other one is going well.

They may not be as identical and have different themes installed (even if you have the same theme active). 

Patricia Zorrilla Leader
Patricia Zorrilla Jan 29 '20
There https://owspain.com are two languages here, and it is working fine, you cannot see the list of members if you do not login even if you access directly by URL to https://owspain.com/users/ or https://owspain.com/admin/users/

You can also change the theme on this site, and this does not affect.
Now I have to go to work, on my return I try to close the site to visitors, vary the number of languages and try more things about this.

Eduard
Eduard Feb 2 '20

Quote from Patricia Zorrilla Add this line:

if ( !OW::getUser()->isAuthenticated() ){ throw new AuthenticateException(); }

in the file:

ow_system_plugins/base/controllersuser_list.php

after the line 41, after this:

parent::__construct();






Works like a charm. Thank you!
Patricia Zorrilla Leader
Patricia Zorrilla Jun 24 '20

yes that is


We The People United We Stand

Question is there a way to block just the username list, but still have the search for users and online users still viewable?


lets say you would;

Block website/user; but

Allow website/user/online

Allow website/user/search


Thanks.

Patricia Zorrilla Leader
Patricia Zorrilla Jun 24 '20

Try this version, replace it with yours.

You must rename TXT to PHP, OxWall does not allow attaching files in PHP format in this forum.

To see the 3 changes, search with a text editor for the word "Patri"

I have modified the menu, if you want users not to access this list there is no point in displaying this menu option.

In case the list is accessed from any other part of OxWall or from some plugin, I have forced that if the general list is requested (latest) it shows the OnLine users

Attachments:
  user_list.txt (12Kb)
Pages: 1 2 »