Jump to the post that solved this thread.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Solved: 2 Years, 3 Months, 3 Weeks ago Exclude Usergroups
#1
Solved: 2 Years, 3 Months, 3 Weeks ago
I'm trying to get an automated list that pulls from two different profile fields to exclude certain usergroups. How would I modify this to exclude usergroups 2, 3, 4, 5, 6, 7, 15, 23, 25 ?? I assume that I need to add it into the SELECT lines somehow but I'm not sure. I'd really appreciate the help with this. Smile

<?php
/**
* Author: Invidia
* Date: June 6th' 2014
* Purpose: Automates your faceclaim.
* Comments:
* Please make the changes told in the comments to make it work !
*/
 
// Please insert the access to your Database you also used during the install !
define('DBUSER', '****');
define('DBPASS', '****');
define('DBSERVER', '****');
define('DBNAME', '****');

$conn = new mysqli(DBSERVER, DBUSER, DBPASS, DBNAME);

if (!$conn) {
    die('error connecting to database');
}
 

//automated faceclaim by Invidia
 
define('IN_MYBB', 1);
require "./global.php";
require "./inc/config.php";
 
add_breadcrumb("Faceclaim", "faceclaim.php");
 
// Replace the fid[genderfid] with the fid and the ID of the Facegender profile field and the fid[namefid] with the fid and ID of the Faceclaim profile field ! For example - fid1
$faceclaim=$db->query("SELECT * FROM mybb_users LEFT JOIN mybb_userfields ON mybb_users.uid = mybb_userfields.ufid WHERE fid3 = 'female' ORDER BY mybb_userfields.fid17 ASC");
                   
                   
while($result=$db->fetch_array($faceclaim)) {
      $userid = $result['uid'];
      $username = $result['username'];
      // Replace the fid[namefid] with the fid and the ID of the Faceclaim profile field ! For example - fid2
      $avatar = $result['fid17'];
eval("\$female_faceclaim .= \"".$templates->get("female_faceclaim")."\";");   
}
 
// Replace the fid[genderfid] with the fid and the ID of the Facegender profile field and the fid[namefid] with the fid and ID of the Faceclaim profile field ! For example - fid1
$faceclaim=$db->query("SELECT * FROM mybb_users LEFT JOIN mybb_userfields ON mybb_users.uid = mybb_userfields.ufid WHERE fid3 = 'male' ORDER BY mybb_userfields.fid17 ASC");
                   
                   
while($result=$db->fetch_array($faceclaim)) {
      $userid = $result['uid'];
      $username = $result['username'];
      // Replace the fid[namefid] with the fid and the ID of the Faceclaim profile field ! For example - fid2
      $avatar = $result['fid17'];
 
eval("\$male_faceclaim .= \"".$templates->get("female_faceclaim")."\";");     
}

eval("\$faceclaim = \"".$templates->get("faceclaim")."\";");
output_page($faceclaim);
 
//automated faceclaim by Invidia
?>
Reply
#2
Solved: 2 Years, 3 Months, 3 Weeks ago
You can use MySQL's "NOT IN" clause.

$faceclaim=$db->query("SELECT * FROM mybb_users LEFT JOIN mybb_userfields ON mybb_users.uid = mybb_userfields.ufid WHERE fid3 = 'female' AND mybb_users.usergroup NOT IN (2,3,4,5,6,7,15,23,25) ORDER BY mybb_userfields.fid17 ASC");

Note that this won't check additional usergroups but don't know if you need that.
MyReactions - All Plugins

Can you still feel the butterflies?

Free never tasted like pudding.
Reply
#3
Solved: 2 Years, 3 Months, 3 Weeks ago
That's perfect!! Thank you!
Reply
Jump to the post that solved this thread.


Forum Jump:


Users browsing this thread: 1 Guest(s)