The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$archive_pages - Line: 2 - File: printthread.php(287) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/printthread.php(287) : eval()'d code 2 errorHandler->error
/printthread.php 287 eval
/printthread.php 117 printthread_multipage



UserSpice
Exclude users from view_all_users - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: Support Center (https://userspice.com/forums/forumdisplay.php?fid=23)
+--- Forum: UserSpice 4.3 and Below (https://userspice.com/forums/forumdisplay.php?fid=26)
+--- Thread: Exclude users from view_all_users (/showthread.php?tid=1255)

Pages: 1 2


Exclude users from view_all_users - Moomintroll - 12-05-2018

Is there a way to exclude certain users from the results shown on the view_all_users page?

I've looked over the site using various search terms but nothing seems to address the issue.

I need this for two reasons:

First, although GDPR requires a 'Forget Me' option, if a financial transaction is made there is a separate requirement to keep a record for 10 years (I think), so straight deletion is not an option.

Second, for similar reasons, it would be useful for active members of a society to be able to withhold their names from such a public directory (even one that is restricted to other members).

I'm reasonably sure I can create a column in the users table that could contain a 0, 1 or 2 code, but its the retrieval query in the view_all_users page that I'm stumped by.

I've found these lines:
Code:
$userQ = $db->query("SELECT * FROM users LEFT JOIN profiles ON users.id = user_id ");
// group active, inactive, on naughty step
$users = $userQ->results();
...but I'm not sure what they're doing.

Cheers in advance!


RE: Exclude users from view_all_users - Moomintroll - 12-05-2018

'Sokay, figured it out. Dead simple!
Code:
$userQ = $db->query("SELECT * FROM users LEFT JOIN profiles ON users.id = user_id WHERE active = 2");



RE: Exclude users from view_all_users - mudmin - 12-05-2018

You just beat me to it Smile


RE: Exclude users from view_all_users - mudmin - 12-05-2018

Btw, I'm guessing the whole "naughty" thing was some autocorrect we've missed.  I wrote this feature as a demo in a video and it kind of stuck around unmessed with.


RE: Exclude users from view_all_users - Moomintroll - 12-07-2018

Possibly, but it told me that I was looking in the right place, so no harm done!


RE: Exclude users from view_all_users - mudmin - 12-07-2018

Nice! Glad it worked!


RE: Exclude users from view_all_users - Moomintroll - 12-07-2018

Hi Mudmin,
As an extension of making accounts public or private, I need to create a button that toggles a field in the user's account between 1 and 2.
So, for example, a red button on the account page that says 'Account Set to Private', but when clicked updates the field to the public setting (say '2') and displays a green button that says 'Account set to Public'...and vice versa
How would I go about that?


RE: Exclude users from view_all_users - mudmin - 12-07-2018

(12-07-2018, 06:47 PM)Moomintroll Wrote: Hi Mudmin,
As an extension of making accounts public or private, I need to create a button that toggles a field in the user's account between 1 and 2.
So, for example, a red button on the account page that says 'Account Set to Private', but when clicked updates the field to the public setting (say '2') and displays a green button that says 'Account set to Public'...and vice versa
How would I go about that?

Would the user be setting their own account public/private or would you be doing it for them? The logic is different based on which one.  I'm guessing this is on account.php, right?


RE: Exclude users from view_all_users - Moomintroll - 12-07-2018

That's right. It will be up to the member if their details appear in the Member Directory or not. The details would still be held in the users database and viewable to the Admins.


RE: Exclude users from view_all_users - mudmin - 12-07-2018

Ok, so I worked under the assumption that there is a field in your users table called acctPrivate. If there isn't, either make one, or do a find/replace in the code I'm about to share to whatever the column is in your db.

The code below has 2 parts. A php section that goes above your html and a form that you can drop anywhere on the page that does the button.

https://pastebin.com/DJ67mg6S