PDA

View Full Version : [SOLVED] Where are stored "Browsing Options" on database


omardealo
11-04-2014, 12:23 PM
Hello ,

I Look for the table name that stores the Browsing Options values ​​inside database

and i ask is there a way to grant specific moderator authority to change/edit this option only "Receive Admin Emails?" for users Without the appearance of the rest of the other options .

thnx alot ,

omardealo
11-04-2014, 02:34 PM
okay i found it , all options user stored on options filed on user table
now , how i can update only option Receive Admin Emails [adminemail] for specific user by php code ?

Lynne
11-04-2014, 03:41 PM
What are you wanting to do this via a query and not the admincp?

kh99
11-04-2014, 05:46 PM
okay i found it , all options user stored on options filed on user table
now , how i can update only option Receive Admin Emails [adminemail] for specific user by php code ?

You could execute the query
UPDATE user SET options = options + 16 WHERE (NOT (options & 16)) AND userid = ID

to set it to Yes, and
UPDATE user SET options = options - 16 WHERE options & 16 AND userid=ID

to set it to No. Note that you must change ID to the actual userid in each case. I'm assuming you can write php to do those queries.


As Lynne says, this can be done from the admincp without writing php, but since you said in the first post that you want moderators to be able to do it without giving them permission to change any other settings, I'm guessing that you've decided to write your own code to allow them to do it.

omardealo
11-04-2014, 07:54 PM
What are you wanting to do this via a query and not the admincp?

Becouse , i want gave grant to specific moderator authority to change/edit this option only "Receive Admin Emails?" for users Without the appearance of the rest of the other options .

thnx ,

omardealo
11-07-2014, 03:10 PM
You could execute the query
UPDATE user SET options = options + 16 WHERE (NOT (options & 16)) AND userid = ID

to set it to Yes, and
UPDATE user SET options = options - 16 WHERE options & 16 AND userid=ID

to set it to No. Note that you must change ID to the actual userid in each case. I'm assuming you can write php to do those queries.


As Lynne says, this can be done from the admincp without writing php, but since you said in the first post that you want moderators to be able to do it without giving them permission to change any other settings, I'm guessing that you've decided to write your own code to allow them to do it.

thnx brother , yeah that's what i want to do
now everything is good
Thank you for your understanding of my request kh99


if ($_REQUEST['do'] == 'editemailadmin')
{

$user = $db->query_first("
SELECT options
FROM " . TABLE_PREFIX . "user
WHERE userid = '" . $_REQUEST['userid'] ."'
");

$user = array_merge($user, convert_bits_to_array($user['options'], $vbulletin->bf_misc_useroptions));


print_form_header('index','updateemailadmin',$vbph rase['receive_admin_emails']);
construct_hidden_code("userid",intval($_REQUEST['userid']));
print_cp_header($vbphrase['browsing_options']);
print_radio_row('This is a radio row', 'inputname', array( '1' => 'yes', '0' => 'no' ) , $user['adminemail']);
print_submit_row($vbphrase['save']);
}

if ($_REQUEST['do'] =="updateemailadmin")
{
if ($_REQUEST['inputname'] == 0)
{
$db->query_write("UPDATE " . TABLE_PREFIX . " user SET options = options - 16 WHERE options & 16 AND userid = ".$_REQUEST['userid']." ");
print_cp_message('DONE', "index.php?do=useradminemail");
}elseif ($_REQUEST['inputname'] == 1)
{
$db->query_write("UPDATE " . TABLE_PREFIX . " user SET options = options + 16 WHERE (NOT (options & 16)) AND userid = ".$_REQUEST['userid']." ");
print_cp_message('DONE', "index.php?do=useradminemail");
}
}

iref2010
10-13-2015, 05:50 AM
@all
@kh99;

How do i get the mapping of the user options fields, couldnt find anywhere online.
I want to enable "Receive Email from Other Users" for all the users by using sql query

This needs to be done so that people start receiving mention emails.

Lynne
10-14-2015, 03:59 PM
According to this thread (http://www.vbulletin.com/forum/forum/vbulletin-legacy-versions-products/legacy-vbulletin-versions/vbulletin-3-0-how-do-i-and-troubleshooting-forum/135675-query-to-reset-options-by-email-address), it would be:

UPDATE user
SET options = options - 256
WHERE options & 256

Make sure you backup your database first before running this query!!!!! Better yet, test it on your test site first before doing it on the live site.