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
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Exclude users from view_all_users
#1
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!
  Reply
#2
'Sokay, figured it out. Dead simple!
Code:
$userQ = $db->query("SELECT * FROM users LEFT JOIN profiles ON users.id = user_id WHERE active = 2");
  Reply
#3
You just beat me to it Smile
  Reply
#4
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.
  Reply
#5
Possibly, but it told me that I was looking in the right place, so no harm done!
  Reply
#6
Nice! Glad it worked!
  Reply
#7
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?
  Reply
#8
(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?
  Reply
#9
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.
  Reply
#10
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
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)