The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#101
|
|||
|
|||
Dangit ... I knew I didn't fully understand the JOINs ...
The subscribethread table doesn't have an email column, but if I JOIN the user table I don't have to mention the email table (in the JOIN) in order to use it in the UPDATE ... WHERE as long as the userid from the user table matches the userid from subscribethread table? |
#102
|
||||
|
||||
Quote:
If what I understand you want to achieve why not use the following query: PHP Code:
|
#103
|
|||
|
|||
Ok so JOINs can't be used in an UPDATE? I don't recall reading that anywhere
The reason I'm trying to include the email field is that if I don't it trips an error further along the mod about not inputting a valid email and doesn't complete the query. Code:
// If an email isn't entered or is invalid show this error if (empty($unsubscribe['email'])) { eval(standard_error(fetch_error('advanced_unsubscribe_link_error_unsubscribed', $vbulletin->options['contactuslink']))); } I do use ( for the $db->queries and they do have the ; at the end |
#104
|
|||
|
|||
Ok so I sorta started working on this again, and I can't figure out what's wrong here. I'm trying to copy the rows from subscribethread to unsub_subscribethread *yes it does exist*. Yes the option is selected in the ACP. The mod runs but doesn't spit out ANY errors, it also doesn't copy the rows
This is the select query I'm using Code:
$unsubscribe = $db->query_read("SELECT NULL, userid, threadid, emailupdate, folderid, canview FROM " .TABLE_PREFIX. "subscribethread WHERE userid = '$id' AND emailupdate IN (1, 2,3)"); Code:
// If you selected to backup existing thread subscriptions this code will be exectued. if ($vbulletin->options['advanced_unsubscribe_link_thread_sub_backup']) { // Copies existing thread subscriptions to the unsub_subscribethread table. $db->query(" 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)"); } Code:
INSERT INTO unsub_subscribethread SELECT NULL, userid, threadid, emailupdate, folderid, canview FROM subscribethread WHERE userid = 1 AND emailupdate IN (1, 2, 3) |
#105
|
|||
|
|||
Are you sure $id has the right value?
|
#106
|
|||
|
|||
Quote:
you havent registered the variable $unsubscribe here is an example of how to do so $templater = vB_Template::create('unsubscribe'); $templater->register('$unsubscribe', $unsubscribe); $template_hook[forumhome_wgo_pos2] .= $templater->render(); you will then need to call $unsubscribe in a template which will display the content from the query remembering to change the $template_hook you will then need to place {vb:raw unsubscribe} in template unsubscribe as long as you place the correct hook location with the correct template hook the query will show in the hook location you selected |
#107
|
|||
|
|||
Oh great now I'm even more confused ... this mod uses misc.php?do=unsubscribe as the url. In the mod a basic template is "built" and all of the other code executes fine (so far). I have a few more select queries structured like the one I posted earlier ... they seem to work just fine.
So now I'm wondering ... is the mod even executing those select queries? If it's working as is now (aside from the code in question) do I still need to tie it into a hook? Keep in mind I'm a complete novice at this, all I'm doing is added options to an existing mod (that was marked as reusable and updated for 4.x by kh99). Just for shits n giggles I'm going to attach what I have so far, if someone would be kind enough to look at it and tell me if there's a better way to go about doing this I might as well find out now and switch gears |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|