The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#71
|
|||
|
|||
Hmm...that doesn't help. Look at the surrounding line for missing quote or unusual characters.
|
#72
|
|||
|
|||
It was a missing ! in the following line
|
#73
|
|||
|
|||
I'm about to head to bed after staring at this damn mod for 2 hours trying to find my error.
It imports just fine and the settings work, but when I go to /mics.php?do=unsubscribe all I get is the smiley page. No errors. So I'm going to attach it here and maybe someone can find the error for me It's not complete yet, still have to do the user group stuff, the resubscribe stuff, and find a way to store the existing thread subscriptions. The plan for the subscriptions is to create another table to copy the users subscriptions to and the query to take the data from the backup table and repopulate the original. EDIT: It was a simple typo in the template name So with no errors I can now work on the user group stuff |
#74
|
|||
|
|||
Ok I'm a bit stuck and a little confused (and not about the same thing ).
I basically followed Kevin's "select" and "update" queries to add the other options to be changed. However I'm a little confused why the "select" query selects username and userid when the "update" query doesn't use those variables. Select query Code:
$unsubscribe = $db->query_first("SELECT username, userid, email FROM ".TABLE_PREFIX."user WHERE email = '$esc_email' AND options &16"); Code:
$unsubscribe = $db->query("UPDATE ".TABLE_PREFIX."user SET options = options - 16 WHERE (options & 16) AND email= '" . $db->escape_string($email) . "'"); Code:
if (empty($unsubscribe['email'])) { eval(standard_error(fetch_error('advanced_unsubscribe_link_error_unsubscribed', $vbulletin->options['contactuslink']))); } Code:
$unsubscribe = $db->query_first("SELECT * FROM ".TABLE_PREFIX."subscribethread WHERE userid = '$id' AND emailupdate = 1 OR 2 OR 3"); Is it because the subscribethread table doesn't have an email column? |
#75
|
|||
|
|||
I don't remember why the query included username and userid, I suppose I thought I needed them (or might need them) for one of the other features we talked about. But it also doesn't hurt anything to have them there.
You're right, the subscription table doesn't include email, so there's no reason to check for that field being blank. Also I don't think you're checking correctly for multiple values of emailupdate. I think you want something like: Code:
$unsubscribe = $db->query_first("SELECT * FROM ".TABLE_PREFIX."subscribethread WHERE userid = '$id' AND emailupdate IN (1, 2, 3)"); I think have "OR 2 OR 3" on the end of the query like that will cause it to return every row. Oh, that brings up another issue - since you want to return every record of a user's subscriptions, you can't use query_first(), you need to use query_read() and then use a loop to get each record. |
#76
|
|||
|
|||
Thanks for the tips on thread subscription I thought it was the '$id' that was returning every row, I'll use IN and see what happens
|
#77
|
|||
|
|||
Ok I have confused myself once again The subscribethread table has one column (subscribethreadid) that is auto increment, according to this website https://www.vbulletin.com/docs/html/...ards_sql_query I'm not supposed to include that field in an insert query.
I have tried the following queries which result in different errors. Code:
$db->query_write(" INSERT INTO ".TABLE_PREFIX."unsub_subscribethread SELECT userid, threadid, emailupdate, folderid, canview FROM ".TABLE_PREFIX."subscribethread WHERE userid = '$id' AND emailupdate IN (1, 2, 3)"); Quote:
Code:
$db->query(" INSERT INTO ".TABLE_PREFIX."unsub_subscribethread VALUES What goes here? SELECT (userid, threadid, emailupdate, folderid, canview) FROM ".TABLE_PREFIX."subscribethread WHERE userid = '$id' AND emailupdate IN (1, 2, 3)"); Code:
$db->query_write(" INSERT INTO ".TABLE_PREFIX."unsub_subscribethread SELECT * FROM ".TABLE_PREFIX."subscribethread WHERE userid = '$id' AND emailupdate IN (1, 2, 3)"); None but it doesn't populate unsub_subscribethread, is it because of the auto increment column in subscribethread? According to this website http://www.w3schools.com/sql/sql_select_into.asp I should be using SELECT INTO to copy subscribethread to unsub_subscribethread (vs INSERT INTO) at least that's how I understand it so I tried; Code:
$db->query_write(" SELECT userid, threadid, emailupdate, folderid, canview INTO ".TABLE_PREFIX."unsub_subscribethread FROM ".TABLE_PREFIX."subscribethread WHERE userid = '$id' AND emailupdate IN (1, 2, 3)"); Quote:
Code:
$db->query_write("CREATE TABLE IF NOT EXISTS ".TABLE_PREFIX."unsub_subscribethread LIKE ".TABLE_PREFIX."subscribethread"); |
#78
|
|||
|
|||
I haven't tried these, but I think there's two things you can do: when a column is auto increment, you don't want to supply a value but you can put NULL as a placeholder. You can put NULL where you'd put a column name in a select, and that value will always be null. So I think this would work:
Code:
$db->query_write(" INSERT INTO ".TABLE_PREFIX."unsub_subscribethread SELECT NULL, userid, threadid, emailupdate, folderid, canview FROM ".TABLE_PREFIX."subscribethread WHERE userid = '$id' AND emailupdate IN (1, 2, 3)"); The other way would be to list each column and leave out the id column, like: Code:
$db->query_write(" INSERT INTO ".TABLE_PREFIX."unsub_subscribethread (userid, threadid, emailupdate, folderid, canview) SELECT userid, threadid, emailupdate, folderid, canview FROM ".TABLE_PREFIX."subscribethread WHERE userid = '$id' AND emailupdate IN (1, 2, 3)"); BTW, for future reference you can see some of this in the mysql manual, for instance here's the page for the INSERT statement: http://dev.mysql.com/doc/refman/5.0/en/insert.html |
#79
|
|||
|
|||
Well so far nothing has worked as far as populating unsub_subscribethread. However plugging each query into phpmyadmin (removing the table prefix and defining a user) works.
So it's either not pulling the userid properly, or my loop is screwed up (which certainly wouldn't surprise me). I'll have to do some more reading and hopefully find an good loop example instead of the crap that's in the tutorials. |
#80
|
|||
|
|||
A week ago or so I screwed up and deleted my "good" file for the mod and instead saved the "working" copy. Well when I navigate to the page on my local test site for testing I get the following error;
Quote:
While I am on this subject ... why are there two ' after the ] ? For that matter why is there a ` before it? misc.php code from line 80 to 89 Code:
// ######################### REQUIRE BACK-END ############################ require_once('./global.php'); // ####################################################################### // ######################## START MAIN SCRIPT ############################ // ####################################################################### ($hook = vBulletinHook::fetch_hook('misc_start')) ? eval($hook) : false; // ############################### start buddylist ############################### |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|